Waveform
gwmock_signal.waveform
¶
Waveform generation and backend abstractions.
LALSimulationBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with LALSimulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ref
|
float | None
|
Reference frequency in Hz. Defaults to |
None
|
ringdown_fraction
|
float
|
Fraction of the analysis segment reserved after
coalescence. Must be in |
DEFAULT_RINGDOWN_FRACTION
|
segment_duration
|
float | None
|
Optional fixed analysis-segment length in seconds. When
|
None
|
Source code in src/gwmock_signal/waveform/backends/lal.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
__init__(*, f_ref=None, ringdown_fraction=conditioning.DEFAULT_RINGDOWN_FRACTION, segment_duration=None)
¶
Validate the placement configuration shared with the ripple backend.
Source code in src/gwmock_signal/waveform/backends/lal.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
available_approximants()
¶
Return every LAL approximant this backend can generate.
generate_td_waveform produces FD-native approximants via
SimInspiralChooseFDWaveform and time-domain approximants via
SimInspiralFD, so the advertised set is the union of both. Iterating
over approximant indices yields each name once, in a stable order.
Source code in src/gwmock_signal/waveform/backends/lal.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations, conditioned from frequency to time domain.
Source code in src/gwmock_signal/waveform/backends/lal.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
post_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return the seconds after tc this backend's buffer runs.
The complement of :meth:pre_coalescence_duration, from the same two helpers and the same
single call to them, so the two cannot describe different waveforms: the buffer is
n_samples long and coalescence sits at merger_index, so what remains after it is
the rest. ringdown_fraction is what sets the split.
Source code in src/gwmock_signal/waveform/backends/lal.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
pre_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return the seconds before tc this backend's buffer starts.
Computed from the same two helpers generate_td_waveform uses --
:func:~gwmock_signal.waveform.backends.conditioning.segment_sample_count for the length
and :func:~gwmock_signal.waveform.backends.conditioning.coalescence_placement for where
coalescence sits in it -- so the answer cannot drift from what generation actually does.
Reproducing the arithmetic here instead would be a second implementation of it.
Source code in src/gwmock_signal/waveform/backends/lal.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
PyCBCBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with PyCBC.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
__init__()
¶
Require PyCBC only when this backend is instantiated.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
56 57 58 59 60 61 | |
available_approximants()
¶
Return all PyCBC time-domain approximants.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
63 64 65 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations through pycbc_waveform_wrapper.
Canonical CBC parameters (masses, spins, distance, orientation, tidal
deformabilities) are translated to PyCBC's native names. Any other
get_td_waveform option must be passed inside a waveform_arguments
mapping; unrecognised top-level parameters are rejected.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
post_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return None: this backend cannot say where its buffer ends either.
PyCBC conditions inside its own library, so answering would mean reimplementing that
conditioning here and being wrong whenever it changed. None means unknown, never
zero -- a caller reading zero concludes an event's content stops at coalescence, and
would discard events whose tail reaches into the segment it is writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
Unused; accepted to match the base signature. |
required |
sampling_frequency
|
float
|
Unused; accepted to match the base signature. |
required |
minimum_frequency
|
float
|
Unused; accepted to match the base signature. |
required |
**params
|
object
|
Unused; accepted to match the base signature. |
{}
|
Source code in src/gwmock_signal/waveform/backends/pycbc.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
pre_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return None: this backend cannot say where its buffer starts.
PyCBC sizes the waveform inside its own library, so there is no conditioning arithmetic here to answer from. Declared explicitly rather than inherited so that this is a documented property of the PyCBC backend rather than a silent fallthrough -- and so the base class's discussion of measured losses, which is about backends that can answer, does not appear on this page as though these figures came from PyCBC.
None means unknown, never zero. A caller that reads it as zero concludes the waveform
starts at coalescence and crops the entire inspiral; see WaveformBackend for what that
costs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
Unused; accepted to match the base signature. |
required |
sampling_frequency
|
float
|
Unused; accepted to match the base signature. |
required |
minimum_frequency
|
float
|
Unused; accepted to match the base signature. |
required |
**params
|
object
|
Unused; accepted to match the base signature. |
{}
|
Returns:
| Type | Description |
|---|---|
float | None
|
Always |
Source code in src/gwmock_signal/waveform/backends/pycbc.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
RippleBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with ripple (JAX).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ref
|
float | None
|
Reference frequency in Hz. Defaults to |
None
|
ringdown_fraction
|
float
|
Fraction of the analysis segment reserved after
coalescence. Must be in |
_DEFAULT_RINGDOWN_FRACTION
|
segment_duration
|
float | None
|
Optional fixed analysis-segment length in seconds. When
|
None
|
taper_fraction
|
float
|
Width of the amplitude taper below This changes what |
_DEFAULT_TAPER_FRACTION
|
Source code in src/gwmock_signal/waveform/backends/ripple.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
segment_duration
property
¶
The fixed analysis-segment length in seconds, or None if auto-sized.
taper_fraction
property
¶
Width of the amplitude taper below minimum_frequency, as a fraction of it.
__init__(*, f_ref=None, ringdown_fraction=_DEFAULT_RINGDOWN_FRACTION, segment_duration=None, taper_fraction=_DEFAULT_TAPER_FRACTION)
¶
Require ripple/JAX only when this backend is instantiated.
Source code in src/gwmock_signal/waveform/backends/ripple.py
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | |
available_approximants()
¶
Return the ripple approximants supported by this backend.
Source code in src/gwmock_signal/waveform/backends/ripple.py
572 573 574 | |
coalescence_placement(n_samples, sampling_frequency)
¶
Return (merger_index, epoch) for placing coalescence in a segment.
merger_index is the sample at which coalescence sits after the
time-domain roll (near the segment end, leaving a small ringdown pad), and
epoch is the time of the first sample relative to coalescence (negative),
so a caller places coalescence at epoch + tc. Shared by the time-domain
backend and the batched device path so both use the same convention.
Source code in src/gwmock_signal/waveform/backends/ripple.py
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | |
generate_fd_polarizations(approximant, *, sampling_frequency, minimum_frequency, **params)
¶
Generate ripple's frequency-domain plus/cross polarizations (on-device).
This is the building block the on-device (GPU) projection path consumes: the
polarizations stay as JAX arrays and are not conditioned to the time domain.
generate_td_waveform calls this and then inverse-FFTs the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
A supported ripple approximant name. |
required |
sampling_frequency
|
float
|
Sample rate in Hz; sets the Nyquist frequency. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; bins below it are zeroed. |
required |
**params
|
object
|
CBC source parameters (gwmock-pop canonical names or aliases). |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
FrequencyDomainPolarizations
|
class: |
Source code in src/gwmock_signal/waveform/backends/ripple.py
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | |
generate_fd_polarizations_batch(approximant, *, sampling_frequency, minimum_frequency, parameters, waveform_arguments=None)
¶
Generate ripple FD polarizations for a batch of events on one shared grid.
Evaluates ripple under jax.vmap over the catalogue, so all events share a
single frequency grid. Because vmap needs a fixed shape, the grid is sized
(worst case) for the longest inspiral in the batch: the maximum over every
event's 1PN duration estimate, not the smallest chirp mass, since the mass ratio
enters the 1PN term and can reorder two events of nearly equal chirp mass. Unless a
fixed segment_duration was set on the backend, in which case that wins. This is the on-device entry point
for catalogue-scale (GPU) generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
A supported ripple approximant name. |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; bins below it are zeroed. |
required |
parameters
|
Mapping[str, object]
|
Mapping of canonical gwmock-pop parameter names (no aliases)
to 1-D arrays of equal length |
required |
waveform_arguments
|
Mapping[str, object] | None
|
Optional extra ripple constructor options applied to the
whole batch (the waveform is built once). Same whitelist as the per-event
path — e.g. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
FrequencyDomainPolarizations
|
class: |
FrequencyDomainPolarizations
|
|
Source code in src/gwmock_signal/waveform/backends/ripple.py
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations from ripple, conditioned to time domain.
Source code in src/gwmock_signal/waveform/backends/ripple.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | |
post_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return the seconds after tc this backend's buffer runs.
The complement of :meth:pre_coalescence_duration, from the same sizing call, so the two
cannot drift into describing different buffers. Ripple's 5-smooth sizing and its 1PN eta
term make this a different number from the LAL backend's for the same source, which is
why both are asked of the backend rather than computed once by the caller.
Source code in src/gwmock_signal/waveform/backends/ripple.py
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
pre_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return the seconds before tc this backend's buffer starts.
Built from the same two steps generation uses -- _segment_samples for the length and
coalescence_placement for where coalescence sits in it -- so the answer cannot drift
from what generate_td_waveform actually produces. Ripple sizes differently from the
frequency-domain conditioning shared with the LAL backend (5-smooth lengths rather than
powers of two, and eta enters its 1PN term), which is exactly why this is asked of the
backend rather than computed once by the caller.
Source code in src/gwmock_signal/waveform/backends/ripple.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | |
segment_duration_for(chirp_mass_solar, minimum_frequency, sampling_frequency, eta)
¶
Worst-case segment duration (seconds) the batch path uses for these masses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chirp_mass_solar
|
float | ndarray
|
Detector-frame chirp mass(es) in solar masses. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz. |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
eta
|
float | ndarray
|
Symmetric mass ratio(es), aligned with |
required |
Returns:
| Type | Description |
|---|---|
float
|
Duration in seconds. |
Source code in src/gwmock_signal/waveform/backends/ripple.py
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
signal_start_frequency(minimum_frequency)
¶
Return the lowest frequency the generated strain actually contains.
minimum_frequency is where the waveform reaches full amplitude. With a taper the
strain also holds attenuated content below it, down to this frequency, and the analysis
buffer must be sized from here rather than from the cutoff -- an inspiral that starts lower
lasts longer. Verified: sizing from minimum_frequency instead leaves a 1.4+1.35 system
at 10 Hz with a negative margin and a post-ringdown level of 2.9e-3, worse than the hard
cutoff it was meant to improve on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minimum_frequency
|
float
|
The requested cutoff in Hz. |
required |
Returns:
| Type | Description |
|---|---|
float
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/waveform/backends/ripple.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
with_segment_duration(segment_duration)
¶
Return a copy of this backend pinned to a fixed segment_duration.
Same f_ref, ringdown_fraction and taper_fraction; useful for forcing one shared
grid across several batched calls (e.g. count-chunked catalogue generation). The taper has
to travel with the copy: a pinned backend that quietly reverted to a hard cutoff would
change the conditioning of the very chunks this exists to keep identical.
Source code in src/gwmock_signal/waveform/backends/ripple.py
612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
WaveformBackend
¶
Bases: ABC
Abstract interface for time-domain waveform generators.
Source code in src/gwmock_signal/waveform/backends/base.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
available_approximants()
abstractmethod
¶
Return supported time-domain approximant names.
Source code in src/gwmock_signal/waveform/backends/base.py
47 48 49 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
abstractmethod
¶
Generate plus and cross GWpy time series.
Source code in src/gwmock_signal/waveform/backends/base.py
51 52 53 54 55 56 57 58 59 60 | |
post_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return how long after tc the generated waveform runs, in seconds.
The other half of :meth:pre_coalescence_duration, and needed for the decision that one
cannot make: knowing where a buffer starts tells a caller that an event begins before a
segment, never that it has finished before one. A caller placing signals from a
population that begins earlier than its run has no way, from the start alone, to tell an
event whose content is entirely in the past from one whose tail lands in the segment it is
about to write -- so it must generate both.
The tail is a fraction of the buffer, not a fixed ringdown. It therefore scales with everything the buffer scales with: a stellar-mass binary at 20 Hz carries a fraction of a second, a binary neutron star at the same cutoff carries tens of seconds, and a lower cutoff lengthens both. A caller substituting a constant -- "ringdown is milliseconds" -- is not approximating this quantity, it is discarding it.
Asked of the backend for the same reason as the pre side: the length is a property of how each library conditions its output, and a caller reproducing that arithmetic would be a second implementation of it, wrong differently per backend.
Returns:
| Type | Description |
|---|---|
float | None
|
Seconds between coalescence and one sample past the buffer's end, always positive. |
float | None
|
|
float | None
|
than "zero". |
float | None
|
Test for |
float | None
|
stops at its coalescence, which would discard every event whose |
float | None
|
segment -- including the ones whose tail lands inside it, which is worse than the |
float | None
|
behaviour this method exists to enable. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
The approximant that will be generated. |
required |
sampling_frequency
|
float
|
Sample rate in Hz, which sets the sample count. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; the dominant term in the buffer length. |
required |
**params
|
object
|
The source parameters that will be generated, in the same form
|
{}
|
Source code in src/gwmock_signal/waveform/backends/base.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
pre_coalescence_duration(approximant, sampling_frequency, minimum_frequency, **params)
¶
Return how long before tc the generated waveform starts, in seconds.
A caller placing a signal in segmented data needs this before generating: a compact
binary's inspiral precedes its coalescence, so a buffer whose tc sits just past a
segment boundary begins in an earlier segment. Deciding which segment claims an event
without knowing this length means cropping the start away.
How much that costs is not a single number. It moves by orders of magnitude with the
low-frequency cutoff, with how far past tc lands beyond the boundary, and with the
backend -- from under 1% to over 99% of a binary's unweighted strain-squared energy, for the
same source. A percentage quoted without all three is not interpretable, so none is quoted
here. The measured tables live in the user guide, under How much signal a segment boundary
costs, together with what they are a proxy for and what they are not anchored against.
Asked of the backend rather than computed by the caller on purpose. The length is a
property of how each library conditions its output: the LAL backend sizes with
:func:~gwmock_signal.waveform.backends.conditioning.segment_sample_count, the gwsignal
backend inherits that because it overrides only the frequency-domain evaluation, ripple
applies its own 5-smooth sizing, and PyCBC delegates to its library. A caller reproducing
any of that would be a second implementation of a quantity that already exists, wrong
differently per backend -- and wrong in the direction that silently truncates.
This is where the buffer starts, not where audible signal begins. The buffer carries headroom beyond the estimated chirp time and is rounded up, so the first samples are near-silent: a 30+25 solar-mass binary reports 3.6 s while carrying roughly 1.1 s of inspiral. That is the safe direction for choosing a segment -- placing from this value never crops real signal -- but it is not a statement about signal duration.
Returns:
| Type | Description |
|---|---|
float | None
|
Seconds between the first sample and coalescence, always positive. |
float | None
|
backend cannot say, which callers must treat as "unknown" rather than "zero": the |
float | None
|
default is deliberately unhelpful because a wrong number is worse than none. A caller |
float | None
|
that gets |
float | None
|
Test for |
float | None
|
|
float | None
|
holding its coalescence, which is the behaviour this method exists to avoid. |
float | None
|
Of the backends here, only PyCBC returns |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
The approximant that will be generated. Accepted because a backend may condition differently per family, even though the current ones do not. |
required |
sampling_frequency
|
float
|
Sample rate in Hz, which sets the sample count. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; the dominant term in the chirp time. |
required |
**params
|
object
|
The source parameters that will be generated, in the same form
|
{}
|
Source code in src/gwmock_signal/waveform/backends/base.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
WaveformFactory
¶
Registry and dispatcher for time-domain waveform generators.
On construction, every name returned by the configured backend is registered
and mapped to that backend's generate_td_waveform implementation.
You may register additional names pointing at custom callables. See package docs for examples.
Source code in src/gwmock_signal/waveform/factory.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
__init__(backend=None)
¶
Build the registry of built-in backend approximants.
Note
Enumerating approximants can be slow; reuse one factory instance in tight loops instead of creating many factories.
Source code in src/gwmock_signal/waveform/factory.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
generate(waveform_model, parameters, **extra_params)
¶
Generate polarizations by calling the registered model with merged parameters.
The callable is invoked with waveform_model, then entries from parameters,
then extra_params (later keys override earlier ones).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform_model
|
str
|
Name of the registered model to run. |
required |
parameters
|
dict[str, Any]
|
Injection parameters (e.g. |
required |
**extra_params
|
Any
|
Additional fixed settings (e.g. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, TimeSeries]
|
Dict whose keys are the strings |
dict[str, TimeSeries]
|
GWpy |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the underlying generator is called with invalid arguments. |
Source code in src/gwmock_signal/waveform/factory.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
get_model(name)
¶
Look up the generator function registered for name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Registered model name (built-in approximant or custom). |
required |
Returns:
| Type | Description |
|---|---|
Callable[..., dict[str, TimeSeries]]
|
The callable registered for this name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/waveform/factory.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
list_models()
¶
Return every registered waveform model name, in dict iteration order.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of keys (backend approximants plus any custom registrations). |
Source code in src/gwmock_signal/waveform/factory.py
199 200 201 202 203 204 205 | |
post_coalescence_duration(name, sampling_frequency, minimum_frequency, **params)
¶
Return how long after tc the buffer for name runs, or None if unknown.
The complement of :meth:pre_coalescence_duration, delegating the same way and excluding
custom registrations for the same reason: an arbitrary callable never reaches the backend,
so the backend's sizing would not describe what it produces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Waveform model name, as passed to :meth: |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz. |
required |
**params
|
object
|
Source parameters, as generation would receive them. |
{}
|
Returns:
| Type | Description |
|---|---|
float | None
|
Seconds from coalescence to one sample past the buffer's end, or |
float | None
|
backend cannot say -- unknown, never zero. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/waveform/factory.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
pre_coalescence_duration(name, sampling_frequency, minimum_frequency, **params)
¶
Return how long before tc the buffer for name starts, or None if unknown.
Delegates to the backend, which computes it from the same sizing its own generation uses.
See :meth:~gwmock_signal.waveform.backends.base.WaveformBackend.pre_coalescence_duration
for what the number means -- in particular that it is where the buffer starts, not where
audible signal begins, and that None means unknown rather than zero.
Returns None for a custom registered model. Those are arbitrary callables that never
reach the backend, so the backend's sizing would not describe what they produce. The check
is by identity against the wrappers built at construction, so a registration that shadows a
backend approximant is also excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Waveform model name, as passed to :meth: |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz. |
required |
**params
|
object
|
Source parameters, as generation would receive them. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/waveform/factory.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
register_model(name, factory_func)
¶
Register or overwrite a waveform model under name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Key used with |
required |
factory_func
|
Callable[..., Any] | str
|
Callable that accepts merged waveform kwargs (including
|
required |
Raises:
| Type | Description |
|---|---|
ImportError
|
If a string path does not refer to an importable module. |
AttributeError
|
If the imported module has no such callable attribute. |
ValueError
|
If factory_func string is neither 'module.path:callable' nor 'package.module.callable'. |
TypeError
|
Registered model is not callable. |
Source code in src/gwmock_signal/waveform/factory.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
__getattr__(name)
¶
Resolve optional waveform helpers lazily.
Source code in src/gwmock_signal/waveform/__init__.py
24 25 26 27 28 29 30 | |
For usage examples, see the User guide — Waveform examples.