Beispiel #1
0
    def __init__(self, config_dict):

        Logger.__init__(self)
        self.__table = None
        # Check wanted key type
        self.__config_dict = collections.OrderedDict(
            config_dict) if type(config_dict) is dict else config_dict
Beispiel #2
0
  def __init__( self, name, HistogramPath = "Expert", OutputLevel=1):

    Logger.__init__(self)
    self.__recoAlgs = []
    self.__histpath = HistogramPath
    self.__outputLevel = OutputLevel
    self.configure()
Beispiel #3
0
 def __init__(self, email, password, templates):
     Logger.__init__(self)
     self.__myEmail = email
     self.__myPassword = password
     self.__smtpServer = 'smtp.gmail.com'
     self.__smtpPort = 587
     self.__env = Environment(loader=FileSystemLoader(templates))
Beispiel #4
0
    def __init__(self,
                 path,
                 model_idx,
                 str_et_bins=str_etbins_zee,
                 str_eta_bins=str_etabins):
        '''
        This class is a little monitoring tool for saphyra trained models.
        Its use the dumped json history of a trained model. If you don't have this json
        use the dump_all_traiplot_monitoringn_history from base_table in kolmov.

        Arguments:
        - path_to_history: the path to json history files

        Ex.: /my_volume/my_history_files

        - model_idx: the index of model that you want extract the monitoring info.
        - str_et_bins: a list which contains the et boundaries.
        The default values are the zee et binning, other are in constants.
        '''

        Logger.__init__(self)
        self.plot_names = {
            'loss': 'Loss Function Evolution',
            'max_sp_val': r'$SP$ Index Evolution',
            'max_sp_pd_val': r'$P_D$ Evolution',
            'max_sp_fa_val': r'$F_A$ Evolution',
        }

        self.h_dict = self.load(path, model_idx)
        self.sort_name_dict = {idx: 'Fold %i' % (idx + 1) for idx in range(10)}
        self.et_range = str_et_bins
        self.eta_range = str_eta_bins
Beispiel #5
0
    def __init__(self):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzetti')
        from ROOT import CaloPhiRange
        # Create the algorithm
        self.__core = CaloPhiRange()
Beispiel #6
0
  def __init__( self, name, **kw ):

    Logger.__init__(self)
    import ROOT
    ROOT.gSystem.Load('liblorenzetti')
    from ROOT import RunManager, OptimalFilter
    self.__core = OptimalFilter(name)
    for key, value in kw.items():
      self.setProperty( key, value )
Beispiel #7
0
  def __init__( self, name, **kw ):

    Logger.__init__(self)
    import ROOT
    ROOT.gSystem.Load('liblorenzett')
    from ROOT import RunManager, CaloRingerBuilder
    self.__core = CaloRingerBuilder(name)
    for key, value in kw.items():
      self.setProperty( key, value )
Beispiel #8
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzett')
        from ROOT import RunManager, PulseGenerator
        self.__core = PulseGenerator(name)
        for key, value in kw.items():
            self.__core.setProperty(key, value)
Beispiel #9
0
    def __init__(self, url):

        Logger.__init__(self)
        try:
            self.__engine = create_engine(url)
            Session = sessionmaker(bind=self.__engine)
            self.__session = Session()
        except Exception as e:
            MSG_FATAL(self, e)
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzetti')
        from ROOT import RunManager, DetectorATLASConstruction
        self.__core = DetectorATLASConstruction(name)
        for key, value in kw.items():
            self.setProperty(key, value)
Beispiel #11
0
 def __init__( self, name, collectionKey, f, **kw ): 
   Logger.__init__(self)
   self.name = name
   self.CaloCellFile = f
   self.CollectionKey = collectionKey
   for key, value in kw.items():
     if key in self.__allow_keys:
       setattr( self, key , value )
     else:
       MSG_FATAL( self, "Property with name %s is not allow for %s object", key, self.__class__.__name__)
Beispiel #12
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzetti')
        from ROOT import generator
        # Create the algorithm
        self.__core = generator.ParticleGun()
        for key, value in kw.items():
            self.setProperty(key, value)
Beispiel #13
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzetti')
        from ROOT import RawNtupleMaker
        self.__core = RawNtupleMaker(name)

        for key, value in kw.items():
            self.setProperty(key, value)
