Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: float division by zero when trying to create sidecar #201

Closed
Remi-Gau opened this issue Mar 27, 2024 · 4 comments · Fixed by #218
Closed

ZeroDivisionError: float division by zero when trying to create sidecar #201

Remi-Gau opened this issue Mar 27, 2024 · 4 comments · Fixed by #218
Labels
bug Something isn't working
Milestone

Comments

@Remi-Gau
Copy link
Contributor

[15:05:09] WARNING  bidsMReye - [15:05:09] - log level: WARNING                                                                                                                        bidsmreye.py:115
Mask 0/2, Sum: 4.379, Mean 0.365, Std 0.423, Median 0.157
Mask 1/2, Sum: 10.109, Mean 0.842, Std 1.176, Median 0.521
Mask 2/2, Sum: -15.330, Mean -1.278, Std 11.405, Median 0.018
[15:05:44] WARNING  bidsMReye - [15:05:44] - Found a repetition time of 0.0 seconds.                                                                                                  bids_utils.py:141
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\runpy.py:197 in _run_module_as_main                   │
│                                                                                                  │
│   194 │   main_globals = sys.modules["__main__"].__dict__                                        │
│   195 │   if alter_argv:                                                                         │
│   196 │   │   sys.argv[0] = mod_spec.origin                                                      │
│ > 197 │   return _run_code(code, main_globals, None,                                             │
│   198 │   │   │   │   │    "__main__", mod_spec)                                                 │
│   199                                                                                            │
│   200 def run_module(mod_name, init_globals=None,                                                │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │   alter_argv = False                                                                         │ │
│ │         code = <code object <module> at 0x0000024B56A1D660, file                             │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\__main__.py",   │ │
│ │                line 2>                                                                       │ │
│ │ main_globals = {                                                                             │ │
│ │                │   '__name__': '__main__',                                                   │ │
│ │                │   '__doc__': None,                                                          │ │
│ │                │   '__package__': '',                                                        │ │
│ │                │   '__loader__': <zipimporter object                                         │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                │   '__spec__': ModuleSpec(name='__main__', loader=<zipimporter object        │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                origin='C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\… │ │
│ │                │   '__annotations__': {},                                                    │ │
│ │                │   '__builtins__': <module 'builtins' (built-in)>,                           │ │
│ │                │   '__file__':                                                               │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__main… │ │
│ │                │   '__cached__':                                                             │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__pyca… │ │
│ │                │   're': <module 're' from                                                   │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\lib\\re.py'>,                   │ │
│ │                │   ... +2                                                                    │ │
│ │                }                                                                             │ │
│ │     mod_name = '__main__'                                                                    │ │
│ │     mod_spec = ModuleSpec(name='__main__', loader=<zipimporter object                        │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                origin='C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\… │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\runpy.py:87 in _run_code                              │
│                                                                                                  │
│    84 │   │   │   │   │      __loader__ = loader,                                                │
│    85 │   │   │   │   │      __package__ = pkg_name,                                             │
│    86 │   │   │   │   │      __spec__ = mod_spec)                                                │
│ >  87 │   exec(code, run_globals)                                                                │
│    88 │   return run_globals                                                                     │
│    89                                                                                            │
│    90 def _run_module_code(code, init_globals=None,                                              │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │       cached = 'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__pyca… │ │
│ │         code = <code object <module> at 0x0000024B56A1D660, file                             │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\__main__.py",   │ │
│ │                line 2>                                                                       │ │
│ │        fname = 'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__main… │ │
│ │ init_globals = None                                                                          │ │
│ │       loader = <zipimporter object                                                           │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">              │ │
│ │     mod_name = '__main__'                                                                    │ │
│ │     mod_spec = ModuleSpec(name='__main__', loader=<zipimporter object                        │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                origin='C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\… │ │
│ │     pkg_name = ''                                                                            │ │
│ │  run_globals = {                                                                             │ │
│ │                │   '__name__': '__main__',                                                   │ │
│ │                │   '__doc__': None,                                                          │ │
│ │                │   '__package__': '',                                                        │ │
│ │                │   '__loader__': <zipimporter object                                         │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                │   '__spec__': ModuleSpec(name='__main__', loader=<zipimporter object        │ │
│ │                "C:\Workdir\MyApps\MyApp\envs\Python391\Scripts\bidsmreye.exe\">,             │ │
│ │                origin='C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\… │ │
│ │                │   '__annotations__': {},                                                    │ │
│ │                │   '__builtins__': <module 'builtins' (built-in)>,                           │ │
│ │                │   '__file__':                                                               │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__main… │ │
│ │                │   '__cached__':                                                             │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye.exe\\__pyca… │ │
│ │                │   're': <module 're' from                                                   │ │
│ │                'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\lib\\re.py'>,                   │ │
│ │                │   ... +2                                                                    │ │
│ │                }                                                                             │ │
│ │  script_name = None                                                                          │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ in <module>:7                                                                                    │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\bidsmreye.py:54 in cli        │
│                                                                                                  │
│    51 │   │   log_level = min(len(log_levels()) - 1, max(log_level + adjustment, 0))             │
│    52 │   log_level_name = log_levels()[log_level]                                               │
│    53 │                                                                                          │
│ >  54 │   bidsmreye(                                                                             │
│    55 │   │   bids_dir=args.bids_dir,                                                            │
│    56 │   │   output_dir=args.output_dir,                                                        │
│    57 │   │   analysis_level=args.analysis_level,                                                │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │           args = Namespace(bids_dir='C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\f… │ │
│ │                  output_dir='C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\bidsmreye… │ │
│ │                  analysis_level='participant', action='prepare', participant_label=['999'],  │ │
│ │                  task=None, run=None, space=None, log_level=None, debug=False,               │ │
│ │                  reset_database=False, bids_filter_file=None, non_linear_coreg=False,        │ │
│ │                  model='1to6')                                                               │ │
│ │           argv = [                                                                           │ │
│ │                  │   'C:\\Workdir\\MyApps\\MyApp\\envs\\Python391\\Scripts\\bidsmreye',      │ │
│ │                  │   '--action',                                                             │ │
│ │                  │   'prepare',                                                              │ │
│ │                  │   'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep',        │ │
│ │                  │   'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\bidsmreye',       │ │
│ │                  │   'participant',                                                          │ │
│ │                  │   '--participant_label',                                                  │ │
│ │                  │   '999'                                                                   │ │
│ │                  ]                                                                           │ │
│ │      log_level = 2                                                                           │ │
│ │ log_level_name = 'WARNING'                                                                   │ │
│ │         parser = MuhParser(prog='bidsmreye', usage=None, description='BIDS app using         │ │
│ │                  deepMReye to decode eye motion for fMRI time series data.',                 │ │
│ │                  formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', │ │
│ │                  add_help=True)                                                              │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\bidsmreye.py:129 in bidsmreye │
│                                                                                                  │
│   126 │   if action in {"all", "generalize"} and isinstance(cfg.model_weights_file, str):        │
│   127 │   │   cfg.model_weights_file = download(cfg.model_weights_file)                          │
│   128 │                                                                                          │
│ > 129 │   dispatch(analysis_level=analysis_level, action=action, cfg=cfg)                        │
│   130                                                                                            │
│   131                                                                                            │
│   132 def dispatch(analysis_level: str, action: str, cfg: Config) -> None:                       │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │             action = 'prepare'                                                               │ │
│ │     analysis_level = 'participant'                                                           │ │
│ │           bids_dir = 'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep'         │ │
│ │        bids_filter = None                                                                    │ │
│ │   bids_filter_file = None                                                                    │ │
│ │                cfg = Config(                                                                 │ │
│ │                      │                                                                       │ │
│ │                      input_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives… │ │
│ │                      │                                                                       │ │
│ │                      output_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivative… │ │
│ │                      │   subjects=['999'],                                                   │ │
│ │                      │   space=['MNI152NLin2009cAsym'],                                      │ │
│ │                      │   task=['aestheticlikingjudgement'],                                  │ │
│ │                      │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                │ │
│ │                      │   model_weights_file='1to6',                                          │ │
│ │                      │   bids_filter={                                                       │ │
│ │                      │   │   'bold': {                                                       │ │
│ │                      │   │   │   'datatype': 'func',                                         │ │
│ │                      │   │   │   'desc': 'preproc',                                          │ │
│ │                      │   │   │   'suffix': '^bold$',                                         │ │
│ │                      │   │   │   'extension': 'nii.*',                                       │ │
│ │                      │   │   │   'task': '^aestheticlikingjudgement$',                       │ │
│ │                      │   │   │   'space': '^MNI152NLin2009cAsym$',                           │ │
│ │                      │   │   │   'subject': '999',                                           │ │
│ │                      │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                               │ │
│ │                      │   │   },                                                              │ │
│ │                      │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                   │ │
│ │                      │   │   'no_label': {                                                   │ │
│ │                      │   │   │   'desc': 'nolabel',                                          │ │
│ │                      │   │   │   'suffix': '^bidsmreye$$',                                   │ │
│ │                      │   │   │   'extension': 'npz'                                          │ │
│ │                      │   │   },                                                              │ │
│ │                      │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},      │ │
│ │                      │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}   │ │
│ │                      │   },                                                                  │ │
│ │                      │   debug=False,                                                        │ │
│ │                      │   reset_database=False,                                               │ │
│ │                      │   non_linear_coreg=False                                              │ │
│ │                      )                                                                       │ │
│ │              debug = False                                                                   │ │
│ │     log_level_name = 'WARNING'                                                               │ │
│ │ model_weights_file = '1to6'                                                                  │ │
│ │   non_linear_coreg = False                                                                   │ │
│ │         output_dir = 'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\bidsmreye'        │ │
│ │  participant_label = ['999']                                                                 │ │
│ │     reset_database = False                                                                   │ │
│ │                run = None                                                                    │ │
│ │              space = None                                                                    │ │
│ │               task = None                                                                    │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\bidsmreye.py:145 in dispatch  │
│                                                                                                  │
│   142 │   │   │   prepare_data(cfg)                                                              │
│   143 │   │   │   generalize(cfg)                                                                │
│   144 │   │   elif action == "prepare":                                                          │
│ > 145 │   │   │   prepare_data(cfg)                                                              │
│   146 │   │   elif action == "generalize":                                                       │
│   147 │   │   │   generalize(cfg)                                                                │
│   148 │   │   elif action == "qc":                                                               │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │         action = 'prepare'                                                                   │ │
│ │ analysis_level = 'participant'                                                               │ │
│ │            cfg = Config(                                                                     │ │
│ │                  │                                                                           │ │
│ │                  input_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/fMR… │ │
│ │                  │                                                                           │ │
│ │                  output_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/bi… │ │
│ │                  │   subjects=['999'],                                                       │ │
│ │                  │   space=['MNI152NLin2009cAsym'],                                          │ │
│ │                  │   task=['aestheticlikingjudgement'],                                      │ │
│ │                  │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                    │ │
│ │                  │   model_weights_file='1to6',                                              │ │
│ │                  │   bids_filter={                                                           │ │
│ │                  │   │   'bold': {                                                           │ │
│ │                  │   │   │   'datatype': 'func',                                             │ │
│ │                  │   │   │   'desc': 'preproc',                                              │ │
│ │                  │   │   │   'suffix': '^bold$',                                             │ │
│ │                  │   │   │   'extension': 'nii.*',                                           │ │
│ │                  │   │   │   'task': '^aestheticlikingjudgement$',                           │ │
│ │                  │   │   │   'space': '^MNI152NLin2009cAsym$',                               │ │
│ │                  │   │   │   'subject': '999',                                               │ │
│ │                  │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                                   │ │
│ │                  │   │   },                                                                  │ │
│ │                  │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                       │ │
│ │                  │   │   'no_label': {                                                       │ │
│ │                  │   │   │   'desc': 'nolabel',                                              │ │
│ │                  │   │   │   'suffix': '^bidsmreye$$',                                       │ │
│ │                  │   │   │   'extension': 'npz'                                              │ │
│ │                  │   │   },                                                                  │ │
│ │                  │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},          │ │
│ │                  │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}       │ │
│ │                  │   },                                                                      │ │
│ │                  │   debug=False,                                                            │ │
│ │                  │   reset_database=False,                                                   │ │
│ │                  │   non_linear_coreg=False                                                  │ │
│ │                  )                                                                           │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\prepare_data.py:185 in        │
│ prepare_data                                                                                     │
│                                                                                                  │
│   182 │                                                                                          │
│   183 │   for subject_label in subjects:                                                         │
│   184 │   │                                                                                      │
│ > 185 │   │   process_subject(cfg, layout_in, layout_out, subject_label)                         │
│   186                                                                                            │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │           cfg = Config(                                                                      │ │
│ │                 │                                                                            │ │
│ │                 input_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/fMRI… │ │
│ │                 │                                                                            │ │
│ │                 output_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/bid… │ │
│ │                 │   subjects=['999'],                                                        │ │
│ │                 │   space=['MNI152NLin2009cAsym'],                                           │ │
│ │                 │   task=['aestheticlikingjudgement'],                                       │ │
│ │                 │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                     │ │
│ │                 │   model_weights_file='1to6',                                               │ │
│ │                 │   bids_filter={                                                            │ │
│ │                 │   │   'bold': {                                                            │ │
│ │                 │   │   │   'datatype': 'func',                                              │ │
│ │                 │   │   │   'desc': 'preproc',                                               │ │
│ │                 │   │   │   'suffix': '^bold$',                                              │ │
│ │                 │   │   │   'extension': 'nii.*',                                            │ │
│ │                 │   │   │   'task': '^aestheticlikingjudgement$',                            │ │
│ │                 │   │   │   'space': '^MNI152NLin2009cAsym$',                                │ │
│ │                 │   │   │   'subject': '999',                                                │ │
│ │                 │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                                    │ │
│ │                 │   │   },                                                                   │ │
│ │                 │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                        │ │
│ │                 │   │   'no_label': {                                                        │ │
│ │                 │   │   │   'desc': 'nolabel',                                               │ │
│ │                 │   │   │   'suffix': '^bidsmreye$$',                                        │ │
│ │                 │   │   │   'extension': 'npz'                                               │ │
│ │                 │   │   },                                                                   │ │
│ │                 │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},           │ │
│ │                 │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}        │ │
│ │                 │   },                                                                       │ │
│ │                 │   debug=False,                                                             │ │
│ │                 │   reset_database=False,                                                    │ │
│ │                 │   non_linear_coreg=False                                                   │ │
│ │                 )                                                                            │ │
│ │     layout_in = BIDS Layout: ..._analysis\derivatives\fMRIprep | Subjects: 1 | Sessions: 0 | │ │
│ │                 Runs: 10                                                                     │ │
│ │    layout_out = BIDS Layout: ...erivatives\bidsmreye\bidsmreye | Subjects: 1 | Sessions: 0 | │ │
│ │                 Runs: 1                                                                      │ │
│ │ subject_label = '999'                                                                        │ │
│ │      subjects = ['999']                                                                      │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\prepare_data.py:155 in        │
│ process_subject                                                                                  │
│                                                                                                  │
│   152 │   │   move_file(deepmreye_mask_name, mask_name)                                          │
│   153 │   │                                                                                      │
│   154 │   │   source = str(Path(img).relative_to(layout_in.root))                                │
│ > 155 │   │   save_sampling_frequency_to_json(layout_out, img=img, source=source)                │
│   156 │   │                                                                                      │
│   157 │   │   combine_data_with_empty_labels(layout_out, mask_name)                              │
│   158                                                                                            │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │                    bf = [                                                                    │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         │                                                                    │ │
│ │                         'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │                         ]                                                                    │ │
│ │                   cfg = Config(                                                              │ │
│ │                         │                                                                    │ │
│ │                         input_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivati… │ │
│ │                         │                                                                    │ │
│ │                         output_dir=WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivat… │ │
│ │                         │   subjects=['999'],                                                │ │
│ │                         │   space=['MNI152NLin2009cAsym'],                                   │ │
│ │                         │   task=['aestheticlikingjudgement'],                               │ │
│ │                         │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                             │ │
│ │                         │   model_weights_file='1to6',                                       │ │
│ │                         │   bids_filter={                                                    │ │
│ │                         │   │   'bold': {                                                    │ │
│ │                         │   │   │   'datatype': 'func',                                      │ │
│ │                         │   │   │   'desc': 'preproc',                                       │ │
│ │                         │   │   │   'suffix': '^bold$',                                      │ │
│ │                         │   │   │   'extension': 'nii.*',                                    │ │
│ │                         │   │   │   'task': '^aestheticlikingjudgement$',                    │ │
│ │                         │   │   │   'space': '^MNI152NLin2009cAsym$',                        │ │
│ │                         │   │   │   'subject': '999',                                        │ │
│ │                         │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                            │ │
│ │                         │   │   },                                                           │ │
│ │                         │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                │ │
│ │                         │   │   'no_label': {                                                │ │
│ │                         │   │   │   'desc': 'nolabel',                                       │ │
│ │                         │   │   │   'suffix': '^bidsmreye$$',                                │ │
│ │                         │   │   │   'extension': 'npz'                                       │ │
│ │                         │   │   },                                                           │ │
│ │                         │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},   │ │
│ │                         │   │   'eyetrack_qc': {                                             │ │
│ │                         │   │   │   'suffix': '^eyetrack$$',                                 │ │
│ │                         │   │   │   'extension': 'json'                                      │ │
│ │                         │   │   }                                                            │ │
│ │                         │   },                                                               │ │
│ │                         │   debug=False,                                                     │ │
│ │                         │   reset_database=False,                                            │ │
│ │                         │   non_linear_coreg=False                                           │ │
│ │                         )                                                                    │ │
│ │   deepmreye_mask_name = WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/fMRIpr… │ │
│ │ deepmreye_mask_report = WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/fMRIpr… │ │
│ │                   img = 'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub… │ │
│ │             layout_in = BIDS Layout: ..._analysis\derivatives\fMRIprep | Subjects: 1 |       │ │
│ │                         Sessions: 0 | Runs: 10                                               │ │
│ │            layout_out = BIDS Layout: ...erivatives\bidsmreye\bidsmreye | Subjects: 1 |       │ │
│ │                         Sessions: 0 | Runs: 1                                                │ │
│ │             mask_name = WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/bidsmr… │ │
│ │           report_name = WindowsPath('C:/Workdir/MyApps/MRI_data_analysis/derivatives/bidsmr… │ │
│ │                source = 'sub-999\\func\\sub-999_task-aestheticlikingjudgement_run-01_space-… │ │
│ │         subject_label = '999'                                                                │ │
│ │           this_filter = {                                                                    │ │
│ │                         │   'datatype': 'func',                                              │ │
│ │                         │   'desc': 'preproc',                                               │ │
│ │                         │   'suffix': '^bold$',                                              │ │
│ │                         │   'extension': 'nii.*',                                            │ │
│ │                         │   'task': '^aestheticlikingjudgement$',                            │ │
│ │                         │   'space': '^MNI152NLin2009cAsym$',                                │ │
│ │                         │   'subject': '999',                                                │ │
│ │                         │   'run': '1|2|3|4|5|6|7|8|9|10'                                    │ │
│ │                         }                                                                    │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Workdir\MyApps\MyApp\envs\Python391\lib\site-packages\bidsmreye\bids_utils.py:143 in          │
│ save_sampling_frequency_to_json                                                                  │
│                                                                                                  │
│   140 │   if sampling_frequency <= 1:                                                            │
│   141 │   │   log.warning(f"Found a repetition time of {sampling_frequency} seconds.")           │
│   142 │   create_sidecar(                                                                        │
│ > 143 │   │   layout_out, img, SamplingFrequency=1 / float(sampling_frequency), source=source    │
│   144 │   )                                                                                      │
│   145                                                                                            │
│   146                                                                                            │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │           func_img = <nibabel.nifti1.Nifti1Image object at 0x0000024B1D8B4C70>               │ │
│ │             header = <nibabel.nifti1.Nifti1Header object at 0x0000024B1D8CEA00>              │ │
│ │                img = 'C:\\Workdir\\MyApps\\MRI_data_analysis\\derivatives\\fMRIprep\\sub-99… │ │
│ │         layout_out = BIDS Layout: ...erivatives\bidsmreye\bidsmreye | Subjects: 1 |          │ │
│ │                      Sessions: 0 | Runs: 1                                                   │ │
│ │ sampling_frequency = 0.0                                                                     │ │
│ │             source = 'sub-999\\func\\sub-999_task-aestheticlikingjudgement_run-01_space-MNI… │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
ZeroDivisionError: float division by zero
Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@costantinoai
Copy link

Hi,

I am having the same exact issue running bidsmreye using docker on an fmriprep output. Here is what I get with any subject:

$ docker run -it --rm -v /data/projects/chess/data/BIDS/derivatives/fmriprep:/data -v /data/projects/chess/temp_bidsmreye:/out cpplab/bidsmreye:latest --action all /data /out participant --participant_label 01

2024-07-15 15:00:10.956530: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F AVX512_VNNI FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-07-15 15:00:11.037137: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-07-15 15:00:11.040178: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2024-07-15 15:00:11.040200: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2024-07-15 15:00:11.419164: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2024-07-15 15:00:11.419237: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2024-07-15 15:00:11.419245: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.

WARNING
[15:00:40] WARNING  bidsMReye - [15:00:40] - log level: WARNING                                                      bidsmreye.py:112
Mask 0/2, Sum: 3.861, Mean 0.322, Std 0.469, Median 0.003
Mask 1/2, Sum: 13.689, Mean 1.141, Std 1.621, Median 0.556
Mask 2/2, Sum: -12.583, Mean -1.049, Std 2.780, Median -0.009
[15:00:59] WARNING  bidsMReye - [15:00:59] - Found a repetition time of 0.0 seconds.                                                         prepare_data.py:163
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/miniconda-latest/envs/bidsmreye/bin/bidsmreye:8 in <module>                                 │
│                                                                                                  │
│   5 from bidsmreye.bidsmreye import cli                                                          │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(cli())                                                                          │
│   9                                                                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ __annotations__ = {}                                                                         │ │
│ │    __builtins__ = <module 'builtins' (built-in)>                                             │ │
│ │      __cached__ = None                                                                       │ │
│ │         __doc__ = None                                                                       │ │
│ │        __file__ = '/opt/miniconda-latest/envs/bidsmreye/bin/bidsmreye'                       │ │
│ │      __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7fd16ac2bc10>     │ │
│ │        __name__ = '__main__'                                                                 │ │
│ │     __package__ = None                                                                       │ │
│ │        __spec__ = None                                                                       │ │
│ │             cli = <function cli at 0x7fd1600a7af0>                                           │ │
│ │              re = <module 're' from                                                          │ │
│ │                   '/opt/miniconda-latest/envs/bidsmreye/lib/python3.9/re.py'>                │ │
│ │             sys = <module 'sys' (built-in)>                                                  │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/bidsmreye.py:54 in    │
│ cli                                                                                              │
│                                                                                                  │
│    51 │   │   log_level = min(len(log_levels()) - 1, max(log_level + adjustment, 0))             │
│    52 │   log_level_name = log_levels()[log_level]                                               │
│    53 │                                                                                          │
│ ❱  54 │   bidsmreye(                                                                             │
│    55 │   │   bids_dir=args.bids_dir,                                                            │
│    56 │   │   output_dir=args.output_dir,                                                        │
│    57 │   │   analysis_level=args.analysis_level,                                                │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │           args = Namespace(bids_dir='/data', output_dir='/out',                              │ │
│ │                  analysis_level='participant', action='all', participant_label=['01'],       │ │
│ │                  task=None, run=None, space=None, log_level=None, debug=False,               │ │
│ │                  reset_database=False, bids_filter_file=None, non_linear_coreg=False,        │ │
│ │                  model='1to6')                                                               │ │
│ │           argv = [                                                                           │ │
│ │                  │   '/opt/miniconda-latest/envs/bidsmreye/bin/bidsmreye',                   │ │
│ │                  │   '--action',                                                             │ │
│ │                  │   'all',                                                                  │ │
│ │                  │   '/data',                                                                │ │
│ │                  │   '/out',                                                                 │ │
│ │                  │   'participant',                                                          │ │
│ │                  │   '--participant_label',                                                  │ │
│ │                  │   '01'                                                                    │ │
│ │                  ]                                                                           │ │
│ │      log_level = 2                                                                           │ │
│ │ log_level_name = 'WARNING'                                                                   │ │
│ │         parser = MuhParser(prog='bidsmreye', usage=None, description='BIDS app using         │ │
│ │                  deepMReye to decode eye motion for fMRI time series data.',                 │ │
│ │                  formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', │ │
│ │                  add_help=True)                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/bidsmreye.py:126 in   │
│ bidsmreye                                                                                        │
│                                                                                                  │
│   123 │   if action in {"all", "generalize"} and isinstance(cfg.model_weights_file, str):        │
│   124 │   │   cfg.model_weights_file = download(cfg.model_weights_file)                          │
│   125 │                                                                                          │
│ ❱ 126 │   dispatch(analysis_level=analysis_level, action=action, cfg=cfg)                        │
│   127                                                                                            │
│   128                                                                                            │
│   129 def dispatch(analysis_level: str, action: str, cfg: Config) -> None:                       │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │             action = 'all'                                                                   │ │
│ │     analysis_level = 'participant'                                                           │ │
│ │           bids_dir = '/data'                                                                 │ │
│ │        bids_filter = None                                                                    │ │
│ │   bids_filter_file = None                                                                    │ │
│ │                cfg = Config(                                                                 │ │
│ │                      │   input_dir=PosixPath('/data'),                                       │ │
│ │                      │   output_dir=PosixPath('/out/bidsmreye'),                             │ │
│ │                      │   subjects=['01'],                                                    │ │
│ │                      │   space=['T1w', 'MNI152NLin2009cAsym', 'fsnative'],                   │ │
│ │                      │   task=['exp'],                                                       │ │
│ │                      │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                │ │
│ │                      │                                                                       │ │
│ │                      model_weights_file=PosixPath('/home/neuro/bidsMReye/models/dataset_1to… │ │
│ │                      │   bids_filter={                                                       │ │
│ │                      │   │   'bold': {                                                       │ │
│ │                      │   │   │   'datatype': 'func',                                         │ │
│ │                      │   │   │   'suffix': '^bold$',                                         │ │
│ │                      │   │   │   'extension': 'nii.*',                                       │ │
│ │                      │   │   │   'task': '^exp$',                                            │ │
│ │                      │   │   │   'space': '^T1w$|^MNI152NLin2009cAsym$|^fsnative$',          │ │
│ │                      │   │   │   'subject': '01',                                            │ │
│ │                      │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                               │ │
│ │                      │   │   },                                                              │ │
│ │                      │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                   │ │
│ │                      │   │   'no_label': {                                                   │ │
│ │                      │   │   │   'desc': 'nolabel',                                          │ │
│ │                      │   │   │   'suffix': '^bidsmreye$$',                                   │ │
│ │                      │   │   │   'extension': 'npz'                                          │ │
│ │                      │   │   },                                                              │ │
│ │                      │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},      │ │
│ │                      │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}   │ │
│ │                      │   },                                                                  │ │
│ │                      │   debug=False,                                                        │ │
│ │                      │   reset_database=False,                                               │ │
│ │                      │   non_linear_coreg=False                                              │ │
│ │                      )                                                                       │ │
│ │              debug = False                                                                   │ │
│ │     log_level_name = 'WARNING'                                                               │ │
│ │ model_weights_file = '1to6'                                                                  │ │
│ │   non_linear_coreg = False                                                                   │ │
│ │         output_dir = '/out'                                                                  │ │
│ │  participant_label = ['01']                                                                  │ │
│ │     reset_database = False                                                                   │ │
│ │                run = None                                                                    │ │
│ │              space = None                                                                    │ │
│ │               task = None                                                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/bidsmreye.py:139 in   │
│ dispatch                                                                                         │
│                                                                                                  │
│   136 │                                                                                          │
│   137 │   elif analysis_level == "participant":                                                  │
│   138 │   │   if action == "all":                                                                │
│ ❱ 139 │   │   │   prepare_data(cfg)                                                              │
│   140 │   │   │   generalize(cfg)                                                                │
│   141 │   │   elif action == "prepare":                                                          │
│   142 │   │   │   prepare_data(cfg)                                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │         action = 'all'                                                                       │ │
│ │ analysis_level = 'participant'                                                               │ │
│ │            cfg = Config(                                                                     │ │
│ │                  │   input_dir=PosixPath('/data'),                                           │ │
│ │                  │   output_dir=PosixPath('/out/bidsmreye'),                                 │ │
│ │                  │   subjects=['01'],                                                        │ │
│ │                  │   space=['T1w', 'MNI152NLin2009cAsym', 'fsnative'],                       │ │
│ │                  │   task=['exp'],                                                           │ │
│ │                  │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                    │ │
│ │                  │                                                                           │ │
│ │                  model_weights_file=PosixPath('/home/neuro/bidsMReye/models/dataset_1to6.h5… │ │
│ │                  │   bids_filter={                                                           │ │
│ │                  │   │   'bold': {                                                           │ │
│ │                  │   │   │   'datatype': 'func',                                             │ │
│ │                  │   │   │   'suffix': '^bold$',                                             │ │
│ │                  │   │   │   'extension': 'nii.*',                                           │ │
│ │                  │   │   │   'task': '^exp$',                                                │ │
│ │                  │   │   │   'space': '^T1w$|^MNI152NLin2009cAsym$|^fsnative$',              │ │
│ │                  │   │   │   'subject': '01',                                                │ │
│ │                  │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                                   │ │
│ │                  │   │   },                                                                  │ │
│ │                  │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                       │ │
│ │                  │   │   'no_label': {                                                       │ │
│ │                  │   │   │   'desc': 'nolabel',                                              │ │
│ │                  │   │   │   'suffix': '^bidsmreye$$',                                       │ │
│ │                  │   │   │   'extension': 'npz'                                              │ │
│ │                  │   │   },                                                                  │ │
│ │                  │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},          │ │
│ │                  │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}       │ │
│ │                  │   },                                                                      │ │
│ │                  │   debug=False,                                                            │ │
│ │                  │   reset_database=False,                                                   │ │
│ │                  │   non_linear_coreg=False                                                  │ │
│ │                  )                                                                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/prepare_data.py:187   │
│ in prepare_data                                                                                  │
│                                                                                                  │
│   184 │                                                                                          │
│   185 │   for subject_label in subjects:                                                         │
│   186 │   │                                                                                      │
│ ❱ 187 │   │   process_subject(cfg, layout_in, layout_out, subject_label)                         │
│   188                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │           cfg = Config(                                                                      │ │
│ │                 │   input_dir=PosixPath('/data'),                                            │ │
│ │                 │   output_dir=PosixPath('/out/bidsmreye'),                                  │ │
│ │                 │   subjects=['01'],                                                         │ │
│ │                 │   space=['T1w', 'MNI152NLin2009cAsym', 'fsnative'],                        │ │
│ │                 │   task=['exp'],                                                            │ │
│ │                 │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                                     │ │
│ │                 │                                                                            │ │
│ │                 model_weights_file=PosixPath('/home/neuro/bidsMReye/models/dataset_1to6.h5'… │ │
│ │                 │   bids_filter={                                                            │ │
│ │                 │   │   'bold': {                                                            │ │
│ │                 │   │   │   'datatype': 'func',                                              │ │
│ │                 │   │   │   'suffix': '^bold$',                                              │ │
│ │                 │   │   │   'extension': 'nii.*',                                            │ │
│ │                 │   │   │   'task': '^exp$',                                                 │ │
│ │                 │   │   │   'space': '^T1w$|^MNI152NLin2009cAsym$|^fsnative$',               │ │
│ │                 │   │   │   'subject': '01',                                                 │ │
│ │                 │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                                    │ │
│ │                 │   │   },                                                                   │ │
│ │                 │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                        │ │
│ │                 │   │   'no_label': {                                                        │ │
│ │                 │   │   │   'desc': 'nolabel',                                               │ │
│ │                 │   │   │   'suffix': '^bidsmreye$$',                                        │ │
│ │                 │   │   │   'extension': 'npz'                                               │ │
│ │                 │   │   },                                                                   │ │
│ │                 │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},           │ │
│ │                 │   │   'eyetrack_qc': {'suffix': '^eyetrack$$', 'extension': 'json'}        │ │
│ │                 │   },                                                                       │ │
│ │                 │   debug=False,                                                             │ │
│ │                 │   reset_database=False,                                                    │ │
│ │                 │   non_linear_coreg=False                                                   │ │
│ │                 )                                                                            │ │
│ │     layout_in = BIDS Layout: .../data | Subjects: 37 | Sessions: 0 | Runs: 327               │ │
│ │    layout_out = BIDS Layout: .../out/bidsmreye | Subjects: 2 | Sessions: 0 | Runs: 2         │ │
│ │ subject_label = '01'                                                                         │ │
│ │      subjects = ['01']                                                                       │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/prepare_data.py:153   │
│ in process_subject                                                                               │
│                                                                                                  │
│   150 │   │   deepmreye_mask_name = get_deepmreye_filename(layout_in, img, "mask")               │
│   151 │   │   move_file(deepmreye_mask_name, mask_name)                                          │
│   152 │   │                                                                                      │
│ ❱ 153 │   │   save_sampling_frequency_to_json(layout_out, img)                                   │
│   154 │   │                                                                                      │
│   155 │   │   combine_data_with_empty_labels(layout_out, mask_name)                              │
│   156                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                    bf = [                                                                    │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-1_space-MNI152NLin2009cAsym_… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-1_space-T1w_desc-preproc_bol… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-2_space-MNI152NLin2009cAsym_… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-2_space-T1w_desc-preproc_bol… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-3_space-MNI152NLin2009cAsym_… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-3_space-T1w_desc-preproc_bol… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-4_space-MNI152NLin2009cAsym_… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-4_space-T1w_desc-preproc_bol… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-5_space-MNI152NLin2009cAsym_… │ │
│ │                         │                                                                    │ │
│ │                         '/data/sub-01/func/sub-01_task-exp_run-5_space-T1w_desc-preproc_bol… │ │
│ │                         │   ... +2                                                           │ │
│ │                         ]                                                                    │ │
│ │                   cfg = Config(                                                              │ │
│ │                         │   input_dir=PosixPath('/data'),                                    │ │
│ │                         │   output_dir=PosixPath('/out/bidsmreye'),                          │ │
│ │                         │   subjects=['01'],                                                 │ │
│ │                         │   space=['T1w', 'MNI152NLin2009cAsym', 'fsnative'],                │ │
│ │                         │   task=['exp'],                                                    │ │
│ │                         │   run=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],                             │ │
│ │                         │                                                                    │ │
│ │                         model_weights_file=PosixPath('/home/neuro/bidsMReye/models/dataset_… │ │
│ │                         │   bids_filter={                                                    │ │
│ │                         │   │   'bold': {                                                    │ │
│ │                         │   │   │   'datatype': 'func',                                      │ │
│ │                         │   │   │   'suffix': '^bold$',                                      │ │
│ │                         │   │   │   'extension': 'nii.*',                                    │ │
│ │                         │   │   │   'task': '^exp$',                                         │ │
│ │                         │   │   │   'space': '^T1w$|^MNI152NLin2009cAsym$|^fsnative$',       │ │
│ │                         │   │   │   'subject': '01',                                         │ │
│ │                         │   │   │   'run': '1|2|3|4|5|6|7|8|9|10'                            │ │
│ │                         │   │   },                                                           │ │
│ │                         │   │   'mask': {'suffix': 'mask', 'extension': 'p'},                │ │
│ │                         │   │   'no_label': {                                                │ │
│ │                         │   │   │   'desc': 'nolabel',                                       │ │
│ │                         │   │   │   'suffix': '^bidsmreye$$',                                │ │
│ │                         │   │   │   'extension': 'npz'                                       │ │
│ │                         │   │   },                                                           │ │
│ │                         │   │   'eyetrack': {'suffix': '^eyetrack$$', 'extension': 'tsv'},   │ │
│ │                         │   │   'eyetrack_qc': {                                             │ │
│ │                         │   │   │   'suffix': '^eyetrack$$',                                 │ │
│ │                         │   │   │   'extension': 'json'                                      │ │
│ │                         │   │   }                                                            │ │
│ │                         │   },                                                               │ │
│ │                         │   debug=False,                                                     │ │
│ │                         │   reset_database=False,                                            │ │
│ │                         │   non_linear_coreg=False                                           │ │
│ │                         )                                                                    │ │
│ │   deepmreye_mask_name = PosixPath('/data/sub-01/func/mask_sub-01_task-exp_run-1_space-MNI15… │ │
│ │ deepmreye_mask_report = PosixPath('/data/sub-01/func/report_sub-01_task-exp_run-1_space-MNI… │ │
│ │                   img = '/data/sub-01/func/sub-01_task-exp_run-1_space-MNI152NLin2009cAsym_… │ │
│ │             layout_in = BIDS Layout: .../data | Subjects: 37 | Sessions: 0 | Runs: 327       │ │
│ │            layout_out = BIDS Layout: .../out/bidsmreye | Subjects: 2 | Sessions: 0 | Runs: 2 │ │
│ │             mask_name = PosixPath('/out/bidsmreye/sub-01/func/sub-01_task-exp_run-1_space-M… │ │
│ │           report_name = PosixPath('/out/bidsmreye/sub-01/func/sub-01_task-exp_run-1_space-M… │ │
│ │         subject_label = '01'                                                                 │ │
│ │           this_filter = {                                                                    │ │
│ │                         │   'datatype': 'func',                                              │ │
│ │                         │   'suffix': '^bold$',                                              │ │
│ │                         │   'extension': 'nii.*',                                            │ │
│ │                         │   'task': '^exp$',                                                 │ │
│ │                         │   'space': '^T1w$|^MNI152NLin2009cAsym$|^fsnative$',               │ │
│ │                         │   'subject': '01',                                                 │ │
│ │                         │   'run': '1|2|3|4|5|6|7|8|9|10'                                    │ │
│ │                         }                                                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/miniconda-latest/envs/bidsmreye/lib/python3.9/site-packages/bidsmreye/prepare_data.py:164   │
│ in save_sampling_frequency_to_json                                                               │
│                                                                                                  │
│   161 │   sampling_frequency = header.get_zooms()[3]                                             │
│   162 │   if sampling_frequency <= 1:                                                            │
│   163 │   │   log.warning(f"Found a repetition time of {sampling_frequency} seconds.")           │
│ ❱ 164 │   create_sidecar(layout_out, img, SamplingFrequency=1 / float(sampling_frequency))       │
│   165                                                                                            │
│   166                                                                                            │
│   167 def prepare_data(cfg: Config) -> None:                                                     │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │           func_img = <nibabel.nifti1.Nifti1Image object at 0x7fd0843720a0>                   │ │
│ │             header = <nibabel.nifti1.Nifti1Header object at 0x7fd084372160>                  │ │
│ │                img = '/data/sub-01/func/sub-01_task-exp_run-1_space-MNI152NLin2009cAsym_res… │ │
│ │         layout_out = BIDS Layout: .../out/bidsmreye | Subjects: 2 | Sessions: 0 | Runs: 2    │ │
│ │ sampling_frequency = 0.0                                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ZeroDivisionError: float division by zero

Any ideas why? Everything looks ok in my BOLD JSON sidecar file. including the repetition time field.

Thanks in advance,
Andrea

@Remi-Gau Remi-Gau added this to the 0.4.0 milestone Aug 1, 2024
@Remi-Gau Remi-Gau added the bug Something isn't working label Aug 1, 2024
@Remi-Gau
Copy link
Contributor Author

Remi-Gau commented Aug 5, 2024

seems due to the fact that the nifti header does not contain the proper value for the repetition time and contains 0 instead

will fix by relying on the BIDS metadata instead

@costantinoai
Copy link

As an update on this, it does not seem like the problem is resolved on the Docker image (which, by the way, fails also in seeing/initializing the GPU on my machine, while other images don't).

The problem is not there if I install using pip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants