nipreps / eddymotion

Open-source eddy-current and head-motion correction for dMRI.
https://nipreps.org/eddymotion
Apache License 2.0
13 stars 16 forks source link

Import in `BaseModel.__init__` method instead of at the top of the file #206

Open jhlegarreta opened 5 months ago

jhlegarreta commented 5 months ago

What happened?

The base imports a module:

from importlib import import_module

within the __iinit__ method of the BaseModel class: https://github.com/nipreps/eddymotion/blob/main/src/eddymotion/model/base.py#L135

If that is done for performance reasons, would lazy loading help so that the import is put at the top of the file (if that is relevant)?

What command did you use?

None.

What version of the software are you running?

main

How are you running this software?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

Not applicable.

Additional information / screenshots

No response

oesteban commented 4 months ago

This is intended to allow using virtually any DIPY model with a minimal boilerplate. I agree it delays errors if DIPY is not installed or in an incompatible version. That could be tested at the top, certainly.