Search code examples
python-2.7scipyinterpolationpsychopy

what does interpolation of non-equal dimension means in Python?


I am looking at source code of Psychopy program, and I encountered the below line.

interpolateCones = scipy.interpolate.interp1d(wavelength_5nm, cones_SmithPokorny)

in which wavelength_5nm is a (1,81) vector and cones_SmithPokorny dimension is (3,81) and both of them contain predefined numbers.

I really cannot understand the meaning of interpolating with input parameters of non-equal dimensions. shouldn't cones_SmithPokorny be (1,81) too? why there is no error when I run the code?


Solution

  • interp1d has default value axis=-1, so the 1D interpolation is over the last axis. I.e., there are 81 x-coordinates, and for each x-coordinate there are 3 y-values. So it's not interpolating across unequal dimensions.