snsim.sample ============ .. py:module:: snsim.sample .. autoapi-nested-parse:: SimSample class used to store simulations. Classes ------- .. autoapisummary:: snsim.sample.SimSample Module Contents --------------- .. py:class:: SimSample(sample_name, sim_lcs, header, dir_path=None) Class to store simulated SN sample. :param sample_name: Name of the sample. :type sample_name: str :param sim_lcs: The simulated lightcurves. :type sim_lcs: list(astropy.Table) :param header: Simulation header. :type header: dict :param model_dir: The path to the simulation model files. :type model_dir: str, opt :param file_path: Path of the sample. :type file_path: str, opt :param Initialize SimSample class.: .. py:method:: fromDFlist(sample_name, sim_lcs, header, dir_path=None) :classmethod: Initialize the class from a list of pandas.DataFrame. :param cls: The SimSample class. :type cls: SimSample class :param sim_file: The file to load. :type sim_file: str :param model_dir: The directory of the configuration files of the sim model. :type model_dir: str, opt :param sample_name: Name of the simulation. :type sample_name: str :param sim_lcs: The sim lightcurves. :type sim_lcs: list(pandas.DataFrame) :param header: Simulation header. :type header: dict :returns: A SimSample class with the simulated lcs. :rtype: SimSample class object .. py:method:: fromFile(sim_file, engine='pyarrow') :classmethod: Initialize the class from a fits or pickle file. :param cls: The SimSample class. :type cls: SimSample class :param sim_file: The file to load. :type sim_file: str :param model_dir: The directory of the configuration files of the sim model. :type model_dir: str, opt :param engine: Engine to use to open the file pyarrow or fastparquet. :type engine: str :returns: A SimSample class with the simulated lcs. :rtype: SimSample class object .. py:method:: get_obj_sim_model(obj_ID) Get th sim model of one obj. :param obj_ID: ID of the obj. :type obj_ID: int :returns: sncosmo sim model of the obj. :rtype: sncosmo.Model .. py:method:: set_fit_model(model, model_dir=None, mw_dust=None) Set the fit with a given SNCosmo Model. :param model: A sncosmo Model or a model name for utils.init_sn_model(model, model_dir). :type model: sncosmo.models.Model or str :param model_dir: In case you want to set your model via utils.init_sn_model(model, model_dir). :type model_dir: str, opt :param mw_dust: Milky Wat dust model to apply. | mw_dust | ├── model : str (model name) | └── rv : float, opt :type mw_dust: dict, opt :returns: Set the self._fit_model attribute. :rtype: None .. py:method:: fit_lc(obj_ID=None, **kwargs) Fit all or just one SN lightcurve(s). :param ID: The SN ID, if not specified all SN are fit. :type ID: int, default is None :returns: Directly modified the _fit_res attribute. :rtype: None .. rubric:: Notes Use snc_fitter from utils .. py:method:: write_mod(formats=['pkl', 'parquet']) Write a file containing only the modified SN epochs. :param formats: The output formats, 'pkl' or 'fits'. :type formats: list(str) or str, opt :returns: Just write a file. :rtype: None .. py:method:: write_fit(fit_model_name, write_path=None) Write fits results in fits format. :returns: Write an output file. :rtype: None .. rubric:: Notes Use write_fit from utils. .. py:method:: plot_hist(key, ax=None, **kwargs) Plot the histogram of the key metadata. :param key: A key of lightcurves metadata. :type key: str :param ax: ax on which plot the histogram. :type ax: matplotlib.axis, opt :param \*\*kwargs: matplotlib plot options. :type \*\*kwargs: type :returns: Description of returned object. :rtype: type .. py:method:: plot_lc(obj_ID, plot_sim=True, plot_fit=False, **kwargs) Plot the given SN lightcurve. :param obj_ID: The Object ID. :type obj_ID: int :param mag: If True plot the magnitude instead of the flux. :type mag: boolean, default = False :param zp: Used zeropoint for the plot. :type zp: float :param plot_sim: If True plot the theorical simulated lightcurve. :type plot_sim: boolean, default = True :param plot_fit: If True plot the fitted lightcurve. :type plot_fit: boolean, default = False :param Jy: If True plot in Jansky. :type Jy: boolean, default = False :param mod: If True use the self.modified_lcs rather than self.sim_lcs :type mod: boolean, default = False :returns: Just plot the SN lightcurve ! :rtype: None .. rubric:: Notes Use plot_lc from utils. .. py:method:: plot_ra_dec(plot_vpec=False, field_dic=None, field_size=None, **kwarg) Plot a mollweide map of ra, dec. :param plot_vpec: If True plot a vpec colormap. :type plot_vpec: boolean :param field_dic: Dict of fields coordinates -> Field_ID : {'RA', 'Dec'} :type field_dic: dict(int : dict(str : float)) :param field_size: The size of the field [RA, Dec] :type field_size: list(float, float) :returns: Just plot the map. :rtype: None .. py:method:: get(key, mod=False) Get an array of sim_lc metadata. :param key: The metadata to access. :type key: str :returns: The array of the key metadata for all SN. :rtype: numpy.ndarray .. py:method:: get_peakmags(band, magsys='ab') Get peak apparent magnitude in any band. :param band: The band, the name has to be in sncosmo registry :type band: str :param magsys: The magnitude system, default: ab. :type magsys: str :returns: The array of the peak apparent magnitude for all SN. :rtype: numpy.ndarray .. py:property:: name Get sample name. .. py:property:: header Get header. .. py:property:: n_obj Get SN number. .. py:property:: sim_lcs Get sim_lcs. .. py:property:: meta Get lcs meta dict. .. py:property:: sim_model Get sim model. .. py:property:: fit_model Get fit model. .. py:property:: fit_res Get fit results list.