physiopy / phys2bids

Python3 library to format physiological files in BIDS. At the moment, it supports Acqknowledge and Labchart. BrainHack participants, check the issues with the BrainHack labels!
https://phys2bids.readthedocs.io
Apache License 2.0
63 stars 44 forks source link

If an AcqKowledge file is both in .txt and .acq format and you input the txt, the program reads the acq file instead #128

Open vinferrer opened 4 years ago

vinferrer commented 4 years ago

Expected Behavior

Reading txt file: phys2bids -in Test_belt_pulse_samefreq.txt -info -chtrig 2 File extension is .txt Reading the file phys2bids detected that your file is in AcqKnowledge format Interval is not in seconds. Converting its value. RESP - RSP100C PULSE - Custom, DA100C MR TRIGGER - Custom, HLT100C - A 5 PPG100C CO2 O2 Reading infos File Test_belt_pulse_samefreq.txt contains:

  1. RESP - RSP100C; sampled at 10000.0 Hz
  2. MR TRIGGER - Custom, HLT100C - A 5; sampled at 10000.0 Hz
  3. PPG100C; sampled at 10000.0 Hz
  4. CO2; sampled at 10000.0 Hz
  5. O2; sampled at 0.0 Hz saving channels plot at plot at Test_belt_pulse_samefreq.png

Actual Behavior

Steps to Reproduce the Problem

phys2bids -in phys2bids/phys2bids/tests/data/Test_belt_pulse_samefreq.txt -info -chtrig 2 File extension is .acq Reading the file

  1. Channel RESP - RSP100C: 1336815 samples, 10000.0 samples/sec, loaded: True

  2. Channel PULSE - Custom, DA100C: 1336815 samples, 10000.0 samples/sec, loaded: True

  3. Channel PPG100C: 1336815 samples, 10000.0 samples/sec, loaded: True

  4. Channel CO2: 1336815 samples, 10000.0 samples/sec, loaded: True

  5. Channel O2: 1336815 samples, 10000.0 samples/sec, loaded: True Reading infos File phys2bids/phys2bids/tests/data/Test_belt_pulse_samefreq.acq contains:

  6. RESP - RSP100C; sampled at 10000.0 Hz

  7. PULSE - Custom, DA100C; sampled at 10000.0 Hz

  8. PPG100C; sampled at 10000.0 Hz

  9. CO2; sampled at 10000.0 Hz

  10. O2; sampled at 10000.0 Hz saving channels plot at plot at Test_belt_pulse_samefreq.png

    Specifications

    • Python version: Python 3.6.9
    • phys2bids version:phys2bids v1.2.0-beta+36.g24df90f.dirty
    • Platform: ubuntu

Possible solution

vinferrer commented 4 years ago

@smoia, should we left this as it is? or if the user inputs the .txt format that should prevail?

smoia commented 4 years ago

@vinferrer, I think we have many options here:

  1. we can tweak the "automatic extension finder" so that it gives priority to whatever extension the user provides
  2. we can remove the "automatic extension finder" and always ask for an extension
  3. we can decide that an extension is more important.

In the latter case, I would privilege native file formats, as theoretically they should contain more information. In this case, acq would be privileged compared to txt. However, option 1 makes total sense, shall we want to proceed in that direction. Why don't we discuss about it during a dev call? Maybe this month the agenda is a bit packed, but next time for sure!