Beispiel #14
0
 def __init__( self, name, **kw ): 
   
   Logger.__init__(self)
   import ROOT
   ROOT.gSystem.Load('liblorenzett')
   from ROOT import JF17
   # Create the algorithm
   self.__core = JF17()
   for key, value in kw.items():
     self.setProperty( key,value )
Beispiel #15
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzett')
        from ROOT import RunManager, EventGenerator
        # Create the algorithm
        self.__core = EventGenerator()
        for key, value in kw.items():
            self.setProperty(key, value)
Beispiel #16
0
  def __init__( self, name, **kw ): 
    
    Logger.__init__(self)
    import ROOT
    ROOT.gSystem.Load('liblorenzetti')
    from ROOT import CaloCellMerge
    # Create the algorithm
    self.__core = CaloCellMerge(name)

    for key, value in kw.items():
      self.setProperty( key,value  )
Beispiel #17
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzetti')
        from ROOT import TruthParticleMaker
        # Create the algorithm
        self.__core = TruthParticleMaker(name)

        for key, value in kw.items():
            self.setProperty(key, value)
Beispiel #18
0
    def __init__(self, node, db, schedule, postman, master=True):

        Logger.__init__(self)
        self.__node = node
        self.__schedule = schedule
        self.__postman = postman
        self.__db = db
        self.__queue = {}

        self.__master = master
        self.__clock = Clock(10 * SECONDS)
Beispiel #19
0
  def __init__( self , refFile=None, targets=None):
    Logger.__init__(self)
    self.__references = collections.OrderedDict()

    # Set all references from the reference file and target list
    if refFile and targets:
      from saphyra.core import ReferenceReader
      refObj = ReferenceReader().load(refFile)
      for ref in targets:
        pd = (refObj.getSgnPassed(ref[0]) , refObj.getSgnTotal(ref[0]))
        fa = (refObj.getBkgPassed(ref[0]) , refObj.getBkgTotal(ref[0]))
        self.add_reference( ref[0], ref[1], pd, fa )
Beispiel #20
0
  def __init__(self, node, queuename, db=None, gpu=False, postman=None):
    Logger.__init__(self,name=queuename)


    self.__slots = list()
    self.__available_nodes = list()
    self.__gpu = gpu
    self.__total = 0
    self.__queuename = queuename

    self.__db = db
    self.__postman = postman
    self.__node = node
Beispiel #21
0
    def __init__(self, config_dict, etbins=None, etabins=None):
        '''
        The objective of this class is extract the tuning information from saphyra's output and
        create a pandas DataFrame using then.
        The informations used in this DataFrame are listed in info_dict, but the user can add more
        information from saphyra summary for example.


        Arguments:

        - config_dict: a dictionary contains in keys the measures that user want to check and
        the values need to be a empty list.

        Ex.: info = collections.OrderedDict( {

              "max_sp_val"      : 'summary/max_sp_val',
              "max_sp_pd_val"   : 'summary/max_sp_pd_val#0',
              "max_sp_fa_val"   : 'summary/max_sp_fa_val#0',
              "max_sp_op"       : 'summary/max_sp_op',
              "max_sp_pd_op"    : 'summary/max_sp_pd_op#0',
              "max_sp_fa_op"    : 'summary/max_sp_fa_op#0',
              'tight_pd_ref'    : "reference/tight_cutbased/pd_ref#0",
              'tight_fa_ref'    : "reference/tight_cutbased/fa_ref#0",
              'tight_pd_ref_passed'     : "reference/tight_cutbased/pd_ref#1",
              'tight_fa_ref_passed'     : "reference/tight_cutbased/fa_ref#1",
              'tight_pd_ref_total'      : "reference/tight_cutbased/pd_ref#2",
              'tight_fa_ref_total'      : "reference/tight_cutbased/fa_ref#2",
              'tight_pd_val_passed'     : "reference/tight_cutbased/pd_val#1",
              'tight_fa_val_passed'     : "reference/tight_cutbased/fa_val#1",
              'tight_pd_val_total'      : "reference/tight_cutbased/pd_val#2",
              'tight_fa_val_total'      : "reference/tight_cutbased/fa_val#2",
              'tight_pd_op_passed'      : "reference/tight_cutbased/pd_op#1",
              'tight_fa_op_passed'      : "reference/tight_cutbased/fa_op#1",
              'tight_pd_op_total'       : "reference/tight_cutbased/pd_op#2",
              'tight_fa_op_total'       : "reference/tight_cutbased/fa_op#2",

              } )

        - etbins: a list of et bins edges used in training;
        - etabins: a list of eta bins edges used in training;
        '''
        Logger.__init__(self)
        self.__table = None
        # Check wanted key type
        self.__config_dict = collections.OrderedDict(
            config_dict) if type(config_dict) is dict else config_dict
        self.__etbins = etbins
        self.__etabins = etabins
    def __init__(self,
                 etbins,
                 etabins,
                 kf,
                 data_generator,
                 input_generator,
                 model_generator=my_model_generator):

        # init base class
        Logger.__init__(self)
        self.etbins = etbins
        self.etabins = etabins
        self.__data_generator = data_generator
        self.__input_generator = input_generator
        self.__kf = kf
        self.__model_generator = model_generator
