Ejemplo n.º 1
0
    def __init__(self,
                 base = 'MySource',
                 configFile = False,
                 curveConfig = {'tstart' : 0,
                                'tstop' : 0,
                                'tstep' : 86400,
                                'tsmin' : 4,
                                'model' : 'my_model.xml'},
                 analysisConfig = {"ra" : 0,
                                   "dec" : 0,
                                   "rad" : 10,
                                   "tmin" : "INDEF",
                                   "tmax" : "INDEF",
                                   "emin" : 100,
                                   "emax" : 300000,
                                   "zmax" : 100,
                                   "binsize" : 0.1,
                                   "convtype" : -1},
                 likelihoodConfig = {"model" : "MySource_model.xml",
                                     "sourcename" : "Source Name",
                                     "drmtol" : 0.1,
                                     "mintol" : 1e-4},
                 commonConfig = {"base" : 'MySource',
                                 "eventclass" : 2,
                                 "binned" : False,
                                 "irfs" : "P7SOURCE_V6",
                                 "verbosity" : 0}):
        
        commonConfig['base'] = base
        
        self.logger = qU.initLogger(base, 'quickCurve')
        
        if(configFile):
            try:
                commonConfigRead,analysisConfigRead,likelihoodConfigRead,plotConfigRead,curveConfigRead = qU.readConfig(self.logger,base)
            except(qU.FileNotFound):
                self.logger.critical("One or more needed files do not exist")
                return
            try:
                commonConfig = qU.checkConfig(self.logger,commonConfig,commonConfigRead)
            except(KeyError):
                return
            try:
                likelihoodConfig = qU.checkConfig(self.logger,likelihoodConfig,likelihoodConfigRead)
            except(KeyError):
                return
            try:
                analysisConfig = qU.checkConfig(self.logger,analysisConfig,analysisConfigRead)
            except(KeyError):
                return
            try:
                curveConfig = qU.checkConfig(self.logger,curveConfig,curveConfigRead)
            except(KeyError):
                return

        self.commonConf = commonConfig
        self.curveConf = curveConfig
        self.likelihoodConf = likelihoodConfig
        self.analysisConf = analysisConfig
Ejemplo n.º 2
0
    def __init__(self,
                 base='MySource',
                 configFile = False,
                 analysisConfig = {"ra" : 0,
                                   "dec" : 0,
                                   "rad" : 10,
                                   "tmin" : "INDEF",
                                   "tmax" : "INDEF",
                                   "emin" : 100,
                                   "emax" : 300000,
                                   "zmax" : 100,
                                   "ltzmax" : 180,
                                   "binsize" : 0.1,
                                   "convtype" : -1,
                                   "nxpix" : -1,
                                   "nypix" : -1,
                                   "filter" : "DATA_QUAL==1 && LAT_CONFIG==1",
                                   "roicut" : "yes"},
                 commonConfig = {"base" : 'MySource',
                                 "binned" : False,
                                 "eventclass" : 2,
                                 "irfs" : "P7REP_SOURCE_V15",
                                 "verbosity" : 0,
                                 "multicore": 0}):

        commonConfig['base'] = base

        self.logger = qU.initLogger(base, 'quickAnalysis')

        if(configFile):
            try:
                commonConfigRead,analysisConfigRead,likelihoodConfigRead,plotConfigRead,curveConfigRead = qU.readConfig(self.logger,base)
            except(qU.FileNotFound):
                self.logger.critical("One or more needed files do not exist.")
                sys.exit()
            try:
                commonConfig = qU.checkConfig(self.logger,commonConfig,commonConfigRead)
            except(KeyError):
                sys.exit()
            try:
                analysisConfig = qU.checkConfig(self.logger,analysisConfig,analysisConfigRead)
            except(KeyError):
                sys.exit()

        self.commonConf = commonConfig
        self.analysisConf = analysisConfig

        logString = "Created quickAnalysis object: "
        for variable, value in commonConfig.iteritems():
            logString += variable+"="+str(value)+","
        for variable, value in analysisConfig.iteritems():
            logString += variable+"="+str(value)+","
        self.logger.info(logString)
Ejemplo n.º 3
0
    def __init__(
        self,
        base='MySource',
        configFile=False,
        likelihoodConfig={
            "model": "MySource_model.xml",
            "sourcename": "Source Name",
            "drmtol": 0.1,
            "mintol": 1e-4
        },
        commonConfig={
            "base": 'MySource',
            "eventclass": 2,
            "binned": False,
            "irfs": "P7SOURCE_V6",
            "verbosity": 0,
            "multicore": 0
        }):

        commonConfig['base'] = base

        self.logger = qU.initLogger(base, 'quickLike')

        if (configFile):
            try:
                commonConfigRead, analysisConfigRead, likelihoodConfigRead, plotConfigRead, curveConfigRead = qU.readConfig(
                    self.logger, base)
            except (qU.FileNotFound):
                self.logger.critical("One or more needed files do not exist")
                return
            try:
                commonConfig = qU.checkConfig(self.logger, commonConfig,
                                              commonConfigRead)
            except (KeyError):
                return
            try:
                likelihoodConfig = qU.checkConfig(self.logger,
                                                  likelihoodConfig,
                                                  likelihoodConfigRead)
            except (KeyError):
                return

        self.commonConf = commonConfig
        self.likelihoodConf = likelihoodConfig

        self.ret = re.compile('\n')
        self.fitbit = False
        self.Print()
Ejemplo n.º 4
0
    def __init__(
        self,
        base="MySource",
        configFile=False,
        likelihoodConfig={"model": "MySource_model.xml", "sourcename": "Source Name", "drmtol": 0.1, "mintol": 1e-4},
        commonConfig={
            "base": "MySource",
            "eventclass": 2,
            "binned": False,
            "irfs": "P7SOURCE_V6",
            "verbosity": 0,
            "multicore": 0,
        },
    ):

        commonConfig["base"] = base

        self.logger = qU.initLogger(base, "quickLike")

        if configFile:
            try:
                commonConfigRead, analysisConfigRead, likelihoodConfigRead, plotConfigRead, curveConfigRead = qU.readConfig(
                    self.logger, base
                )
            except (qU.FileNotFound):
                self.logger.critical("One or more needed files do not exist")
                return
            try:
                commonConfig = qU.checkConfig(self.logger, commonConfig, commonConfigRead)
            except (KeyError):
                return
            try:
                likelihoodConfig = qU.checkConfig(self.logger, likelihoodConfig, likelihoodConfigRead)
            except (KeyError):
                return

        self.commonConf = commonConfig
        self.likelihoodConf = likelihoodConfig

        self.ret = re.compile("\n")
        self.fitbit = False
        self.Print()
Ejemplo n.º 5
0
    def __init__(self,
                 base = 'MySource',
                 configFile = False,
                 curveConfig = {'tstart'  : 0,
                                'tstop'   : 0,
                                'tstep'   : 86400,
                                'tsmin'   : 1,
                                'model'   : 'my_model.xml',
                                'summary' : 'lc_summary.dat',
                                'output'  : 'lc.pickle',
                                'ulfluxdf' : 2.0,
                                'ulbayes'  : 4.0,
                                'ulchi2'  : 4,
                                'ulcl'    : 0.95,
                                'opt'     : 'MINUIT',
                                'sliding' : False,
                                'rebin'   : 1},
                 analysisConfig = {"ra" : 0,
                                   "dec" : 0,
                                   "rad" : 10,
                                   "tmin" : "INDEF",
                                   "tmax" : "INDEF",
                                   "emin" : 100,
                                   "emax" : 300000,
                                   "zmax" : 100,
                                   "ltzmax" : 180,
                                   "binsize" : 0.1,
                                   "convtype" : -1,
                                   "filter" : "DATA_QUAL==1 && LAT_CONFIG==1",
                                   "roicut" : "yes"},
                 likelihoodConfig = {"model" : "MySource_model.xml",
                                     "sourcename" : "Source Name",
                                     "drmtol" : 0.1,
                                     "mintol" : 1e-4},
                 commonConfig = {"base" : 'MySource',
                                 "eventclass" : 2,
                                 "binned" : False,
                                 "irfs" : "P7REP_SOURCE_V15",
                                 "verbosity" : 0}):
        
        commonConfig['base'] = base
        
        self.logger = qU.initLogger(base, 'quickCurve')
        
        if(configFile):
            try:
                commonConfigRead,analysisConfigRead,\
                    likelihoodConfigRead,plotConfigRead,curveConfigRead = qU.readConfig(self.logger,base)
            except(qU.FileNotFound):
                self.logger.critical("One or more needed files do not exist")
                return
            try:
                commonConfig = qU.checkConfig(self.logger,commonConfig,commonConfigRead)
            except(KeyError):
                return
            try:
                likelihoodConfig = qU.checkConfig(self.logger,likelihoodConfig,likelihoodConfigRead)
            except(KeyError):
                return
            try:
                analysisConfig = qU.checkConfig(self.logger,analysisConfig,analysisConfigRead)
            except(KeyError):
                return
            try:
                curveConfig = qU.checkConfig(self.logger,curveConfig,curveConfigRead)
            except(KeyError):
                return

        self.commonConf = commonConfig
        self.curveConf = curveConfig
        self.likelihoodConf = likelihoodConfig
        self.analysisConf = analysisConfig

        self.model = self.curveConf['model']
        self.ft2 = self.commonConf['base']+"_SC.fits"
        self.irfs = self.commonConf['irfs']
        self.optimizer = self.curveConf['opt']

        self.lc = []
        self.obsfiles=[]