SNNSNMetric

class rubin_sim.maf.metrics.SNNSNMetric(metric_name='SNNSNMetric', mjd_col='observationStartMJD', filter_col='filter', m5_col='fiveSigmaDepth', exptime_col='visitExposureTime', night_col='night', obsid_col='observationId', nexp_col='numExposures', vistime_col='visitTime', seeing_col='seeingFwhmEff', note_col='note', season=[-1], coadd_night=True, zmin=0.1, zmax=0.5, z_step=0.03, daymax_step=3.0, verbose=False, ploteffi=False, n_bef=3, n_aft=8, snr_min=1.0, n_phase_min=1, n_phase_max=1, sigma_c=0.04, zlim_coeff=0.95, bands='grizy', add_dust=False, hard_dust_cut=0.25, gamma_name='gamma_WFD.hdf5', **kwargs)

Bases: BaseMetric

Measure zlim of type Ia supernovae.

Parameters:
metricNamestr, opt

metric name (default : SNSNRMetric)

mjd_colstr, opt

mjd column name (default : observationStartMJD)

filter_colstr, opt

filter column name (default: filter)

m5_colstr, opt

five-sigma depth column name (default : fiveSigmaDepth)

exptime_colstr, opt

exposure time column name (default : visitExposureTime)

night_colstr, opt

night column name (default : night)

obsid_colstr, opt

observation id column name (default : observationId)

nexp_colstr, opt

number of exposure column name (default : numExposures)

vistime_colstr, opt

visit time column name (default : visitTime)

seeing_colstr, opt

seeing column name (default: seeingFwhmEff)

note_colstr, opt

note column name (default: note)

seasonlist, opt

list of seasons to process (float)(default: -1 = all seasons)

coaddbool, opt

coaddition per night (and per band) (default : True)

zminfloat, opt

min redshift for the study (default: 0.0)

zmaxfloat, opt

max redshift for the study (default: 1.2)

verbosebool, opt

verbose mode (default: False)

n_befint, opt

number of LC points LC before T0 (default:5)

n_aftint, opt

number of LC points after T0 (default: 10)

snr_minfloat, opt

minimal SNR of LC points (default: 5.0)

n_phase_minint, opt

number of LC points with phase<= -5(default:1)

n_phase_maxint, opt

number of LC points with phase>= 20 (default: 1)

zlim_coeff: float, opt

corresponds to the zlim_coeff fraction of SN with z<zlim

bandsstr, opt

bands to consider (default: grizy)

gammaName: `str`, opt

name of the gamma ref file to load (default: gamma_WFD.hdf5)

dustbool, opt

Apply dust extinction to visit depth values (default False)

hard_dust_cutfloat, opt

If set, cut any point on the sky that has an ebv extinction higher than the hard_dust_cut value. Default 0.25

Methods Summary

calc_daymax(grp, daymax_step)

Method to estimate T0 (daymax) values for simulation.

check_dur_z(dur_z[, nmin])

"

coadd(obs)

Method to coadd data per band and per night

duration_z(grp[, min_duration])

Method to estimate the season length vs redshift This is necessary to take into account boundary effects when estimating the number of SN that can be detected

efficiencies(dfo)

"

gen_lc(grp, gen_par_orig, x1, color)

Method to generate light curves from observations

get_epochs(nights, flag, flagph)

Method to get the number of epochs

get_nsn(effi, durinterp_z, zmin, zmax, zstep)

Method to estimate to total number of SN: NSN = Sum(effi(z)*rate(z))

get_season_info(dfa, zseason[, min_duration])

method to get season infos vs z

get_sum(lcarr, varname, nvals, flag)

Method to get the sum of variables using broadcasting

getseason(obs[, season_gap, mjd_col])

Method to estimate seasons

metric(data_slice, zseason[, x1, color, ...])

Method to run the metric

nsn(grp[, sn_type])

Method to estimate the metric nsn up to zlim

nsn_expected_z(grp)

Method to estimate the expected nsn vs redshift

nsn_from_rate(grp)

Method to estimate the expected number of supernovae

reducen_sn(metric_val)

reducezlim(metric_val)

