예제 #1
0
    def get_osc_prob_maps(self,deltam21=None,deltam31=None,theta12=None, 
                          theta13=None,theta23=None,deltacp=None,**kwargs):
        """
        Returns an oscillation probability map dictionary calculated 
        at the values of the input parameters:
          deltam21,deltam31,theta12,theta13,theta23,deltacp
        for flavor_from to flavor_to, with the binning of ebins,czbins.
        The dictionary is formatted as:
          'nue_maps': {'nue':map,'numu':map,'nutau':map},
          'numu_maps': {...}
          'nue_bar_maps': {...}
          'numu_bar_maps': {...}
        """
    
        ########################################################################
        ### TRUE ALGORITHM WHEN WE DECIDE ON HOW TO HANDLE OSC PROB DATA     ###
        # step 1: identify where the data is located: on disk or on server?    #
        # step 2: downsample these maps if not already done, for ebins, czbins #
        # step 3: do interpolation in oscillation parameters to arrive at the  #
        #         maps for (deltam21,deltam31,theta12,theta13,theta23,deltacp) #
        # return dictionary of smoothed, interpolated map.                     #
        ########################################################################
        
        ### TEMPORARY SOLUTION:
        # for now, I will grab the data from the local directory:
        #import os
        #maps_dir = os.getenv('PISA')+'/resources/oscProbMaps/ebins500_czbins500/'
        # for now, no interpolation
        if deltam31 > 0.0:
          filename = os.path.join(self.datadir,'oscProbLT_dm31_0.246_th23_38.645.hdf5') 
        else:
          filename = os.path.join(self.datadir+'oscProbLT_dm31_-0.238_th23_38.645.hdf5')
        logging.info("Loading file: %s"%filename)
        osc_probLT_dict = get_osc_probLT_dict_hdf5(filename)
        ebinsLT = osc_probLT_dict['ebins']
        czbinsLT = osc_probLT_dict['czbins']
        
        start_time = datetime.now()
        logging.info("Getting smoothed maps...")

        # do smoothing
        smoothed_maps = {}
        smoothed_maps['ebins'] = self.ebins
        smoothed_maps['czbins'] = self.czbins
        for from_nu in ['nue','numu','nue_bar','numu_bar']:
            path_base = from_nu+'_maps'
            to_maps = {}
            to_nu_list = ['nue_bar','numu_bar','nutau_bar'] if 'bar' in from_nu else ['nue','numu','nutau']
            for to_nu in to_nu_list:
                logging.info("Getting smoothed map %s"%(from_nu+'_maps/'+to_nu))
                to_maps[to_nu]=get_smoothed_map(osc_probLT_dict[from_nu+'_maps'][to_nu],
                                                ebinsLT,czbinsLT,self.ebins,self.czbins)
                
            smoothed_maps[from_nu+'_maps'] = to_maps

        total_time = (datetime.now() - start_time)
        logging.info("Finshed getting smoothed maps. This took: %s"%(datetime.now()-start_time))
        
        return smoothed_maps
예제 #2
0
    def get_osc_prob_maps(self, **kwargs):
        """
        Returns an oscillation probability map dictionary calculated
        at the values of the input parameters:
          deltam21,deltam31,theta12,theta13,theta23,deltacp
        for flavor_from to flavor_to, with the binning of ebins,czbins.
        The dictionary is formatted as:
          'nue_maps': {'nue':map,'numu':map,'nutau':map},
          'numu_maps': {...}
          'nue_bar_maps': {...}
          'numu_bar_maps': {...}
        NOTES:
          * expects all angles in [rad]
          * this method doesn't calculate the oscillation probabilities
            itself, but calls get_osc_probLT_dict internally, to get a
            high resolution map of the oscillation probs,
        """

        #Get the finely binned maps as implemented in the derived class
        logging.info('Retrieving finely binned maps')
        with Timer(verbose=False) as t:
            fine_maps = self.get_osc_probLT_dict(**kwargs)
        print "       ==> elapsed time to get all fine maps: %s sec" % t.secs

        logging.info("Smoothing fine maps...")
        smoothed_maps = {}
        smoothed_maps['ebins'] = self.ebins
        smoothed_maps['czbins'] = self.czbins

        with Timer(verbose=False) as t:
            for from_nu, tomap_dict in fine_maps.items():
                if 'vals' in from_nu: continue
                new_tomaps = {}
                for to_nu, pvals in tomap_dict.items():
                    logging.debug("Getting smoothed map %s/%s" %
                                  (from_nu, to_nu))

                    new_tomaps[to_nu] = get_smoothed_map(
                        pvals, fine_maps['evals'], fine_maps['czvals'],
                        self.ebins, self.czbins)

                smoothed_maps[from_nu] = new_tomaps

        tprofile.debug("       ==> elapsed time to smooth maps: %s sec" %
                       t.secs)

        return smoothed_maps
예제 #3
0
    def get_osc_prob_maps(self, **kwargs):
        """
        Returns an oscillation probability map dictionary calculated
        at the values of the input parameters:
          deltam21,deltam31,theta12,theta13,theta23,deltacp
        for flavor_from to flavor_to, with the binning of ebins,czbins.
        The dictionary is formatted as:
          'nue_maps': {'nue':map,'numu':map,'nutau':map},
          'numu_maps': {...}
          'nue_bar_maps': {...}
          'numu_bar_maps': {...}
        NOTES:
          * expects all angles in [rad]
          * this method doesn't calculate the oscillation probabilities
            itself, but calls get_osc_probLT_dict internally, to get a
            high resolution map of the oscillation probs,
        """

        # Get the finely binned maps as implemented in the derived class
        logging.info("Retrieving finely binned maps")
        with Timer(verbose=False) as t:
            fine_maps = self.get_osc_probLT_dict(**kwargs)
        print "       ==> elapsed time to get all fine maps: %s sec" % t.secs

        logging.info("Smoothing fine maps...")
        smoothed_maps = {}
        smoothed_maps["ebins"] = self.ebins
        smoothed_maps["czbins"] = self.czbins

        with Timer(verbose=False) as t:
            for from_nu, tomap_dict in fine_maps.items():
                if "vals" in from_nu:
                    continue
                new_tomaps = {}
                for to_nu, pvals in tomap_dict.items():
                    logging.debug("Getting smoothed map %s/%s" % (from_nu, to_nu))

                    new_tomaps[to_nu] = get_smoothed_map(
                        pvals, fine_maps["evals"], fine_maps["czvals"], self.ebins, self.czbins
                    )

                smoothed_maps[from_nu] = new_tomaps

        profile.debug("       ==> elapsed time to smooth maps: %s sec" % t.secs)

        return smoothed_maps
예제 #4
0
    def get_osc_prob_maps(self,deltam21=None,deltam31=None,theta12=None, 
                          theta13=None,theta23=None,deltacp=None,**kwargs):
        """
        Returns an oscillation probability map dictionary calculated 
        at the values of the input parameters:
          deltam21,deltam31,theta12,theta13,theta23,deltacp
        for flavor_from to flavor_to, with the binning of ebins,czbins.
        The dictionary is formatted as:
          'nue_maps': {'nue':map,'numu':map,'nutau':map},
          'numu_maps': {...}
          'nue_bar_maps': {...}
          'numu_bar_maps': {...}
        NOTE: expects all angles in [rad]
        """
        
        osc_probLT_dict = self.get_osc_probLT_dict(theta12,theta13,theta23,
                                              deltam21,deltam31,deltacp)
        ebinsLT = osc_probLT_dict['ebins']
        czbinsLT = osc_probLT_dict['czbins']
        
        start_time = datetime.now()
        logging.info("Getting smoothed maps...")

        # do smoothing
        smoothed_maps = {}
        smoothed_maps['ebins'] = self.ebins
        smoothed_maps['czbins'] = self.czbins
        for from_nu in ['nue','numu','nue_bar','numu_bar']:
            path_base = from_nu+'_maps'
            to_maps = {}
            to_nu_list = ['nue_bar','numu_bar','nutau_bar'] if 'bar' in from_nu else ['nue','numu','nutau']
            for to_nu in to_nu_list:
                logging.info("Getting smoothed map %s"%(from_nu+'_maps/'+to_nu))
                to_maps[to_nu]=get_smoothed_map(osc_probLT_dict[from_nu+'_maps'][to_nu],
                                                ebinsLT,czbinsLT,self.ebins,self.czbins)
                
            smoothed_maps[from_nu+'_maps'] = to_maps

            
        logging.info("Finshed getting smoothed maps. This took: %s"%(datetime.now()-start_time))
        
        return smoothed_maps
예제 #5
0
    def get_osc_prob_maps(self, **kwargs):
        """
        Returns an oscillation probability map dictionary calculated
        at the values of the input parameters:
          deltam21,deltam31,theta12,theta13,theta23,deltacp
        for flavor_from to flavor_to, with the binning of ebins,czbins.
        The dictionary is formatted as:
          'nue_maps': {'nue':map,'numu':map,'nutau':map},
          'numu_maps': {...}
          'nue_bar_maps': {...}
          'numu_bar_maps': {...}
        NOTES: * expects all angles in [rad]
               * this method doesn't calculate the oscillation probabi-
                 lities itself, but calls get_osc_probLT_dict internally
        """
        #Get the finely binned maps as implemented in the derived class
        logging.info('Retrieving finely binned maps')
        fine_maps = self.get_osc_probLT_dict(**kwargs)

        logging.info("Smoothing fine maps...")
        profile.info("start smoothing maps")
        smoothed_maps = {}
        smoothed_maps['ebins'] = self.ebins
        smoothed_maps['czbins'] = self.czbins

        for from_nu, tomap_dict in fine_maps.items():
            if 'bins' in from_nu: continue
            new_tomaps = {}
            for to_nu, tomap in tomap_dict.items():
                logging.debug("Getting smoothed map %s/%s"%(from_nu,to_nu))
                new_tomaps[to_nu] = get_smoothed_map(tomap,
                                         fine_maps['ebins'],
                                         fine_maps['czbins'],
                                         self.ebins, self.czbins)
            smoothed_maps[from_nu] = new_tomaps

        profile.info("stop smoothing maps")

        return smoothed_maps