| Re: Interpolation to conserve integrated flux [message #71162 is a reply to message #71161] |
Sun, 30 May 2010 12:32   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On May 29, 9:13 pm, John Shaw <jds...@udel.edu> wrote:
> Hi all,
>
> I am hoping someone out there can help me with this.
>
> I am looking to combine spectra such that the integrated flux between
> any arbitrary set of points is conserved.
>
> Consider a set of two equal length float arrays, one containing
> wavelength values (call this x1, x2, x3, ...) and one containing flux
> values (call these y1, y2, y3,...). So that y1 goes with x1 and y2
> goes with x2, and so on.
>
> Unfortunately, the wavelength arrays (x1, x2, x3, ...) have similar
> values but not the same, e.g.:
>
> x1 = [3212.7, 3215.1, 3217.5, 3219.9, ...]
> x2 = [3213.1, 3215.4, 3217.7, 3220.0, ...]
>
> What I want to do is combine x1 and x2 to x_comb and y1 and y2 to
> y_comb such that if one were to sum between two wavelengths the in the
> new arrays (x_comb and y_comb) you would get the same as doing them in
> the original (x1,y1 and x2,y2) and adding the results. That is, if I
> need to sum up values in y when x is between 3214.0 and 3219.0. For
> x1, I would linearly interpolate the values in y1 for the two
> wavelengths and sum under the curve. I then do the same for x2 and
> y2. I can already do this - that part is simple. What I want to do
> is have new arrays x_comb and y_comb such that I can do the same sum
> across such that the same (summed region in y1) + (summed region in
> y2) = (summed region in y_comb).
>
> Is there an algorithm that anyone knows that will do this?
>
> Or, as an intermediate step, is there a way interpolate the values in
> x2 to x1, and y2 to an new set of values (y2_new) that keeps the sums
> of y2 and y2_new the same between any two arbitray points (as
> described above)?
First, I think you need to be a little careful if your measurements
are at exact bin centers, or you are giving bin edges, or what. Since
you want to do your operation carefully, you need to be careful about
definitions.
There are an infinite number of ways to interpolate a series. And I
believe there are an infinite number of ways to do it while conserving
area. So you have a lot of choices!
It looks like your wavelengths are quantized at 0.1 units. The most
obvious thing to do is to subdivide your original flux into smaller
0.1 unit bins, assuming equal flux density throughout the original
bin. You can do that pretty easily, and can do it exactly. Once you
have all the spectra on 0.1 unit binning, then they should all be on a
matching X scale, and you can establish new bin edges and sum
appropriately.
Craig
|
|
|
|