Beispiel #1
0
    def __init__(self, source = "custom", input = "Plain", output = "Plain", 
                 jsonString = '[]', dataOut = False, sparseData = False, **pars):

        '''
        There are several ways to run this code.  You can provide
        execute it by providing it one of the built in sources to see
        what an example output looks like.  Availalble built-ins
        include 'PG1553', 'Crab', 'PKS2233' and '4C5517' (you must
        give those exact strings.  There are many options surrounding
        each of the custom sources (for example, you can pass a
        different redshift or average zenith angle).  You can also
        define a custom source by passing 'custom' to the source
        variable.  You'll then need to define the full spectral shape.
        See '--help custom' for more details.

        '''

        self.logger = initLogger('VOT')

        if (input == "JSON"):
            jsonObject = json.loads(jsonString)
            pars = jsonObject[0]
            source = pars['source']
        
        sources = {"PG1553" : self.calcPG1553,
                   "Crab" : self.calcCrab,
                   "PKS2233" : self.calcPKS2233,
                   "4C5517" : self.calc4C5517,
                   "custom" : self.calculateRateAndTime}
        
        sources[source](**pars)
        self.Print(output, dataOut, sparseData)
    def __init__(self,EBins = [], dNdE = [], Emin=1, Emax=10000, Nbins=100,
                 eblModel="Dominguez",redshift=0.5,spectralModel="PowerLaw", 
                 **spectralPars):


        self.logger = initLogger('VOTSpectrum')

        eblModels = {"Null": self.loadNullTau,
                     "Simple": self.loadSimpleTau,
                     "Dominguez": self.loadDominguezTau,
                     "Finke": self.loadFinkeTau,
                     "Kneiske": self.loadKneiskeTau}

        if(not EBins):
            self.EBins = self.generateEnergyBins(Emin,Emax,Nbins,"GeV")
        else:
            self.EBins = EBins
        if(not dNdE):
            self.dNdE = self.Spectrum(spectralModel,self.EBins,**spectralPars)
        else:
            self.dNdE = dNdE

        try:
            z_array,e_array,t_array = eblModels[eblModel]()
        except KeyError:
            self.logger.critical("Unsupported EBL model.Exiting")
            return

        self.interpolated_taus = self.interpolateTaus(redshift, self.EBins, z_array, e_array, t_array)
        
        self.dNdE_absorbed = self.absorbSpectrum(self.dNdE,self.interpolated_taus[0:,0])
Beispiel #3
0
    def __init__(self,
                 EBins=[],
                 dNdE=[],
                 Emin=1,
                 Emax=10000,
                 Nbins=100,
                 eblModel="Dominguez",
                 redshift=0.5,
                 spectralModel="PowerLaw",
                 **spectralPars):

        self.logger = initLogger('VOTSpectrum')

        eblModels = {
            "Null": self.loadNullTau,
            "Simple": self.loadSimpleTau,
            "Dominguez": self.loadDominguezTau,
            "Finke": self.loadFinkeTau,
            "Kneiske": self.loadKneiskeTau
        }

        if (not EBins):
            self.EBins = self.generateEnergyBins(Emin, Emax, Nbins, "GeV")
        else:
            self.EBins = EBins
        if (not dNdE):
            self.dNdE = self.Spectrum(spectralModel, self.EBins,
                                      **spectralPars)
        else:
            self.dNdE = dNdE

        try:
            z_array, e_array, t_array = eblModels[eblModel]()
        except KeyError:
            self.logger.critical("Unsupported EBL model.Exiting")
            return

        self.interpolated_taus = self.interpolateTaus(redshift, self.EBins,
                                                      z_array, e_array,
                                                      t_array)

        self.dNdE_absorbed = self.absorbSpectrum(self.dNdE,
                                                 self.interpolated_taus[0:, 0])
Beispiel #4
0
    def __init__(self,
                 source="custom",
                 input="Plain",
                 output="Plain",
                 jsonString='[]',
                 dataOut=False,
                 sparseData=False,
                 **pars):
        '''
        There are several ways to run this code.  You can provide
        execute it by providing it one of the built in sources to see
        what an example output looks like.  Availalble built-ins
        include 'PG1553', 'Crab', 'PKS2233' and '4C5517' (you must
        give those exact strings.  There are many options surrounding
        each of the custom sources (for example, you can pass a
        different redshift or average zenith angle).  You can also
        define a custom source by passing 'custom' to the source
        variable.  You'll then need to define the full spectral shape.
        See '--help custom' for more details.

        '''

        self.logger = initLogger('VOT')

        if (input == "JSON"):
            jsonObject = json.loads(jsonString)
            pars = jsonObject[0]
            source = pars['source']

        sources = {
            "PG1553": self.calcPG1553,
            "Crab": self.calcCrab,
            "PKS2233": self.calcPKS2233,
            "4C5517": self.calc4C5517,
            "custom": self.calculateRateAndTime
        }

        sources[source](**pars)
        self.Print(output, dataOut, sparseData)
 def __init__(self,instrument="VERITAS", **pars):
     
     self.logger = initLogger('VOTSpectrum')
     self.loadEA(instrument, **pars)
Beispiel #6
0
    def __init__(self, instrument="VERITAS", **pars):

        self.logger = initLogger('VOTSpectrum')
        self.loadEA(instrument, **pars)