Note that the observations are gridded and contain a lot of zeros. When I run a cubic smoothing spline (I use the package csaps in python) we get something like the plot below.
(My apologies for the changing colour scales).
As can be seen on the second plot, the splines oscillate and become even negative, which in our application does not make sense and is an issue. I researched a bit and found that this phenomenon is often referred to as Gibbs phenomenon that can affect splines (for example in this or that application).
I have a vague understanding of the math behind it and am more interested in the practical application. Does anybody know of an implementation of splines that are free of the Gibbs phenomenon in Python (or R or something else really) that we could use for our application?
Some more background on the application:
We are estimating the probability that two particles are in the same volume. The observations are occupation rates per volume (in some arbitrary unit, such as hours/year). We would like to fit the smooth to the data in an analogous way as you can fit a function to a 1D histogram (in our case it’s just 3D). Since the observed data is noisy (and we don't have access to the underlying generating process), we would like to use the fitted function to draw or to estimate some probabilities instead of using the observations directly. The probabilities (or occupancy rate, which is somewhat similar in our case) are then used to estimate the probability that two particles are in the same volume (the other particle is generated by a different process which we know how to model).