Class to hold/interpret experiment-specific metadata
Definition at line 103 of file extractor_dict.py.
def python.extractor_dict.expMetaData.__init__ |
( |
|
self, |
|
|
|
expname, |
|
|
|
inputfile |
|
) |
| |
Definition at line 105 of file extractor_dict.py.
106 MetaData.__init__(self, inputfile)
111 from experiment_utilities
import MetaDataKey
113 print(
"You have not defined an experiment-specific metadata and key-translating module in experiment_utilities. Exiting")
116 metaDataModule = MetaDataKey()
117 self.metadataList, self.
translateKeyf = metaDataModule.metadataList(), metaDataModule.translateKey
def python.extractor_dict.expMetaData.getmetadata |
( |
|
self, |
|
|
|
md0 = {} |
|
) |
| |
Get metadata from input file and return as python dictionary.
Calls other methods in class and returns metadata dictionary
Definition at line 220 of file extractor_dict.py.
221 """ Get metadata from input file and return as python dictionary. 222 Calls other methods in class and returns metadata dictionary""" 226 return self.
md_gen(mdart, md0)
def python.extractor_dict.expMetaData.md_gen |
( |
|
self, |
|
|
|
mdart, |
|
|
|
md0 = {} |
|
) |
| |
Loop through art metdata, generate metadata dictionary
Definition at line 123 of file extractor_dict.py.
124 """Loop through art metdata, generate metadata dictionary""" 134 for mdkey, mdval
in list(mdart.items()):
140 if mdkey
in [
'file_format_version',
'file_format_era',
'run_type']:
142 elif mdkey
in [
'art.file_format_version',
'art.file_format_era',
'art.run_type']:
146 elif mdkey
in [
'art.first_event',
'art.last_event']:
155 elif mdkey ==
'data_stream' and mdval ==
'out':
158 elif mdkey ==
'data_stream' and mdval[:3] ==
'out' and \
159 mdval[3] >=
'0' and mdval[3] <=
'9':
163 elif mdkey ==
'applicationFamily' or mdkey ==
'application.family':
165 elif mdkey ==
'process_name' or mdkey ==
'art.process_name':
167 elif mdkey ==
'applicationVersion' or mdkey ==
'application.version':
171 elif mdkey ==
'parents':
172 md[
'parents'] = [{
'file_name': parent}
for parent
in mdval]
174 elif mdkey.startswith(
'mixparent'):
175 mixparents.append(mdval.strip(
' ,"') )
178 elif mdkey
in [
'first_event',
'last_event']:
179 if (
type(mdval) ==
type([])
or type(mdval) ==
type(()))
and len(mdval) >= 3:
183 elif mdkey
in self.metadataList:
188 elif mdkey ==
'fclName':
189 md[
'fcl.name'] = mdval
190 elif mdkey ==
'fclVersion':
191 md[
'fcl.version'] = mdval
200 for mixparent
in mixparents:
201 mixparent_dict = {
'file_name': mixparent}
202 md[
'parents'].append(mixparent_dict)
206 md[
'file_name'] = self.inputfile.split(
"/")[-1]
207 if 'file_size' in md0:
208 md[
'file_size'] = md0[
'file_size']
210 md[
'file_size'] = os.path.getsize(self.
inputfile)
212 md[
'crc'] = md0[
'crc']
214 md[
'crc'] = root_metadata.fileEnstoreChecksum(self.
inputfile)
def python.extractor_dict.expMetaData.translateKey |
( |
|
self, |
|
|
|
key |
|
) |
| |
Returns the output of the imported translateKey function (as translateKeyf) called on key
Definition at line 119 of file extractor_dict.py.
120 """Returns the output of the imported translateKey function (as translateKeyf) called on key"""
python.extractor_dict.expMetaData.expname |
python.extractor_dict.expMetaData.md |
python.extractor_dict.expMetaData.translateKeyf |
The documentation for this class was generated from the following file: