Commit 7c7dd237 authored by Miroslav Shaltev's avatar Miroslav Shaltev
Browse files

AM compute sum and average within distance limit.

parent 6747bf30
......@@ -99,21 +99,24 @@ INT4 AFTERMath::XLALInitUserVars ( int argc, char *argv[] )
uvar->metricType = MTAVFSTAT;
uvar->distanceLimit = 1e-3;
if ( (uvar->MetricIFO = XLALCreateStringVector ( "H1,L1", NULL )) == NULL ) {
LogPrintf (LOG_CRITICAL, "Call to XLALCreateStringVector() failed with xlalErrno = %d\n", xlalErrno );
}
/* register user input variables */
XLALRegisterUvarMember( version,BOOLEAN, 'V', SPECIAL, "Output version information");
XLALRegisterUvarMember( fnamein, STRING, 0, OPTIONAL, "Input filename");
XLALRegisterUvarMember( fnameout, STRING, 0, OPTIONAL, "Output filename");
XLALRegisterUvarMember( ephemEarth, STRING, 0, OPTIONAL, "Location of Earth ephemeris file");
XLALRegisterUvarMember( ephemSun, STRING, 0, OPTIONAL, "Location of Sun ephemeris file");
XLALRegisterUvarMember( segmentList, STRING, 0, OPTIONAL, "File containing a segment list used to compute Fisher ellipsoid: lines of form <startGPS endGPS duration[h] NumSFTs>");
XLALRegisterUvarMember( sType, INT4, 0, OPTIONAL, "Search / metric / cache type: Isolated ( 0 - ALPHA_DELTA, 1 - ALPHA_DELTA_FREQ_F1DOT, 2 - ALPHA_DELTA_FREQ_F1DOT_F2DOT, 3 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_F3DOT, 4 - FREQ_F1DOT, 5 - FREQ_F1DOT_F2DOT, 6 - FREQ_F1DOT_F2DOT_F3DOT ), Binary ( 7 - ALPHA_DELTA_FREQ_ASINI_TASC_OMEGA_KAPPA_ETA, 8 - ALPHA_DELTA_FREQ_F1DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 9 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 10 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_F3DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 11 - FREQ_ASINI_TASC_OMEGA_KAPPA_ETA, 12 - FREQ_F1DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 13 - FREQ_F1DOT_F2DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 14 - FREQ_F1DOT_F2DOT_F3DOT_ASINI_TASC_OMEGA_KAPPA_ETA )");
XLALRegisterUvarMember( refTime, REAL8, 0, OPTIONAL, "Ref. time for pulsar pars [Default: 0]");
XLALRegisterUvarMember( metricType, INT4, 0, OPTIONAL, "Type of metric to compute: 0=phase-metric, 1=average F-metric");
XLALRegisterUvarMember( MetricIFO, STRINGVector, 0, OPTIONAL, "Use this IFOs to compute metric");
XLALRegisterUvarMember( version,BOOLEAN, 'V', SPECIAL, "Output version information.");
XLALRegisterUvarMember( fnamein, STRING, 0, OPTIONAL, "Input filename.");
XLALRegisterUvarMember( fnameout, STRING, 0, OPTIONAL, "Output filename.");
XLALRegisterUvarMember( ephemEarth, STRING, 0, OPTIONAL, "Location of Earth ephemeris file.");
XLALRegisterUvarMember( ephemSun, STRING, 0, OPTIONAL, "Location of Sun ephemeris file.");
XLALRegisterUvarMember( segmentList, STRING, 0, OPTIONAL, "File containing a segment list used to compute Fisher ellipsoid: lines of form <startGPS endGPS duration[h] NumSFTs>.");
XLALRegisterUvarMember( sType, INT4, 0, OPTIONAL, "Search / metric / cache type: Isolated ( 0 - ALPHA_DELTA, 1 - ALPHA_DELTA_FREQ_F1DOT, 2 - ALPHA_DELTA_FREQ_F1DOT_F2DOT, 3 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_F3DOT, 4 - FREQ_F1DOT, 5 - FREQ_F1DOT_F2DOT, 6 - FREQ_F1DOT_F2DOT_F3DOT ), Binary ( 7 - ALPHA_DELTA_FREQ_ASINI_TASC_OMEGA_KAPPA_ETA, 8 - ALPHA_DELTA_FREQ_F1DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 9 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 10 - ALPHA_DELTA_FREQ_F1DOT_F2DOT_F3DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 11 - FREQ_ASINI_TASC_OMEGA_KAPPA_ETA, 12 - FREQ_F1DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 13 - FREQ_F1DOT_F2DOT_ASINI_TASC_OMEGA_KAPPA_ETA, 14 - FREQ_F1DOT_F2DOT_F3DOT_ASINI_TASC_OMEGA_KAPPA_ETA ).");
XLALRegisterUvarMember( refTime, REAL8, 0, OPTIONAL, "Ref. time for pulsar pars.");
XLALRegisterUvarMember( metricType, INT4, 0, OPTIONAL, "Type of metric to compute: 0=phase-metric, 1=average F-metric.");
XLALRegisterUvarMember( MetricIFO, STRINGVector, 0, OPTIONAL, "Use this IFOs to compute metric.");
XLALRegisterUvarMember( distanceLimit, REAL8, 0, OPTIONAL, "Distance limit.");
/* read cmdline & cfgfile */
BOOLEAN should_exit = 0;
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
......@@ -169,13 +172,20 @@ AFTERMath::AFTERMath(int argc, char *argv[]) {
AFTERMath::~AFTERMath() {}
INT4 AFTERMath::ComputeAMS() {
for (int i=0; i < indata.size() - 1; i++) {
for (int j = i + 1; j < indata.size(); j++) {
for (int i=0; i < indata.size(); i++) {
REAL8 likesum = gsl_vector_get(indata.at(i),DP_STAT);
INT4 cnt = 1;
for (int j = 0; i != j && j < indata.size(); j++) {
REAL8 dst = compute_metric_distance(uvar->sType, metric, indata.at(i), indata.at(j));
REAL8 guess_stat = guess_2F(dst,gsl_vector_get(indata.at(i),DP_STAT));
REAL8 mess_stat = gsl_vector_get(indata.at(j),DP_STAT);
printf("Distance point %d to point %d: %e, measured stat: %e, guess: %e, perc: %f\n",i,j,dst,mess_stat,guess_stat,mess_stat/guess_stat*100);
if ( dst < uvar->distanceLimit ){
likesum += mess_stat;
cnt++;
}
printf("Distance point %d to point %d: %e, measured stat: %e, guess: %e, perc: %f\n",i,j,dst,mess_stat,guess_stat,mess_stat/guess_stat*100);
}
printf("Sum for point %d within the distance limit: %f, average: %f, points: %d\n",i,likesum,likesum/(REAL8)cnt,cnt);
}
return 0;
}
......@@ -134,6 +134,7 @@ extern "C" {
REAL8 refTime;
INT4 metricType;
LALStringVector* MetricIFO;
REAL8 distanceLimit;
} UserInput_t;
#ifdef __cplusplus
} /* Close C++ protection */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment