-
Notifications
You must be signed in to change notification settings - Fork 25
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
Comparison to AxisArrays #38
Comments
I've wondered a bit about this myself. I've leaned away from it because of the type piracy point. I think the more general point is that not all of the things one wants to do with constant-sample-rate signals make sense with the more general One possibility, which would still have many of the advantages you list above, is to define I like the idea of wrapping an AxisArray in the long-term, but I'd be wary of it short term, because there are still some tricky issues in working with AxisArrays. I use them a fair amount in some code where I have 4D arrays that model early cortical auditory responses. I've run into a number of basic functions that don't work very conveniently with AxisArrays, mostly because broadcasting returns plain Arrays (which Julia 0.7 should make fixable) or because of some issue with unitful axis values (which is listed as an issue in AxisArrays, and will presumably be fixed). I also have some issues with the overall ease of use of defining and slicing by a named axes, which I haven't entirely thought through and would like to provide some constructive criticism about once I have. |
My two cents worth of thoughts on this: I experimented with |
There's definitely a lot of overlap between
SampleBuf
andAxisArray
. When I originally started SampledSignals.jl, AxisArrays.jl was younger and more experimental and seemed like it might be more general than what I needed. I could provide a simpler API by making the assumption that we're strictly talking about multi-channel regularly-sampled data across time or frequency, with each channel being a column.That said, I figured it was worth re-visiting this overlap, particularly in light of the work that @haberdashPI has been doing to use the same Interval and Unitful package that AxisArrays uses. Either we figure out that AxisArrays would work well for this use-case or whether we just document why it makes sense to keep doing what we're doing.
Advantages of keeping
SampleBuf
separateAxisArray
you need to dofoo[atindex(0s..1s, 1)]
, whereas for aSampleBuf
it's justfoo[0s..1s]
)SampleBuf(data, samplerate)
is all you need, vsA = AxisArray(data, Axis{:time}(0s:1s/samplerate:60s), Axis{:channel}([1, 2]))
domain
,nframes
, as well as the variety of resampling/mixing/promotion behaviors we've talked about in Explore promotion mechanism #30 and Review concatenation strategies #31Advantages of merging with AxisArrays
foospec = barspec[100Hz..5kHz]
and then further refine withfoospec[1kHz..2kHz]
There might be some middle ground where we have type alias like
const SampleBuf{T, N, D, I1, I2} = AxisArray{T, N, D, Tuple{Axis{:time, I1}, Axis{:channel, I2}}}
and define more convenient constructors and methods on it, but I worry a bit about the complexity of nested type parameters and aliases being hard to extend and maintain (might not be too bad though...). Also doing anything promotion-related on these types would be type piracy (though less likely to affect anyone because they would have to unwittingly create an AxisArray with:time
and:channel
axes).cc @mbauman
The text was updated successfully, but these errors were encountered: