Waveforms#
WaveformModes class#
Bases: WaveformMixin, TimeSeries
Array-like object representing time-series data of SWSH modes
We generally assume that the data represent mode weights in expansions of functions in terms of spin-weighted spherical harmonics (where the standard spherical harmonics just happen to have spin weight 0).
This object is based on the TimeSeries object, but has many additional methods for manipulating modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_array
|
(..., N, ..., M, ...) array_like
|
Input data representing the dependent variable, in any form that can be
converted to a numpy array. This includes scalars, lists, lists of tuples,
tuples, tuples of tuples, tuples of lists, and numpy ndarrays. It can have
an arbitrary number of dimensions, but the length |
required |
time
|
(N,) array_like
|
1-D array containing values of the independent variable. Values must be real, finite, and in strictly increasing order. |
required |
time_axis
|
int
|
Axis along which |
required |
modes_axis
|
int
|
Axis of the array along which the modes are stored. See Notes below. |
required |
ell_min
|
int
|
Smallest value of ℓ stored in the data |
required |
ell_max
|
int
|
Largest value of ℓ stored in the data |
required |
Notes
We assume that the modes at a given time, say, are stored in a flat array, in
order of increasing m and ell, with m varying most rapidly — something
like the following:
[f(ell, m) for ell in range(ell_min, ell_max+1) for m in range(-ell,ell+1)]
The total size is implicitly ell_max * (ell_max + 2) - ell_min ** 2 + 1.
The recommended way of retrieving individual modes is
h_22 = waveform[:, waveform.index(2,2)]
or equivalently,
h_22 = waveform.data[:, waveform.index(2,2)]
For backwards compatibility, it is also possible to retrieve individual modes in the same way as the old NRAR-format HDF5 files would be read, as in
h_22 = waveform["Y_l2_m2.dat"]
Note that "History.txt" may not contain anything but an empty string, because history is not retained in more recent data formats. Also note that — while not strictly a part of this class — the loaders that open waveform files will return a dict-like object when the extrapolation order is not specified. That object can also be accessed in a backwards-compatible way much like the root directory of the NRAR-format HDF5 files. For example:
with sxs.loadcontext("rhOverM_Asymptotic_GeometricUnits_CoM.h5") as f:
h_22 = f["Extrapolated_N2.dir/Y_l2_m2.dat"]
This code is identical to the equivalent code using h5py except that the call
to h5py.File is replaced with the call to sxs.loadcontext. The .dat
datasets are reconstructed on the fly, but should be bitwise-identical to the
output from the HDF5 file whenever the underlying format is NRAR.
Source code in sxs/waveforms/waveform_modes.py
20 21 22 23 24 25 26 27 28 29 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 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 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 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 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 | |
LM
property
#
Array of (ell, m) values in the data
This array is just a flat array of [ell, m] pairs. It is automatically
recomputed each time ell_min or ell_max is changed. Specifically, it is
np.array([
[ell, m]
for ell in range(self.ell_min, self.ell_max+1)
for m in range(-ell, ell+1)
])
abs
property
#
Absolute value of the data
Returns:
| Name | Type | Description |
|---|---|---|
absolute |
TimeSeries
|
Because the absolute values make no sense as mode weights, this is just a plain TimeSeries object. |
See Also
arg
angular_velocity
property
#
Angular velocity of waveform
This function calculates the angular velocity of a WaveformModes object from its modes — essentially, the angular velocity of the rotating frame in which the time dependence of the modes is minimized. This was introduced in Sec. II of "Angular velocity of gravitational radiation and the corotating frame" http://arxiv.org/abs/1302.2919.
It can be calculated in terms of the expectation values ⟨w|Lᵃ∂ₜ|w⟩ and ⟨w|LᵃLᵇ|w⟩ according to the relation
⟨w|LᵇLᵃ|w⟩ ωₐ = -⟨w|Lᵇ∂ₜ|w⟩
For each set of modes (e.g., at each instant of time), this is a simple linear equation in 3 dimensions to be solved for ω.
See Also
expectation_value_LL expectation_value_Ldt
arg
property
#
Complex phase angle of the data
Note that the result is not "unwrapped", meaning that there may be discontinuities as the phase approaches ±π.
Returns:
| Name | Type | Description |
|---|---|---|
phase |
TimeSeries
|
Values are in the interval (-π, π]. |
See Also
numpy.angle arg_unwrapped
arg_unwrapped
property
#
Complex phase angle of the data, unwrapped along the time axis
The result is "unwrapped", meaning that discontinuities as the phase approaches ±π are removed by adding an appropriate amount to all following data points.
Returns:
| Name | Type | Description |
|---|---|---|
phase |
TimeSeries
|
Values at the initial time are in the interval (-π, π], but may evolve to arbitrary real values. |
See Also
numpy.angle numpy.unwrap arg
bar
property
#
Return waveform modes of function representing conjugate of this function
N.B.: This property is different from the .conjugate method; see below.
See Also
re : Return modes of function representing the real part of this function im : Return modes of function representing the imaginary part of this function
Notes
This property is different from the .conjugate (or .conj) method, in that
.conjugate returns the conjugate of the mode weights of the function, whereas
this property returns the mode weights of the conjugate of the function. That
is, .conjugate treats the data as a generic numpy array, and simply returns
the complex conjugate of the raw data without considering what the data
actually represents. This property treats the data as a function represented
by its mode weights.
The resulting function has the negative spin weight of the input function.
We have
conjugate(f){s, l, m} = (-1)**(s+m) * conjugate(f{-s, l, -m})
ell_max
property
#
Largest value of ℓ stored in the data
ell_min
property
#
Smallest value of ℓ stored in the data
eth_GHP
property
#
Spin-raising derivative operator defined by Geroch-Held-Penrose
The operator ð is defined in https://dx.doi.org/10.1063/1.1666410
See Also
eth : Related operator in the Newman-Penrose convention ethbar : Similar operator in the Newman-Penrose convention ethbar_GHP : Conjugate of this operator
Notes
We assume that the Ricci rotation coefficients satisfy β=β'=0, meaning that this operator equals the Newman-Penrose operator ð multiplied by 1/√2.
ethbar_GHP
property
#
Spin-lowering derivative operator defined by Geroch-Held-Penrose
The operator ð̄ is defined in https://dx.doi.org/10.1063/1.1666410
See Also
eth : Related operator in the Newman-Penrose convention ethbar : Similar operator in the Newman-Penrose convention eth_GHP : Conjugate of this operator
Notes
We assume that the Ricci rotation coefficients satisfy β=β'=0, meaning that this operator equals the Newman-Penrose operator ð̄ multiplied by 1/√2.
expectation_value_LL
property
#
Compute the matrix expectation value ⟨w|LᵃLᵇ|w⟩
Here, Lᵃ is the usual angular-momentum operator familiar from quantum physics, and
⟨w|LᵃLᵇ|w⟩ = ℜ{Σₗₘₙ w̄ˡᵐ ⟨l,m|LᵃLᵇ|l,n⟩ wˡⁿ}
This quantity is important for computing the angular velocity of a waveform. Its dominant eigenvector can also be used as a good choice for the axis of a decomposition into modes.
See Also
dominant_eigenvector_LL expectation_value_Ldt angular_velocity
expectation_value_Ldt
property
#
Compute the matrix expectation value ⟨w|Lᵃ∂ₜ|w⟩
Here, Lᵃ is the usual angular-momentum operator familiar from quantum physics, ∂ₜ is the partial derivative with respect to time, and
⟨w|Lᵃ∂ₜ|w⟩ = ℑ{Σₗₘₙ w̄ˡᵐ ⟨l,m|Lᵃ|l,n⟩ ∂ₜwˡⁿ}
This quantity is important for computing the angular velocity of a waveform.
See Also
expectation_value_LL angular_velocity
im
property
#
Return waveform modes of function representing imaginary part of this function
N.B.: This property is different from the .imag method; see below.
See Also
re : Equivalent method for the real part bar : Return modes of function representing the conjugate of this function
Notes
This property is different from the .imag method, in that .imag returns the
imaginary part of the mode weights of the function, whereas this property
returns the mode weights of the imaginary part of the function. That is,
.imag treats the data as a generic numpy array, and simply returns the
imaginary part of the raw data without considering what the data actually
represents. This property treats the data as a function represented by its
mode weights.
Note that this only makes sense for functions of spin weight zero; taking the imaginary part of functions with nonzero spin weight will depend too sensitively on the orientation of the coordinate system to make sense. Therefore, this property raises a ValueError for other spins.
The condition that a function f be imaginary is that its modes satisfy
f{l, m} = -conjugate(f){l, m} = (-1)**(m+1) * conjugate(f{l, -m})
[Note that conjugate(f){l, m} != conjugate(f{l, m}).] As usual, we enforce that condition by essentially averaging the two modes:
f{l, m} = (f{l, m} + (-1)**(m+1) * conjugate(f{l, -m})) / 2
modes_axis
property
#
Axis of the array storing the various modes
See the documentation of this class for an explanation of what this means.
See Also
time_axis : Axis of the array along which time varies
n_modes
property
#
Total number of mode weights stored in the data
norm
property
#
Compute the L² norm of the waveform
Returns:
| Name | Type | Description |
|---|---|---|
n |
TimeSeries
|
|
See Also
numpy.linalg.norm numpy.take norm2 : squared version of this
Notes
The integral of the (squared) magnitude of the data equals the sum of the (squared) magnitude of the modes for orthonormal basis functions, meaning that the L² norm of the function equals the basic Euclidean norm of the modes. We assume that these modes are expanded in a band-limited but otherwise complete orthonormal basis.
re
property
#
Return waveform modes of function representing real part of this function
N.B.: This property is different from the .real method; see below.
See Also
im : Equivalent method for the imaginary part bar : Return modes of function representing the conjugate of this function
Notes
This property is different from the .real method, in that .real returns the
real part of the mode weights of the function, whereas this property returns
the mode weights of the real part of the function. That is, .real treats the
data as a generic numpy array, and simply returns the real part of the raw data
without considering what the data actually represents. This property treats
the data as a function represented by its mode weights.
Note that this only makes sense for functions of spin weight zero; taking the real part of functions with nonzero spin weight will depend too sensitively on the orientation of the coordinate system to make sense. Therefore, this property raises a ValueError for other spins.
The condition that a function f be real is that its modes satisfy
f{l, m} = conjugate(f){l, m} = (-1)**(m) * conjugate(f{l, -m})
[Note that conjugate(f){l, m} != conjugate(f{l, m}).] As usual, we enforce that condition by essentially averaging the two modes:
f{l, m} = (f{l, m} + (-1)**m * conjugate(f{l, -m})) / 2
boost(v⃗, ell_max)
#
Find modes of waveform boosted by velocity v⃗
Implements Equation (21) of arxiv.org/abs/1509.00862
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Three-vector representing the velocity of the boosted frame relative to the inertial frame, in units where the speed of light is 1 |
required | |
ell_max
|
int
|
Maximum value of |
required |
Returns:
| Name | Type | Description |
|---|---|---|
wprime |
WaveformModes
|
Modes of waveform measured in boosted frame or of modes from boosted source
measured in original frame. This should have the same properties as the
input waveform, except with (1) different time data [see Notes, below], (2)
a minimum |
Notes
Due to the nature of the transformation, some of the information in the input waveform must be discarded, because it corresponds to slices of the output waveform that are not completely represented in the input. Thus, the times of the output waveform will not just be the Lorentz-transformed times of the input waveform.
Depending on the magnitude β=|v⃗|, a very large value of ell_max may be
needed. The dominant factor is the translation that builds up over time:
β*T, where T is the largest time found in the waveform. For example, if
β*T ≈ 1000M, we might need ell_max=64 to maintain a comparable accuracy as in
the input data.
Because of the β*T effects, it is usually best to set t=0 at the merger time
— best approximated as self.max_norm_time(). The largest translation is then
found early in the waveform, when the waveform is changing slowly.
Source code in sxs/waveforms/waveform_modes.py
convert_from_conjugate_pairs()
#
Convert modes from conjugate-pair format in place
This function reverses the effects of convert_to_conjugate_pairs. See that
function's docstring for details.
Source code in sxs/waveforms/waveform_modes.py
convert_to_conjugate_pairs()
#
Convert modes to conjugate-pair format in place
This function alters this object's modes to store the sum and difference of
pairs with opposite m values. If we denote the modes f[l, m], then we
define
s[l, m] = (f[l, m] + f̄[l, -m]) / √2
d[l, m] = (f[l, m] - f̄[l, -m]) / √2
For m<0 we replace the mode data with d[l, -m], for m=0 we do nothing, and
for m>0 we replace the mode data with s[l, m]. That is, the mode data on
output look like this:
[d[2, 2], d[2, 1], f[2, 0], s[2, 1], s[2, 2], d[3, 3], d[3, 2], ...]
The factor of √2 is chosen so that the norm (sum of the magnitudes squared) at each time for this data is the same as it is for the original data.
Source code in sxs/waveforms/waveform_modes.py
coprecessing_frame(rough_direction=None, rough_direction_index=0)
#
Return the coprecessing frame of the waveform
This function returns the minimally rotating coprecessing frame of the
waveform, as a quaternionic.array. Specifically, the result rotates
the static \((x,y,z)\) frame onto a frame in which the dominant eigenvector
of the matrix expectation value ⟨w|LᵃLᵇ|w⟩ is aligned with the \(z'\) axis.
Furthermore, to fix the rotation about the \(z'\) axis, the minimal-
rotation condition is enforced.
The coprecessing frame and the minimal-rotation condition are defined in https://arxiv.org/abs/1110.2965.
For details about the arguments, see the docstring for the
dominant_eigenvector_LL method.
Source code in sxs/waveforms/waveform_modes.py
corotating_frame(R0=quaternionic.one, tolerance=1e-12, z_alignment_region=None, return_omega=False, max_phase_per_timestep=None)
#
Return rotor taking current mode frame into corotating frame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R0
|
quaternionic
|
Value of the output rotation at the first output instant; defaults to 1 |
one
|
tolerance
|
float
|
Absolute tolerance used in integration; defaults to 1e-12 |
1e-12
|
z_alignment_region
|
None or 2-tuple of floats
|
If not None, the dominant eigenvector of the |
None
|
return_omega
|
If True, return a 2-tuple consisting of the frame (the usual returned
object) and the angular-velocity data. That is frequently also needed, so
this is just a more efficient way of getting the data. Default is |
False
|
|
max_phase_per_timestep
|
float
|
Maximum phase change per time step. If given, the approximate phase change per time step is calculated, and if it exceeds this value, a ValueError is raised. |
None
|
Notes
Essentially, this function evaluates the angular velocity of the waveform, and then integrates it to find the corotating frame itself. This frame is defined to be the frame in which the time-dependence of the waveform is minimized — at least, to the extent possible with a time-dependent rotation.
That frame is only unique up to a single overall rotation, which can be
specified as the optional R0 argument to this function. If it is not
specified, the z axis of the rotating frame is aligned with the
dominant_eigenvector_LL, and chosen to be more parallel than anti-parallel to
the angular velocity.
Source code in sxs/waveforms/waveform_modes.py
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 | |
dominant_eigenvector_LL(rough_direction=None, rough_direction_index=0)
#
Calculate the principal axis of the matrix expectation value ⟨w|LᵃLᵇ|w⟩
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rough_direction
|
array_like
|
Vague guess about the preferred direction as a 3-vector. Default is the
|
None
|
rough_direction_index
|
int
|
Index at which the |
0
|
See also
WaveformModes.to_corotating_frame quaternionic.array.to_minimal_rotation
Notes
The principal axis is the eigenvector corresponding to the largest-magnitude (dominant) eigenvalue. This direction can be used as a good choice for the axis of a waveform-mode decomposition at any instant https://arxiv.org/abs/1205.2287. Essentially, it maximizes the power in the large-|m| modes. For example, this can help to ensure that the (ℓ,m) = (2,±2) modes are the largest ℓ=2 modes.
Note, however, that this only specifies an axis at each instant of time. This choice can be supplemented with the "minimal-rotation condition" https://arxiv.org/abs/1110.2965 to fully specify a frame, resulting in the "co-precessing frame". Or it can be used to determine the constant of integration in finding the "co-rotating frame" https://arxiv.org/abs/1302.2919.
The resulting vector is given in the (possibly rotating) mode frame (X,Y,Z), rather than the inertial frame (x,y,z).
Source code in sxs/waveforms/waveform_modes.py
evaluate(*directions)
#
Evaluate waveform in a particular direction or set of directions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directions
|
array_like
|
Directions of the observer relative to the source may be specified using
the usual spherical coordinates, and an optional polarization angle (see
Notes below). These can be expressed as 2 or 3 floats (where the third is
the polarization angle), or as an array with final dimension of size 2 or
3. Alternatively, the input may be a |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
signal |
array_like
|
Note that this is complex-valued, meaning that it represents both polarizations. To get the signal measured by a single detector, just take the real part. |
Notes
To evaluate mode weights and obtain values, we need to evaluate spin-weighted spherical harmonics (SWSHs). Though usually treated as functions of just the angles (θ, ϕ), a mathematically correct treatment (arxiv.org/abs/1604.08140) defines SWSHs as functions of the rotation needed to rotate the basis (x̂, ŷ, ẑ) onto the usual spherical-coordinate basis (θ̂, ϕ̂, n̂). This function can take quaternionic arrays representing such a rotation directly, or the (θ, ϕ) coordinates themselves, and optionally the polarization angle ψ, which are automatically converted to quaternionic arrays.
We define the spherical coordinates (θ, ϕ) such that θ is the polar angle (angle between the z axis and the point) and ϕ is the azimuthal angle (angle between x axis and orthogonal projection of the point into the x-y plane). This gives rise to the standard unit tangent vectors (θ̂, ϕ̂).
We also define the polarization angle ψ as the angle through which we must rotate the vector θ̂ in a positive sense about n̂ to line up with the vector defining the legs of the detector. If not given, this angle is treated as 0.
Examples:
We can evaluate the signal in a single direction:
>>> θ, ϕ, ψ = 0.1, 0.2, 0.3
>>> w.evaluate(θ, ϕ) # Default polarization angle
>>> w.evaluate(θ, ϕ, ψ) # Specified polarization angle
Or we can evaluate in a set of directions:
We can also evaluate on a more extensive set of directions. Here, we construct an equi-angular grid to evaluate the waveform on (though irregular grids are also acceptable as long as you can pack them into a numpy array).
>>> n_theta = n_phi = 2 * w.ell_max + 1
>>> equiangular = np.array([
[
[theta, phi]
for phi in np.linspace(0.0, 2*np.pi, num=n_phi, endpoint=False)
]
for theta in np.linspace(0.0, np.pi, num=n_theta, endpoint=True)
])
>>> w.evaluate(equiangular)
Source code in sxs/waveforms/waveform_modes.py
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 | |
fourier_transform(theta_phi=None, total_mass=None, luminosity_distance=None)
#
Fourier transform the modes of a waveform.
This Fourier transforms the mode time series of the WaveformModes object and replaces the time attribute with the frequencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta_phi
|
tuple
|
Point on the two-sphere to evaluate the waveform at. Default is None. |
None
|
total_mass
|
float
|
Total mass in solar masses. Default is no scaling is applied. |
None
|
luminosity_distance
|
float
|
Luminosity distance in Mpc. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
h_tilde |
TimeSeries
|
Unitful Fourier transform. |
Source code in sxs/waveforms/waveform_modes.py
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | |
index(ell, m)
#
Mode index of given (ell,m) mode in the data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ell
|
int
|
|
required |
m
|
int
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
idx |
int
|
Index such that self.LM[idx] == [ell, m] |
Source code in sxs/waveforms/waveform_modes.py
interpolate(new_time, derivative_order=0, out=None)
#
Interpolate this object to a new set of times
Note that if this object has "frame" data and the derivative order is nonzero, it is not entirely clear what is desired. In those cases, the frame is just interpolated to the new times, but no derivative or antiderivative is taken.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_time
|
array_like
|
Points to evaluate the interpolant at |
required |
derivative_order
|
int
|
Order of derivative to evaluate. If negative, the antiderivative is returned. Default value of 0 returns the interpolated data without derivatives or antiderivatives. Must be between -3 and 3, inclusive. |
0
|
See Also
scipy.interpolate.CubicSpline :
The function that this function is based on.
antiderivative :
Calls this funtion with new_time=self.time and
derivative_order=-antiderivative_order (defaulting to a single
antiderivative).
derivative :
Calls this function new_time=self.time and
derivative_order=derivative_order (defaulting to a single derivative).
dot :
Property calling self.derivative(1).
ddot :
Property calling self.derivative(2).
int :
Property calling self.antiderivative(1).
iint :
Property calling self.antiderivative(2).
Source code in sxs/waveforms/waveform_modes.py
max_norm_index(skip_fraction_of_data=4)
#
Index of time step with largest norm
The optional argument skips a fraction of the data. The default is 4, which means that it skips the first 1/4 of the data, and only searches the last 3/4 of the data for the max. This must be strictly greater than 1, or the entire data is searched for the maximum of the norm.
Source code in sxs/waveforms/waveform_modes.py
max_norm_time(skip_fraction_of_data=4, interpolate=False)
#
Return time at which largest norm occurs in data
See help(max_norm_index) for explanation of
skip_fraction_of_data.
If interpolate is True, the time is interpolated to a higher
precision than the time step of the data. This is done by
fitting a cubic spline to the norm of the data and finding the
time at which the norm is maximized.
Source code in sxs/waveforms/waveform_modes.py
preprocess(t1=0, t2=500, t3=None, t4=None, dt=None, **kwargs)
#
Preprocess the data to prepare for FFT
This function is a convenience function that applies a series of common preprocessing steps to the data before Fourier transforming it. The steps are:
1. `interpolate`
2. `taper`
3. `transition_to_constant`
4. `pad`
5. `line_subtraction`
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t1
|
float
|
Time before which the data will be zeroed, after which the taper will begin. Default is 0 (not the first time step, but t=0). |
0
|
t2
|
float
|
Time at which the tapering will end. Default is 500. |
500
|
t3
|
float
|
Time at which the transition to a constant value will begin. Default is max_norm_time+100. |
None
|
t4
|
float
|
Time after which the data will be constant. Default is max_norm_time+200. |
None
|
dt
|
float
|
Time step for the new time array. Default is the smallest time step in the input data. |
None
|
Keyword Parameters
evaluate_directions : array_like, optional
Directions at which to evaluate the waveform. Default is
None, in which case the waveform modes are
pre-processed. See evaluate for more information on the
meaning of other possible input values.
pad_length : tuple, optional
Length of padding to apply to the data. Default option
will triple the length of the data. (See pad for more
information.)
pad_mode : str, optional
Mode of padding. Default value is "edge". (See pad
for more information.)
treat_as_zero : str, optional
How to treat the data at the boundaries. Default value is
"begin". (See line_subtraction for more information.)
All other keyword arguments are passed to numpy.pad.
Returns:
| Type | Description |
|---|---|
TimeSeries
|
New object with preprocessed data. |
Source code in sxs/waveforms/waveform_modes.py
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | |
remove_memory(integration_start_time)
#
Remove memory from a waveform.
This uses sxs.waveforms.memory.remove_memory to remove
memory from the waveform. Note that to return the
waveform to a state as close as possible to before the
memory correction was applied, one should use the
simulation's relaxation time as the integration_start_time.
Even with this, however, the waveform will still be slightly
altered as this process is not invertible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
integration_start_time
|
float
|
The time at which to start the integration for the memory calculation. If this is not the relaxation time, then the memory removal may be worse. |
required |
Source code in sxs/waveforms/waveform_modes.py
rotate(quat)
#
Rotate decomposition basis of modes represented by this waveform
This returns a new waveform object, with missing "frame" data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quat
|
array
|
This must have one quaternion or the same number of quaternions as the number of times in the waveform. |
required |
Source code in sxs/waveforms/waveform_modes.py
to_coprecessing_frame(rough_direction=None, rough_direction_index=0)
#
Transform this waveform to the coprecessing frame
The coprecessing frame is defined to be a rotating frame for which the dominant eigenvector of the matrix expectation value ⟨w|LᵃLᵇ|w⟩ is aligned with the \(z'\) axis, and the minimal-rotation condition is enforced. This leaves the frame completely determined, except for a single rotation about the \(z'\) axis.
The coprecessing frame and the minimal-rotation condition are defined in https://arxiv.org/abs/1110.2965.
For details about the arguments, see the docstring for the
dominant_eigenvector_LL method.
Source code in sxs/waveforms/waveform_modes.py
to_corotating_frame(R0=None, tolerance=1e-12, z_alignment_region=None, return_omega=False, truncate_log_frame=False, max_phase_per_timestep=None)
#
Return a copy of this waveform in the corotating frame
The corotating frame is defined to be a rotating frame for which the (L² norm of the) time-dependence of the modes expressed in that frame is minimized. This leaves the frame determined only up to an overall rotation. In this
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R0
|
quaternionic
|
Initial value of frame when integrating angular velocity. Defaults to the identity. |
None
|
tolerance
|
float
|
Absolute tolerance used in integration of angular velocity |
1e-12
|
z_alignment_region
|
None, 2-tuple of floats
|
If not None, the dominant eigenvector of the |
None
|
return_omega
|
bool
|
If True, return a 2-tuple consisting of the waveform in the corotating frame (the usual returned object) and the angular-velocity data. That is frequently also needed, so this is just a more efficient way of getting the data. |
False
|
truncate_log_frame
|
bool
|
If True, set bits of log(frame) with lower significance than |
False
|
max_phase_per_timestep
|
float
|
Maximum phase change per time step. If given, the approximate phase change per time step is calculated, and if it exceeds this value, a ValueError is raised. |
None
|
Source code in sxs/waveforms/waveform_modes.py
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 | |
to_inertial_frame()
#
Return a copy of this waveform in the inertial frame
Source code in sxs/waveforms/waveform_modes.py
truncate(tol=1e-10)
#
Truncate the precision of this object's data in place
This function sets bits in the data to 0 when they have lower significance than
will alter the norm of the Waveform by a fraction tol at that instant in
time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tol
|
float
|
Fractional tolerance to which the norm of this waveform will be preserved |
1e-10
|
Returns:
| Type | Description |
|---|---|
None
|
This value is returned to serve as a reminder that this function operates in place. |
See also
TimeSeries.truncate
Source code in sxs/waveforms/waveform_modes.py
WaveformMixin base class#
Bases: ABC