<commit_before>from collections import OrderedDict
import numpy as np
import inspect
import os
from numpy.random import uniform, normal
from scipy.interpolate import interp1d
from scipy.stats import multivariate_normal
from scipy.misc import logsumexp

from dessn.framework.model import Model
from dessn.utility.get_cosmologies import get_cosmology_dictionary


class ApproximateModel(Model):

    def __init__(self, filename="approximate.stan", num_nodes=4, global_calibration=14):
        file = os.path.abspath(inspect.stack()[0][1])
        directory = os.path.dirname(file)
        stan_file = directory + "/stan/" + filename
        super().__init__(stan_file)
        self.num_redshift_nodes = num_nodes
        self.global_calibration = global_calibration

    def get_parameters(self):
        return ["Om", "alpha", "beta", "dscale", "dratio", "mean_MB",
                #"outlier_MB_delta", "outlier_dispersion",
                "mean_x1", "mean_c", "sigma_MB", "sigma_x1", "sigma_c",
                "calibration", "intrinsic_correlation"]

    def get_labels(self):
        mapping = OrderedDict([
            ("Om", r"$\Omega_m$"),
            ("w", r"$w$"),
            ("alpha", r"$\alpha$"),
            ("beta", r"$\beta$"),
            ("mean_MB", r"$\langle M_B \rangle$"),
            #("outlier_MB_delta", r"$\delta M_B$"),
            #("outlier_dispersion", r"$\sigma_{\rm out}^{%d}$"),
            ("mean_x1", r"$\langle x_1^{%d} \rangle$"),
            ("mean_c", r"$\langle c^{%d} \rangle$"),
            ("sigma_MB", r"$\sigma_{\rm m_B}^{%d}$"),
            ("sigma_x1", r"$\sigma_{x_1}^{%d}$"),
            ("sigma_c", r"$\sigma_{c}^{%d}$"),
            ("dscale", r"$\delta(0)$"),
            ("dratio", r"$\delta(\infty)/\delta(0)$"),
            ("calibration", r"$\delta \mathcal{Z}_{%d}$")
        ])
        return mapping

    def get_init(self, **kwargs):
        deta_dcalib = kwargs["deta_dcalib"]
        num_supernova = kwargs["n_sne"]
        num_surveys = kwargs["n_surveys"]
        randoms = {<commit_msg>Saving alphas<commit_after>from collections import OrderedDict
import numpy as np
import inspect
import os
from numpy.random import uniform, normal
from scipy.interpolate import interp1d
from scipy.stats import multivariate_normal
from scipy.misc import logsumexp

from dessn.framework.model import Model
from dessn.utility.get_cosmologies import get_cosmology_dictionary


class ApproximateModel(Model):

    def __init__(self, filename="approximate.stan", num_nodes=4, global_calibration=14):
        file = os.path.abspath(inspect.stack()[0][1])
        directory = os.path.dirname(file)
        stan_file = directory + "/stan/" + filename
        super().__init__(stan_file)
        self.num_redshift_nodes = num_nodes
        self.global_calibration = global_calibration

    def get_parameters(self):
        return ["Om", "alpha", "beta", "dscale", "dratio", "mean_MB",
                #"outlier_MB_delta", "outlier_dispersion", "alpha_c", "alpha_x1",
                "mean_x1", "mean_c", "sigma_MB", "sigma_x1", "sigma_c",
                "calibration", "intrinsic_correlation"]

    def get_labels(self):
        mapping = OrderedDict([
            ("Om", r"$\Omega_m$"),
            ("w", r"$w$"),
            ("alpha", r"$\alpha$"),
            ("beta", r"$\beta$"),
            ("mean_MB", r"$\langle M_B \rangle$"),
            #("outlier_MB_delta", r"$\delta M_B$"),
            #("outlier_dispersion", r"$\sigma_{\rm out}^{%d}$"),
            ("mean_x1", r"$\langle x_1^{%d} \rangle$"),
            ("mean_c", r"$\langle c^{%d} \rangle$"),
            ("sigma_MB", r"$\sigma_{\rm m_B}^{%d}$"),
            ("sigma_x1", r"$\sigma_{x_1}^{%d}$"),
            ("sigma_c", r"$\sigma_{c}^{%d}$"),
            ("dscale", r"$\delta(0)$"),
            ("dratio", r"$\delta(\infty)/\delta(0)$"),
            ("calibration", r"$\delta \mathcal{Z}_{%d}$")
        ])
        return mapping

    def get_init(self, **kwargs):
        deta_dcalib = kwargs["deta_dcalib"]
        num_supernova = kwargs["n_sne"]
        num_surveys = kwargs["n_surveys"]
        randoms = {
{'fraction_non_alphanumeric': 0.17511520737327188, 'fraction_numerical': 0.007033713315546932, 'mean_word_length': 2.7422867513611617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5435313', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1353, 'n_words': 265}