waveformtools.dataIO
Functions for handling data IO operations from waveforms class
Functions
|
Get the largest available mode number from available data in files. |
|
Get ell max from a list of keys. |
|
Load the Psi4 waveforms from the RIT catalogue from ASCII files from disk. |
|
Load the RIT strain waveforms from the RIT catalogue, from hdf5 files from disk. |
|
Load the SpECTRE or SpEC CCE waveform to modes_array,from hdf5 files from disk. |
|
Load the SpEC waveform to modes_array,from hdf5 files from disk. |
|
Load the RIT strain waveforms from the RIT catalogue, from hdf5 files from disk. |
|
Save the waveform mode data to an hdf file. |
- waveformtools.dataIO.get_ell_max_from_file(data_dir, var_type='Psi4', file_name='*.h5')[source]
Get the largest available mode number from available data in files.
- Parameters:
- data_dirstring
A string containing the directory path where the mode files can be found.
- var_type: string, optional
A string that denotes the variable that is being loaded. Options are Psi4 and strain. The former is the default.
- file_namestring, optional
The h5 file that contains the modes data. It defaults to the only file in the directory. If there are multiple files, it throws an error.
- Returns
- ——-
- ell_maxint
The maximum available ell.
- keys_listlist
A list of data access keys.
Notes
Reads in various ASCII dat files for RIT Psi4, h5 files for RIT strain and gen strain.
- waveformtools.dataIO.get_ell_max_from_keys(all_keys)[source]
Get ell max from a list of keys.
- Parameters:
- all_keyslist
A list of strings string containing the modes keys.
- Returns
- ——-
- ell_maxint
The maximum available ell.
- waveformtools.dataIO.load_RIT_Psi4_from_disk(wfa=None, data_dir='./', label='RIT_rPsi4inf', ell_max=None, save_as_ma=False, spin_weight=- 2, resam_type='finest', interp_kind='cubic')[source]
Load the Psi4 waveforms from the RIT catalogue from ASCII files from disk.
- Parameters:
- wfawaveforms
An instance of the waveforms class. Updates this instance if provided, else creates a new instance.
- data_dirstring
A string containing the directory path where the mode files can be found.
- labelstring, optional
The label of the modes_array object.
- ell_maxint, optional
The maximum mode number to load. If not specified, then all available modes are loaded.
- save_as_mabool, optional
Save to disk again as a modes_array h5 file?
- spin_weightint, optional
The spin weight of the object. Used for filtering modes. Defaults to -2.
- resam_typestring, float, optional
The type of resampling to do. Options are finest and coarsest, and user input float.
- interp_kindstring, optional
The interpolation type to use. Default is cubic.
- Returns:
- rit_modes_arraymodes_array
A modes_array instance containing the loaded modes.
Notes
It seems like the time axis of individual modes are identical to each other. Hence, one need not worry about choosing the time domain. This may change in future.
- waveformtools.dataIO.load_RIT_Strain_data_from_disk(wfa=None, data_dir='./', file_name='*', label='RIT_strain', spin_weight=- 2, ell_max='auto', resam_type='auto', interp_kind='cubic', save_as_ma=False, modes_list=None, crop=False, centre=True, r_ext_factor=1, debug=False)[source]
Load the RIT strain waveforms from the RIT catalogue, from hdf5 files from disk.
- Parameters:
- wfawaveforms
An instance of the waveforms class. Creates a new one if not provided.
- data_dirstring
A string containing the directory path where the mode files can be found.
- labelstring, optional
The label of the modes_array object.
- ell_maxint, optional
The maximum mode number to load. If not specified, then all available modes are loaded.
- save_as_mabool, optional
Save to disk again as a modes_array h5 file?
- spin_weightint, optional
The spin weight of the object. Used for filtering modes. Defaults to -2.
- resam_typestring, float, optional
The type of resampling to do. Options are finest and coarsest, and user input float.
- interp_kindstring, optional
The interpolation type to use. Default is cubic.
- Returns:
- rit_modes_arraymodes_array
A modes_array instance containing the loaded modes.
Notes
It seems like the time axis of individual modes are identical to each other. Hence, one need not worry about choosing the time domain. This may change in future.
- waveformtools.dataIO.load_SpECTRE_data_from_disk(wfa=None, label='SpECTRE Strain', data_dir='./', file_name='rhOverM_Extrapolated_N5_CoM_Mem.h5', r_ext=None, ell_max=12, centre=True, modes_list=None, r_ext_factor=1, save_as_ma='False', resam_type='auto', interp_kind='cubic', compression_opts=0)[source]
Load the SpECTRE or SpEC CCE waveform to modes_array,from hdf5 files from disk.
- Parameters:
- wfamodes_array, optional
The modes array to which to store the loaded waveform to. A new modes array will be returned if not provided.
- data_dirstring
A string containing the directory path where the mode files can be found.
- file_namestring
The name of the file containing the waveform data.
- labelstring, optional
The label of the modes_array object.
- ell_maxint, optional
The maximum mode number to load. If not specified, then all available modes are loaded.
- save_as_mabool, optional
Save to disk again as a modes_array h5 file?
- resam_typestring, float, optional
The type of resampling to do. Options are finest and coarsest, and user input float.
- interp_kindstring, optional
The interpolation type to use. Default is cubic.
- Returns:
- modes_arraymodes_array
A modes_array instance containing the loaded modes.
- waveformtools.dataIO.load_SpEC_data_from_disk(wfa=None, label='SXS Strain', data_dir='./', file_name='rhOverM_Extrapolated_N5_CoM_Mem.h5', extrap_order=4, r_ext=None, ell_max=None, centre=True, modes_list=None, save_as_ma='False', resam_type='auto', interp_kind='cubic', compression_opts=0, r_ext_factor=1, debug=False)[source]
Load the SpEC waveform to modes_array,from hdf5 files from disk.
- Parameters:
- wfamodes_array, optional
The modes array to which to store the loaded waveform to. A new modes array will be returned if not provided.
- data_dirstring
A string containing the directory path where the mode files can be found.
- file_namestring
The name of the file containing the waveform data.
- labelstring, optional
The label of the modes_array object.
- ell_maxint, optional
The maximum mode number to load. If not specified, then all available modes are loaded.
- save_as_mabool, optional
Save to disk again as a modes_array h5 file?
- resam_typestring, float, optional
The type of resampling to do. Options are finest and coarsest, and user input float.
- interp_kindstring, optional
The interpolation type to use. Default is cubic.
- Returns:
- modes_arraymodes_array
A modes_array instance containing the loaded modes.
- waveformtools.dataIO.load_gen_data_from_disk(wfa=None, label='generic waveform', data_dir='./', file_name='*.h5', r_ext=None, ell_max=8, pre_key=None, modes_list=None, crop=False, centre=True, key_ex=None, r_ext_factor=1, *args, **kwargs)[source]
Load the RIT strain waveforms from the RIT catalogue, from hdf5 files from disk.
- Parameters:
- data_dirstring
A string containing the directory path where the mode files can be found.
- labelstring, optional
The label of the modes_array object.
- ell_maxint, optional
The maximum mode number to load. If not specified, then all available modes are loaded.
- save_as_mabool, optional
Save to disk again as a modes_array h5 file?
- spin_weightint, optional
The spin weight of the object. Used for filtering modes. Defaults to -2.
- resam_typestring, float, optional
The type of resampling to do. Options are finest and coarsest, and user input float.
- interp_kindstring, optional
The interpolation type to use. Default is cubic.
- Returns:
- rit_modes_arraymodes_array
A modes_array instance containing the loaded modes.
Notes
It seems like the time axis of individual modes are identical to each other. Hence, one need not worry about choosing the time domain. This may change in future.
- waveformtools.dataIO.save_modes_data_to_gen(wfa, ell_max=None, pre_key=None, key_format=None, modes_to_save=None, out_file_name='mp_new_modes.h5', r_ext_factor=None, compression_opts=0, r_ext=None)[source]
Save the waveform mode data to an hdf file.
- Parameters:
- pre_key: str, optional
A string containing the key of the group in the HDF file in which the modes` dataset exists. It defaults to None.
- mode_numbers: list
The mode numbers to load from the file. Each item in the list is a list that contains two integrer numbers, one for the mode index \(\ell\) and the other for the mode index \(m\).
- Returns:
- waveform_obj: 3d array
Sets the three dimensional array waveform.modes that contains the required \(\ell, m\) modes.
Examples
>>> from waveformtools.waveforms import waveform >>> waveform.set_basedir('./') >>> waveform.set_datadir('data/') >>> mode_numbers = [[2, 2], [3, 3]] >>> waveform.load_data(mode_numbers=mode_numbers)