wtclarke / spec2nii

Multi-format in vivo MR spectroscopy conversion to NIFTI
Other
27 stars 23 forks source link

spec2nii twix generates stderr #19

Closed marcelzwiers closed 2 years ago

marcelzwiers commented 3 years ago

Running spec2nii twix runs without error (i.e. with error code / exit status = 0):

spec2nii twix -j -f "sub-mrssiemens_run-2_press" -o "/home/mrphys/marzwi/mridata/spec2nii2bids/bids/sub-mrssiemens/mrs"  -e image "/home/mrphys/marzwi/mridata/spec2nii2bids/raw/sub-mrssiemens/water/HERMES/sub-220182106_thal_wat.dat"
pymapVBVD version 0.4.3
Software version: VD
Converting twix file /home/mrphys/marzwi/mridata/spec2nii2bids/raw/sub-mrssiemens/water/HERMES/sub-220182106_thal_wat.dat.
Looking for evalinfo flag image.
Found data of size (4096, 32, 16).
Header extension validated!

However, it outputs statistics output on stderr:

Scan 1/2, read all mdhs:   0%|          | 0.00/60.7M [00:00<?, ?B/s]

Scan 2/2, read all mdhs:   0%|          | 0.00/66.0M [00:00<?, ?B/s]

read data:   0%|          | 0/65 [00:00<?, ?it/s]
read data:  22%|???       | 14/65 [00:00<00:00, 111.17it/s]
read data:  46%|?????     | 30/65 [00:00<00:00, 131.76it/s]
read data:  95%|??????????| 62/65 [00:00<00:00, 136.18it/s]

This is of course not a big problem, but I believe it is not good practice (and it provokes a warning in the (unreleased/experimental) spec2nii plugin I wrote for my BIDScoin application)

wtclarke commented 3 years ago

Hi @marcelzwiers , thanks for giving spec2nii a go. You are right, stderr doesn't seem like a good place to output the read progress to. I'll take a look as whether that can be changed.

It seems to be what https://github.com/tqdm/tqdm does by default, with this included via the pymapvbvd package.

wtclarke commented 3 years ago

For my own notes. It seems that passing file=sys.stdout to the main tqdm call in pymapvbvd will change where the progress output is sent.

wtclarke commented 2 years ago

This should now be fixed in pyMapVBVD 0.4.6 which is now on PyPi and will be published on conda-forge soon.