Skip to content

Ensure the dataset mandatory attributes are present in data instantiation #302

@jhlegarreta

Description

@jhlegarreta

What would you like to see added in this software?

Type annotation alone do not force errors when instantiating the items (e.g. data instances) without the properties that are required for them to work properly (gradients, etc.). These attributes need to have the default=Nonefield because the base class already has some optional attributes, and no optional attribute can be followed by a mandatory one.

e.g. The following statement does not raise any error, despite gradients being necessary for a DWI instance to work for NiFreeze purposes (although not for the test):

nifreeze/test/test_model.py

Lines 101 to 105 in adf71da

data = DWI(
dataobj=rng.normal(size=(*_S0.shape, 10)),
bzero=_clipped_S0,
brainmask=mask,
)

Thus, some refactoring is needed to ensure that these properties are present at initialization and the appropriate tests would be required.
   

Do you have any interest in helping implement the feature?

Yes

Additional information / screenshots

Related to PRs #287, #289 and #290.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions