Mercurial > hg > fxanalyse
diff Allan.c @ 138:02044ad2749a
Coding style
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Wed, 22 Jan 2014 14:45:07 +0100 |
parents | 792ac7151f0f |
children | be87c8e78266 |
line wrap: on
line diff
--- a/Allan.c Wed Jan 22 13:41:07 2014 +0100 +++ b/Allan.c Wed Jan 22 14:45:07 2014 +0100 @@ -36,7 +36,7 @@ { Instance->active = FALSE; SetCtrlVal(Instance->parent, Instance->control, FALSE); - DiscardPanel (Instance->AllanPanel); + DiscardPanel(Instance->AllanPanel); } @@ -94,11 +94,11 @@ static void Allan_Display(Allan_Data *Instance) { + double x[ALLAN_NUM_DATAPOINTS]; + double y[ALLAN_NUM_DATAPOINTS]; + double error; + int dedrift; int i; - double X[ALLAN_NUM_DATAPOINTS]; - double Y[ALLAN_NUM_DATAPOINTS]; - double Error; - int dedrift; GetCtrlVal(Instance->AllanPanel, ALLANPANEL_DEDRIFT, &dedrift); SetCtrlVal(Instance->AllanPanel, ALLANPANEL_DRIFT, Instance->Drift); @@ -106,27 +106,28 @@ for (i = 0; i < ALLAN_NUM_DATAPOINTS; i++) { if (Instance->AllanVar[i] == 0.0) break; - X[i] = pow(2, i); + x[i] = pow(2, i); /* remove linear drift estimated contribution to the allan variance */ if (dedrift) { - double corr = 0.5 * (Instance->Drift * X[i]) * (Instance->Drift * X[i]); + double corr = 0.5 * (Instance->Drift * x[i]) * (Instance->Drift * x[i]); /* uncertainty in the estimate of the drift rate may over correct the estimated allan variance and result in a negative value. in this case we take the absolute value of the corrected value as the best estimator of the allan variance */ - Y[i] = sqrt(fabs(Instance->AllanVar[i] - corr)) / Instance->normalization; + y[i] = sqrt(fabs(Instance->AllanVar[i] - corr)) / Instance->normalization; } else { - Y[i] = sqrt(Instance->AllanVar[i]) / Instance->normalization; + y[i] = sqrt(Instance->AllanVar[i]) / Instance->normalization; } } DeleteGraphPlot(Instance->AllanPanel, ALLANPANEL_ALLANPLOT, -1, VAL_IMMEDIATE_DRAW); - PlotXY(Instance->AllanPanel, ALLANPANEL_ALLANPLOT, X, Y, ALLAN_NUM_DATAPOINTS, + PlotXY(Instance->AllanPanel, ALLANPANEL_ALLANPLOT, x, y, ALLAN_NUM_DATAPOINTS, VAL_DOUBLE, VAL_DOUBLE, VAL_SCATTER, VAL_SOLID_SQUARE, VAL_SOLID, 1, DATAPOINT_COLOR); for (i = 0; i < ALLAN_NUM_DATAPOINTS; i++) { - Error = 1/sqrt(Instance->BlocksNumber[i]); - PlotLine(Instance->AllanPanel, ALLANPANEL_ALLANPLOT, X[i], Y[i]*(1-Error), X[i], Y[i]*(1+Error), ERRORBAR_COLOR); + error = 1 / sqrt(Instance->BlocksNumber[i]); + PlotLine(Instance->AllanPanel, ALLANPANEL_ALLANPLOT, + x[i], y[i] * (1 - error), x[i], y[i] * (1 + error), ERRORBAR_COLOR); } }