Beispiel #1
0
 def __init__(
     self,
     A_pol             = 1,
     calib_100P        = 1,
     calib_143P        = 1,
     calib_217P        = 1,
     galf_EE_A_100     = param(0.060, 0.012, range=(0,10), gaussian_prior=(0.060, 0.012)),
     galf_EE_A_100_143 = param(0.050, 0.015, range=(0,10), gaussian_prior=(0.050, 0.015)),
     galf_EE_A_100_217 = param(0.110, 0.033, range=(0,10), gaussian_prior=(0.110, 0.033)),
     galf_EE_A_143     = param(0.10,  0.02,  range=(0,10), gaussian_prior=(0.10,  0.02)),
     galf_EE_A_143_217 = param(0.240, 0.048, range=(0,10), gaussian_prior=(0.240, 0.048)),
     galf_EE_A_217     = param(0.72,  0.14,  range=(0,10), gaussian_prior=(0.72,  0.14)),
     galf_EE_index     = -2.4,
     galf_TE_A_100     = param(0.140, 0.042, range=(0,10), gaussian_prior=(0.140, 0.042)),
     galf_TE_A_100_143 = param(0.120, 0.036, range=(0,10), gaussian_prior=(0.120, 0.036)),
     galf_TE_A_100_217 = param(0.30,  0.09,  range=(0,10), gaussian_prior=(0.30,  0.09)),
     galf_TE_A_143     = param(0.240, 0.072, range=(0,10), gaussian_prior=(0.240, 0.072)),
     galf_TE_A_143_217 = param(0.60,  0.018, range=(0,10), gaussian_prior=(0.60,  0.018)),
     galf_TE_A_217     = param(1.80,  0.54,  range=(0,10), gaussian_prior=(1.80,  0.54)),
     galf_TE_index     = -2.4,
     **kwargs
 ):
     super().__init__(**arguments())
     
     # set beam leakages to zero (if the user didn't pass them in)
     for m in range(5):
         for i,j in ['00','01','02','11','12','22']:
             for xi,xj in ['TE','EE']:
                 k = "bleak_epsilon_{m}_{i}{xi}_{j}{xj}".format(m=m,i=i,j=j,xi=xi,xj=xj)
                 if k not in self: self[k] = 0
Beispiel #2
0
 def __init__(
     self,
     clik_file,
     A_planck=param(1, 0.0025, range=(0.9, 1.1),
                    gaussian_prior=(1, 0.0025)),
 ):
     super().__init__(**arguments())
Beispiel #3
0
    def __call__(self,
                 As=None,
                 DoLensing=True,
                 H0=None,
                 lmax=None,
                 mnu=None,
                 Neff=None,
                 nrun=None,
                 ns=None,
                 ombh2=None,
                 omch2=None,
                 omk=None,
                 output='tCl, lCl, pCl',
                 pivot_scalar=None,
                 r=None,
                 tau=None,
                 Tcmb=2.7255,
                 theta=None,
                 w=None,
                 Yp=None,
                 nowarn=False,
                 **kwargs):

        if not nowarn and kwargs:
            print('Warning: passing unknown parameters to CLASS: ' +
                  str(kwargs) + ' (set nowarn=True to turn off this message.)')

        params = dict(
            self.defaults, **{
                k: v
                for k, v in arguments(include_kwargs=False,
                                      exclude=["nowarn"]).items()
                if v is not None
            })
        self.model.set(self.convert_params(**params))
        self.model.compute()

        lmax = params['lmax']
        ell = arange(lmax + 1)
        if params['DoLensing'] == True:
            self.cmb_result = {
                x: (self.model.lensed_cl(lmax)[x.lower()]) * Tcmb**2 * 1e12 *
                ell * (ell + 1) / 2 / pi
                for x in ['TT', 'TE', 'EE', 'BB', 'PP', 'TP']
            }
        else:
            self.cmb_result = {
                x: (self.model.raw_cl(lmax)[x.lower()]) * Tcmb**2 * 1e12 *
                ell * (ell + 1) / 2 / pi
                for x in ['TT']
            }

        self.model.struct_cleanup()
        self.model.empty()

        return self.cmb_result
