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

_storage_scheme -> _default_storage_scheme #716

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rijobro
Copy link
Contributor

@rijobro rijobro commented Jun 12, 2020

fixes #715.

@evgueni-ovtchinnikov how about this. Change _storage_scheme to _default_storage_scheme. If using the static method, return the default. However, if the object exists, return the corresponding type.

I've added the test, which fails with the old code, but passes with these changes:

    AcquisitionData.set_storage_scheme("memory")
    ad = AcquisitionData(raw_data_file)
    AcquisitionData.set_storage_scheme("file")
    test.check_if_equal("memory", ad.get_storage_scheme())

@KrisThielemans
Copy link
Member

strategy seems ok to me, but is it necessary to change the C++ name (you don't on the python side)? One more thing that breaks backwards compatibility, for not so good reasons?

@rijobro
Copy link
Contributor Author

rijobro commented Jun 12, 2020

I can leave the naming as it is if you'd like, but it seems confusing to me.

Keeping the old name makes it unclear as to whether you're returning the default scheme or the scheme for the current object.

I didn't change the naming on the python side because it handles both cases - if object is None, return default scheme, else return scheme for specific object.

Thinking about it, I should probably update the matlab side...

@KrisThielemans
Copy link
Member

Keeping the old name makes it unclear as to whether you're returning the default scheme or the scheme for the current object.

I didn't change the naming on the python side because it handles both cases - if object is None, return default scheme, else return scheme for specific object.

I don't see the difference between C++ and Python in that respect. PETAcquisitionData::storage_scheme() has no object, so will return the default. acq_data.storage_scheme() will return the value for the object. That's what you do in Python as well:

AcquisitionData.set_storage_scheme(scheme)

I agree that the default_storage_scheme() name might be better, but it does need some more changes in demos and UserGuide (ok, the latter will have to be updated in any case!).

In any case, I want to have the same names in Python/MATLAB/C++.

Copy link
Member

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs changes in UsersGuide and CHANGES. see also comment

Comment on lines +111 to +112
temp = PET.AcquisitionData();
temp.set_storage_scheme('memory');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be amazed if this changes the default. In C++,Python you need PET.AcquisitionData.set_storage_scheme

@KrisThielemans
Copy link
Member

@evgueni-ovtchinnikov is this PR still valid (I'm sure it'd need changes). If so, please assign to 3.1

@evgueni-ovtchinnikov evgueni-ovtchinnikov modified the milestones: v3.1, v4.0 Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing storage scheme of AcquisitionData
3 participants