Ejemplo n.º 1
0
def Analysis(folder,
             config,
             configgeneric=None,
             tag="",
             convtyp='-1',
             verbose=1):
    import os
    from enrico import utils
    from enrico.gtfunction import Observation
    from enrico.fitmaker import FitMaker
    import Loggin

    mes = Loggin.Message()
    """ run an analysis"""
    Obs = Observation(folder, config, tag=tag)
    if verbose:
        utils._log('SUMMARY: ' + tag)
        Obs.printSum()

    FitRunner = FitMaker(Obs, config)  ##Class
    if config['Spectrum']['FitsGeneration'] == 'yes':
        FitRunner.FirstSelection(
            configgeneric)  #Generates fits files for the coarse selection
        FitRunner.GenerateFits(
        )  #Generates fits files for the rest of the products
    return FitRunner
Ejemplo n.º 2
0
def Analysis(folder, config, tag="", convtyp='-1', verbose=1):
    """ run an analysis"""
    Obs = Observation(folder, config, convtyp, tag=tag)
    if verbose:
        utils._log('SUMMARY: ' + tag)
        Obs.printSum()
    FitRunner = FitMaker(Obs, config)  ##Class
    if config['Spectrum']['FitsGeneration'] == 'yes':
        FitRunner.GenerateFits()  #Generates fits files
    return FitRunner
Ejemplo n.º 3
0
def Analysis(folder, config, configgeneric=None, tag="", convtyp='-1', verbose = 1):

    mes = Loggin.Message()
    """ run an analysis"""
    # If there are no xml files, create it and print a warning <--- This should be here?
    #if len(glob.glob(config['file']['xml'].replace('.xml','*.xml')))==0:
    if len(glob.glob(config['file']['xml']))==0: #.replace('.xml','*.xml')))==0:
        mes.warning("Xml not found, creating one for the given config %s" %config['file']['xml'])
        XmlMaker(config)
    
    Obs = Observation(folder, config, tag=tag)
    if verbose:
        utils._log('SUMMARY: ' + tag)
        Obs.printSum()

    FitRunner = FitMaker(Obs, config)##Class
    if config['Spectrum']['FitsGeneration'] == 'yes':
        FitRunner.FirstSelection(configgeneric) #Generates fits files for the coarse selection
        FitRunner.GenerateFits() #Generates fits files for the rest of the products
    return FitRunner
Ejemplo n.º 4
0
def FindSrc(infile):
    config = get_config(infile)
    folder = config['out']

    Obs = Observation(folder, config)
    utils._log('SUMMARY: ')
    Obs.printSum()

    FitRunner = FitMaker(Obs, config)

    if config["findsrc"]["FitsGeneration"]== "yes":
        config['analysis']['likelihood'] = 'unbinned'
        FitRunner.GenerateFits()

    FitRunner._log('gtfindsrc', 'Optimize source position')
    os.system("rm "+utils._dump_findsrcout(config))
    Obs.FindSource()
    try:
      update_reg(config)
    except:
      pass