nrcatalogtools.lvc¶
Frame-rotation helpers and LVCNR format utilities.
LAL mode dictionaries¶
get_lal_mode_dictionary
¶
Get LALDict with all specified modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode_array
|
list
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
waveform_dictionary |
LALDict with all modes included
|
|
Source code in nrcatalogtools/lvc.py
get_lal_mode_dictionary_from_lmax
¶
Get LALDict with modes derived from lmax.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
waveform_dictionary |
LALDict with all modes upto `lmax` included
|
|
Source code in nrcatalogtools/lvc.py
LVCNR file I/O¶
get_modes_from_lvcnr_file
¶
get_modes_from_lvcnr_file(path_to_file: str, Mtot: float, distance: float, srate: int, lmax: int = 4, f_low: float | None = None) -> tuple
Get individual modes from LVCNR format file.
Parameters¶
path_to_file: string
Path to LVCNR file
Mtot: float
Total mass (in units of MSUN) to scale the waveform to
distance: float
Luminosity Distance (in units of MPc) to scale the waveform to
srate: int
Sampling rate for the waveform
lmax: int
Max value of :math:\ell to use
(Default: 4)
f_low: float
Value of the low frequency to start waveform generation
Uses value given from the LVCNR file if None is provided
(Default: None)
Returns¶
mass_ratio: float
Mass ratio derived from the LVCNR file
spins_args: list
List of spins derived from the LVCNR file
eccentricity: float
Eccentricty derived from the LVCNR file.
Returns None is eccentricity is not a number.
f_low: float
Low Frequency derived either from the file, or provided
in the call
f_ref: float
Reference Frequency derived from the file
modes: dict of pycbc TimeSeries objects
dict containing all the read in modes
Source code in nrcatalogtools/lvc.py
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 | |
get_strain_from_lvcnr_file
¶
get_strain_from_lvcnr_file(path_to_file: str, Mtot: float, distance: float, inclination: float, phi_ref: float, srate: int, mode_array: list | None = None) -> tuple
Get full strain from LVCNR format file.
Parameters¶
path_to_file: string
Path to LVCNR file
Mtot: float
Total mass (in units of MSUN) to scale the waveform to
distance: float
Luminosity Distance (in units of MPc) to scale the waveform to
srate: int
Sampling rate for the waveform
mode_array: list
list of modes to be included. None means all modes are included.
(Default:None)
Returns¶
UNDER CONSTRUCTION
Source code in nrcatalogtools/lvc.py
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 | |
Reference time and frequency¶
check_interp_req
¶
check_interp_req(h5_file: object = None, metadata: dict | None = None, ref_time: float | None = None, avail_ref_time: float | None = None) -> tuple
Check if the required reference time is different from the available reference time in the NR HDF5 file or the simulation metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
file object
|
|
None
|
metadata
|
dict | None
|
|
None
|
ref_time
|
float
|
|
None
|
avail_ref_time
|
float
|
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
interp |
bool
|
Whether interpolation across time is required. |
avail_ref_time |
float
|
The ref_time available in the NR HDF5 file. |
Source code in nrcatalogtools/lvc.py
get_ref_freq_from_ref_time
¶
Get the reference frequency from reference time
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
file object
|
|
required |
ref_time
|
float
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
f_ref |
float
|
Reference frequency. |
Source code in nrcatalogtools/lvc.py
get_ref_time_from_ref_freq
¶
Get the reference time from reference frequency
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
file object
|
|
required |
ref_freq
|
float
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
fTime |
float
|
Reference time. |
Source code in nrcatalogtools/lvc.py
get_ref_time_from_metadata
¶
Get the reference time of definition of the LAL frame from the simulation metadata, if available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_metadata
|
dict
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
t_ref |
float
|
The reference time |
Source code in nrcatalogtools/lvc.py
LAL source frame computation¶
check_nr_attrs
¶
check_nr_attrs(sim_metadata_object: object, req_attrs: list = ['LNhatx', 'LNhaty', 'LNhatz', 'nhatx', 'nhaty', 'nhatz']) -> bool
Check if the NR h5 file or a simulation metadata dictionary contains all the attributes required.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_metadata_object
|
h5 file object, dict
|
|
required |
req_attrs
|
list
|
|
['LNhatx', 'LNhaty', 'LNhatz', 'nhatx', 'nhaty', 'nhatz']
|
Returns:
| Name | Type | Description |
|---|---|---|
present |
bool
|
Whether or not all specified attributes are present. |
absent_attrs |
list
|
The attributes that are absent. |
Source code in nrcatalogtools/lvc.py
get_ref_vals
¶
get_ref_vals(sim_metadata_object: object, req_attrs: list = ['LNhatx', 'LNhaty', 'LNhatz', 'nhatx', 'nhaty', 'nhatz']) -> dict
Get the reference values from a NR HDF5 file or a simulation metadata dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_metadata_object
|
h5 file object, dict
|
|
required |
req_attrs
|
list
|
|
['LNhatx', 'LNhaty', 'LNhatz', 'nhatx', 'nhaty', 'nhatz']
|
Returns:
| Name | Type | Description |
|---|---|---|
params |
dict
|
The parameter values at the reference time. |
Source code in nrcatalogtools/lvc.py
get_interp_ref_values_from_h5_file
¶
Get the interpolated reference values at a given reference time from the NR HDF5 File
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
file object
|
|
required |
req_ts_attrs
|
list
|
|
required |
ref_time
|
float
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
params |
dict
|
The parameter values at the reference time. |
Source code in nrcatalogtools/lvc.py
compute_lal_source_frame_from_sxs_metadata
¶
Compute the LAL source frame vectors at the available reference time from the SXS simulation metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_metadata
|
dict
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
params |
dict
|
A dictionary containing the LAL source frame vectors. |
Source code in nrcatalogtools/lvc.py
compute_lal_source_frame_by_interp
¶
Compute the LAL source frame vectors at a given reference time by interpolation of time series data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
h5 file object
|
|
required |
t_ref
|
float
|
The reference time. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
params |
dict
|
The LAL source frame vectors at the reference time. |
Source code in nrcatalogtools/lvc.py
normalize_metadata
¶
Ensure that the keys of the metadata are as required.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_metadata
|
dict
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
norm_sim_metadata |
dict
|
The normalized simulation metadata |
Source code in nrcatalogtools/lvc.py
transform_spins_nr_to_lal
¶
Trnasform the spins of the NR simulation from the NR frame to the frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nrSpin1
|
list
|
|
required |
nrSpin2
|
list
|
|
required |
n_hat
|
list
|
|
required |
ln_hat
|
list
|
|
required |
Returns:
| Type | Description |
|---|---|
S1, S2 : list
|
The transformed spins in LAL frame. |
Source code in nrcatalogtools/lvc.py
get_nr_to_lal_rotation_angles
¶
get_nr_to_lal_rotation_angles(h5_file: object, sim_metadata: dict, inclination: float, phi_ref: float = 0, f_ref: float | None = None, t_ref: float | None = None, tol: float = 1e-06) -> tuple
Get the angular coordinates :math:\theta, \phi
and the rotation angle :math:\alpha from the H5 file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h5_file
|
file object
|
|
required |
inclination
|
float
|
|
required |
phi_ref
|
float
|
|
0
|
f_ref
|
float
|
|
None
|
t_ref
|
float
|
|
None
|
sim_metadata
|
dict
|
|
required |
tol
|
float
|
The tolerance to use to allow floating point representation errors. |
1e-06
|
Returns:
| Name | Type | Description |
|---|---|---|
angles |
dict
|
The angular corrdinates Theta, Psi, and the rotation angle Alpha. If available, this also contains the reference time and frequency. |
Notes
Variable definitions.
theta : Returned inclination angle of source in NR coordinates. psi : Returned azimuth angle of source in NR coordinates. alpha: Returned polarisation angle. h5_file: h5py object of the NR HDF5 file. inclination: inclination of source in LAL source frame. phi_ref: Orbital reference phase. t_ref : Reference time. -1 or None indicates it was not found in the sim_metadata. f_ref: Reference frequency.
The reference epoch is defined close to the beginning of the simulation.
Source code in nrcatalogtools/lvc.py
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 | |