snat_sim.plotting

The plotting module provides functions for generating plots of analysis results that are visually consistent and easily reproducible.

Plotting Function Summaries

plot_cosmology_fit

Plot a cosmological fit to a set of supernova data.

plot_delta_colors

Shows the change in SN color as a function of redshift with each SN color coded by PWV

plot_delta_mag_vs_pwv

Single panel, multi-line plot for change in magnitude vs PWV color coded by redshift

plot_delta_mag_vs_z

Single panel, multi-line plot of change in magnitude vs redshift color coded by PWV

plot_delta_mu

Plot the variation in fitted distance modulus as a function of redshift and PWV

plot_derivative_mag_vs_z

Single panel, multi-line plot of slope in delta magnitude vs redshift color coded by PWV

plot_fitted_params

Multi-panel plot showing subplots for each salt2 parameter vs redshift.

plot_magnitude

Multi-panel plot showing magnitudes in different columns vs PWV and redshift in different rows

plot_pwv_mag_effects

Multi panel plot with a column for each band and rows for the change in magnitude vs pwv and redshift parameters

plot_residuals_on_sky

Plot hubble residuals as a function of supernova coordinates.

plot_spectral_template

Plot a spectral template with overlaid PWV and bandpass throughput curves

plot_year_pwv_vs_time

Plot PWV measurements taken over a single year as a function of time.

compare_prop_effects

Compare the Zenith PWV assumed by different propagation effects

plot_transmission_variation

Compare the atmospheric transmission function for two PWV concentrations

plot_flux_variation

Compare the PWV absorbed flux of a SN IA for two PWV concentrations

plot_delta_sn_flux

Plot the change to spectroscopic SN Ia flux over wavelength and redshift

Module Docs

snat_sim.plotting.plot_delta_mag_vs_z(pwv_arr, z_arr, delta_mag_arr, axis=None, label=None)[source]

Single panel, multi-line plot of change in magnitude vs redshift color coded by PWV

Parameters:
  • pwv_arr (ndarray) – Array of PWV values

  • z_arr (ndarray) – Array of redshift values

  • delta_mag_arr (ndarray) – Array of delta mag values

  • axis (Optional[axis]) – Optionally plot on a given axis

  • label (Optional[str]) – Optional label to format with PWV

Return type:

None

snat_sim.plotting.plot_delta_mag_vs_pwv(pwv_arr, z_arr, delta_mag_arr, axis=None, label=None)[source]

Single panel, multi-line plot for change in magnitude vs PWV color coded by redshift

Parameters:
  • pwv_arr (ndarray) – Array of PWV values

  • z_arr (ndarray) – Array of redshift values

  • delta_mag_arr (ndarray) – Array of delta mag values

  • axis (Optional[axis]) – Optionally plot on a given axis

  • label (Optional[str]) – Optional label to format with redshift

Return type:

None

snat_sim.plotting.plot_derivative_mag_vs_z(pwv_arr, z_arr, slope_arr, axis=None)[source]

Single panel, multi-line plot of slope in delta magnitude vs redshift color coded by PWV

Parameters:
  • pwv_arr (ndarray) – Array of PWV values

  • z_arr (ndarray) – Array of redshift values

  • slope_arr (ndarray) – Slope of delta mag at reference PWV

  • axis (Optional[axis]) – Optionally plot on a given axis

Return type:

None

snat_sim.plotting.plot_pwv_mag_effects(pwv_arr, z_arr, delta_mag, slopes, bands, figsize=(10, 8))[source]

Multi panel plot with a column for each band and rows for the change in magnitude vs pwv and redshift parameters

delta_mag is expected to have band names as keys, and 2d arrays as values. Each array should represent the change in magnitude for each given PWV and redshift

