aboutsummaryrefslogtreecommitdiff
path: root/qolab/data
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/data')
-rw-r--r--qolab/data/trace.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py
index bda4da5..cc51d5b 100644
--- a/qolab/data/trace.py
+++ b/qolab/data/trace.py
@@ -25,12 +25,11 @@ def loadTraceRawHeaderAndData(fname, tryCompressedIfMissing=True):
headerstr=[]
data = None
if (not os.path.exists(fname)) and tryCompressedIfMissing:
- if os.path.exists(fname+'.gz'):
- fname += '.gz'
- if os.path.exists(fname+'.bz'):
- fname += '.bz'
- if os.path.exists(fname+'.bz2'):
- fname += '.bz2'
+ # attempt to locate compressed file for the missing base file
+ for ext in ['gz', 'bz', 'bz2']:
+ if os.path.exists(fname+'.'+ext):
+ fname += '.'+ext
+ break
# we will try to guess if the file compressed
_open = open
for ext in ['gz', 'bz', 'bz2']: