snsim.hosts

This module contains the class which are used in the simulation.

Classes

SnHosts

Class containing the SN Host parameters.

Functions

model_host_noise(sim_par, obs)

Compute noise coming from host galaxy in photoelectron units (approximation)

Module Contents

class snsim.hosts.SnHosts(config, z_range=None, geometry=None)[source]

Class containing the SN Host parameters.

Parameters:
  • config (str) –

    Configuration of host.

    config
    ├── host_file, ‘PATH/TO/HOSTFILE’
    ├── distrib, str, Optional, default = ‘rate’, options given by self._dist_options
    ├── reweight_vol, bool, Optional, default = False, reweight input host distrib to volumetric
    └── key_dic: {‘column_name’: ‘new_column_name’, etc}, Optional, only use to change columns names

  • z_range (list(float), opt) – The redshift range.

  • class. (Initialize SnHost)

property config

Get the configuration dic of host.

property max_dz

Get the maximum redshift gap.

property df

Get pandas Dataframe of host.

compute_weights(rate=None, sn_type=None, cosmology=None)[source]

Compute the weights for random choice.

Parameters:

rate (function, optional) – rate function of z, by default None.

Returns:

weigths for the random draw.

Return type:

numpy.ndarray(float)

random_choice(n, seed=None, rate=None, sn_type=None, cosmology=None)[source]

Randomly select hosts.

Parameters:
  • n (int) – Number of hosts to select.

  • seed (int, opt) – Random seed.

Returns:

Dataframe with selected hosts properties.

Return type:

pandas.Dataframe

snsim.hosts.model_host_noise(sim_par, obs)[source]

Compute noise coming from host galaxy in photoelectron units (approximation)