Beispiel #4
0
 def __init__(self,
              Asz = param(start=5,  scale=3, min=0, gaussian_prior=(5.5,  3.0)),
              Acl = param(start=20, scale=3, min=0, gaussian_prior=(19.3, 3.5)),
              Aps = param(start=5,  scale=3, min=0, gaussian_prior=(5,    2.5)),
              **kwargs):
     super().__init__(**arguments())
     
     rootdir = osp.join(osp.dirname(__file__),"data")
     self.template_sz = loadtxt(osp.join(rootdir,"dl_sz.txt"))[:,1]
     self.template_cl = loadtxt(osp.join(rootdir,"dl_clustered_point_source.txt"))[:,1]
     self.template_ps = loadtxt(osp.join(rootdir,"dl_poisson_point_source.txt"))[:,1]
Beispiel #5
0
 def __init__(self,
              Asz = param(start=5,  scale=3, min=0, gaussian_prior=(5.5,  3.0)),
              Acl = param(start=20, scale=3, min=0, gaussian_prior=(19.3, 3.5)),
              Aps = param(start=5,  scale=3, min=0, gaussian_prior=(5,    2.5)),
              **kwargs):
     super().__init__(**arguments())
     
     rootdir = osp.join(osp.dirname(__file__),"data")
     self.template_sz = loadtxt(osp.join(rootdir,"SPTSZ_lowl_foreground_templates/SZ_template.txt"))[:,1]
     self.template_cl = loadtxt(osp.join(rootdir,"SPTSZ_lowl_foreground_templates/cluster_template.txt"))[:,1]
     self.template_ps = loadtxt(osp.join(rootdir,"SPTSZ_lowl_foreground_templates/poisson_template.txt"))[:,1]
Beispiel #6
0
 def __call__(self,
              ALens=None,
              As=None,
              DoLensing=None,
              H0=None,
              k_eta_max_scalar=None,
              lmax=None,
              massive_neutrinos=None,
              massless_neutrinos=None,
              mnu=None,
              Neff=None,
              NonLinear=None,
              ns=None,
              ombh2=None,
              omch2=None,
              omk=None,
              pivot_scalar=None,
              tau=None,
              theta=None,
              Yp=None,
              nowarn=False,
              **kwargs):
     """
     
     Args
     ----
     nowarn : bool
         don't warn about unrecognized parameters which were passed in
     
     Returns : dict
         dictionary of {'TT':array(), 'TE':array(), ...} giving the CMB Dl's in muK^2
         
     """
     
     if not nowarn and kwargs:
         print('Warning: passing unknown parameters to CAMB: '+str(kwargs)+' (set nowarn=True to turn off this message.)')
     
     
     params = dict(self.defaults, 
                   **{k:v for k,v in arguments(include_kwargs=False, exclude=["nowarn"]).items() 
                      if v is not None})
         
     cp = self._camb.set_params(**self.convert_params(**params))
     self.result = self._camb.get_results(cp)
     cl = dict(list(zip(['TT','EE','BB','TE'],(cp.TCMB*1e6)**2*self.result.get_cmb_power_spectra(spectra=['total'])['total'].T)))
     cl.update(dict(list(zip(['pp','pT','pE'],self.results.get_lens_potential_cls()))))
     return cl
Beispiel #7
0
    def __init__(self,
                 clik_file,
                 auto_reject_errors=False,
                 lensing=None,
                 **nuisance):

        super().__init__(**arguments())

        from clik import clik, clik_lensing
        
        if lensing or "lensing" in clik_file:
            loaded_cliks[clik_file] = self.clik = loaded_cliks[clik_file] if clik_file in loaded_cliks else clik_lensing(clik_file)
            self.lensing = True
            self.clik_specs = ['pp'] + clik_specs
            
        else:
            loaded_cliks[clik_file] = self.clik = loaded_cliks[clik_file] if clik_file in loaded_cliks else clik(clik_file)
            self.lensing = False
            self.clik_specs = clik_specs
Beispiel #8
0
    def __init__(self,
                 clik_file,
                 auto_reject_errors=False,
                 lensing=None,
                 **nuisance):

        super().__init__(**arguments())

        from clik import clik, clik_lensing

        if lensing or "lensing" in clik_file:
            loaded_cliks[clik_file] = self.clik = loaded_cliks[
                clik_file] if clik_file in loaded_cliks else clik_lensing(
                    clik_file)
            self.lensing = True
            self.clik_specs = ['pp'] + clik_specs

        else:
            loaded_cliks[clik_file] = self.clik = loaded_cliks[
                clik_file] if clik_file in loaded_cliks else clik(clik_file)
            self.lensing = False
            self.clik_specs = clik_specs
