1
$\begingroup$

This question may be better suited for an Astronomy Stack Exchange site, but I figured I'd ask here. Say I have measurements of something as a function of radius for a number of objects.

Here's an example to make things concrete:

# Object 1
In [92]: r1
Out[92]: 
array([ 0.05      ,  0.07040816,  0.09081633,  0.11122449,  0.13163265,
    0.15204082,  0.17244898,  0.19285714,  0.21326531,  0.23367347,
    0.25408163,  0.2744898 ,  0.29489796,  0.31530612,  0.33571429,
    0.35612245,  0.37653061,  0.39693878,  0.41734694,  0.4377551 ,
    0.45816327,  0.47857143,  0.49897959,  0.51938776,  0.53979592,
    0.56020408,  0.58061224,  0.60102041,  0.62142857,  0.64183673,
    0.6622449 ,  0.68265306,  0.70306122,  0.72346939,  0.74387755,
    0.76428571,  0.78469388,  0.80510204,  0.8255102 ,  0.84591837,
    0.86632653,  0.88673469,  0.90714286,  0.92755102,  0.94795918,
    0.96836735,  0.98877551,  1.00918367,  1.02959184,  1.05      ])
# Object 2
In [93]: r2
Out[93]: 
array([ 0.04      ,  0.06081633,  0.08163265,  0.10244898,  0.12326531,
    0.14408163,  0.16489796,  0.18571429,  0.20653061,  0.22734694,
    0.24816327,  0.26897959,  0.28979592,  0.31061224,  0.33142857,
    0.3522449 ,  0.37306122,  0.39387755,  0.41469388,  0.4355102 ,
    0.45632653,  0.47714286,  0.49795918,  0.51877551,  0.53959184,
    0.56040816,  0.58122449,  0.60204082,  0.62285714,  0.64367347,
    0.6644898 ,  0.68530612,  0.70612245,  0.72693878,  0.7477551 ,
    0.76857143,  0.78938776,  0.81020408,  0.83102041,  0.85183673,
    0.87265306,  0.89346939,  0.91428571,  0.93510204,  0.95591837,
    0.97673469,  0.99755102,  1.01836735,  1.03918367,  1.06      ])
# Object 3
In [94]: r3
Out[94]: 
array([ 0.045     ,  0.06540816,  0.08581633,  0.10622449,  0.12663265,
    0.14704082,  0.16744898,  0.18785714,  0.20826531,  0.22867347,
    0.24908163,  0.2694898 ,  0.28989796,  0.31030612,  0.33071429,
    0.35112245,  0.37153061,  0.39193878,  0.41234694,  0.4327551 ,
    0.45316327,  0.47357143,  0.49397959,  0.51438776,  0.53479592,
    0.55520408,  0.57561224,  0.59602041,  0.61642857,  0.63683673,
    0.6572449 ,  0.67765306,  0.69806122,  0.71846939,  0.73887755,
    0.75928571,  0.77969388,  0.80010204,  0.8205102 ,  0.84091837,
    0.86132653,  0.88173469,  0.90214286,  0.92255102,  0.94295918,
    0.96336735,  0.98377551,  1.00418367,  1.02459184,  1.045     ])

Where r1, r2, and r3 are the radial lists which I make measurements for (Object 1, 2, and 3, respectively). The measurements look like this:

In [95]: out1
Out[95]: 
array([ 0.39919261,  0.40078876,  0.40335025,  0.40702841,  0.41194375,
    0.41818517,  0.42580846,  0.43483499,  0.44525116,  0.45700891,
    0.4700276 ,  0.48419736,  0.49938363,  0.51543283,  0.53217868,
    0.54944865,  0.56707028,  0.58487678,  0.60271173,  0.62043267,
    0.63791355,  0.65504607,  0.67174007,  0.6879231 ,  0.70353938,
    0.71854842,  0.73292329,  0.74664884,  0.75971994,  0.77213972,
    0.783918  ,  0.79506992,  0.80561461,  0.81557416,  0.82497273,
    0.83383575,  0.84218935,  0.85005984,  0.85747334,  0.86445547,
    0.87103113,  0.87722433,  0.88305811,  0.88855443,  0.89373415,
    0.898617  ,  0.90322162,  0.90756555,  0.91166525,  0.91553618])
In [96]: out2
Out[96]: 
array([ 0.31626381,  0.31638513,  0.31667084,  0.31721226,  0.31811294,
    0.31948646,  0.32145416,  0.32414259,  0.32768059,  0.33219587,
    0.33781106,  0.34463926,  0.35277915,  0.36230989,  0.37328607,
    0.38573305,  0.39964318,  0.41497335,  0.43164433,  0.449542  ,
    0.46852083,  0.48840914,  0.50901598,  0.53013886,  0.55157189,
    0.57311338,  0.59457264,  0.61577537,  0.63656761,  0.65681803,
    0.6764189 ,  0.69528578,  0.71335626,  0.73058811,  0.74695691,
    0.76245356,  0.77708177,  0.79085565,  0.80379747,  0.81593569,
    0.82730323,  0.83793606,  0.84787193,  0.85714946,  0.86580729,
    0.87388357,  0.88141541,  0.88843862,  0.89498747,  0.90109452])