Parameters:
  • pwv_arr (ndarray) – PWV values used in the calculation

  • z_arr (ndarray) – Redshift values used in the calculation

  • delta_mag (dict) – Dictionary with delta mag for each band

  • slopes (ndarray) – Slope in delta_mag for each redshift

  • bands (List[str]) – Order of bands to plot

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[Figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.sci_notation(num, decimal_digits=1, precision=None, exponent=None)[source]

Return a string representation of number in scientific notation.

Return type:

str

snat_sim.plotting.plot_spectral_template(source, wave_arr, z_arr, pwv, phase=0, resolution=2, figsize=(6, 4))[source]

Plot a spectral template with overlaid PWV and bandpass throughput curves

Parameters:
  • source (Union[str, Source]) – sncosmo source to use as spectral template

  • wave_arr (ndarray) – The observer frame wavelengths to plot flux for in Angstroms

  • z_arr (ndarray) – The redshifts to plot the template at

  • pwv (ndarray) – The PWV to plot the transmission function for

  • phase (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – The phase of the template to plot

  • resolution (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – The resolution of the atmospheric model

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[Figure, array]

Returns:

The matplotlib figure and an array of matplotlib axes

snat_sim.plotting.plot_spectrum(wave, flux, figsize=(9, 3), hardware_only=False)[source]

Plot a spectrum over the per-filter LSST hardware throughput

Parameters:
  • wave (array) – Spectrum wavelengths in Angstroms

  • flux (array) – Flux of the spectrum in arbitrary units

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – Size of the figure

  • hardware_only – Only include hardware contributions in the plotted filters

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_magnitude(mags, pwv, z, figsize=(9, 6))[source]

Multi-panel plot showing magnitudes in different columns vs PWV and redshift in different rows

Parameters:
  • mags (Dict[str, ndarray]) – Simulated magnitude values for each band

  • pwv (ndarray) – Array of PWV values

  • z (ndarray) – Array of redshift values

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – Size of the figure

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_fitted_params(fitted_params, pwv_arr, z_arr, bands)[source]

Multi-panel plot showing subplots for each salt2 parameter vs redshift.

Multiple lines included for different PWV values.

Parameters:
  • fitted_params (Dict[str, ndarray]) – Dictionary with fitted parameters in each band

  • pwv_arr (ndarray) – PWV value used for each supernova fit

  • z_arr (ndarray) – Redshift value used for each supernova fit

  • bands (List[str]) – Bands to include in the plot. Must be keys of fitted_params

Return type:

Tuple[Figure, array]

Returns:

The matplotlib figure and an array of matplotlib axes

snat_sim.plotting.plot_delta_colors(pwv_arr, z_arr, mag_dict, colors, ref_pwv=0)[source]

Shows the change in SN color as a function of redshift with each SN color coded by PWV

Parameters:
  • pwv_arr (ndarray) – Array of PWV values

  • z_arr (ndarray) – Array of redshift values

  • mag_dict (Dict[str, ndarray]) – Dictionary with magnitudes for each band

  • colors (List[Tuple[str, str]]) – Band combinations to plot colors for

  • ref_pwv (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Plot values relative to given reference PWV

Return type:

None

snat_sim.plotting.plot_delta_mu(mu, pwv_arr, z_arr, cosmo=FlatLambdaCDM(H0=70 km / (Mpc s), Om0=0.295, Tcmb0=0 K, Neff=3.04, m_nu=None, Ob0=None))[source]

Plot the variation in fitted distance modulus as a function of redshift and PWV

Parameters:
  • mu (ndarray) – Array of distance moduli

  • pwv_arr (ndarray) – Array of PWV values

  • z_arr (ndarray) – Array of redshift values

  • cosmo (Cosmology) – Astropy cosmology to compare results against

Return type:

None

snat_sim.plotting.plot_year_pwv_vs_time(pwv_series, figsize=(8, 4), missing=1)[source]

Plot PWV measurements taken over a single year as a function of time.

Set missing=None to disable plotting of missing data windows.

Parameters:
  • pwv_series (Series) – Measured PWV index by datetime

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – Size of the figure in inches

  • missing (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Highlight time ranges larger than given number of days with missing PWV

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_cosmology_fit(data, abs_mag, H0, Om0, w0, alpha, beta)[source]

Plot a cosmological fit to a set of supernova data.

Parameters:
  • data (DataFrame) – Results from the snat_sim fitting pipeline

  • abs_mag (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Intrinsic absolute magnitude of SNe Ia

  • H0 (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Fitted Hubble constant at z = 0 in [km/sec/Mpc]

  • Om0 (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Omega matter density in units of the critical density at z=0

  • w0 (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Dark energy equation of state

  • alpha (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Fitted nuisance parameter for supernova stretch correction

  • beta (Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]) – Fitted nuisance parameter for supernova color correction

Return type:

Tuple[figure, ndarray, ndarray]

Returns:

The matplotlib figure, fitted distance modulus, and tabulated residuals

snat_sim.plotting.plot_residuals_on_sky(ra, dec, residual, cmap='coolwarm', figsize=(8, 4))[source]

Plot hubble residuals as a function of supernova coordinates.

Parameters:
  • ra (array) – Right Ascension for each supernova

  • dec (array) – Declination of each supernova

  • residual (array) – Hubble residual for each supernova

  • cmap (str) – Name of the matplotlib color map to use

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.compare_prop_effects(pwv_data, static, seasonal, variable, figsize=(9, 6))[source]

Compare the Zenith PWV assumed by different propagation effects

Parameters:
  • pwv_data (Series) – Series with PWV values and a Datetime index

  • static (StaticPWVTrans) – Static propagation effect

  • seasonal (SeasonalPWVTrans) – Seasonal Propagation effect

  • variable (VariablePWVTrans) – Variable Propagation effect

  • figsize (Tuple[float, float]) – The size of the figure

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_transmission_variation(pwv1, pwv2, wave_min=6500, wave_max=10000, resolution=9, figsize=(8, 4))[source]

Compare the atmospheric transmission function for two PWV concentrations

Parameters:
  • pwv1 (float) – The first PWV concentration to plot the transmission for

  • pwv2 (float) – The second PWV concentration to plot the transmission for

  • wave_min (float) – Minimum wavelength to plot

  • wave_max (float) – Maximum wavelength to plot

  • resolution (int) – Bin the atmospheric transmission function to a lower transmission

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_flux_variation(pwv1, pwv2, z=0.55, wave_min=6500, wave_max=10000, resolution=9, figsize=(8, 4))[source]

Compare the PWV absorbed flux of a SN IA for two PWV concentrations

Parameters:
  • pwv1 (float) – The first PWV concentration to plot the flux for

  • pwv2 (float) – The second PWV concentration to plot the flux for

  • z (float) – The redshift of the SN Ia

  • wave_min (float) – Minimum wavelength to plot

  • wave_max (float) – Maximum wavelength to plot

  • resolution (int) – Bin the atmospheric transmission function to a lower transmission

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[figure, Axes]

Returns:

The matplotlib figure and axis

snat_sim.plotting.plot_delta_sn_flux(pwv=4, wave_min=6500, wave_max=10000, figsize=(8, 6))[source]

Plot the change to spectroscopic SN Ia flux over wavelength and redshift

An imshow style plot with the change in flux along the color axis.

Parameters:
  • pwv (float) – The PWV concentration to use when determining the change in flux

  • wave_min (float) – Minimum wavelength to plot

  • wave_max (float) – Maximum wavelength to plot

  • figsize (Tuple[Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong], Union[float, float16, float32, float64, float128, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, longlong, ulonglong]]) – The size of the figure

Return type:

Tuple[figure, array]

Returns:

The matplotlib figure and and array of matplotlib axes