Beispiel #1
0
    def get_template(self,params,return_stages=False):
        '''
        Runs entire template-making chain, using parameters found in
        'params' dict. If 'return_stages' is set to True, returns
        output from each stage as a simple tuple.
        '''

        flux_maps = get_flux_maps(self.flux_service,self.ebins,self.czbins)

        logging.info("Getting osc prob maps...")
        osc_flux_maps = get_osc_flux(flux_maps,self.osc_service,
            oversample_e=self.oversample_e,oversample_cz=self.oversample_cz,**params)

        logging.info("Getting event rate true maps...")
        event_rate_maps = get_event_rates(osc_flux_maps,self.aeff_service, **params)

        logging.info("Getting event rate reco maps...")
        event_rate_reco_maps = get_reco_maps(event_rate_maps,self.reco_service,
                                             **params)

        logging.info("Getting pid maps...")
        final_event_rate = get_pid_maps(event_rate_reco_maps,self.pid_service)

        if not return_stages:
            return final_event_rate

        # Otherwise, return all stages as a simple tuple
        return (flux_maps, osc_flux_maps, event_rate_maps, event_rate_reco_maps,
                final_event_rate)
Beispiel #2
0
    def get_template(self, params, return_stages=False):
        '''
        Runs entire template-making chain, using parameters found in
        'params' dict. If 'return_stages' is set to True, returns
        output from each stage as a simple tuple.
        '''

        logging.info("STAGE 1: Getting Atm Flux maps...")
        with Timer() as t:
            flux_maps = get_flux_maps(self.flux_service, self.ebins,
                                      self.czbins, **params)
        tprofile.debug("==> elapsed time for flux stage: %s sec" % t.secs)

        logging.info("STAGE 2: Getting osc prob maps...")
        with Timer() as t:
            osc_flux_maps = get_osc_flux(flux_maps,
                                         self.osc_service,
                                         oversample_e=self.oversample_e,
                                         oversample_cz=self.oversample_cz,
                                         **params)
        tprofile.debug("==> elapsed time for oscillations stage: %s sec" %
                       t.secs)

        logging.info("STAGE 3: Getting event rate true maps...")
        with Timer() as t:
            event_rate_maps = get_event_rates(osc_flux_maps, self.aeff_service,
                                              **params)
        tprofile.debug("==> elapsed time for aeff stage: %s sec" % t.secs)

        logging.info("STAGE 4: Getting event rate reco maps...")
        with Timer() as t:
            event_rate_reco_maps = get_reco_maps(event_rate_maps,
                                                 self.reco_service, **params)
        tprofile.debug("==> elapsed time for reco stage: %s sec" % t.secs)

        logging.info("STAGE 5: Getting pid maps...")
        with Timer(verbose=False) as t:
            final_event_rate = get_pid_maps(event_rate_reco_maps,
                                            self.pid_service)
        tprofile.debug("==> elapsed time for pid stage: %s sec" % t.secs)

        if not return_stages:
            return final_event_rate

        # Otherwise, return all stages as a simple tuple
        return (flux_maps, osc_flux_maps, event_rate_maps,
                event_rate_reco_maps, final_event_rate)
Beispiel #3
0
    def get_template(self, params, return_stages=False):
        '''
        Runs entire template-making chain, using parameters found in
        'params' dict. If 'return_stages' is set to True, returns
        output from each stage as a simple tuple.
        '''

        logging.info("STAGE 1: Getting Atm Flux maps...")
        with Timer() as t:
            flux_maps = get_flux_maps(self.flux_service, self.ebins,
                                      self.czbins, **params)
        profile.debug("==> elapsed time for flux stage: %s sec"%t.secs)

        logging.info("STAGE 2: Getting osc prob maps...")
        with Timer() as t:
            osc_flux_maps = get_osc_flux(flux_maps, self.osc_service,
                                         oversample_e=self.oversample_e,
                                         oversample_cz=self.oversample_cz,
                                         **params)
        profile.debug("==> elapsed time for oscillations stage: %s sec"%t.secs)

        logging.info("STAGE 3: Getting event rate true maps...")
        with Timer() as t:
            event_rate_maps = get_event_rates(osc_flux_maps,
                                              self.aeff_service, **params)
        profile.debug("==> elapsed time for aeff stage: %s sec"%t.secs)

        logging.info("STAGE 4: Getting event rate reco maps...")
        with Timer() as t:
            event_rate_reco_maps = get_reco_maps(event_rate_maps,
                                                 self.reco_service,
                                                 **params)
        profile.debug("==> elapsed time for reco stage: %s sec"%t.secs)

        logging.info("STAGE 5: Getting pid maps...")
        with Timer(verbose=False) as t:
            final_event_rate = get_pid_maps(event_rate_reco_maps,
                                            self.pid_service)
        profile.debug("==> elapsed time for pid stage: %s sec"%t.secs)

        if not return_stages:
            return final_event_rate

        # Otherwise, return all stages as a simple tuple
        return (flux_maps, osc_flux_maps, event_rate_maps,
                event_rate_reco_maps, final_event_rate)
