added a skip_first and last keyword to limit files being worked on

This commit is contained in:
marco cammarata 2017-03-11 11:28:10 +01:00
parent 56aec108d4
commit 9eb8484331
1 changed files with 6 additions and 1 deletions

View File

@ -66,7 +66,7 @@ def findLogFile(folder):
if len(files)>1: log.warn("Found more than one *.log file that is not diagnostics.log: %s"%files) if len(files)>1: log.warn("Found more than one *.log file that is not diagnostics.log: %s"%files)
return logfile return logfile
def readLogFile(fnameOrFolder,subtractDark=False): def readLogFile(fnameOrFolder,subtractDark=False,skip_first=0,asDataStorage=True,last=None):
""" read id9 style logfile """ """ read id9 style logfile """
if os.path.isdir(fnameOrFolder): if os.path.isdir(fnameOrFolder):
fname = findLogFile(fnameOrFolder) fname = findLogFile(fnameOrFolder)
@ -88,6 +88,11 @@ def readLogFile(fnameOrFolder,subtractDark=False):
if subtractDark: if subtractDark:
for diode in ['pd1ic','pd2ic','pd3ic','pd4ic']: for diode in ['pd1ic','pd2ic','pd3ic','pd4ic']:
if diode in darks: data[diode]=data[diode]-darks[diode]*data['timeic'] if diode in darks: data[diode]=data[diode]-darks[diode]*data['timeic']
data = data[skip_first:last]
if asDataStorage:
# rstrip("_") is used to clean up last _ that appera for some reason in file_
data = storage.DataStorage( dict((name.rstrip("_"),data[name]) for name in data.dtype.names ) )
data.file = data.file.astype(str)
return data return data