run(data_slice, slice_point)

Run method of the metric

season_info(grp, min_duration)

Method to estimate seasonal info (cadence, season length, ...)

season_length(seasons, data_slice, zseason)

Method to estimate season lengths vs z

sigma_s_nparams(grp)

Method to estimate variances of SN parameters from inversion of the Fisher matrix

sn_effi(lc)

Method to transform LCs to supernovae

step_efficiencies(lc)

Method to estimate observing efficiencies

step_lc(obs, gen_par[, x1, color])

Method to generate lc

step_nsn(sn_effis, dur_z)

Method to estimate the number of supernovae from efficiencies

z_season(seasons, data_slice)

Fill the z values per season

z_season_allz(zseason)

zlim(grp[, sn_type])

Method to estimate the metric zcomp

zlim_or_nsn(effi[, sntype, zlim])

Method to estimate the redshift limit or the number of sn

Methods Documentation

calc_daymax(grp, daymax_step)

Method to estimate T0 (daymax) values for simulation.

Parameters:
grp: group (pandas df sense)
group of data to process with the following cols:

t0_min: T0 min value (per season) t0_max: T0 max value (per season)

daymax_step: float

step for T0 simulation

Returns:
pandas df with daymax, min_rf_phase, max_rf_phase values
check_dur_z(dur_z, nmin=2)

” Method to remove seasons with a poor redshift range due to too low season length

Parameters:
dur_z: pandas df

data to process

nmin: int, opt

minimal number of redshift points per season (default: 2)

Returns:
pandas df with seasons having at least nmin points in redshift
coadd(obs)

Method to coadd data per band and per night

Parameters:
datapd.DataFrame

pandas df of observations

Returns:
coadded datapd.DataFrame
duration_z(grp, min_duration=60.0)

Method to estimate the season length vs redshift This is necessary to take into account boundary effects when estimating the number of SN that can be detected

daymin, daymax = min and max MJD of a season T0_min(z) = daymin-(1+z)*min_rf_phase_qual T0_max(z) = daymax-(1+z)*max_rf_phase_qual season_length(z) = T0_max(z)-T0_min(z)

Parameters:
grp: pandas df group

data to process: season infos

min_duration: float, opt

min season length for a season to be processed (deafult: 60 days)

Returns:
pandas df with season_length, z, T0_min and T0_max cols
efficiencies(dfo)

” Method to estimate selection efficiencies

Parameters:
df: pandas df

data to process

gen_lc(grp, gen_par_orig, x1, color)

Method to generate light curves from observations

Parameters:
grp: pandas group

observations to process

gen_par_orig: pandas df

simulation parameters

x1: float

SN stretch

color: float

SN color

Returns:
light curves as pandas df
get_epochs(nights, flag, flagph)

Method to get the number of epochs

Parameters:
nights: array

night number array

flag: array(bool)

flag to apply

flagph: array(bool)

flag to apply

Returns:
array with the number of epochs
get_nsn(effi, durinterp_z, zmin, zmax, zstep)

Method to estimate to total number of SN: NSN = Sum(effi(z)*rate(z))

Parameters:
effi: 1D interpolator

efficiencies vs z

durinterp_z: 1D interpolator

duration vs z

zmin: float

redshift min

zmax: float

redshift max

zstep: float

redshift step

Returns:
total number of SN up to zmax
get_season_info(dfa, zseason, min_duration=60.0)

method to get season infos vs z

Parameters:
dfa: pandas df

dat to process

zseason: pandas df

redshift infos per season

min_duration: float, opt

min season length to be accepted (default: 60 days)

Returns:
pandas df with season length infos
get_sum(lcarr, varname, nvals, flag)

Method to get the sum of variables using broadcasting

Parameters:
lcarr: numpy array

data to process

varname: str

col to process in lcarr

nvals: int

dimension for tiling

flag: array(bool)

flag to apply

Returns:
array: the sum of the corresponding variable
getseason(obs, season_gap=80.0, mjd_col='observationStartMJD')

Method to estimate seasons

Parameters:
obs: `np.ndarray`

array of observations

season_gap: `float`, optional

