From 95a4e9a060759872f48359575aa42ccbed536bb2 Mon Sep 17 00:00:00 2001 From: John Stowers Date: Thu, 17 Dec 2020 19:16:39 +0100 Subject: [PATCH] stimuli: dont lose/change filename case of legacy playlists this code is only really used in the playlist converter and in the tests, but it broke the tests on linux (#13), and maybe should windows ever become case sensitive as seen from python, this would break --- flyvr/audio/stimuli.py | 9 ++++-- .../opto_nivamasan_10sON90sOFF.txt.yml | 32 +++++++++---------- .../opto_nivamasan_10sON90sOFF.yml | 24 +++++++------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/flyvr/audio/stimuli.py b/flyvr/audio/stimuli.py index e5c79dbc..cc0fd87a 100644 --- a/flyvr/audio/stimuli.py +++ b/flyvr/audio/stimuli.py @@ -761,9 +761,14 @@ def _parse_list(_s): intensities = _parse_list(intensity) chans = [] - for chan_idx, chan_name in enumerate(stimFileName.split(';')): + for chan_idx, _chan_name in enumerate(stimFileName.split(';')): + _cnl = _chan_name.lower().strip() + if _cnl in {'optooff', 'optoon', 'square', 'sin', ''}: + chan_name = _chan_name.lower() + else: + chan_name = _chan_name - chan = _legacy_factory(chan_name=chan_name.lower(), + chan = _legacy_factory(chan_name=chan_name, rate=int(rate), silencePre=int(silencePre), silencePost=int(silencePost), diff --git a/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.txt.yml b/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.txt.yml index a54c6a16..53acad57 100644 --- a/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.txt.yml +++ b/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.txt.yml @@ -3,7 +3,7 @@ playlist: audio: - MATFileStim-a93f0de49a5c44ccae00a03c4b398b58: attenuator: null - filename: silentstim_tdur4s + filename: silentStim_TDUR4s frequency: -1.0 intensity: 0.0 max_value: 10.0 @@ -14,7 +14,7 @@ playlist: sample_rate: 10000 - MATFileStim-6fc9b557d0f04a1bb1d6e93e62423da2: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -25,7 +25,7 @@ playlist: sample_rate: 10000 - MATFileStim-bda2036a1c924242ab6d78a93d4c01e2: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -36,7 +36,7 @@ playlist: sample_rate: 10000 - MATFileStim-f69e66e6cba24ed28f9506050bf5d93f: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -47,7 +47,7 @@ playlist: sample_rate: 10000 - MATFileStim-f145b22e455b44ffae68e67d69bb5f09: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -58,7 +58,7 @@ playlist: sample_rate: 10000 - MATFileStim-5e5204dbe9784edd9859e7bc277c58d3: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -69,7 +69,7 @@ playlist: sample_rate: 10000 - MATFileStim-872b488e2587425da36c345956521b00: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -80,7 +80,7 @@ playlist: sample_rate: 10000 - MATFileStim-3973492411014426b70cab46711f0dc5: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -91,7 +91,7 @@ playlist: sample_rate: 10000 - MATFileStim-3550e07630b64b27b402a15600aa5072: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -102,7 +102,7 @@ playlist: sample_rate: 10000 - MATFileStim-2628b5986d2b404c8810f49660e1b3c4: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -113,7 +113,7 @@ playlist: sample_rate: 10000 - MATFileStim-9ee8dcd380a04b31b4df912ebd39f4a6: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -124,7 +124,7 @@ playlist: sample_rate: 10000 - MATFileStim-b9c76d6035df430c9ff2bd20ae5dfc8b: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -135,7 +135,7 @@ playlist: sample_rate: 10000 - MATFileStim-0d140d6fa25d4d818b55c64243dd5c96: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -146,7 +146,7 @@ playlist: sample_rate: 10000 - MATFileStim-745fddf21fc44a53a8742f0433b7d8be: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -157,7 +157,7 @@ playlist: sample_rate: 10000 - MATFileStim-d296cd7c212542b2bd7d47e29eec0915: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -168,7 +168,7 @@ playlist: sample_rate: 10000 - MATFileStim-dc0dab4af8c846e0b9bcb99a6ad44d41: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 diff --git a/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.yml b/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.yml index ee603c05..ec527895 100644 --- a/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.yml +++ b/tests/test_data/nivedita_vr1/opto_nivamasan_10sON90sOFF.yml @@ -38,7 +38,7 @@ playlist: sample_rate: 10000 - Opto1090-9-2: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -49,7 +49,7 @@ playlist: sample_rate: 10000 - Opto1090-8-2: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -60,7 +60,7 @@ playlist: sample_rate: 10000 - Opto1090-7-2: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -71,7 +71,7 @@ playlist: sample_rate: 10000 - Opto1090-9-3: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -82,7 +82,7 @@ playlist: sample_rate: 10000 - Opto1090-8-3: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -93,7 +93,7 @@ playlist: sample_rate: 10000 - Opto1090-7-3: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -104,7 +104,7 @@ playlist: sample_rate: 10000 - Opto1090-9-4: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -115,7 +115,7 @@ playlist: sample_rate: 10000 - Opto1090-8-4: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -126,7 +126,7 @@ playlist: sample_rate: 10000 - Opto1090-7-4: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0 @@ -137,7 +137,7 @@ playlist: sample_rate: 10000 - Opto1090-9-5: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 9.0 max_value: 10.0 @@ -148,7 +148,7 @@ playlist: sample_rate: 10000 - Opto1090-8-5: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 8.0 max_value: 10.0 @@ -159,7 +159,7 @@ playlist: sample_rate: 10000 - Opto1090-7-5: attenuator: null - filename: 190712_opto_10son_90soff + filename: 190712_opto_10sON_90sOFF frequency: -1.0 intensity: 7.0 max_value: 10.0