wtbarnes / fiasco

Python interface to the CHIANTI atomic database
http://fiasco.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
20 stars 15 forks source link

Enforce a consistent interpolation method #274

Open wtbarnes opened 3 months ago

wtbarnes commented 3 months ago

Data often need to be interpolated to a particular grid, usually in temperature space. Initially, I used interp1d for everything, but that function is now considered "legacy" and thus should be avoided.

Additionally, for reasons explained more fully in #223, I've used a PCHIP interpolation method in log-log space for particular pieces of data.

Now, in #260, CubicSpline is being used.

We need to come up with a policy for which interpolation method we use by default and stick to a single method unless there is a compelling reason to deviate from that method. Once a decision is made, this should probably be put in the docs somewhere.

A rough plan of work for addressing this:

  1. Decide whether CubicSpline or PCHIPInterpolator is a more appropriate general solution
  2. Replace all interp1d calls with the decision from 1
  3. Document this decision somewhere, maybe a dev guide?
jwreep commented 3 months ago

I used CubicSpline in #260 simply because it closely matches the IDL code. Happy to switch if another is preferred.

wtbarnes commented 3 months ago

Actually, I think your approach is the right one. We should replace interp1d with CubicSpline everywhere and use PCHIPInterpolator where necessary.