ijazz.PhotonToElectronScale_MMG =============================== .. py:module:: ijazz.PhotonToElectronScale_MMG Classes ------- .. autoapisummary:: ijazz.PhotonToElectronScale_MMG.IJazZMMG Functions --------- .. autoapisummary:: ijazz.PhotonToElectronScale_MMG.ijazz_sas_cmd ijazz.PhotonToElectronScale_MMG.ijazz_sas ijazz.PhotonToElectronScale_MMG.compute_sas Module Contents --------------- .. py:function:: ijazz_sas_cmd() entry point for the ijazz_sas command .. py:function:: ijazz_sas(config: dict = None, do_fit=True, save_corrlib=True, correct_files=True) Perform the scale and smearing fit, plot the results and save the results. The configuration file should contain the following sections: - file_dt: data file (parquet format) - file_mc: mc file (parquet format) - dir_results: directory where to save the results - fitter: configuration for the fitter - sas: configuration for the scale and smearing fit - minimizer: configuration for the minimizer - syst: configuration for the systematic computation - corrlib: add description and version number to the correctionlib file - cat_latex: dictionary to convert the category name to latex - scale_flat_syst: flat systematic for scale - smear_flat_syst: flat systematic for smearing - dset_name: name of the dataset eg ``2023`` - cset_name: name of the correction set eg ``EtaR9`` See an example `sas_config.yaml `_ :param config: configuration dictionary containing the parameters for the fit :type config: dict :param do_fit: if True, perform the fit :param save_corrlib: if True, save the correctionlib file .. py:class:: IJazZMMG(dt: pandas.DataFrame, mc: pandas.DataFrame, config: dict, categories: dict = None) Scale-and-smearing fitter specialized for MMG inputs. .. py:attribute:: categories_def :value: None .. py:attribute:: cfg .. py:attribute:: vllg_name .. py:attribute:: mll_name .. py:attribute:: mllg_name .. py:attribute:: pt_name .. py:attribute:: cat_name .. py:attribute:: cut :value: '' .. py:attribute:: categories :value: None .. py:attribute:: categories_mc .. py:attribute:: categories_dt .. py:attribute:: dt .. py:attribute:: mc .. py:attribute:: fitter :value: None .. py:attribute:: resp :value: None .. py:attribute:: reso :value: None .. py:attribute:: resp_corr :value: None .. py:attribute:: reso_uncorr :value: None .. py:attribute:: eresp :value: None .. py:attribute:: ereso :value: None .. py:attribute:: eresp_mc :value: None .. py:attribute:: ereso_mc :value: None .. py:attribute:: pt_mean :value: None .. py:method:: fit(optimizer=tf.keras.optimizers.Adam) -> numpy.ndarray Actually performs the fit :param optimizer: tensorflow compatible optimizer for instance tf.keras.optimizers.Adam (this is not the optimizer the the class) :type optimizer: class :param learning_rate: learning rate to pass to the optimizer. Defaults to 0.01. :type learning_rate: float, optional :param dnll_tol: delta likelihood tolerance to stop the fit. Defaults to 0.01. :type dnll_tol: float, optional :param max_epochs: maximum number of iteration. Defaults to 1000. :type max_epochs: int, optional :param init_rand: random starting poin. Defaults to False. :type init_rand: bool, optional :param batch_size: can perform the fit in batch size (usefull for large number of parameters). Defaults to -1. :type batch_size: int, optional :param device: _description_. Defaults to 'CPU'. :type device: str, optional :param batch_training: use the batch training mode. Defaults to False. :type batch_training: bool, optional :param hess: computation of the hession (None, 'numerical', or 'analytical'), it can take a while. Defaults to 'numerical'. :type hess: str, optional :param cats: subset of categories to perform the fit. Defaults to slice(None). :type cats: _type_, optional :returns: array of the value of the -2 * log likelihood during the fit :rtype: np.ndarray .. py:method:: calc_err_stat(force=False) .. py:method:: calc_err_mc() compute the error due to MC statistical fluctuations, this may take a while .. py:method:: correct_data(response: numpy.ndarray, prefix: str = None) correct the data dataframe after the fit :param response: array with the responses to apply for correction :type response: np.ndarray :param prefix: prefix used for naming the categorisation. Defaults to None. :type prefix: str, optional .. py:method:: dump_json(outfile: Union[pathlib.Path, str] = None) Dump the resulst to a json file :param outfile: output file name. Defaults to None. :type outfile: Union[Path, str], optional .. py:function:: compute_sas(dt, mc, cfg, categories=None) -> IJazZMMG Wrapper to compute the scale and smearing parameters :param dt: input dataframe for data :type dt: pd.DataFrame :param mc: input dataframe for mc :type mc: pd.DataFrame :param cfg: config file to control the sas fit :type cfg: Union[str, Path] :param categories: categories to do the fit (can be specified in config). Defaults to None. :type categories: dict, optional :returns: return the ScaleAndSmearing fitter :rtype: IJazZSAS