py4py.reverb.timeseries.input ============================= .. py:module:: py4py.reverb.timeseries.input .. autoapi-nested-parse:: Functions for importing data used by CARAMEL and MEMEcho .. autoapisummary:: py4py.reverb.timeseries.input.read_spectra_times py4py.reverb.timeseries.input.read_lightcurve py4py.reverb.timeseries.input.read_spectrum py4py.reverb.timeseries.input.read_caramel_data Module Contents --------------- .. py:function:: 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. :param filename: Name of the file with times :type filename: str :param time_units: Unit the times are in (e.g. u.s, u.d) :type time_units: Unit :param time_name: The name of the time column :type time_name: str :returns: Single-column table of time in given units .. py:function:: read_lightcurve(file: str, time_units: Optional[astropy.units.Unit] = None, value_units: Optional[astropy.units.Unit] = None, time_name: str = 'MJD', value_name: Optional[str] = None, bolometric_correction: Optional[float] = None, error_ratio: Optional[float] = None, delta_continuum_range: Optional[float] = None, target_bolometric_luminosity: Optional[astropy.units.Quantity] = 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. :param file: Name of the file to read :type file: str :param time_units: Unit the times are in (e.g. u.s, u.d) :type time_units: Optional[Unit] :param time_name: The name of the unit (for plot axes) :type time_name: str :param value_units: Unit the values are in (e.g. ) :type value_units: Optional[Unit] :param value_name: The name of the unit (for plot axes) :type value_name: Optional[str] :param bolometric_correction: If the lightcurve is provided in monochromatic flux, this conversion factor is applied to update it to bolometric flux. :type bolometric_correction: Optional[Quantity] :param target_bolometric_luminosity: Target mean bolometric luminosity to rescale to. :type target_bolometric_luminosity: Optional[Quantity] :param delta_continuum_range: The fractional variation about the mean we would like this lightcurve rescaled to, e.g. +-0.2 about the mean :type delta_continuum_range: Optional[float] :param error_ratio: Target signal to noise ratio in each bin for mock errors, i.e. error in each bin = value/error_ratio. :type error_ratio: Optional[float] :returns: Two/three column, with errors if they exist. :rtype: Table .. py:function:: read_spectrum(file: str, bins: str, values: str, frequency: bool = True, limits: Optional[Tuple[float, float]] = None, wave_units: Optional[astropy.units.Unit] = None, value_units: Optional[astropy.units.Unit] = None, wave_name: Optional[str] = None, value_name: Optional[str] = None, error: Optional[str] = None, subtract_continuum_with_mask: Optional[astropy.units.Quantity] = None, rebin_to: Optional[int] = None) -> Union[astropy.table.Table, Tuple[astropy.table.Table, numpy.poly1d]] Imports a spectrum, and converts to target wavelength units, rebinning if requested. :param file: The input spectrum file. :type file: str :param bins: The name of the column with the frequency/wavelength bins. :type bins: str :param values: The name of the column with the spectrum values. :type values: str :param frequency: Whether this spectrum is binned in frequency or wavelength. Frequency spectra will be converted to wavelength. Frequency is assumed to be in Hz. :type frequency: bool :param error: The name of the error column in the input spectrum. :type error: Optional[str] :param subtract_continuum_with_mask: 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. :type subtract_continuum_with_mask: Optional[quantity] :param limits: The spectrum will be ignored outside of these limits, if provided. :type limits: Optional[Tuple[float, float]] :param wave_units: The units the wavelengths are in (or should be in, for frequency mode) :type wave_units: Optional[Unit] :param wave_name: The name of the wavelength unit, for plotting. :type wave_name: Optional[str] :param value_units: The units the values are in. :type value_units: Optional[Unit] :param value_name: The name of the value units, for plotting. :type value_name: Optional[str] :param rebin_to: Whether the spectrum should be rebinned, and if so to how many bins :type rebin_to: Optional[int] :returns: Table of input file. Key columns are 'wave', 'value' and 'error' poly1d: A function describing the background continuum :rtype: 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... .. py:function:: 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. :param caramel_line_file: The emission line light curve file. :type caramel_line_file: str :param caramel_spectra_file: The timeseries of spectra generated by CARAMEL. :type caramel_spectra_file: str :returns: The emission line values and errors at each timestep. Table: Time-series of spectra generated by CARAMEL. :rtype: Table