Beispiel #9
0
 def __init__(
     self,
     clik_file,
     A_cib_217        = param(60,  10,     range=(0,200)),
     A_planck         = param(1,   0.0025, range=(0.9,1.1), gaussian_prior=(1,0.0025)),
     A_sz             = param(5,   3,      range=(0,10)),
     calib_100T       = param(1,   0.001,  range=(0,3),     gaussian_prior=(0.999,0.001)),
     calib_217T       = param(1,   0.002,  range=(0,3),     gaussian_prior=(0.995,0.002)),
     cib_index        = -1.3,   
     gal545_A_100     = param(7,   2,      range=(0,50),    gaussian_prior=(7,2)),
     gal545_A_143     = param(9,   2,      range=(0,50),    gaussian_prior=(9,2)),
     gal545_A_143_217 = param(21,  8.5,    range=(0,100),   gaussian_prior=(21,8.5)),
     gal545_A_217     = param(80,  20,     range=(0,400),   gaussian_prior=(80,20)),
     ksz_norm         = param(2,   3,      range=(0,10)),
     ps_A_100_100     = param(250, 30,     range=(0,4000)),
     ps_A_143_143     = param(45,  10,     range=(0,4000)),
     ps_A_143_217     = param(40,  10,     range=(0,4000)),
     ps_A_217_217     = param(90,  15,     range=(0,4000)),
     xi_sz_cib        = param(0.5, 0.3,    range=(0,1)),
     **kwargs
 ):
     super().__init__(**arguments())
Beispiel #10
0
 def __call__(self, 
              cmb, 
              egfs=None,
              cal=None):
     """
     
     Compute the likelihood. 
     
     Args:
         cmb (dict): A dict which has a key "TT" which holds
             the CMB Dl's in muK^2 
         egfs/cal: Override whatever (if anything) was set in :func:`__init__`.  See
             :func:`__init__` for documentation on these arguments. 
     """
     
     self.update(**{k:v for k,v in arguments().items() if v is not None})
     
     cl = self.get_cl_model(cmb,self.egfs)
         
     #Apply windows and calculate likelihood
     dcl = self.cal*self.spec-cl
     return dot(dcl,cho_solve(self.cho_sigma, dcl))/2
Beispiel #11
0
    def __init__(self,
                 Asz=param(start=5, scale=3, min=0, gaussian_prior=(5.5, 3.0)),
                 Acl=param(start=20,
                           scale=3,
                           min=0,
                           gaussian_prior=(19.3, 3.5)),
                 Aps=param(start=5, scale=3, min=0, gaussian_prior=(5, 2.5)),
                 **kwargs):
        super().__init__(**arguments())

        rootdir = osp.join(osp.dirname(__file__), "data")
        self.template_sz = loadtxt(
            osp.join(rootdir,
                     "SPTSZ_lowl_foreground_templates/SZ_template.txt"))[:, 1]
        self.template_cl = loadtxt(
            osp.join(
                rootdir,
                "SPTSZ_lowl_foreground_templates/cluster_template.txt"))[:, 1]
        self.template_ps = loadtxt(
            osp.join(
                rootdir,
                "SPTSZ_lowl_foreground_templates/poisson_template.txt"))[:, 1]
Beispiel #12
0
    def __init__(self,
                 model = '',
                #  As = 2.4e-9,
                #  ns = 0.96,
                #  ombh2 = 0.0225,
                #  omch2 = 0.12,
                #  tau = 0.09,
                #  H0 = None,
                #  massive_neutrinos = 1,
                #  massless_neutrinos = 2.046,
                #  omk = 0,
                #  omnuh2 = 0.00064,
                #  nrun = 0,
                #  w = -1,
                 **kwargs):

        super().__init__(**arguments(exclude=["model"]))
        model = model.lower()

        if 'lcdm' in model:
            self.As     = param(2.1e-9,  0.03e-9)
            self.ns     = param(0.96,    0.006)
            self.ombh2  = param(0.0221,  0.0002)
            self.omch2  = param(0.12,    0.002)
            self.tau    = param(0.09,    0.01,  min=0)
            self.theta  = param(0.01041, 5e-6)
            self.H0     = None
        if 'alens' in model:
            self.Alens  = param(1,       0.1)
        if 'neff' in model:
            self.Neff   = param(3,       0.2)
        if 'yp' in model:
            self.Yp     = param(0.24,    0.1)
        if 'mnu' in model:
            self.mnu    = param(0,       0.001, range=(0,1))
        if 'nrun' in model:
            self.nrun   = param(0,       0.01)
Beispiel #13
0
 def __init__(self,
              clik_file,
              A_cib_217=param(60, 10, range=(0, 200)),
              A_planck=param(1,
                             0.0025,
                             range=(0.9, 1.1),
                             gaussian_prior=(1, 0.0025)),
              A_sz=param(5, 3, range=(0, 10)),
              calib_100T=param(1,
                               0.001,
                               range=(0, 3),
                               gaussian_prior=(0.999, 0.001)),
              calib_217T=param(1,
                               0.002,
                               range=(0, 3),
                               gaussian_prior=(0.995, 0.002)),
              cib_index=-1.3,
              gal545_A_100=param(7, 2, range=(0, 50),
                                 gaussian_prior=(7, 2)),
              gal545_A_143=param(9, 2, range=(0, 50),
                                 gaussian_prior=(9, 2)),
              gal545_A_143_217=param(21,
                                     8.5,
                                     range=(0, 100),
                                     gaussian_prior=(21, 8.5)),
              gal545_A_217=param(80,
                                 20,
                                 range=(0, 400),
                                 gaussian_prior=(80, 20)),
              ksz_norm=param(2, 3, range=(0, 10)),
              ps_A_100_100=param(250, 30, range=(0, 4000)),
              ps_A_143_143=param(45, 10, range=(0, 4000)),
              ps_A_143_217=param(40, 10, range=(0, 4000)),
              ps_A_217_217=param(90, 15, range=(0, 4000)),
              xi_sz_cib=param(0.5, 0.3, range=(0, 1)),
              **kwargs):
     super().__init__(**arguments())
Beispiel #14
0
    def __init__(self,
                 model = '',
                #  As = 2.4e-9,
                #  ns = 0.96,
                #  ombh2 = 0.0225,
                #  omch2 = 0.12,
                #  tau = 0.09,
                #  H0 = None,
                #  massive_neutrinos = 1,
                #  massless_neutrinos = 2.046,
                #  omk = 0,
                #  omnuh2 = 0.00064,
                #  nrun = 0,
                #  w = -1,
                 **kwargs):
        
        super().__init__(**arguments(exclude=["model"]))
        model = model.lower()

        if 'lcdm' in model:
            self.As     = param(2.1e-9,  0.03e-9)
            self.ns     = param(0.96,    0.006)
            self.ombh2  = param(0.0221,  0.0002)
            self.omch2  = param(0.12,    0.002)
            self.tau    = param(0.09,    0.01,  min=0)
            self.theta  = param(0.01041, 5e-6)
            self.H0     = None
        if 'alens' in model: 
            self.Alens  = param(1,       0.1)
        if 'neff' in model: 
            self.Neff   = param(3,       0.2)
        if 'yp' in model: 
            self.Yp     = param(0.24,    0.1)
        if 'mnu' in model: 
            self.mnu    = param(0,       0.001, range=(0,1))
        if 'nrun' in model: 
            self.nrun   = param(0,       0.01)
Beispiel #15
0
 def __init__(
     self,
     clik_file,
     A_planck = param(1, 0.0025, range=(0.9,1.1), gaussian_prior=(1,0.0025)),
 ):
     super().__init__(**arguments())
Beispiel #16
0
    def __init__(self,
                 which='s12',
                 lmin=None,
                 lmax=None,
                 drop=None,
                 egfs='default',
                 cal=None,
                 **kwargs):
        """
        Args:
            which: 'k11' or 's12'
            lmin/lmax (int): restrict the data to this :math:`\ell`-range
            drop (slice, int, or array of ints): remove the bins at these indices
            cal (float): calibration parameter, defined to multiply the data
                power spectrum. (only available if which='s12')
            egfs (callable, None, or 'default'): A callable object which will be
                called to compute the extra-galactic foreground model. It should
                accept keyword arguments `lmax` which specifies the length of
                the array to reuturn, and `egfs_specs` which contains information
                like frequency and fluxcut needed for more sophisticated
                foreground models.  If `egfs` is None, its assumed it will be
                set later (you must do so before computing the likelihood). If
                'default' is specified, the default foreground model will be
                used (see :class:`spt_lowl_egfs`)
        """
        
        super().__init__(**arguments())
        
        if self.egfs == 'default':
            self.egfs = spt_lowl_egfs()
        
        if which=='s12':
            tar_filename = "spt_lps12_20120828.tar.gz"
            if cal is None:
                self.cal = param(start=1, scale=0.026, gaussian_prior=(1,0.026))
        elif which=='k11':
            tar_filename = "bandpowers_spt20082009.tar.gz"
            if not ((cal is None) or cal!=1.):
                raise ValueError(dedent("""
                Can't use a calibration parameter with the 'k11' likelihood, it
                already has the calibration marginalized into the covariance.
                """))
            else:
                self.cal = 1
        else:
            raise ValueError("spt_lowl: 'which' must be one of ['s12','k11']")


        with tarfile.open(osp.join(osp.dirname(__file__),"data",tar_filename)) as tf:
            
            newdat_file = next(f for f in tf.getnames() if "newdat" in f)
            
            #Load spectrum and covariance
            with tf.extractfile(newdat_file) as f:
                while 'TT' not in str(f.readline()): pass
                self.spec=array([fromstring(f.readline(),sep=' ')[1] for _ in range(47)])
                self.sigma=array([fromstring(f.readline(),sep=' ') for _ in range(94)])[47:]
            
            #Load windows
            def load_window(i):
                return loadtxt(tf.extractfile(next(f for f in tf.getnames() if f.endswith("window_%i"%i))))
            self.windows = [load_window(i)[:,1] for i in range(1,48)]
            self.windowrange = (lambda x: slice(int(min(x)),int(max(x)+1)))(load_window(1)[:,0])
        
        if lmin is not None:
            bmin = sum(1 for _ in takewhile(lambda x: x<lmin, (sum(1 for _ in takewhile(lambda x: abs(x)<.001,w) ) for w in self.windows)))
        else: bmin = 0

        if lmax is not None:
            bmax = sum(1 for _ in takewhile(lambda x: x<lmax, [3251 - sum(1 for _ in takewhile(lambda x: abs(x)<.001,reversed(w)) ) for w in self.windows]))
        else: bmax = 48

        self.spec = self.spec[bmin:bmax]
        self.sigma = self.sigma[bmin:bmax,bmin:bmax]
        self.windows = self.windows[bmin:bmax]
        
        if drop is not None:
        	self.spec = delete(self.spec,drop)
        	self.sigma = delete(delete(self.sigma,drop,0),drop,1)
        	self.windows = delete(self.windows,drop,0)
        
        self.cho_sigma = cho_factor(self.sigma)
        
        
        self.lmax = self.windowrange.stop
        self.ells = array([dot(arange(10000)[self.windowrange],w) for w in self.windows])

        self.egfs_specs = egfs_specs(
            kind = 'TT',
            freqs = ({'dust':154, 'radio': 151, 'tsz':153},)*2,
            fluxcut = 50
        )
    def __init__(self,
                 params,
                 output_file=None,
                 output_extra_params=None,
                 num_samples=100,
                 print_level=0,
                 cov_est=None,
                 proposal_scale=2.4,
                 proposal_update=True,
                 proposal_update_start=1000,
                 mpi_comm_freq=100,
                 max_weight=10,
                 debug_output=False,
                 temp=1,
                 reseed=True,
                 yield_rejected=False):
        """
        Args:
            params:
                The script to which this sampler is attached
            output_file:
                File where to save the chain (if running with MPI, everything
                still gets dumped into one file). By default only sampled
                parameters get saved.  Use `cosmoslik.utils.load_chain` to load
                chains.
            output_extra_params:
                Extra parameters besides the sampled ones which to save to file.
                Arbitrary objects can be outputted, in which case entires should
                be tuples of (<name>,'object'), or for more efficient and faster
                file write/reads (<name>,<dtype>) where <dtype> is a valid numpy
                dtype (e.g. '(10,10)d' for a 10x10 array of doubles, etc...)
            num_samples:
                The number of total desired samples (including rejected ones)
            print_level:
                0/1/2 to print little/medium/alot
            cov_est:
                One or a list of covariances which will be combined with
                K.chains.combine_cov (see documentation there for understood
                formats) to produce the full proposal covariance.  Covariance
                for any sampled parameter not provided here will be taken  from
                the `scale` attribute of that parameters. This should be a best
                estimate of the posterior covariance. The actual proposal
                covariance is  multiplied by `proposal_scale**2 / N` where `N`
                is the number of parameters. (default: diagonal covariance taken
                from the `scale` of each parameter)
            proposal_scale:
                Scale the proposal matrix. (default: 2.4)
            proposal_update:
                Whether to update the proposal matrix. Ignored if not running
                with MPI. The proposal is updated by taking the sample
                covariance of the last half of each chain. (default: True)
            proposal_update_start:
                If `proposal_update` is True, how many total samples (including
                rejected) per chain to wait before starting to do updates
                (default: 1000).
            mpi_comm_freq:
                Number of accepted samples to wait inbetween the chains
                communicating with the master process and having their progress
                written to file (default: 50)
            max_weight:
                If a the chain stays in the same location more than this number of samples,
                it is broken up as distinct steps
            reseed:
                Draw a random seed based on system time and process number
                before starting. (default: True)
            yield_rejected:
                Yield samples with 0 weight (default: False)
            debug_output:
                Print (code) debugging messages.
        """

        if output_extra_params is None: output_extra_params = []
        super().__init__(**arguments(exclude=['params']))

        self.output_extra_params = OrderedDict([k if isinstance(k,tuple) else (k,dtype('float').name) for k in output_extra_params])
        self.sampled = params.find_sampled()
        self.x0 = [params[k].start for k in self.sampled]
        self.cov_est = initialize_covariance(self.sampled,self.cov_est)
