Belle II Software development
PickleHarvestingModule Class Reference
Inheritance diagram for PickleHarvestingModule:
HarvestingModule SummarizeTriggerResults SummarizeTriggerVariables

Public Member Functions

def barn (self)
 
def refine (self, crops)
 

Public Attributes

 crops
 The gathered crops until now.
 

Detailed Description

Overloaded harvester, that stores its data into a pandas data frame instead of a numpy array,
because they are more flexible when it comes to changing columns and value types to be stored.

Definition at line 22 of file variable_modules.py.

Member Function Documentation

◆ barn()

def barn (   self)
Coroutine that receives the dictionaries of names and values from peel and store them into a pandas df.

Reimplemented from HarvestingModule.

Definition at line 28 of file variable_modules.py.

28 def barn(self):
29 """Coroutine that receives the dictionaries of names and values from peel and store them into a pandas df."""
30 crop = (yield)
31 crops = []
32
33 if isinstance(crop, numbers.Number):
34 try:
35 while True:
36 crops.append({"value": crop})
37 # next crop
38 crop = (yield)
39 except GeneratorExit:
40 pass
41
42 elif isinstance(crop, collections.abc.MutableMapping):
43 try:
44 while True:
45 crops.append(crop)
46 crop = (yield)
47 except GeneratorExit:
48 pass
49
50 else:
51 msg = f"Unrecognised crop {crop} of type {type(crop)}"
52 raise ValueError(msg)
53
54
55 self.crops = crops
56

◆ refine()

def refine (   self,
  crops 
)
Receive the gathered crops and saves them into a ROOT file.

Reimplemented from HarvestingModule.

Definition at line 57 of file variable_modules.py.

57 def refine(self, crops):
58 """Receive the gathered crops and saves them into a ROOT file."""
59 with open(self.output_file_name, "wb") as f:
60 pickle.dump(crops, f)
61
62

Member Data Documentation

◆ crops

crops

The gathered crops until now.

Definition at line 55 of file variable_modules.py.


The documentation for this class was generated from the following file: