Closed mmyros closed 3 years ago
Hi @mmyros, this is great. I really appreciate this addition. It is something I've meant to get around to for a long time and I think it really improves the usability of the package.
Couple of thoughts:
What do you think?
Hi Eric, I'm glad this is helpful! Great suggestions, I will try to implement one or both of these.
For #1, maybe it's best to create a separate function for multitaper + connectivity that takes two sets of kwargs. The xarray part only really needs the output array and MT object, so it can be a separate function for those who prefer to calculate those separately. I'm just concerned that including that many arguments will have a high cognitive complexity.
Do you think #2 could be done with super()
? Otherwise I can try adding them as coordinates.
I do think a separate function is best. I initially separated the multitaper transform and connectivity because I was thinking of implementing a wavelet transform as well.
Perhaps for 1, it could be a decorator for all the connectivity functions? That way everything gets spit out as a xarray object. Again, more aspirational though, just having a function to start with is great.
And for 2, I would just propagate them as attributes on the xarray DataArray (See http://xarray.pydata.org/en/stable/data-structures.html)
Decorator sounds intriguing. I'm looking forward to your comments re: 2900e7f as that implements attributes and separates out multitaper_connectivity
and connectivity_to_xarray
. multitaper_connectivity
now calls connectivity_to_xarray()
This iteration skips group_delay and canonical_coherence, since canonical_coherence
has one more dimension than the rest. This can of course be fixed, but maybe at a later time. Could you make sure that the rest of the outputs checks out? Thanks for the comments!
Thanks @mmyros !
spectral_connectivity.multitaper_connectivity()
usesMultitaper
andConnectivity
and returns xarray output. This allows for one-liner faceted plots. See example at the end ofTutorial_On_Simulated_Examples.ipynb