Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 246:d6a37eca6d92
Fix errors in previous commit
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 27 Feb 2015 10:52:11 +0100 |
parents | b1dc2ba9a315 |
children | eaac96094640 |
comparison
equal
deleted
inserted
replaced
245:b1dc2ba9a315 | 246:d6a37eca6d92 |
---|---|
378 .keep_slope = TRUE, | 378 .keep_slope = TRUE, |
379 .f0 = 0.0, | 379 .f0 = 0.0, |
380 .fDDS = 70e6, | 380 .fDDS = 70e6, |
381 .applied = 0.0, | 381 .applied = 0.0, |
382 .interval = 30.0, | 382 .interval = 30.0, |
383 .t0 = 0.0 | 383 .t0 = 0.0, |
384 .threshold = 10.0, | 384 .threshold = 20.0, // corresponding to a relative frequnecy stability of ~1e-13 |
385 .badcount = 0, | 385 .badcount = 0, |
386 .badcountmax = 10, | |
386 .safety = TRUE, | 387 .safety = TRUE, |
387 .badcountmax = 10, | |
388 }; | 388 }; |
389 | 389 |
390 | 390 |
391 void dedrift_update_enable() | 391 void dedrift_update_enable() |
392 { | 392 { |
426 // criteria it does not contribute to the collected statistics and the | 426 // criteria it does not contribute to the collected statistics and the |
427 // previous data point is used instead and `count` is incremented by | 427 // previous data point is used instead and `count` is incremented by |
428 // one. If the data point is accepted `count` is reset to zero. | 428 // one. If the data point is accepted `count` is reset to zero. |
429 int stat_accumulate_resilient(struct stat *stat, double v, double threshold, int *count) | 429 int stat_accumulate_resilient(struct stat *stat, double v, double threshold, int *count) |
430 { | 430 { |
431 if ((! isnan(stat.previous) && (fabs(v - stat->previous) > threshold)) { | 431 if (!isnan(stat->previous) && (fabs(v - stat->previous) > threshold)) { |
432 // bad data point | 432 // bad data point |
433 stat_accumulate(stat, stat->previous); | 433 stat_accumulate(stat, stat->previous); |
434 *count++; | 434 *count += 1; |
435 return TRUE; | 435 return TRUE; |
436 } else { | 436 } else { |
437 // good data point | 437 // good data point |
438 stat_accumulate(stat, v); | 438 stat_accumulate(stat, v); |
439 *count = 0; | 439 *count = 0; |
452 if (dedrift.badcount) { | 452 if (dedrift.badcount) { |
453 // bad data point detected | 453 // bad data point detected |
454 logmsg("dedrift: bad data point detected"); | 454 logmsg("dedrift: bad data point detected"); |
455 | 455 |
456 // too many consecutive bad data points detected | 456 // too many consecutive bad data points detected |
457 if ((dedrift.safety) && (dedrift.badcount > &dedrift.badcountmax)) { | 457 if (dedrift.safety && (dedrift.badcount > dedrift.badcountmax)) { |
458 logmsg("dedrift: maximum number of consecutive bad data points exceeded"); | |
458 dedrift_update_disable(); | 459 dedrift_update_disable(); |
459 logmsg("dedrift: maximum number of consecutive bad data points exceeded"); | |
460 } | 460 } |
461 } | 461 } |
462 | 462 |
463 // check if the previous check disabled slope update | 463 // check if the previous check disabled slope update |
464 if (! dedrift.enabled) | 464 if (! dedrift.enabled) |
2033 } | 2033 } |
2034 | 2034 |
2035 int CVICALLBACK CB_OnStopSlopeCancellingOnUnlocked (int panel, int control, int event, | 2035 int CVICALLBACK CB_OnStopSlopeCancellingOnUnlocked (int panel, int control, int event, |
2036 void *callbackData, int eventData1, int eventData2) | 2036 void *callbackData, int eventData1, int eventData2) |
2037 { | 2037 { |
2038 int value; | |
2039 switch (event) | 2038 switch (event) |
2040 { | 2039 { |
2041 case EVENT_COMMIT: | 2040 case EVENT_COMMIT: |
2042 GetCtrlVal(panel, control, &dedrift.safety); | 2041 GetCtrlVal(panel, control, &dedrift.safety); |
2043 break; | 2042 break; |