implementation of different data structure type handling

This commit is contained in:
Sebastian Wehling-Benatelli 2015-05-20 09:38:25 +02:00
parent 56a0563709
commit 5badf2ba34
2 changed files with 22 additions and 14 deletions

View File

@ -4,6 +4,7 @@
import os
import argparse
import glob
from pylot.core.util import _getVersionString
from pylot.core.read import Data, AutoPickParameter
@ -32,10 +33,15 @@ def autoPyLoT(fnames, inputfile):
.. rubric:: Example
'''
# reading parameter file
parameter = AutoPickParameter(inputfile)
data = Data()
# declaring parameter variables (only for convenience)
meth = parameter.getParam('algoP')
tsnr1 = parameter.getParam('tsnr1')
tsnr2 = parameter.getParam('tsnr2')
@ -44,24 +50,23 @@ def autoPyLoT(fnames, inputfile):
order = parameter.getParam('hosorder')
thosmw = parameter.getParam('tlta')
# getting information on data structure
if parameter.hasParam('datastructure'):
datastructure = DATASTRUCTURE[parameter.getParam('datastructure')]()
dsfields = {'root':parameter.getParam('rootpath')} #see TODO: in data.py
datastructure.modifyFields(dsfields)
dsfields = {'root':parameter.getParam('rootpath'),
'dpath':parameter.getParam('datapath'),
'dbase':parameter.getParam('database')}
def expandSDS(datastructure):
return datastructure.expandDataPath()
datastructure.modifyFields(**dsfields)
def expandPDS(datastructure):
return os.path.join(datastructure.expandDataPath(),'*')
datastructure.setExpandFields(['root', 'dpath', 'dbase'])
dsem = {'PDS':expandPDS, 'SDS':expandSDS}
expandMethod = dsem[datastructure.getName()]
data.setWFData(expandMethod())
else:
data.setWFData()
# process each event in database
datapath = datastructure.expandDataPath()
for event in glob.glob(datapath):
data.setWFData(os.path.join(datapath, event, '*'))
print data
cfP = METHOD[meth](data.getWFData(), (tnoise, tsignal), thosmw, order)

View File

@ -50,6 +50,9 @@ class Data(object):
self.cuttimes = None
self.dirty = False
def __str__(self):
return str(self.evtdata), '\n', str(self.wfdata)
def getParent(self):
return self._parent