Beispiel #23
0
    def __init__(self, name, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzett')
        from ROOT import EventReader as G4Gun
        # Create the algorithm
        self.__core = G4Gun(name)

        for key, value in kw.items():
            self.setProperty(key, value)

        from ROOT import TFile, TTree
        f = TFile(self.getProperty("FileName"))
        t = f.Get("particles")
        self.__nevents = t.GetEntries()
        f.Close()
Beispiel #24
0
    def __init__(self, name, detector, **kw):

        Logger.__init__(self)
        import ROOT
        ROOT.gSystem.Load('liblorenzett')
        from ROOT import RunManager
        self.__core = RunManager(name)
        self.__core.setDetectorConstruction(detector.core())
        self.__numberOfEvents = 10000
        for key, value in kw.items():
            if key in self.__allow_keys:
                setattr(self, '__' + key, value)
                self.__core.setProperty(key, value)
            else:
                MSG_FATAL(self,
                          "Property with name %s is not allow for %s object",
                          key, self.__class__.__name__)
Beispiel #25
0
    def __init__(self, raw_data):
        '''
        This class has the objective of transform the ringer data into pandas Dataframe
        in order to make easer to manipulate and extract information.

        Arguments:
        - raw_data: the file .npz created in prometheus framework
        Ex.:
        my_data_path =data18_path  some_path_to_data/meaninful_data_name_et%i_eta%i.npz')
        et, eta      = 2, 0
        my_raw_data = dict(np.load(my_data_path %(et, eta)))
        '''
        Logger.__init__(self)
        self.raw_data = raw_data
        self.et_bin = raw_data['etBinIdx'].tolist()
        self.eta_bin = raw_data['etaBinIdx'].tolist()
        # create a pandas DataFrame
        MSG_INFO(self, 'Creating a pandas Dataframe... ')
        self.df_ = pd.DataFrame(data=self.raw_data['data'],
                                columns=self.raw_data['features'])
        self.df_['target'] = self.raw_data['target']
Beispiel #26
0
    def __init__(self, job, slot, db):
        Logger.__init__(self)
        self.__job = job
        self.__db = db
        self.__slot = slot

        self.__pending = True
        self.__broken = False
        self.__killed = False

        # compose the job name
        hash_object = hashlib.md5(str.encode(job.execArgs))
        self.__hash = hash_object.hexdigest()
        self.__namespace = job.getTask().getUser().getUserName()
        queuename = job.getQueueName()
        self.__jobname = (queuename + '.user.' + self.__namespace + '.' +
                          self.__hash).replace('_', '-')  # add protection name

        # process
        self.__proc = None

        MSG_INFO(self, "Create consumer with name: %s for namespace: %s",
                 self.__jobname, self.__namespace)
Beispiel #27
0
 def __init__(self, path, generator, **kw):
     Logger.__init__(self)
     self.__path = path
     self.__generator = generator
     self.__kw = kw
Beispiel #28
0
 def __init__(self, feature_names, method):
     Logger.__init__(self)
     self.__feature_names = feature_names
     self.__method = method
Beispiel #29
0
 def __init__(self):
     Logger.__init__(self)
     self.__states = []
Beispiel #30
0
 def __init__( self ):
   Logger.__init__(self)