In [97]: out3
Out[97]: 
array([ 0.6325231 ,  0.63424383,  0.63647521,  0.63916579,  0.64227168,
    0.64575317,  0.64957324,  0.65369686,  0.65809065,  0.6627228 ,
    0.66756296,  0.67258231,  0.67775356,  0.68305097,  0.68845041,
    0.69392934,  0.69946681,  0.70504349,  0.71064159,  0.71624488,
    0.72183859,  0.72740939,  0.7329453 ,  0.73843566,  0.74387099,
    0.749243  ,  0.75454444,  0.75976907,  0.76491154,  0.76996738,
    0.77493287,  0.77980499,  0.78458137,  0.78926022,  0.79384025,
    0.79832065,  0.80270103,  0.80698134,  0.81116187,  0.81524321,
    0.81922618,  0.82311181,  0.82690134,  0.83059613,  0.83419771,
    0.83770771,  0.84112783,  0.84445988,  0.84770571,  0.8508672 ])

Sorry for all of the output. Anyway, the question is, what is the proper technique for "adding" these curves? I'm looking for an average measurement vs. radius curve (with error bars), and I'm not entirely sure what that means for different radial measurements of different systems. My first idea was to interpolate between values of object 1, and evaluate them at the location of object 2 and 3, so that they can be evaluated on the same footing. But, I have potentially thousands of these objects, and that doesn't like the right thing to do for that many (plus that also brings up my interpolation method - cubic, linear, etc..). Any ideas would be appreciated! Let me know if further clarification is needed. Thanks!

$\endgroup$
  • 2
    $\begingroup$ What are you trying to get to in the end? $\endgroup$ – ja72 Aug 19 '13 at 0:57
  • $\begingroup$ You're absolutely right - this is more of a pure numerical question. The reason I'm posting on this forum is because I'm a physicist and this is a very common problem among researchers. I have the best chance of getting highly relevant, thought-out answers to my problem. From now on I'll be more careful about where my question may fit in best. In case you were wondering, my measurements are axis ratios of multi-particle systems versus the radial coordinate from the c.o.m. @ ja72 - I hope to get a single average curve which represents these measurements as a function of radius. $\endgroup$ – astromax Aug 19 '13 at 2:28
  • $\begingroup$ That is fine. I actual do not understand the problem you are talking about. $\endgroup$ – unsym Aug 19 '13 at 2:47
  • $\begingroup$ Interesting that you do not understand it - your answer below was exactly what I was hoping for :) This is a very common problem in astrophysics. Say you have spectra (number of photons versus wavelength) of some class of object from multiple instruments. How would you say something about the aggregate objects using data from both instruments if the wavelength measurements don't exactly line up? My situation happens to be measuring density, but the concept is basically the same. $\endgroup$ – astromax Aug 19 '13 at 3:24
1
$\begingroup$

Yes, interpolation is usually your best bet. There are three main methods to add them together, but they only fit in some context.

  1. Add interpolated function together: Assume you can fit the results as a continuous $f_i(r_i)$, then you can get the average $f(r) = \frac{1}{n}\sum_i^n f_i(r)$. But using this method, you must assume that the original function $f_i$ are smooth (and the error are small) so that you can do interpolation. The error can be found in the similar way. By glimpsing through your data, I think it is the case.

  2. Combine all data points: Merge the x data points together, and y data points together, i.e. $union({r_i})$ and $union({f_i})$. It works if they are actually the outcome of the same object/ same ensemble, with large errors. Since they represent the same think, you don't really need to take the average and it works well for very small number of samples. In addition, you can add a simple fitting curve for these high noise data.

  3. Use binned average: In case you have large number of data series (you mentioned), a simple way to do so is to use binned average. The bin can be, say, $r=[0.05, 0.15, ..., 0.95]$ and then you put the corresponding data points in each bin. For each bin, you can then take the average and variance of data points. If you have large number of data points and they belong to the same ensemble, this usually give you the best smooth results and have good error estimate.

For the limited information you give, I would recommend you to use the last method.

$\endgroup$
  • $\begingroup$ My first instinct was binning as well $\endgroup$ – Kevin Driscoll Aug 19 '13 at 1:52
  • $\begingroup$ Great, now that I think about it binning would definitely make the most sense. For situations like having only a few stellar spectra (not what I'm doing here) I think interpolation would be simple. But for potentially thousands of these systems each measured at slightly different radial values, binning is probably what I should go with if I wish to make any statements about the aggregate population. Thanks for the response! $\endgroup$ – astromax Aug 19 '13 at 2:32
  • $\begingroup$ @astromax As you mentioned a particle system, you might need to rescale the radius with the system size to have all data aligned. This is what I mean a same ensemble. $\endgroup$ – unsym Aug 19 '13 at 2:49
  • $\begingroup$ @hwlau I essentially have three populations of these systems. They are placed into these populations based upon the value of their total mass. Almost all of these objects in each population have about the same inner/outer radius (hence my sample data containting three radial lists which start and end at almost the same values). This is the reason for my asking the question: How do I add these measurements together if the radial values for each of these objects are nearly (but not exactly) the same. $\endgroup$ – astromax Aug 19 '13 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.