-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
More options for the interpolation of sparse spectra #52
Comments
https://github.com/timholy/Grid.jl If you go to http://iainnz.github.io/packages.julialang.org/, hit Ctrl-F and type interp you will find it. |
Re extrapolation, that's something currently under discussion: timholy/Grid.jl#37 |
Thanks, @timholy My (poor, but working) implementation enables the user to choose from several boundary conditions, like natural (zero 2nd order derivatives), clamped (arbitrary 1st order derivatives), curvature-adjusted (arbitrary 2nd order derivatives) and not-a-knot conditions. Everything is just tailored to the 1-dimensional case of spectral representations. Maybe that is not a smart move on my part. I’ll try out how your implementation works. |
It would just be strange to contribute interpolation algorithms to a package devoted to color, when there is an interpolation package. Why not contribute them to Grid? |
@timholy I guess you’re right. I was just playing with this idea because e.g. linear interpolation is implemented at least twice in |
I hadn't noticed it's here. That said, linear interpolation is so trivial, it's not crazy to have local definitions. But once you start adding boundary conditions, higher-order interpolation, etc, it makes more sense to use a common infrastructure. Regarding implementation, Grid doesn't have to be a B-splines-only package. You may find timholy/Grid.jl#38 inspirational (though complex) if you're looking for really fast implementations. |
I'll close this in favor of continuing the conversation over at Grid. |
It would be really nice to do non-linear interpolation in |
Yes, that sounds reasonable. |
Sorry I'm so late; I've been traveling this summer. It's worth mentioning that the ASTM outlines very specific interpolation instructions when integrating spectra for tristimulus value calculation (ASTM E2022). This is specifically to try to correct for bandpass error in a wide-band measurement device. However, I'm not sure if this is support we really need or not (in my experience, this correction is usually ignored). |
This is for bandpass correction, yes. Most spectra I found already have the correction implemented in the measurement device software if these measurements were taken with high-end spectrophotometers. Some measurements I found were made with more “exotic” devices like tunable liquid crystal filters, glass filters (like the multispectral MER pancam images) and such. I think in academic use the bandpass and other appropriate corrections are already taken into consideration. |
Very good points @m-lohmann. I guess I just brought it up because It was on my mind; I had spent the last weeks of class before the summer calibrating an LCTF spectral imaging system, and this came up in conversation. You're completely right that commercial devices should already account for this. |
I’m opening this issue because I could not find any package working similar to MATLAB’s interp functions. So I started to write my own.
The reason is that spectral data only exists as sparse datasets where interpolation is needed to produce good colorimetric results. As far as I can see,
colormatch.jl
only provides us with linear interpolation, which I find quite surprising in the context of producing color matching functions.In colorimetry cubic interpolation is the most common and recommended way to deal with sparse spectra. Usually it is recommended to avoid linear interpolation for obvious reasons.
The interp1d function I wrote is able to interpolate in several ways. I still need to sort out some errors (calling me a “programmer” would be an insult to all of you), but here’s a preview of a few interpolation schemes I have implemented:
http://nbviewer.ipython.org/gist/m-lohmann/e67e67bf4381771d67e8
I’m demonstrating only a handful of schemes because the difference is not visible in the graph showing the full interpolated spectrum.
I’m also going to implement a simple extrapolation function to cope with the problem of missing data at the ends of the spectrum, so you can choose e.g. linear, parabolic or cubic extrapolation to fill in missing data.
Please tell me if someone else already has written a package to do all this, or of someone else is already working on that.
Any thoughts or suggestions?
The text was updated successfully, but these errors were encountered: