redback.get_data.open_data.OpenDataGetter
- class redback.get_data.open_data.OpenDataGetter(transient: str, transient_type: str)[source]
Bases:
DataGetter
- __init__(transient: str, transient_type: str) None [source]
Constructor class for a data getter. The instance will be able to download the specified Swift data.
- Parameters:
transient (str) – Telephone number of GRB, e.g., ‘GRB140903A’ or ‘140903A’ are valid inputs.
transient_type (str) – Type of the transient. Must be from redback.get_data.open_data.OpenDataGetter.VALID_TRANSIENT_TYPES.
- __call__(**kwargs)
Call self as a function.
Methods
__init__
(transient, transient_type)Constructor class for a data getter.
Downloads the data from astrocats and saves it into the raw file path.
Converts the raw data into processed data and saves it into the processed file path.
get_data
()Downloads the raw data and produces a processed .csv file.
Tries to get the GRB alias from the Open Access Catalog metadata table.
Tries to infer the event time from the GRB catalog.
get_time_of_event
(data, metadata)Infers the time of the event from the given data.
Attributes
DATA_MODE
VALID_TRANSIENT_TYPES
The path to the metadata file.
The astrocats metadata url.
Checks if the transient type is valid when setting.
The astrocats raw data url.
- collect_data() None [source]
Downloads the data from astrocats and saves it into the raw file path.
- convert_raw_data_to_csv() Optional[DataFrame] [source]
Converts the raw data into processed data and saves it into the processed file path. The data columns are in OpenDataGetter.PROCESSED_FILE_COLUMNS.
- Returns:
The processed data.
- Return type:
pandas.DataFrame
- get_data() DataFrame
Downloads the raw data and produces a processed .csv file.
- Returns:
The processed data
- Return type:
pandas.DataFrame
- get_grb_alias() Optional[Match] [source]
Tries to get the GRB alias from the Open Access Catalog metadata table.
- Returns:
Union[re.Match, None]
- Return type:
The grb alias if found, else None.
- get_t0_from_grb() float [source]
Tries to infer the event time from the GRB catalog.
- Returns:
float
- Return type:
The event time.
- get_time_of_event(data: DataFrame, metadata: DataFrame) Time [source]
Infers the time of the event from the given data.
- Parameters:
data (pandas.DataFrame) – The half-processed data.
metadata (pandas.DataFrame) – The metadata.
data – pd.DataFrame:
metadata – pd.DataFrame:
- Returns:
astropy.time.Time
- Return type:
The time of the event in the astropy format.
- property metadata_path
The path to the metadata file. :rtype: str
- Type:
return
- property metadata_url: str
The astrocats metadata url. :rtype: str
- Type:
return
- property transient_type: str
Checks if the transient type is valid when setting.
- Returns:
The transient type.
- Return type:
str
- property url: str
The astrocats raw data url. :rtype: str
- Type:
return