aboutsummaryrefslogtreecommitdiff
path: root/qolab/data
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2024-06-20 22:37:22 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2024-06-20 22:38:28 -0400
commitd8b4e87f3185c2cc99dd1171bdff1c169ceb2c83 (patch)
treec6481bae0e2585a23f872592826801e0ed86695d /qolab/data
parent6393ee0ccf4a137378bfbed3ee67ecf87513b7d7 (diff)
downloadqolab-d8b4e87f3185c2cc99dd1171bdff1c169ceb2c83.tar.gz
qolab-d8b4e87f3185c2cc99dd1171bdff1c169ceb2c83.zip
Streamline missing file to compressed file algorythm
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']: