Change the rate of a target#

In skysurvey, rate refers to the volumetric rate in target/yr/Gpc³ and is used while drawing the redshift. It enables for instance to know how many target to draw if only a time range and redshift range are specified.

rate could be a constant (a float) and is thus understood as an universal rate. Alternatively, rate could be a function of redshift. It is then understood as the function that specifies how the (volumetric) rate of the target evolves with redshift.

Each pre-computed skysurvey target has a default volumetric rate ; see _RATE (e.g., skysurvey.SNeIa._RATE). You can overwrite this rate while loading the target (see, the (from_)draw() rate= option) or using the set_rate() method.


Change the volumetric rate: rate=float#

import skysurvey

Here, let’s draw a SNIa, specifying a volumetric rate of 3e4 target/yr/Gpc³. We draw that for 1 day and between z=[0, 0.1] full sky.

snia = skysurvey.SNeIa.from_draw(tstart=0, tstop=1, 
                                zmin=0, zmax=0.1, 
                                rate=3e4)
len(snia.data)
82

Let’s now change the rate to 5e5 and redraw:

snia.set_rate(5e5)
data = snia.draw(tstart=0, tstop=1, zmin=0, zmax=0.1, 
                inplace=True) # inplace to replace self.data
len(snia.data)
1368

Change the volumetric rate: rate=function#

Let’s say we want to draw a redshift evolving volumetric rate, as defined, e.g., by Frohmaier et al. 2019 (2019MNRAS.486.2308F) for SNIa.

def evolving_rate(z, r0=2.3e4, alpha=1.70, **kwargs):
    """ redshift dependent rate (target/yr/Gpc3) 
    as ``r = r0(1+z)^alpha`` 
    
    Values from Frohmaier et al. 2019 (2019MNRAS.486.2308F).
    Note: this paper specifies r0=2.3e-5 target/yr/Mpc3
    => x1e9 to convert it into Gpc3.
    """
    return r0*(1+z)**alpha

Let’s draw SN Ia up to z=1 for 1 year and for 1 LSST field.

from skysurvey import lsst
skyarea = lsst.get_lsst_footprint()
snia = skysurvey.SNeIa.from_draw(skyarea=skyarea, 
                                 zmin=0.01, zmax=1,
                                 rate=evolving_rate, 
                                 tstart=0, tstop=365)
len(snia.data)
11