-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read and apply in-flight calibration factors to counts using simulated data #893
Comments
From Ruth:
|
Example data |
From document
/*
** APPLY ELECTRON CALIBRATION FACTORS
**
** These factors are used to account for changes in gain with time.
**
** They are derived from the weekly electron calibration data.
** The procedure is to compare the counts obtained at the operating CEM
** level (step 2 of the cal run) to the counts are the next higher CEM
** level (step 3 of the cal run). We assume that the next higher
** level is correct, and use this ratio to scale the counts.
**
*/
/*****************
** electron_cal ** given an S/C time, return interpolated electron cals
****************/
float *
electron_cal(uint32 sct)
{
int i;
static int last_i; / value of i at previous iteration */
static float factor[7];
/*
** First time through? Read in the calibration data
*/
if (cal == NULL) init_electron_cal();
/*
** Iterate over all points, until we find ourselves within this range.
**
** When we do, return a linear interpolation of the factors at the
** two measured points.
**
** NOTE: since the cal data file is in sequential order, and the only
** code that invokes us also does so in sequence, we can optimize a
** step by preserving last_i and assuming we will never be invoked for
** a time prior to the last one.
*/
for (i=last_i; i < npoints-1; i++){
if (cal[i].sct <= sct && sct < cal[i+1].sct) {
int j;
int run = cal[i+1].sct - cal[i].sct;
int tdif= sct - cal[i].sct;
}
printf("cannot extrapolate beyond last cal\n");
exit(1);
}
The text was updated successfully, but these errors were encountered: