ml4gw 0.6.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ml4gw might be problematic. Click here for more details.

Files changed (51) hide show
  1. {ml4gw-0.6.0 → ml4gw-0.6.1}/PKG-INFO +1 -1
  2. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/cbc/phenom_d.py +13 -12
  3. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/cbc/taylorf2.py +6 -2
  4. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/conversion.py +17 -0
  5. {ml4gw-0.6.0 → ml4gw-0.6.1}/pyproject.toml +1 -1
  6. {ml4gw-0.6.0 → ml4gw-0.6.1}/README.md +0 -0
  7. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/__init__.py +0 -0
  8. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/augmentations.py +0 -0
  9. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/constants.py +0 -0
  10. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/dataloading/__init__.py +0 -0
  11. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/dataloading/chunked_dataset.py +0 -0
  12. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/dataloading/hdf5_dataset.py +0 -0
  13. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/dataloading/in_memory_dataset.py +0 -0
  14. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/distributions.py +0 -0
  15. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/gw.py +0 -0
  16. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/__init__.py +0 -0
  17. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/autoencoder/__init__.py +0 -0
  18. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/autoencoder/base.py +0 -0
  19. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/autoencoder/convolutional.py +0 -0
  20. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/autoencoder/skip_connection.py +0 -0
  21. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/autoencoder/utils.py +0 -0
  22. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/norm.py +0 -0
  23. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/resnet/__init__.py +0 -0
  24. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/resnet/resnet_1d.py +0 -0
  25. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/resnet/resnet_2d.py +0 -0
  26. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/streaming/__init__.py +0 -0
  27. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/streaming/online_average.py +0 -0
  28. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/nn/streaming/snapshotter.py +0 -0
  29. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/spectral.py +0 -0
  30. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/__init__.py +0 -0
  31. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/pearson.py +0 -0
  32. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/qtransform.py +0 -0
  33. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/scaler.py +0 -0
  34. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/snr_rescaler.py +0 -0
  35. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/spectral.py +0 -0
  36. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/spectrogram.py +0 -0
  37. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/spline_interpolation.py +0 -0
  38. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/transform.py +0 -0
  39. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/waveforms.py +0 -0
  40. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/transforms/whitening.py +0 -0
  41. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/types.py +0 -0
  42. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/utils/interferometer.py +0 -0
  43. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/utils/slicing.py +0 -0
  44. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/__init__.py +0 -0
  45. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/adhoc/__init__.py +0 -0
  46. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/adhoc/ringdown.py +0 -0
  47. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/adhoc/sine_gaussian.py +0 -0
  48. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/cbc/__init__.py +0 -0
  49. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/cbc/phenom_d_data.py +0 -0
  50. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/cbc/phenom_p.py +0 -0
  51. {ml4gw-0.6.0 → ml4gw-0.6.1}/ml4gw/waveforms/generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ml4gw
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Tools for training torch models on gravitational wave data
5
5
  Author: Alec Gunny
6
6
  Author-email: alec.gunny@ligo.org
@@ -590,18 +590,19 @@ class IMRPhenomD(TaylorF2):
590
590
  return fRD, fDM
591
591
 
592
592
  def fmaxCalc(self, fRD, fDM, gamma2, gamma3):
593
- res = torch.zeros_like(gamma2)
594
- res = torch.abs(fRD + (-fDM * gamma3) / gamma2) * (gamma2 > 1).to(
595
- torch.int
596
- ) + torch.abs(
597
- fRD
598
- + (fDM * (-1 + torch.sqrt(1 - gamma2 * gamma2)) * gamma3) / gamma2
599
- ) * (
600
- gamma2 <= 1
601
- ).to(
602
- torch.int
603
- )
604
- return res
593
+ mask = gamma2 <= 1
594
+ # calculate result for gamma2 <= 1 case
595
+ sqrt_term = torch.sqrt(1 - gamma2.pow(2))
596
+ result_case1 = fRD + (fDM * (-1 + sqrt_term) * gamma3) / gamma2
597
+
598
+ # calculate result for gamma2 > 1 case
599
+ # i.e. don't add sqrt term
600
+ result_case2 = fRD + (-fDM * gamma3) / gamma2
601
+
602
+ # combine results using mask
603
+ result = torch.where(mask, result_case1, result_case2)
604
+
605
+ return torch.abs(result)
605
606
 
606
607
  def _linear_interp_finspin(self, finspin):
607
608
  # chi is a batch of final spins i.e. torch.Size([n])
@@ -4,6 +4,7 @@ from jaxtyping import Float
4
4
  from ml4gw.constants import MPC_SEC, MTSUN_SI, PI
5
5
  from ml4gw.constants import EulerGamma as GAMMA
6
6
  from ml4gw.types import BatchTensor, FrequencySeries1d
7
+ from ml4gw.waveforms.conversion import chirp_mass_and_mass_ratio_to_components
7
8
 
8
9
 
9
10
  class TaylorF2(torch.nn.Module):
@@ -60,8 +61,11 @@ class TaylorF2(torch.nn.Module):
60
61
  or phic.shape[0] != inclination.shape[0]
61
62
  ):
62
63
  raise RuntimeError("Tensors should have same batch size")
63
- mass2 = chirp_mass * (1.0 + mass_ratio) ** 0.2 / mass_ratio**0.6
64
- mass1 = mass_ratio * mass2
64
+
65
+ mass1, mass2 = chirp_mass_and_mass_ratio_to_components(
66
+ chirp_mass, mass_ratio
67
+ )
68
+
65
69
  cfac = torch.cos(inclination)
66
70
  pfac = 0.5 * (1.0 + cfac * cfac)
67
71
 
@@ -32,6 +32,23 @@ def XLALSimInspiralL_2PN(eta: BatchTensor):
32
32
  return 1.5 + eta / 6.0
33
33
 
34
34
 
35
+ def chirp_mass_and_mass_ratio_to_components(
36
+ chirp_mass: BatchTensor, mass_ratio: BatchTensor
37
+ ):
38
+ """
39
+ Compute component masses from chirp mass and mass ratio.
40
+ Args:
41
+ chirp_mass: Tensor of chirp mass values
42
+ mass_ratio:
43
+ Tensor of mass ratio values, `m2 / m1`,
44
+ where m1 >= m2, so that mass_ratio <= 1
45
+ """
46
+ total_mass = chirp_mass * (1 + mass_ratio) ** 1.2 / mass_ratio**0.6
47
+ mass_1 = total_mass / (1 + mass_ratio)
48
+ mass_2 = mass_1 * mass_ratio
49
+ return mass_1, mass_2
50
+
51
+
35
52
  def bilby_spins_to_lalsim(
36
53
  theta_jn: BatchTensor,
37
54
  phi_jl: BatchTensor,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ml4gw"
3
- version = "0.6.0"
3
+ version = "0.6.1"
4
4
  description = "Tools for training torch models on gravitational wave data"
5
5
  readme = "README.md"
6
6
  authors = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes