osl_func utility: run any function from the command line #257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a utility function addition to run any osl function (with limitations) from the terminal command line, i.e.,
osl_func function_name arg1 arg2
.Example:
osl_func osl.source_recon.rhino.polhemus.delete_headshape_points None None polhemus_headshape.txt
will iteratively load the (sub-) module until it reaches the function, and then run the function with the function arguments. This example will runosl.source_recon.rhino.polhemus.delete_headshape_points(recon_dir=None, subject=None, polhemus_headshape_file='polhemus_headshape.txt')
.This is especially useful for interactive functions, which often don't work very well in Jupyter Notebook. Because I expect that this is an issue that many people will face, I thought this would be useful (so users don't have to make separate scripts for this purpose every time). The main limitation currently is that you can only use functions with string, boolean, or None arguments.