Beispiel #18
0
    def __init__(self,
                 A_pol=1,
                 calib_100P=1,
                 calib_143P=1,
                 calib_217P=1,
                 galf_EE_A_100=param(0.060,
                                     0.012,
                                     range=(0, 10),
                                     gaussian_prior=(0.060, 0.012)),
                 galf_EE_A_100_143=param(0.050,
                                         0.015,
                                         range=(0, 10),
                                         gaussian_prior=(0.050, 0.015)),
                 galf_EE_A_100_217=param(0.110,
                                         0.033,
                                         range=(0, 10),
                                         gaussian_prior=(0.110, 0.033)),
                 galf_EE_A_143=param(0.10,
                                     0.02,
                                     range=(0, 10),
                                     gaussian_prior=(0.10, 0.02)),
                 galf_EE_A_143_217=param(0.240,
                                         0.048,
                                         range=(0, 10),
                                         gaussian_prior=(0.240, 0.048)),
                 galf_EE_A_217=param(0.72,
                                     0.14,
                                     range=(0, 10),
                                     gaussian_prior=(0.72, 0.14)),
                 galf_EE_index=-2.4,
                 galf_TE_A_100=param(0.140,
                                     0.042,
                                     range=(0, 10),
                                     gaussian_prior=(0.140, 0.042)),
                 galf_TE_A_100_143=param(0.120,
                                         0.036,
                                         range=(0, 10),
                                         gaussian_prior=(0.120, 0.036)),
                 galf_TE_A_100_217=param(0.30,
                                         0.09,
                                         range=(0, 10),
                                         gaussian_prior=(0.30, 0.09)),
                 galf_TE_A_143=param(0.240,
                                     0.072,
                                     range=(0, 10),
                                     gaussian_prior=(0.240, 0.072)),
                 galf_TE_A_143_217=param(0.60,
                                         0.018,
                                         range=(0, 10),
                                         gaussian_prior=(0.60, 0.018)),
                 galf_TE_A_217=param(1.80,
                                     0.54,
                                     range=(0, 10),
                                     gaussian_prior=(1.80, 0.54)),
                 galf_TE_index=-2.4,
                 **kwargs):
        super().__init__(**arguments())

        # set beam leakages to zero (if the user didn't pass them in)
        for m in range(5):
            for i, j in ['00', '01', '02', '11', '12', '22']:
                for xi, xj in ['TE', 'EE']:
                    k = "bleak_epsilon_{m}_{i}{xi}_{j}{xj}".format(m=m,
                                                                   i=i,
                                                                   j=j,
                                                                   xi=xi,
                                                                   xj=xj)
                    if k not in self: self[k] = 0