minimal gap required to define a season (default: 80 days)

mjd_col: `str`, optional

col name for MJD infos (default: observationStartMJD)

Returns:
obsnp.ndarray

original numpy array with seasonnumber appended

metric(data_slice, zseason, x1=-2.0, color=0.2, zlim=-1, metric='zlim')

Method to run the metric

Parameters:
data_slice: array

observations to use for processing

zseason: array

season infos (season length vs z)

x1: float, opt

SN stretch (default: -2.0)

color: float, opt

SN color (default: -0.2)

zlim: float, opt

redshift limit used to estimate NSN (default: -1)

metric: str, opt

metric to estimate [zlim or nsn] (default: zlim)

nsn(grp, sn_type='medium')

Method to estimate the metric nsn up to zlim

Parameters:
grp: pandas group
sn_type: str, opt

type of SN to estimate zlim (default: medium)

Returns:
pandas df with the metric as cols
nsn_expected_z(grp)

Method to estimate the expected nsn vs redshift

Parameters:
grp: pandas df group

data to process: season infos

Returns:
pandas df with season_length, z, nsn_expected cols
nsn_from_rate(grp)

Method to estimate the expected number of supernovae

Parameters:
grp: pandas df

data to process

Returns:
pandas df with z and nsn_expected as cols
reducen_sn(metric_val)
reducezlim(metric_val)
run(data_slice, slice_point)

Run method of the metric

Parameters:
data_slice: `np.array`

Observations to process (scheduler simulations)

slice_point: `bool`, opt

Information about the location on the sky from the slicer

Returns:
metricValnp.recarray

[‘n_sn’, ‘zlim’] at this point on the sky

season_info(grp, min_duration)

Method to estimate seasonal info (cadence, season length, …)

Parameters:
grp: pandas df group
min_duration: float

minimal duration for a season to be considered

Returns:
pandas df with the following cols:
  • Nvisits: number of visits for this group
  • N_xx: number of visits in xx where xx is defined in self.bandstat
season_length(seasons, data_slice, zseason)

Method to estimate season lengths vs z

Parameters:
seasonslist(int)

list of seasons to process

data_slice: numpy array

array of observations

Returns:
seasonslist(int)

list of seasons to process

dur_zpandas df

season lengths vs z

sigma_s_nparams(grp)

Method to estimate variances of SN parameters from inversion of the Fisher matrix

Parameters:
grp: pandas df of flux derivatives wrt SN parameters
Returns
———-
Diagonal elements of the inverted matrix (as pandas df)
sn_effi(lc)

Method to transform LCs to supernovae

Parameters:
lc: pandas grp

light curve

Returns:
pandas df of sn efficiencies vs z
step_efficiencies(lc)

Method to estimate observing efficiencies

Returns:
pandas df with efficiencies
step_lc(obs, gen_par, x1=-2.0, color=0.2)

Method to generate lc

Parameters:
obs: array

observations

gen_par: array

simulation parameters

x1: float, opt

stretch value (default: -2.0)

color: float, opt

color value (default: 0.2)

Returns:
SN light curves (astropy table)
step_nsn(sn_effis, dur_z)

Method to estimate the number of supernovae from efficiencies

Parameters:
sn_effis: pandas df

data with efficiencies of observation

dur_z: array

array of season length

Returns:
initial sn_effis appended with a set of infos (duration, nsn)
z_season(seasons, data_slice)

Fill the z values per season

Parameters:
seasons: list

seasons to process

data_slice: array

data to process

z_season_allz(zseason)
zlim(grp, sn_type='faint')

Method to estimate the metric zcomp

Parameters:
grp: pandas group
sn_type: str, opt

type of SN to estimate zlim (default: faint)

Returns:
pandas df with the metric as cols
zlim_or_nsn(effi, sntype='faint', zlim=-1.0)

Method to estimate the redshift limit or the number of sn

Parameters:
effi: pandas df

data to process

sntype: str, opt

type of SN to consider for estimation (default: faint)

zlim: float, opt

redshift limit

Returns:
if zlim<0: returns the redshift limit
if zlim>0: returns the number of sn up to zlim