Skip to content

Refactoring around checking for scipy  #324

@bcipolli

Description

@bcipolli

In refactoring imageclasses.py to distribute info into individual image classes (#323), I want to implement a simple function to check if scipy exists. I see that scipy checking is a bit varied across the code:

  • Different files define their own function / decorators (imageclasses.py, tests/test_spm99analyze.py, tests/test_image_load_save.py, tests/test_image_api.py, etc), using different methods to check (ImportError, optional_package, etc)
  • Some tests pass if scipy doesn't exist (even if required); other tests are skipped if scipy doesn't exist.

I suggest the following cleanup:

  • Create a file utils.py, and add have_scipy() as a function.
  • Use this function everywhere (in image classes where scipy status determines if they're makeable, in tests to determine if they're skippable, and other conditional logic)

Posting here just to double-check before doing the work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions