I have a TH2 that I would like to interpolate to have finer binning. There is no know function to fit the plane to. Currently I use TGraphDelaunay to achieve this but I would like a smoother interpolation. If my original histogram is h2_RealXSecs and my interpolated histogram with fine binning is h2_RealXSecsGrid_Interp then I obtain the second from the first by the following code:
Is it possible to use better methods than this for the interpolation? eg Spline or Kriging. My figure of merit is smooth level curves. My interpolated histogram need not pass through the original points and I do have errors on the bins that I could use in the interpolation. Could you please give an example that would replace the above code?
Additionally, is ComputeZ() intended to be equivalent to Interpolate()? I ask because Interpolate() always returns 0.
Note that instead of doing the loop to fill the TGraph2D from the histogram you can use the constructor: TGraph2D(TH2* h2)
see: root.cern.ch/root/html/TGraph2D.html
Yes I am aware of how the constructor works but doing it that way I was not sure that I would get the exact (x,y) values I calculated z for.
I am also aware that there is a Bilinear Interpolation available through TH2::Interpolate but I believe that is worse quality than a Delaney Interpolation. I would how ever entertain a Bicubic interpolation but I have not found such a method.
By the way, as this is my first time posting on RootTalk, I am not sure if I should have posted in the more general “ROOT Support” forum. Please advise.
Unfortunately we do not have multi-simensional splines in ROOT. I had somewhere myself also code for Loess (local regression), but I never put it in ROOT. Eventually if you are interested I could send it to you
Since i have no idea what the true form of the underlying distribution is, I would not feel comfortable fitting a polynomial guess as it would very likely add a large bias. Also, any smoothing or Loess-like teqnique would only remove information. What I want is a rigerouse interpolation method. The delanuay and bilinear methods will have to do for now.
Is it possible to add an option to TH2::interpolate to choose Delanuay instead of bilinear? The implementation should be simple as it is already implemented in TGraph2D::Interpolate().
In principle further functionality is important and should be put into ROOT if one can find some open source. The differing interpolation methods are defined summarized here: www.esri.com/news/arcuser/0704/files/interpolating.pdf
Thanks for the input I will let you guys know if I end up coding anything useful.
Keith
Since i have no idea what the true form of the underlying distribution is, I would not feel comfortable fitting a polynomial guess as it would very likely add a large bias. Also, any smoothing or Loess-like teqnique would only remove information. What I want is a rigerouse interpolation method. The delanuay and bilinear methods will have to do for now. [/quote]
As an aside: As you don’t know what the underlying distribution is, it doesn’t really matter too much how you guess at it, that’s all you’re going to be doing. At the end of the day, it’s very difficult to increase the number of bins in a histogram as the information is already lost. Getting a finer binned histogram to start with is where I’d spend my effort.