py4py.reverb.timeseries.input
Functions for importing data used by CARAMEL and MEMEcho
|
Imports a ASCII list of spectrum times. |
|
Inputs a two- or three-column ascii file of times, continuum values and errors, and optionally |
|
Imports a spectrum, and converts to target wavelength units, rebinning if requested. |
|
Routine to import CARAMEL output spectra into the same spectra format as the timeseries module creates. |
Module Contents
- py4py.reverb.timeseries.input.read_spectra_times(filename: str, time_units: astropy.units.Unit = None, time_name: str = 'MJD') astropy.table.QTable
Imports a ASCII list of spectrum times.
- Parameters:
filename (str) – Name of the file with times
time_units (Unit) – Unit the times are in (e.g. u.s, u.d)
time_name (str) – The name of the time column
- Returns:
Single-column table of time in given units
- Return type:
astropy.table.QTable
- py4py.reverb.timeseries.input.read_lightcurve(file: str, time_units: astropy.units.Unit | None = None, value_units: astropy.units.Unit | None = None, time_name: str = 'MJD', value_name: str | None = None, bolometric_correction: float | None = None, error_ratio: float | None = None, delta_continuum_range: float | None = None, target_bolometric_luminosity: astropy.units.Quantity | None = None) astropy.table.Table
Inputs a two- or three-column ascii file of times, continuum values and errors, and optionally rescales it to vary in a specific range (defined in terms of %) around a specific mean. If it has no errors, then errors can be automatically generated.
- Parameters:
file (str) – Name of the file to read
time_units (Optional[Unit]) – Unit the times are in (e.g. u.s, u.d)
time_name (str) – The name of the unit (for plot axes)
value_units (Optional[Unit]) – Unit the values are in (e.g. )
value_name (Optional[str]) – The name of the unit (for plot axes)
bolometric_correction (Optional[Quantity]) – If the lightcurve is provided in monochromatic flux, this conversion factor is applied to update it to bolometric flux.
target_bolometric_luminosity (Optional[Quantity]) – Target mean bolometric luminosity to rescale to.
delta_continuum_range (Optional[float]) – The fractional variation about the mean we would like this lightcurve rescaled to, e.g. +-0.2 about the mean
error_ratio (Optional[float]) – Target signal to noise ratio in each bin for mock errors, i.e. error in each bin = value/error_ratio.
- Returns:
Two/three column, with errors if they exist.
- Return type:
Table
- py4py.reverb.timeseries.input.read_spectrum(file: str, bins: str, values: str, frequency: bool = True, limits: Tuple[float, float] | None = None, wave_units: astropy.units.Unit | None = None, value_units: astropy.units.Unit | None = None, wave_name: str | None = None, value_name: str | None = None, error: str | None = None, subtract_continuum_with_mask: astropy.units.Quantity | None = None, rebin_to: int | None = None) astropy.table.Table | Tuple[astropy.table.Table, numpy.poly1d]
Imports a spectrum, and converts to target wavelength units, rebinning if requested.
- Parameters:
file (str) – The input spectrum file.
bins (str) – The name of the column with the frequency/wavelength bins.
values (str) – The name of the column with the spectrum values.
frequency (bool) – Whether this spectrum is binned in frequency or wavelength. Frequency spectra will be converted to wavelength. Frequency is assumed to be in Hz.
error (Optional[str]) – The name of the error column in the input spectrum.
subtract_continuum_with_mask (Optional[quantity]) – If provided, if the spectra has a continuum, it will be subtracted. The continuum profile will be calculated from the region outside of the mask. This subtraction is done after the wavelength units are applied.
limits (Optional[Tuple[float, float]]) – The spectrum will be ignored outside of these limits, if provided.
wave_units (Optional[Unit]) – The units the wavelengths are in (or should be in, for frequency mode)
wave_name (Optional[str]) – The name of the wavelength unit, for plotting.
value_units (Optional[Unit]) – The units the values are in.
value_name (Optional[str]) – The name of the value units, for plotting.
rebin_to (Optional[int]) – Whether the spectrum should be rebinned, and if so to how many bins
- Returns:
Table of input file. Key columns are ‘wave’, ‘value’ and ‘error’ poly1d: A function describing the background continuum
- Return type:
Table
Todo: A lot of assumptions are made that limits units are the same as bins units, etc. Todo: The actual ‘units’ arguments should be used instead of just assuming…
- py4py.reverb.timeseries.input.read_caramel_data(caramel_line_file: str, caramel_spectra_file: str) Tuple[astropy.table.Table, astropy.table.Table]
Routine to import CARAMEL output spectra into the same spectra format as the timeseries module creates.
- Parameters:
caramel_line_file (str) – The emission line light curve file.
caramel_spectra_file (str) – The timeseries of spectra generated by CARAMEL.
- Returns:
The emission line values and errors at each timestep. Table: Time-series of spectra generated by CARAMEL.
- Return type:
Table