hdf5_tools module
Utility functions for handling hdf5 files.
- exception aiv_utils.hdf5_tools.DataFileReadError
This is a general custom exception to be raised as a result of common HDF5 read errors in correlation burst data.
- aiv_utils.hdf5_tools.get_hdf5_beamformed_data(obs_file, start_channel=64)
Grabs relevant and useful data out of hdf5 files.
- Parameters:
- Return type:
- Returns:
a tuple of numpy arrays including: combined_data: all non nan data frequency_samples: the MHz values of the spectra mean_spectra: mean spectra (time scrunched) time_samples: astropy Time objects for each timestamp mean_time_series: mean time series (frequency scrunched)
- aiv_utils.hdf5_tools.get_multibeam_data(data_file_path, channel_bandwidth)
Helper function to load mult-beam integrated station beam data from file and return it in a dictionary.
- aiv_utils.hdf5_tools.insert_hdf5_metadata(hdf5_path, reference_frame, observer=None, ra_deg=None, ra_str=None, dec_deg=None, dec_str=None, alt_deg=None, az_deg=None, target_name=None, intent=None, notes=None, jira_ticket=None)
Insert metadata into an hdf5 file.
The function can be used like so to get the same metadata as the docs example:
insert_hdf5_metadata( hdf5_path="path/to/hdf5/file.hdf5", reference_frame="ICRS", observer="riley.keel", ra_deg=123.45, ra_str="08:13:36.000", dec_deg=-45.00, dec_str="-45:00:00.000", target_name="NGC254", intent="Checking tracking", notes="Attempt 985 to get a good track on this target, jira_ticket="LCO-40", )
- Parameters:
hdf5_path (
str) – Path to the hdf5 file.reference_frame (
str) – Reference frame in which the scan’s phase centre (pointing) coordinates are defined. One of “ICRS” (RA and dec), “AltAz”(alt and az and).observer (
str) – The observer’s name.ra_deg (
float) – Right Ascension of the scan’s phase centre, in degrees.ra_str (
str) – Right Ascension of the scan’s phase centre, in the format “hh:mm:ss.sss”.dec_deg (
float) – Declination of the scan’s phase centre, in degrees.dec_str (
str) – Declination of the scan’s phase centre, in the format “±dd:mm:ss.sss”.alt_deg (
float) – Altitude (angle above the horizon) of the scan’s phase centre, in degrees.az_deg (
float) – Azimuth (clockwise angle from North) of the scan’s phase centre, in degrees.target_name (
str) – Provide the complete object name. That is, use the pattern “catalog_name object_identifier”, e.g. PSR J0835-4510. Explicitly include the “J” in names based on J2000 coordinates (optional).intent (
str) – A short description of the purpose of the observation (e.g. Pulsar timing test) (optional).notes (
str) – Can be used as a longer description but due to the character limit, consider using “jira_ticket” for anything detailed (optional).jira_ticket (
str) – A link to the Jira ticket which contains longer observation notes (e.g. LCO-40) (optional).
- aiv_utils.hdf5_tools.load_correlation_burst_data(data_file_path)
Helper function to load correlation burst data from file and return it in a dictionary.
- Parameters:
data_file_path – The path to the hdf5 file.
- Return type:
- Returns:
A dictionary with the observation data and metadata