Beispiel #4
0
    def get_template_no_osc(self, params):
        '''
        Runs template making chain, but without oscillations
        '''

        logging.info("STAGE 1: Getting Atm Flux maps...")
        with Timer() as t:
            flux_maps = get_flux_maps(self.flux_service, self.ebins,
                                      self.czbins, **params)
        tprofile.debug("==> elapsed time for flux stage: %s sec" % t.secs)

        # Skipping oscillation stage...
        logging.info("  >>Skipping Stage 2 in no oscillations case...")
        flavours = ['nutau', 'nutau_bar']
        # Create the empty nutau maps:
        test_map = flux_maps['nue']
        for flav in flavours:
            flux_maps[flav] = {
                'map': np.zeros_like(test_map['map']),
                'ebins': np.zeros_like(test_map['ebins']),
                'czbins': np.zeros_like(test_map['czbins'])
            }

        logging.info("STAGE 3: Getting event rate true maps...")
        with Timer() as t:
            event_rate_maps = get_event_rates(flux_maps, self.aeff_service,
                                              **params)
        tprofile.debug("==> elapsed time for aeff stage: %s sec" % t.secs)

        logging.info("STAGE 4: Getting event rate reco maps...")
        with Timer() as t:
            event_rate_reco_maps = get_reco_maps(event_rate_maps,
                                                 self.reco_service, **params)
        tprofile.debug("==> elapsed time for reco stage: %s sec" % t.secs)

        logging.info("STAGE 5: Getting pid maps...")
        with Timer(verbose=False) as t:
            final_event_rate = get_pid_maps(event_rate_reco_maps,
                                            self.pid_service)
        tprofile.debug("==> elapsed time for pid stage: %s sec" % t.secs)

        return final_event_rate
Beispiel #5
0
    def get_template_no_osc(self, params):
        '''
        Runs template making chain, but without oscillations
        '''

        logging.info("STAGE 1: Getting Atm Flux maps...")
        with Timer() as t:
            flux_maps = get_flux_maps(self.flux_service, self.ebins,
                                      self.czbins, **params)
        profile.debug("==> elapsed time for flux stage: %s sec"%t.secs)

        # Skipping oscillation stage...
        logging.info("  >>Skipping Stage 2 in no oscillations case...")
        flavours = ['nutau', 'nutau_bar']
        # Create the empty nutau maps:
        test_map = flux_maps['nue']
        for flav in flavours:
            flux_maps[flav] = {'map': np.zeros_like(test_map['map']),
                               'ebins': np.zeros_like(test_map['ebins']),
                               'czbins': np.zeros_like(test_map['czbins'])}

        logging.info("STAGE 3: Getting event rate true maps...")
        with Timer() as t:
            event_rate_maps = get_event_rates(flux_maps, self.aeff_service,
                                              **params)
        profile.debug("==> elapsed time for aeff stage: %s sec"%t.secs)

        logging.info("STAGE 4: Getting event rate reco maps...")
        with Timer() as t:
            event_rate_reco_maps = get_reco_maps(event_rate_maps,
                                                 self.reco_service, **params)
        profile.debug("==> elapsed time for reco stage: %s sec"%t.secs)

        logging.info("STAGE 5: Getting pid maps...")
        with Timer(verbose=False) as t:
            final_event_rate = get_pid_maps(event_rate_reco_maps,
                                            self.pid_service)
        profile.debug("==> elapsed time for pid stage: %s sec"%t.secs)

        return final_event_rate