Factor out irasa funs and provide a consistent interface #37
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 PR leaves the
_compute_psd_welch
and_compute_sgramm
functions in theirirasa_utils.py
file but at the same time introduces a consistent and convenient interface for functions that_gen_irasa
can use.The idea is basically that
_gen_irasa
request a function with a specific set of parameters (which is specified inutils/types.py
so mypy catches it). The signature of this function is constraint to be:The actutal irasa functions (like
irasa
orirasa_sprint
) the generate a lightweight local function following this exact signature and call the respective function that is imported fromirasa_utils.py
. So, the local function consists only of the definition and the immediatly returned call to the low-level function like this example inirasa
:As you see, the responsibility to handle the kwargs for the low-level functions is now on the local functions and not anymore on the
_gen_irasa
because it does not really need to care about these....This is going to make any efforts of porting it to cython much easier btw.
closes #35