fiesta#
Top-level utility modules.
- class fiesta.scalers.ImageScaler(downscale, upscale)[source]#
Bases:
ScalerScaler that down samples 2D arrays of shape upscale to downscale and the inverse. Note that the methods always assume that the input array x is flattened along the last axis, i.e. it will reshape the input
x.reshape(-1, *upscale). The down sampled image is scaled once more with a scaler object. Attention, this object has no proper fit method, because of its application in FluxTrainerCVAE and the way the data is loaded there to avoid memory issues.- static fix_edges(yp)[source]#
Vectorized version of fix_edges. Takes similar arguments as fix_edges but with additional array axes over which fix_edges is mapped.
Original documentation:
Extrapolate at early and late times from the reconstructed array to avoid artefacts at the edges from jax.image.resize.
- Return type:
Array
- class fiesta.scalers.MinMaxScalerJax(min_val=1.0, max_val=0.0)[source]#
Bases:
ScalerJAX compatible MinMaxScaler. API inspired by sklearn.
- class fiesta.scalers.PCADecomposer(n_components, solver='randomized')[source]#
Bases:
ScalerJAX compatible PCA decomposition. API inspired by sklearn. Based on alonfnt/pcax.
- class fiesta.scalers.SVDDecomposer(svd_ncoeff)[source]#
Bases:
ScalerJAX compatible SVD Decomposition. Based on the old NMMA approach to decompose lightcurves into SVD coefficients.
- class fiesta.scalers.Scaler[source]#
Bases:
objectBase class for all the scalers that depend on some analytic algorithm to transform data.
- class fiesta.scalers.StandardScalerJax(mu=0.0, sigma=1.0)[source]#
Bases:
ScalerJAX compatible StandardScaler. API inspired by sklearn.
- fiesta.conversions.Flambda_to_Fnu(F_lambda, lambdas)[source]#
JAX-compatible conversion of wavelength flux in erg cm^{-2} s^{-1} Angström^{-1} to spectral flux density in mJys.
- Parameters:
flux_lambda (Float[Array]) – 2D flux density array in erg cm^{-2} s^{-1} Angström^{-1}. The rows correspond to the wavelengths provided in lambdas.
lambdas (Float[Array]) – 1D wavelength array in Angström.
- Returns:
2D spectral flux density array in mJys nus (Float[Array]): 1D frequency array in Hz
- Return type:
mJys (Float[Array])
- fiesta.conversions.Fnu_to_Flambda(F_nu, nus)[source]#
JAX-compatible conversion of spectral flux density in mJys to wavelength flux in erg cm^{-2} s^{-1}.
- Parameters:
flux_nu (Float[Array]) – 2D flux density array in mJys. The rows correspond to the frequencies provided in nus.
nus (Float[Array]) – 1D frequency array in Hz.
- Returns:
2D wavelength flux density array in erg cm^{-2} s^{-1} Angström^{-1}. lambdas (Float[Array]): 1D wavelength array in Angström.
- Return type:
flux_lambda (Float[Array])
- fiesta.conversions.apply_redshift(F_nu, times, nus, z)[source]#
Transforms a 2D flux density array from source frame in observer frame, as well as the associated time and frequency array. Does not account for the distance factor, so cosmological energy loss and time elongation are taken into account by the luminosity distance.
- Parameters:
F_nu (Float[Array]) – 2D flux density array in mJy in source frame. The rows correspond to the frequencies provided in nus, the columns to times.
times (Float[Array]) – 1D time array in source frame.
nus (Float[Array]) – 1D frequency array in source frame
- Returns:
times (Float[Array]): 1D time array in observer frame. nus (Float[Array]): 1D frequency array in source frame. F_nu (Float[Array]): 2D flux density redshifted to observer frame.
- Return type:
- fiesta.conversions.bandpass_AB_mag(flux, nus, nus_filt, trans_filt, ref_flux)[source]#
This is a JAX-compatile equivalent of sncosmo.TimeSeriesSource.bandmag(). Unlike sncosmo, we use the frequency flux and not wavelength flux, but this function is tested to yield the same results as the sncosmo version.
- Parameters:
flux (Float[Array, "n_nus n_times"]) – Spectral flux density as a 2D array in mJys.
nus (Float[Array, "n_nus"]) – Associated frequencies in Hz
nus_filt (Float[Array, "n_nus_filt"]) – frequency array of the filter in Hz
trans_filt (Float[Array, "n_nus_filt"]) – transmissivity array of the filter in transmitted photons / incoming photons
ref_flux (Float) – flux in mJy for which the filter is 0 mag
- Return type:
Array, 'n_times']
- fiesta.conversions.integrated_AB_mag(flux, nus, nus_filt, trans_filt)[source]#
- Return type:
Array, 'n_times']
- fiesta.conversions.monochromatic_AB_mag(flux, nus, nus_filt, trans_filt, ref_flux)[source]#
- Return type:
Array, 'n_times']
- fiesta.utils.append_training_data_file(outfile, train_X, train_y, val_X, val_y, test_X, test_y)[source]#
- fiesta.utils.convert_POSSIS_outputs_to_h5(possis_dirs, outfile, parameter_names=['log10_mej_dyn', 'v_ej_dyn', 'Ye_dyn', 'log10_mej_wind', 'v_ej_wind', 'Ye_wind', 'inclination_EM'], clip=6.5144, log_arguments=[0, 3])[source]#
- fiesta.utils.convert_gwemopt_to_h5(dirs, outfile, parameter_names=['dens_slope', 'log10_X_lan', 'vkin', 'log10_mej'], clip=6.5144, log_arguments=[1, 3])[source]#
- fiesta.utils.interpolate_nans(data, times, output_times=None)[source]#
Interpolate NaNs and infs in the raw light curve data.
- Parameters:
- Returns:
Raw light curve data but with NaNs and infs interpolated
- Return type:
- fiesta.utils.load_event_data(filename)[source]#
Takes a file and outputs a magnitude dict with filters as keys.
- fiesta.utils.truncated_gaussian(mag_det, mag_err, mag_est, lim=inf)[source]#
Evaluate log PDF of a truncated Gaussian with loc at mag_est and scale mag_err, truncated at lim above.
- Returns:
_description_
- Return type:
_type_
- fiesta.utils.write_event_data(filename, data)[source]#
Takes a magnitude dict and writes it to filename. The magnitude dict should have filters as keys, the arrays should have the structure [[mjd, mag, err]].
- fiesta.utils.write_training_data(outfile, train_X, train_y, val_X, val_y, test_X, test_y, times, nus, parameter_names, parameter_distributions)[source]#
Constants and simple conversions