Skip to content

Add test for SRM save/load - #1

Merged
mihaic merged 4 commits into
me-sh:save_srmfrom
snastase:save_srm
Oct 13, 2020
Merged

mihaic merged 4 commits into
me-sh:save_srmfrom
snastase:save_srm

Conversation

@snastase

Copy link
Copy Markdown

I made a few minor adjustments to the wording and variable names in the save/load functions. I also added a simple test to test_srm.py that saves a fitted SRM object to tmp_path and reloads it and verifies the attributes against the original. Can someone check that I'm using tmp_path properly? As far as I understand, this save implementation is limited to brainiak.funcalign.srm.SRM—but it would be nice to extend this to the other SRM implementations. Might require a more flexible way to aggregate the variable attributes of different SRM implementations.

Comment thread tests/funcalign/test_srm.py Outdated
print("Test: different number of samples per subject")

# Check save/load functionality for fitted SRM
srm_fn = tmp_path

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You also need to add tmp_path as an argument to the function:

def test_can_instantiate(tmp_path):

Also, tmp_path is a directory, so you need a path to a file within, for example:

srm_fn = tmp_path / "srm.npz"

Finally, I usually read fn as function. How about srm_path?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay, sounds good—I think I got all that fixed up

@mihaic
mihaic merged commit d65f776 into me-sh:save_srm Oct 13, 2020
@me-sh

me-sh commented Oct 20, 2020 •

Copy link
Copy Markdown
Owner

merged

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.

3 participants