-
Notifications
You must be signed in to change notification settings - Fork 3
Add resampling extension #26
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
+ Coverage 90.00% 90.74% +0.74%
==========================================
Files 7 8 +1
Lines 150 162 +12
==========================================
+ Hits 135 147 +12
Misses 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Requiring construction of the interpolator prior to using Let me know what you think |
Co-authored-by: Chris Garling <chris.t.garling@gmail.com>
Co-authored-by: Chris Garling <chris.t.garling@gmail.com>
|
Thanks! I like how we give users the choice to go either route now. I added Interpolations.jl as another interpolator extension to be more in line with what PhotometricFilters.jl uses, and to start playing around with what a uniform interface might look like between these two extensions. Things are a bit fiddly right now, but I think it's starting to go in the right direction. What do you think about this current design? 6426edb |
|
I'm actually reconsidering the method that automatically constructs the interpolator; now that I see how it's inconvenient for Interpolations.jl (because of how the interpolation types are set up there), I don't like it as much. I wonder if we can do this without the need to write the extensions. I added a I made it so when it's called to resample the underlying spectrum, it returns a new spec = SpectrumResampler(...)
for i in 1:N
some_spectrum = <load spectrum from file>
spec = spec(wave(some_spectrum)) # Resample `spec` at new wavelengths in `some_spectrum`
<do stuff>
endthe Probably we should make I'm also not committed to whether it should just return a spectrum or a |
|
Hi Chris, sg! I like the bundling of the resampled spectra and its interpolator. If folks are cool with just bringing their own interpolator, then that def makes things simpler and no extensions are needed. I just made them because I wasn't sure how lazy spectroscopists were =p. If they're cool with bringing their own interpolator, then this sounds like a win all around in terms of maintainability and expressiveness. Will start filling things out with this new design and start playing around with the return types |
|
My design is sort of similar to that of specutils (see here) but they require the use of their own interpolation methods where we can, hopefully, support interpolations provided by any other package. We should provide examples with specific interpolation methods for clarity though |
|
Ok, got an example going here. I decided to drop |
|
For the indexing, I think I want to try exploring #24 a bit more, and hopefully get that in first if we land on a design that seems ok |
|
Thanks for adding this! A small nitpick but it seems to me like we are duplicating examples in the docs file and in the My preference is to place all examples possible in a jldoctest on the actual docstring. This enables you to see the examples when you query the docstring from the REPL, and you can run the doctests as part of the test suite so that the doctests are counted in the test coverage. Then we just include the docstring in the documentation page. I expanded the examples in the docstring to cover both Interpolations.jl and DataInterpolations.jl. My preference would be to replace the @repl blocks with a sufficiently detailed docstring for the I think blocks like @repl and @example are best used when you want to show something that can't be well-represented in the text-only docstring. A good example would be if we wanted to compare how different interpolation algorithms deal with sharp lines in spectra -- we could plot the original spectrum and several different interpolations to compare them. This is partially a style choice so let me know what you think! |
Saves allocations over using `spectrum` probably due how the `meta` dict is handled internally.
|
For now using |
|
Makes sense, thanks! Added this note to the unification re-work |
|
Cool, things are looking green so far. I added a to-do in the parent comment to make sure things still work alright with #24 |
|
After playing around with the spectrum unification PR a bit, I think I am leaning back towards This would reduce the number of additional methods we need to define when doing algebra between spectra, for example, and also looks to be the same design decision that specutils went with. |
|
I like that |
|
Ok, looking all green here. I guess the next step will be to merge in #24 after we wrap it up |
|
Yep, merging this to prep for Fergus' X-ray build out |
Closes: #27
Depends on: #24
Usage
Design questions
resample/resample!with a pre-baked interpolator so that things likeresample(spec, new_wave)work OOTB? This would add an interpolation depresult.fluxwork, or is it preferable to stick with public getters likeSpectra.flux(result::SpectrumResampler)?To-do
XSpectrumtypes #24 is in. Should work on allXSpectrums