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

[REF] Merge CLI into workflows #100

Merged
merged 7 commits into from
Jul 30, 2018
Merged

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Jul 29, 2018

This reorganization would make it easier to update workflows, as the argument parser and the workflow function are consolidated in one file for each workflow (instead of spread between tedana.cli and tedana.workflows.

Changes proposed in this pull request:

  • Move argument parsing for workflows from tedana.cli to tedana.workflows. Each workflow submodule now contains a function named [name]_workflow (e.g., tedana_workflow and t2smap_workflow) as well as private functions such as _main and _get_parser for the argument parsing and CLI.
  • Update setup.py to call the _main functions in the workflows for the CLI.
  • Update tests to use new workflow naming convention.
  • Update docs to match new workflow and CLI organizations.

This could make it easier to update/add workflows. Instead of having to
manage two files, we just need to manage one (although we still need to
update the parser in step with the workflow and its docstring.
@emdupre
Copy link
Member

emdupre commented Jul 30, 2018

We'll need the CI passing before merging, but I don't have a strong feeling on this reorganization either way. I can see the appeal of it, though, and am happy to move forward if it makes things more intuitive ! I imagine it will also make @rmarkello happy, since he thinks we have too many modules 😄

Workflows can now take in a filename for data (i.e., a string) in
addition to a list of files.
@codecov
Copy link

codecov bot commented Jul 30, 2018

Codecov Report

Merging #100 into master will decrease coverage by 0.39%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #100     +/-   ##
=========================================
- Coverage   45.81%   45.42%   -0.4%     
=========================================
  Files          29       28      -1     
  Lines        1602     1585     -17     
=========================================
- Hits          734      720     -14     
+ Misses        868      865      -3
Impacted Files Coverage Δ
tedana/tests/test_model_monoexponential.py 100% <ø> (ø) ⬆️
tedana/tests/test_model_combine.py 100% <ø> (ø) ⬆️
tedana/tests/test_model_fit.py 100% <ø> (ø) ⬆️
tedana/tests/test_tedana.py 0% <0%> (ø) ⬆️
tedana/workflows/__init__.py 100% <100%> (ø) ⬆️
tedana/tests/test_t2smap.py 100% <100%> (ø) ⬆️
tedana/workflows/tedana.py 11.86% <14.28%> (+0.47%) ⬆️
tedana/workflows/t2smap.py 71.64% <31.81%> (-19.67%) ⬇️
tedana/workflows/parser_utils.py 40% <40%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b9687d...b539b68. Read the comment docs.

@@ -28,7 +27,7 @@ def compare_nifti(fn, test_dir, res_dir):
"""
res_fp = (res_dir/fn).as_posix()
test_fp = (test_dir/fn).as_posix()
assert np.allclose(nb.load(res_fp).get_data(), nb.load(test_fp).get_data())
assert np.allclose(nib.load(res_fp).get_data(), nib.load(test_fp).get_data())
Copy link
Member

Choose a reason for hiding this comment

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

Are we consistently using nib instead of nb, now ? I just want to make sure we don't end up with conflicting imports !

Copy link
Member Author

Choose a reason for hiding this comment

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

I can change it back, but my understanding was that nib was the alias used in the nibabel documentation (e.g., here). On the other hand, while they may use that alias in at least some of their documentation, I've never seen anything official about it, so we can use nb if you prefer.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like that's our only import of it for now, and I know I'm the minority opinion so happy to change :) Just wanted to check !

@emdupre
Copy link
Member

emdupre commented Jul 30, 2018

This LGTM ! Ready to merge, @tsalo ?

@tsalo
Copy link
Member Author

tsalo commented Jul 30, 2018

I think so, unless anyone has any concerns.

@emdupre
Copy link
Member

emdupre commented Jul 30, 2018

I think @rmarkello is most likely to have feedback here (since he was involved in the original organization decisions) !

@rmarkello
Copy link
Member

Love it! Thrilled to see consolidation of these modules. On a relatively cursory glance it looks good to me, but if you'd like me to do a line-by-line I can. It seems like @emdupre already checked it over though, so I'm happy to see it merged.

@emdupre
Copy link
Member

emdupre commented Jul 30, 2018

💯 Merging, then ! Thanks everyone !

@emdupre emdupre merged commit 74e23e2 into ME-ICA:master Jul 30, 2018
@tsalo tsalo deleted the consolidate-cli branch July 30, 2018 23:52
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