I have two light sensors.

Sensor A is factory-calibrated and gives a linear response to the light at a certain wavelength.

Sensor B is not calibrated. It may give a linear response to the light the same wavelength, but I don't know how linear the response is.

I have two sets of data dat_A and dat_B which contain the responses of the two sensors to light in the same conditions, say:

dat_A   dat_B
 0.8       16
 0.2        5
 0.3        9
 0.99      20
 0.74      17
 2.33      41
 5.68      80
 1.21      26
 etc.    etc.

What would be the best strategy to calibrate the sensor B given the two sets of data?

  • $\begingroup$ assuming A is the value you want, plot A vs B to give an idea of what the curves might be like. Pick a sensible curve to fit to-preferably one that can be explained by physics, and solve for coefficients. A good result will produce A as a function of B. $\endgroup$
    – Abel
    May 30, 2021 at 12:36
  • 1
    $\begingroup$ That single point at (5.68,80) is going to have more influence on the regression than the other points, because it is far from the mean and has a lot of "leverage". (regression in log(x) can reduce this a little). Answer by NMech sohws, in the plot of the residuals, that the result would be probably different without this one point. If at all possible, it might be nice to get more data . . . $\endgroup$
    – Pete W
    May 30, 2021 at 17:21
  • $\begingroup$ is this a school assignment? $\endgroup$
    – jsotola
    May 30, 2021 at 17:58
  • $\begingroup$ nope this is not school assignment. I do have these machines and I am wondering how to proceed $\endgroup$ May 30, 2021 at 21:38

4 Answers 4


The starting point is to recognize that your calibrated sensor is first used to calibrate your light source, and then your calibrated light source is used to measure the response of your second detector.

Assume that the calibrated sensor comes with a statement of its relative linearity $\Delta m_o / m_o$. This is a statement saying that the response from the calibrated sensor $I_C$ to a perfect light source follows the equation

$$ I_C = m_o I_o $$

Use this calibrated sensor to calibrate your light source. Mapping the setting of the light source $I_S$ to the sensor response $I_C$ gives

$$ I_S = m_S I_C + b_S = m_S\ m_o I_o + b_S $$

Create a plot of $I_S$ versus $I_C$. For simplicity in what follows, assume that your source has no offset error so that $b_S = 0$. Determine $m_S \pm \Delta m_S$ by linear regression (fixing the intercept to zero). Following linear propagation methods, the uncertainty in your source intensity becomes

$$ \left(\frac{\Delta I_S}{I_S}\right)^2 = \left(\frac{\Delta m_S}{m_S}\right)^2 + \left(\frac{\Delta m_o}{m_o}\right)^2 $$

Use your unknown detector. Map its response to the source using

$$ I_D = m_D I_S + b_D $$

Again, for simplicity, assume that your unknown detector has no offset error $b_D = 0$. A plot of $I_D$ versus $I_S$ will give $m_D \pm \Delta m_D$ by linear regression (with the intercept fixed at zero). The total relative uncertainty in your unknown detector becomes

$$ \left(\frac{\Delta I_D}{I_D}\right)^2 = \left(\frac{\Delta m_D}{m_D}\right)^2 + \left(\frac{\Delta m_S}{m_S}\right)^2 + \left(\frac{\Delta m_o}{m_o}\right)^2 $$

The analysis for the relative uncertainty becomes complex when any of the physical devices in this sequence (source and unknown detector) have offset errors.

In summary

  • Obtain a calibration curve for your source using the calibrated detector.

  • Obtain a calibration curve for your unknown detector using the now calibrated source arranged in exactly the same physical configuration as the above step.

  • Combine the factors to report the relative uncertainty for your unknown detector.


Plot dat_A against dat_B. Fit a curve to it (linear would be the simplest). Use the curve as a lookup table to lookup sensor A equivalent value when measurement from sensor B is available.

The curve fit will also tell you the input ranges where the fit is good and where the fit is bad. This can be used to gauge the uncertainty of the looked up value.

Ensure that the experiment results have good repeatability, and that enough calibration measurements are available.

A sample code in Octave (may not be the best method; just an illustration)

dat_A = [0.8, 0.2, 0.3, 0.99, 0.74, 2.33, 5.68, 1.21];
dat_B = [16, 5, 9, 20, 17, 41, 80, 26];

% fit ploynomial and get coefficients
lin = polyfit(dat_B, dat_A, 1);
qua = polyfit(dat_B, dat_A, 2);

% evaluate using the fit polynomial
r1 = polyval(lin, dat_B)
r2 = polyval(qua, dat_B)

plot(dat_B, [dat_A; r1; r2], 'o', 'markersize', 10, 'linewidth', 3);
legend('measured', 'linear', 'quad')

  • 1
    $\begingroup$ Curve fitting using polynomials are not the only method. Go through the documentation of the curve fitting packages and see which one is best applicable to your data. $\endgroup$
    – AJN
    May 30, 2021 at 12:34

Apart from Jeffrey's excellent analysis I'd like to point out that, assuming that sensor A is calibrated and has a linear response, it seems like sensor has a non linear response.

enter image description here

enter image description here

Figure 1: Excel graph of available data

enter image description here

Figure 2: Residuals plot indicating a systematic not linear response of sensor B (assuming Sensor A is calibrated and has a linear response)

From the second figure, there is indication that the response of the second sensor is non linear. However, that cannot really be validated without any more data.

  • $\begingroup$ You'd need more data since curve is largely based on one data point. $\endgroup$ May 30, 2021 at 22:33
  • $\begingroup$ Thank you for writing in a different way, the last sentence in my answer. $\endgroup$
    – NMech
    May 30, 2021 at 22:49

enter image description here

Figure 1. Making a scatter-plot on Google Sheets and adding in a trend line suggests that you've got a good chance.

A quick search shows many articles on find the equation but it would be simple enough to create an extra trend line of the form y = mx + c and adjust the parameters to get a match to the data trend line.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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