def __init__(self, path, data, command_line): # Unusual construction, since the data files are not distributed # alongside JLA (size problems) try: Likelihood_sn.__init__(self, path, data, command_line) except IOError: raise io_mp.LikelihoodError( "The JLA data files were not found. Please download the " "following link " "http://supernovae.in2p3.fr/sdss_snls_jla/jla_likelihood_v4.tgz" ", extract it, and copy all files present in " "`jla_likelihood_v4/data` to `montepython/data/JLA`") # Load matrices from text files, whose names were read in the # configuration file self.C00 = self.read_matrix(self.mag_covmat_file) self.C11 = self.read_matrix(self.stretch_covmat_file) self.C22 = self.read_matrix(self.colour_covmat_file) self.C01 = self.read_matrix(self.mag_stretch_covmat_file) self.C02 = self.read_matrix(self.mag_colour_covmat_file) self.C12 = self.read_matrix(self.stretch_colour_covmat_file) # Reading light-curve parameters from self.data_file (jla_lcparams.txt) self.light_curve_params = self.read_light_curve_parameters()
def __init__(self, path, data, command_line): # Unusual construction, since the data files are not distributed # alongside JLA (size problems) try: Likelihood_sn.__init__(self, path, data, command_line) except IOError: raise io_mp.LikelihoodError( "The JLA data files were not found. Please download the " "following link " "http://supernovae.in2p3.fr/sdss_snls_jla/jla_likelihood_v4.tgz" ", extract it, and copy all files present in " "`jla_likelihood_v4/data` to `your_montepython/data/JLA`") # Load matrices from text files, whose names were read in the # configuration file self.C00 = self.read_matrix(self.mag_covmat_file) self.C11 = self.read_matrix(self.stretch_covmat_file) self.C22 = self.read_matrix(self.colour_covmat_file) self.C01 = self.read_matrix(self.mag_stretch_covmat_file) self.C02 = self.read_matrix(self.mag_colour_covmat_file) self.C12 = self.read_matrix(self.stretch_colour_covmat_file) # Reading light-curve parameters from self.data_file (jla_lcparams.txt) self.light_curve_params = self.read_light_curve_parameters()
def __init__(self, path, data, command_line): # Unusual construction, since the data files are not distributed # alongside Pantheon (size problems) try: Likelihood_sn.__init__(self, path, data, command_line) except IOError: raise io_mp.LikelihoodError( "The Pantheon data files were not found. Please check if " "the following files are in the data/Pantheon directory: " "\n-> pantheon.dataset" "\n-> lcparam_full_long.txt" "\n-> sys_full_long.dat") # Load matrices from text files, whose names were read in the # configuration file self.C00 = self.read_matrix(self.mag_covmat_file) # Reading light-curve parameters from self.data_file (lcparam_full_long.txt) self.light_curve_params = self.read_light_curve_parameters() # Reordering by J. Renk. The following steps can be computed in the # initialisation step as they do not depend on the point in parameter-space # -> likelihood evaluation is 30% faster # Compute the covariance matrix # The module numexpr is used for doing quickly the long multiplication # of arrays (factor of 3 improvements over numpy). It is used as a # replacement of blas routines cblas_dcopy and cblas_daxpy # For numexpr to work, we need (seems like a bug, but anyway) to create # local variables holding the arrays. This cost no time (it is a simple # pointer assignment) C00 = self.C00 covm = ne.evaluate("C00") sn = self.light_curve_params # Update the diagonal terms of the covariance matrix with the # statistical error covm += np.diag(sn.dmb**2) # Whiten the residuals, in two steps. # Step 1) Compute the Cholesky decomposition of the covariance matrix, in # place. This is a time expensive (0.015 seconds) part, which is why it is # now done in init. Note that this is different to JLA, where it needed to # be done inside the loglkl function. self.cov = la.cholesky(covm, lower=True, overwrite_a=True)
def __init__(self, path, data, command_line): # Unusual construction, since the data files are not distributed # alongside Pantheon (size problems) try: Likelihood_sn.__init__(self, path, data, command_line) except IOError: raise io_mp.LikelihoodError( "The Pantheon data files were not found. Please check if " "the following files are in the data/Pantheon directory: " "\n-> pantheon.dataset" "\n-> lcparam_full_long.txt" "\n-> sys_full_long.dat") # Load matrices from text files, whose names were read in the # configuration file self.C00 = self.read_matrix(self.mag_covmat_file) # Reading light-curve parameters from self.data_file (lcparam_full_long.txt) self.light_curve_params = self.read_light_curve_parameters()
def __init__(self, path, data, command_line): # This reads the configuration file as well try: Likelihood_sn.__init__(self, path, data, command_line) except IOError: raise io_mp.LikelihoodError( "The JLA data files were not found. Please download the " "following link " "http://supernovae.in2p3.fr/sdss_snls_jla/jla_likelihood_v4.tgz" ", extract it, and copy all files present in " "`jla_likelihood_v4/data` to `your_montepython/data/JLA`") # read the only matrix self.C00 = self.read_matrix(self.mu_covmat_file) # Read the simplified light-curve self.data_file self.light_curve_params = self.read_light_curve_parameters() # The covariance matrix can be already inverted, once and for all # (cholesky) self.C00 = la.cholesky(self.C00, lower=True, overwrite_a=True)