From 9eb848433129002246918c96b84f6eb9a911e74a Mon Sep 17 00:00:00 2001 From: marco cammarata Date: Sat, 11 Mar 2017 11:28:10 +0100 Subject: [PATCH] added a skip_first and last keyword to limit files being worked on --- xray/id9.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xray/id9.py b/xray/id9.py index 7c90bef..6c94cb7 100644 --- a/xray/id9.py +++ b/xray/id9.py @@ -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) return logfile -def readLogFile(fnameOrFolder,subtractDark=False): +def readLogFile(fnameOrFolder,subtractDark=False,skip_first=0,asDataStorage=True,last=None): """ read id9 style logfile """ if os.path.isdir(fnameOrFolder): fname = findLogFile(fnameOrFolder) @@ -88,6 +88,11 @@ def readLogFile(fnameOrFolder,subtractDark=False): if subtractDark: for diode in ['pd1ic','pd2ic','pd3ic','pd4ic']: 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