Commit 75e97f13 authored by Matthew David Pitkin's avatar Matthew David Pitkin
Browse files

ReadPulsarParFile: some fixes to allow glitch parameters to be read in,...

ReadPulsarParFile: some fixes to allow glitch parameters to be read in, updates to the test suite codes and reading of frequency and derivatives into a vector rather than separate parameers
Original: a880356f6e95976f8736740df3f952874f00ee56
parent 313ce642
......@@ -238,23 +238,31 @@ REAL8Vector* PulsarGetREAL8VectorParam( const PulsarParameters *pars, const CHAR
}
REAL8 PulsarGetREAL8VectorParamIndividual( const PulsarParameters *pars, const CHAR *name){
/* split the input name into the parameter name and an index e.g. FB0 into FB and 0*/
REAL8 PulsarGetREAL8VectorParamIndividual( const PulsarParameters *pars, const CHAR *name ){
/* split the input name into the parameter name and an index e.g. FB0 into FB and 0, or GLEP_1 */
CHAR *namecopy = NULL, *token;
const CHAR delimiters[] = "0123456789"; /* delimit by numbers */
namecopy = XLALStringDuplicate( name );
REAL8 val = 0.;
token = strtok(namecopy, delimiters);
if ( strchr( name, '_' ) ){ /* check for underscore delimiting numbers */
token = strtok(namecopy, "_");
}
else{ /* name delimited by just numbers */
token = strtok(namecopy, "0123456789");
}
REAL8Vector *vpars = PulsarGetREAL8VectorParam( pars, token );
/* get the index value of the parameter name */
INT4 idx = -1;
if( sscanf(name+strlen(token), "%d", &idx) != 1 ){
INT4 loc = strlen(token);
if ( name[loc] == '_' ){ loc++; }
if( sscanf(name+loc, "%d", &idx) != 1 ){
XLAL_ERROR_REAL8( XLAL_EINVAL, "Input parameter (%s) problem", name );
}
/* for glitch parameters GL, or WAVE parameters the index starts at 1, so shift it */
if ( !strncmp( name, "GL", 2 ) || !strncmp( name, "WAVE", 4 ) ) { idx--; }
if ( idx < 0 || (UINT4)idx > vpars->length-1 ){
XLAL_ERROR_REAL8( XLAL_EINVAL, "Input parameter index %d is wrong", idx );
}
......@@ -313,20 +321,28 @@ REAL8Vector *PulsarGetREAL8VectorParamErr( const PulsarParameters *pars, const C
REAL8 PulsarGetREAL8VectorParamErrIndividual( const PulsarParameters *pars, const CHAR *name){
/* split the input name into the parameter name and an index e.g. FB0 into FB and 0*/
CHAR *namecopy = NULL, *token;
const CHAR delimiters[] = "0123456789"; /* delimit by numbers */
namecopy = XLALStringDuplicate( name );
REAL8 val = 0.;
token = strtok(namecopy, delimiters);
if ( strchr( name, '_' ) ){ /* check for underscore delimiting numbers */
token = strtok(namecopy, "_");
}
else{ /* name delimited by just numbers */
token = strtok(namecopy, "0123456789");
}
REAL8Vector *vpars = PulsarGetREAL8VectorParamErr( pars, token );
/* get the index value of the parameter name */
INT4 idx = -1;
if( sscanf(name+strlen(token), "%d", &idx) != 1 ){
XLAL_ERROR_REAL8( XLAL_EINVAL, "Input parameter (%s) problem", name );
INT4 loc = strlen(token);
if ( name[loc] == '_' ){ loc++; }
if( sscanf(name+loc, "%d", &idx) != 1 ){
XLAL_ERROR_REAL8( XLAL_EINVAL, "Input parameter (%s) problem", name );
}
/* for glitch parameters GL, or WAVE parameters the index starts at 1, so shift it */
if ( !strncmp( name, "GL", 2 ) || !strncmp( name, "WAVE", 4 ) ) { idx--; }
if ( idx < 0 || (UINT4)idx > vpars->length-1 ){
XLAL_ERROR_REAL8( XLAL_EINVAL, "Input parameter index %d is wrong", idx );
}
......@@ -611,7 +627,7 @@ typedef struct tagParConversion{
}ParConversion;
#define NUM_PARS 117 /* number of allowed parameters */
#define NUM_PARS 107 /* number of allowed parameters */
/** Initialise conversion structure with most allowed TEMPO2 parameter names and conversion functions
* (convert all read in parameters to SI units where necessary). See http://arxiv.org/abs/astro-ph/0603381 and
......@@ -621,17 +637,7 @@ typedef struct tagParConversion{
* incremented.
*/
ParConversion pc[NUM_PARS] = {
{ .name = "F0", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* frequency (Hz) */
{ .name = "F1", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* first frequency time derivative (Hz/s) */
{ .name = "F2", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* second frequency time derivative (Hz/s^2) */
{ .name = "F3", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* third frequency time derivative (Hz/s^3) */
{ .name = "F4", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* fourth frequency time derivative (Hz/s^4) */
{ .name = "F5", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* fifth frequency time derivative (Hz/s^5) */
{ .name = "F6", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* sixth frequency time derivative (Hz/s^6) */
{ .name = "F7", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* seventh frequency time derivative (Hz/s^7) */
{ .name = "F8", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* eighth frequency time derivative (Hz/s^8) */
{ .name = "F9", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* ninth frequency time derivative (Hz/s^9) */
{ .name = "F10", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* tenth frequency time derivative (Hz/s^10) */
{ .name = "F", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8Vector_t }, /* vector containing frequency and derivatives (Hz, Hz/s, Hz/s^2 ...) */
{ .name = "DIST", .convfunc = ParConvKpcToMetres, .converrfunc = ParConvKpcToMetres, .ptype = PULSARTYPE_REAL8_t }, /* distance to pulsar in metres */
{ .name = "PX", .convfunc = ParConvMasToRads, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* parallax (converted to radians) */
{ .name = "DM", .convfunc = ParConvToFloat, .converrfunc = ParConvToFloat, .ptype = PULSARTYPE_REAL8_t }, /* dispersion measure */
......@@ -777,7 +783,7 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
CHAR str[PULSAR_PARNAME_MAX];
/* three potential values on the line */
CHAR str1[PULSAR_PARNAME_MAX], str2[PULSAR_PARNAME_MAX], str3[PULSAR_PARNAME_MAX];
INT4 i = 0;
INT4 i = 0, tmpnum = 0;
CHAR *nname = NULL; /* duplicate of name */
if ( par == NULL ){ XLAL_ERROR( XLAL_EINVAL, "Error... PulsarParameter structure is not initialised!\n"); }
......@@ -807,12 +813,15 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
/* perform parameter dependent inputs */
for ( i = 0; i < NUM_PARS; i++ ){
/* this has to be hard-coded for the WAVE, FB and glitch (GL) vector parameters */
if ( !strcmp( nname, pc[i].name ) ||
( ( !strncmp( nname, "WAVE", 4 ) && ( !strcmp( "WAVESIN", pc[i].name ) || !strcmp( "WAVECOS", pc[i].name ) ) ) &&
strcmp( "WAVE_OM", nname ) && strcmp( "WAVEEPOCH", nname ) ) ||
( !strncmp( nname, "FB", 2 ) && !strcmp( "FB", pc[i].name ) ) ||
( !strncmp( nname, "GL", 2 ) && !strcmp( "GL", pc[i].name ) ) ){
/* this has to be hard-coded for the F, WAVE, FB and glitch (GL) vector parameters */
/* check for parameters requiring placement in vectors */
INT4 isfreq = ( !strncmp( nname, "F", 1 ) && !strcmp( "F", pc[i].name ) && sscanf( nname+strlen( "F" ), "%d", &tmpnum ) == 1 );
INT4 iswave = ( ( !strncmp( nname, "WAVE", 4 ) && ( !strcmp( "WAVESIN", pc[i].name ) || !strcmp( "WAVECOS", pc[i].name ) ) ) && strcmp( "WAVE_OM", nname ) && strcmp( "WAVEEPOCH", nname ) );
INT4 isfb = ( !strncmp( nname, "FB", 2 ) && !strcmp( "FB", pc[i].name ) );
INT4 isgl = ( !strncmp( nname, "GL", 2 ) && strstr( nname, pc[i].name ) && !strncmp( nname, pc[i].name, strlen(nname)-2 ) );
if ( !strcmp( nname, pc[i].name ) || isfreq || iswave || isfb || isgl ){
UINT4 num = 0;
if ( pc[i].convfunc == NULL ){
......@@ -821,12 +830,21 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
}
/* add parameter */
if ( !strncmp( nname, "FB", 2 ) ){ /* add FB values */
if ( isfreq || isfb ){ /* add frequency and frequency derivative values or FB values */
REAL8Vector *ptr = NULL;
if ( strlen( nname ) > strlen( "FB" ) ){
if ( sscanf( nname+strlen( "FB" ), "%d", &num ) != 1 ){
XLAL_ERROR( XLAL_EINVAL, "Error...problem reading %s number from par file.\n", nname );
if ( isfb ){
if ( strlen( nname ) > strlen( "FB" ) ){
if ( sscanf( nname+strlen( "FB" ), "%d", &num ) != 1 ){
XLAL_ERROR( XLAL_EINVAL, "Error...problem reading %s number from par file.\n", nname );
}
}
}
else{
if ( strlen( nname ) > strlen( "F" ) ){
if ( sscanf( nname+strlen( "F" ), "%d", &num ) != 1 ){
XLAL_ERROR( XLAL_EINVAL, "Error...problem reading %s number from par file.\n", nname );
}
}
}
......@@ -845,8 +863,7 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
XLALFree( val );
}
else if ( !strncmp( nname, "WAVE", 4 ) && strcmp( "WAVE_OM", nname ) && strcmp( "WAVEEPOCH", nname ) && nread == 2
&& ( !strcmp( "WAVESIN", pc[i].name ) || !strcmp( "WAVECOS", pc[i].name ) ) ){ /* add WAVE values */
else if ( iswave && nread == 2 ){ /* add WAVE values */
REAL8Vector *ptr1 = NULL, *ptr2 = NULL;
if ( strlen( nname ) > strlen( "WAVE" ) ){
......@@ -854,6 +871,7 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
XLAL_ERROR( XLAL_EINVAL, "Error...problem reading %s number from par file.\n", nname);
}
}
else{ break; }
num--; /* WAVE values start from WAVE1, so subtract 1 from the num for the vector index */
......@@ -889,10 +907,10 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
/* there are no errors on the wave parameters, so break */
break;
}
else if ( !strncmp( nname, "GL", 2 ) ){ /* get glitch parameters */
else if ( isgl ){ /* get glitch parameters */
REAL8Vector *ptr = NULL;
if ( sscanf( nname+strlen( "_" ), "%d", &num ) != 1 ){
if ( sscanf( strstr(nname, "_")+1, "%d", &num ) != 1 ){
XLAL_ERROR( XLAL_EINVAL, "Error...problem reading %s number from par file.\n", nname);
}
......@@ -917,7 +935,6 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
void *val = (void *)XLALMalloc( PulsarTypeSize[pc[i].ptype] );
pc[i].convfunc( str1, val );
PulsarAddParam( par, pc[i].name, val, pc[i].ptype );
XLALFree( val );
}
......@@ -932,7 +949,7 @@ static INT4 ParseParLine( PulsarParameters *par, const CHAR *name, FILE *fp ){
UINT4 isFit = 0;
/* get the fit flag */
if ( !strncmp( nname, "FB", 2 ) || !strncmp( nname, "GL", 2 ) ){ /* do this for REAL8Vector parameters */
if( isfreq || isfb || isgl ){ /* do this for REAL8Vector parameters */
REAL8Vector *ptr = NULL;
if ( nread == 2 ) { pc[i].converrfunc( str2, val ); }
......
......@@ -13,6 +13,7 @@
#include <lal/LALStdlib.h>
#include <lal/LALgetopt.h>
#include <lal/AVFactories.h>
#include <lal/LALBarycenter.h>
#include <lal/LALInitBarycenter.h>
#include <lal/LALConstants.h>
......@@ -62,7 +63,7 @@ int main(int argc, char *argv[])
double TOA[10000];
double num1;
int telescope;
int i=0, j=0, k=0, exceedPhaseErr=0;
int i=0, j=0, k=0, n = 0, exceedPhaseErr=0;
double PPTime[10000]; /* Pulsar proper time - corrected for solar system and binary orbit delay times */
const double D = 2.41e-4; /* dispersion constant from TEMPO */
......@@ -84,7 +85,7 @@ int main(int argc, char *argv[])
double MJD_tcorr[10000];
double tcorr[10000];
double f0=0., f1=0., f2=0., f3=0., T=0.;
double T=0.;
double DM;
long offset;
......@@ -242,10 +243,8 @@ int main(int argc, char *argv[])
tdat = XLALInitTimeCorrections( tcFile );
REAL8 f0p = PulsarGetREAL8ParamOrZero(params, "F0");
REAL8 f1p = PulsarGetREAL8ParamOrZero(params, "F1");
REAL8 f2p = PulsarGetREAL8ParamOrZero(params, "F2");
REAL8 f3p = PulsarGetREAL8ParamOrZero(params, "F3");
REAL8Vector *f0s = PulsarGetREAL8VectorParam(params, "F");
REAL8Vector *f0update = XLALCreateREAL8Vector( f0s->length );
for(j=0;j<i;j++){
double t; /* DM for current pulsar - make more general */
......@@ -253,6 +252,7 @@ int main(int argc, char *argv[])
double phase;
double tt0;
double phaseWave = 0., tWave = 0.;
double taylorcoeff = 1.;
if (par.clock != NULL){
while(MJD_tcorr[k] < TOA[j]){ k++; }
......@@ -297,10 +297,16 @@ int main(int argc, char *argv[])
if(j==0){
T = PPTime[0] - PulsarGetREAL8ParamOrZero(params, "PEPOCH");
f0 = f0p + f1p*T + 0.5*f2p*T*T + (1./6.)*f3p*T*T*T;
f1 = f1p + f2p*T + 0.5*f3p*T*T;
f2 = f2p + f3p*T;
f3 = f3p;
for ( k=0; k<(INT4)f0s->length; k++ ) {
f0update->data[k] = f0s->data[k];
REAL8 Tupdate = T;
taylorcoeff = 1.;
for ( n = k+1; n<(INT4)f0s->length; n++ ) {
taylorcoeff /= (REAL8)(n-k);
f0update->data[k] += taylorcoeff*f0s->data[n]*Tupdate;
Tupdate *= T;
}
}
}
tt0 = PPTime[j] - PPTime[0];
......@@ -315,10 +321,16 @@ int main(int argc, char *argv[])
for( k = 0; k < (INT4)waveSin->length; k++ ){
tWave += waveSin->data[k]*sin(om*(REAL8)(k+1.)*dtWave) + waveCos->data[k]*cos(om*(REAL8)(k+1.)*dtWave);
}
phaseWave = f0p*tWave;
phaseWave = f0s->data[0]*tWave;
}
phase = f0*tt0 + 0.5*f1*tt0*tt0 + f2*tt0*tt0*tt0/6.0 + f3*tt0*tt0*tt0*tt0/24.;
phase = 0., taylorcoeff = 1.;
REAL8 tt0update = tt0;
for ( k=0; k<(INT4)f0update->length; k++ ){
taylorcoeff /= (REAL8)(k+1);
phase += taylorcoeff*f0update->data[k]*tt0update;
tt0update *= tt0;
}
phase = fmod(phase+phaseWave+0.5, 1.0) - 0.5;
......@@ -339,6 +351,7 @@ int main(int argc, char *argv[])
XLALFree ( par.timfile );
XLALFree ( par.ephem );
XLALFree ( par.clock );
XLALDestroyREAL8Vector( f0update );
PulsarFreeParams( params );
......
......@@ -24,62 +24,73 @@ typedef struct tagParamData{
const CHAR *fitFlag; /* add a TEMPO-style fitting flag to some parameters */
}ParamData;
#define NUMPARS 43
#define NUMPARS 54
/* setup a collection of allowed .par file parameters */
ParamData p[NUMPARS] =
{
/* frequency parameters */
{ "F0", "123.00000", "123.00000", "1.00000e-08", "1.00000e-08", "1" },
{ "F1", "-1.23000e-10", "-1.23000e-10", "1.00000e-12", "1.00000e-12", "1" },
{ "F2", "1.23000e-15", "1.23000e-15", "1.00000e-17", "1.00000e-17", "1" },
{ "F3", "-1.23000e-20", "-1.23000e-20", "1.00000e-22", "1.00000e-22", "1" },
{ "F4", "1.23000e-25", "1.23000e-25", "1.00000e-27", "1.00000e-27", "1" },
{ "F5", "-1.23000e-30", "-1.23000e-30", "1.00000e-32", "1.00000e-32", " " },
{ "F6", "1.23000e-35", "1.23000e-35", "1.00000e-37", "1.00000e-37", "1" },
{ "F7", "-1.23000e-40", "-1.23000e-40", "1.00000e-42", "1.00000e-42", "1" },
{ "F8", "1.23000e-45", "1.23000e-45", "1.00000e-47", "1.00000e-47", "1" },
{ "F9", "-1.23000e-50", "-1.23000e-50", "1.00000e-52", "1.00000e-52", " " },
{ "PEPOCH", "54321.0", "870652748.81600", NULL, NULL, " " },
{ "F0", "123.00000", "123.00000", "1.00000e-08", "1.00000e-08", "1" },
{ "F1", "-1.23000e-10", "-1.23000e-10", "1.00000e-12", "1.00000e-12", "1" },
{ "F2", "1.23000e-15", "1.23000e-15", "1.00000e-17", "1.00000e-17", "1" },
{ "F3", "-1.23000e-20", "-1.23000e-20", "1.00000e-22", "1.00000e-22", "1" },
{ "F4", "1.23000e-25", "1.23000e-25", "1.00000e-27", "1.00000e-27", "1" },
{ "F5", "-1.23000e-30", "-1.23000e-30", "1.00000e-32", "1.00000e-32", " " },
{ "F6", "1.23000e-35", "1.23000e-35", "1.00000e-37", "1.00000e-37", "1" },
{ "F7", "-1.23000e-40", "-1.23000e-40", "1.00000e-42", "1.00000e-42", "1" },
{ "F8", "1.23000e-45", "1.23000e-45", "1.00000e-47", "1.00000e-47", "1" },
{ "F9", "-1.23000e-50", "-1.23000e-50", "1.00000e-52", "1.00000e-52", " " },
{ "F10", "1.23000e-67", "1.23000e-67", "1.00000e-68", "1.00000e-68", " " },
{ "PEPOCH", "54321.0", "870652748.81600", NULL, NULL, " " },
/* name parameters */
{ "PSRJ", "J0000+0000", "J0000+0000", NULL, NULL, " " },
{ "PSRB", "B0000+0000", "B0000+0000", NULL, NULL, " " },
{ "PSR", "0000+0000", "0000+0000", NULL, NULL, " " },
{ "NAME", "J0000+0000", "J0000+0000", NULL, NULL, " " },
{ "PSRJ", "J0000+0000", "J0000+0000", NULL, NULL, " " },
{ "PSRB", "B0000+0000", "B0000+0000", NULL, NULL, " " },
{ "PSR", "0000+0000", "0000+0000", NULL, NULL, " " },
{ "NAME", "J0000+0000", "J0000+0000", NULL, NULL, " " },
/* position parameters */
{ "RAJ", "12:34:56.7", "3.29407", "1.23", "8.94481e-05", "1" },
{ "ra", "12:34:56.7", "3.29407", "1.23", "8.94481e-05", " " }, /* use lower case input name*/
{ "DECJ", "-12:34:56.7", "-0.21960", "1.23", "5.96321e-06", " " },
{ "DEC", "-12:34:56.7", "-0.21960", "1.23", "5.96321e-06", " " },
{ "POSEPOCH", "54321.0", "870652748.81600", NULL, NULL , " " },
{ "PMRA", "12.345", "1.89654e-15", "1.23", "1.88963e-16", " " },
{ "EPHEM", "DE405", "DE405", NULL, NULL , " " },
{ "PMDEC", "-12.345", "-1.89654e-15", "1.23", "1.88963e-16", "1" },
{ "DIST", "123.00000", "3.79538e+21", "12.30000", "3.79538e+20", " " },
{ "RAJ", "12:34:56.7", "3.29407", "1.23", "8.94481e-05", "1" },
{ "ra", "12:34:56.7", "3.29407", "1.23", "8.94481e-05", " " }, /* use lower case input name*/
{ "DECJ", "-12:34:56.7", "-0.21960", "1.23", "5.96321e-06", " " },
{ "DEC", "-12:34:56.7", "-0.21960", "1.23", "5.96321e-06", " " },
{ "POSEPOCH", "54321.0", "870652748.81600", NULL, NULL , " " },
{ "PMRA", "12.345", "1.89654e-15", "1.23", "1.88963e-16", " " },
{ "EPHEM", "DE405", "DE405", NULL, NULL , " " },
{ "PMDEC", "-12.345", "-1.89654e-15", "1.23", "1.88963e-16", "1" },
{ "DIST", "123.00000", "3.79538e+21", "12.30000", "3.79538e+20", " " },
/* glitch parameters */
{ "GLEP_1", "54321.0", "870652748.81600", "0.00123", "106.27200", " " },
{ "GLEP_2", "54322.0", "870739148.81600", "0.00123", "106.27200", " " },
{ "GLPH_1", "0.43453", "0.43453", "0.00453", "0.00453", "1" },
{ "GLPH_2", "0.93453", "0.93453", "0.01453", "0.01453", "1" },
{ "GLF0_1", "2.50000e-8", "2.50000e-08", "4.50000e-09", "4.50000e-09", " " },
{ "GLF0_2", "3.50000e-8", "3.50000e-08", "2.50000e-09", "2.50000e-09", " " },
{ "GLF0D_1", "5.50000e-6", "5.50000e-06", "7.50000e-09", "7.50000e-09", " " },
{ "GLF0D_2", "6.50000e-6", "6.50000e-06", "9.50000e-09", "9.50000e-09", " " },
{ "GLTD_1", "234.500000", "20260800.00000", "2.00000", "172800.00000", " " },
{ "GLTD_2", "23.450000", "2026080.00000", "1.00000", "86400.00000", " " },
/* binary parameters */
{ "BINARY", "BT", "BT", NULL, NULL , " " },
{ "OM", "123.45", "2.15461", "1.23", "0.02147" , " " },
{ "A1", "12.34500", "12.34500", "1.23000e-04", "1.23000e-04", "1" },
{ "ECC", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", " " },
{ "PB", "1.23", "106272.00000", "0.00123", "106.27200" , " " },
{ "T0", "54321.0", "870652748.81600", "0.00123", "106.27200" , " " },
{ "TASC", "54321.0", "870652748.81600", "0.00123", "106.27200" , " " },
{ "EPS1", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", "1" },
{ "EPS2", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", "1" },
{ "FB0", "1.23400e-05", "1.23400e-05", "1.23400e-14", "1.23400e-14", "1" },
{ "FB2", "1.23400e-09", "1.23400e-09", "1.23400e-18", "1.23400e-18", " " },
{ "FB1", "1.23400e-09", "1.23400e-09", "1.23400e-18", "1.23400e-18", "1" },
{ "EDOT", "1.23400e-05", "1.23400e-17", "1.23400e-18", "1.23400e-18", " " },
{ "BINARY", "BT", "BT", NULL, NULL , " " },
{ "OM", "123.45", "2.15461", "1.23", "0.02147" , " " },
{ "A1", "12.34500", "12.34500", "1.23000e-04", "1.23000e-04", "1" },
{ "ECC", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", " " },
{ "PB", "1.23", "106272.00000", "0.00123", "106.27200" , " " },
{ "T0", "54321.0", "870652748.81600", "0.00123", "106.27200" , " " },
{ "TASC", "54321.0", "870652748.81600", "0.00123", "106.27200" , " " },
{ "EPS1", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", "1" },
{ "EPS2", "1.23400e-05", "1.23400e-05", "1.23400e-08", "1.23400e-08", "1" },
{ "FB0", "1.23400e-05", "1.23400e-05", "1.23400e-14", "1.23400e-14", "1" },
{ "FB2", "1.23400e-09", "1.23400e-09", "1.23400e-18", "1.23400e-18", " " },
{ "FB1", "1.23400e-09", "1.23400e-09", "1.23400e-18", "1.23400e-18", "1" },
{ "EDOT", "1.23400e-05", "1.23400e-17", "1.23400e-18", "1.23400e-18", " " },
/* GW parameters */
{ "H0", "1.23000e-22", "1.23000e-22", "1.23000E-23", "1.23000e-23", " " }, /* input exponent as E */
{ "COSIOTA", "-0.12300", "-0.12300", "0.00123", "0.00123" , " " },
{ "PHI0", "1.23000", "1.23000", "0.12300", "0.12300" , " " },
{ "PSI", "-0.12300", "-0.12300", "0.01230", "0.01230" , " " },
{ "APLUS", "1.23000e-22", "1.23000e-22", "1.23000D-23", "1.23000e-23", " " }, /* input exponent as D */
{ "ACROSS", "1.23000e-22", "1.23000e-22", "1.23000D-23", "1.23000e-23", " " }, /* input exponent as D */
{ "H0", "1.23000e-22", "1.23000e-22", "1.23000E-23", "1.23000e-23", " " }, /* input exponent as E */
{ "COSIOTA", "-0.12300", "-0.12300", "0.00123", "0.00123" , " " },
{ "PHI0", "1.23000", "1.23000", "0.12300", "0.12300" , " " },
{ "PSI", "-0.12300", "-0.12300", "0.01230", "0.01230" , " " },
{ "APLUS", "1.23000e-22", "1.23000e-22", "1.23000D-23", "1.23000e-23", " " }, /* input exponent as D */
{ "ACROSS", "1.23000e-22", "1.23000e-22", "1.23000D-23", "1.23000e-23", " " }, /* input exponent as D */
};
const CHAR delimiters[]="0123456789"; /* delimit name by numbers */
int main( void ){
INT4 i = 0;
......@@ -115,7 +126,11 @@ int main( void ){
* for e.g. FB, which is held as a vector */
CHAR *namecopy = NULL, *token = NULL;
namecopy = XLALStringDuplicate( p[i].name );
token = strtok(namecopy, delimiters); /* get part of the name before the numerical delimiter */
/* get part of the name before the numerical/underscore delimiter */
if ( strchr( p[i].name, '_' ) && strncmp( p[i].name, "WAVE", 4 ) ) { /* delimiter by underscores and not a FITWAVES parameter */
token = strtok(namecopy, "_");
}
else{ token = strtok(namecopy, "0123456789"); }
if ( !PulsarCheckParam( pars, p[i].name ) && !PulsarCheckParam( pars, token ) ){
XLAL_ERROR( XLAL_EFAILED, "Error... parameter %s does not exist in the read-in data!\n", p[i].name );
......
Markdown is supported
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