67 #include <lal/LALConstants.h>
68 #include <lal/LALStdlib.h>
69 #include <lal/LALString.h>
70 #include <lal/ComputeFstat.h>
71 #include <lal/TranslateAngles.h>
72 #include <lal/TranslateMJD.h>
73 #include <lal/LALHashFunc.h>
74 #include <lal/ReadPulsarParFile.h>
77 #define UNUSED __attribute__ ((unused))
83 #define DAYSTOSECS 86400.0
96 [
'a'] =
'A', [
'b'] =
'B', [
'c'] =
'C', [
'd'] =
'D', [
'e'] =
'E', [
'f'] =
'F', [
'g'] =
'G', [
'h'] =
'H',
97 [
'i'] =
'I', [
'j'] =
'J', [
'k'] =
'K', [
'l'] =
'L', [
'm'] =
'M', [
'n'] =
'N', [
'o'] =
'O', [
'p'] =
'P',
98 [
'q'] =
'Q', [
'r'] =
'R', [
's'] =
'S', [
't'] =
'T', [
'u'] =
'U', [
'v'] =
'V', [
'w'] =
'W', [
'x'] =
'X',
99 [
'y'] =
'Y', [
'z'] =
'Z'
109 if ( (
c =
a2A[(
int )( *
s )] ) ) {
116 typedef struct taghash_elem {
148 if ( !elem1 || !elem2 ) {
163 if ( pars == NULL ) {
173 while (
this != NULL ) {
174 if ( !strcmp( this->name,
name ) ) {
203 if ( pars == NULL ) {
213 tmp.
name = upperName;
231 return ( item->
value );
303 CHAR *namecopy = NULL, *token;
307 if ( strchr(
name,
'_' ) ) {
308 token = strtok( namecopy,
"_" );
310 token = strtok( namecopy,
"0123456789" );
321 if ( sscanf(
name +
loc,
"%d", &idx ) != 1 ) {
326 if ( !strncmp(
name,
"GL", 2 ) || !strncmp(
name,
"WAVE", 4 ) ) {
329 if ( idx < 0 || (
UINT4 )idx > vpars->
length - 1 ) {
333 val = vpars->
data[idx];
349 return ( item->
err );
398 return *(
REAL8 * )val;
426 CHAR *namecopy = NULL, *token;
430 if ( strchr(
name,
'_' ) ) {
431 token = strtok( namecopy,
"_" );
433 token = strtok( namecopy,
"0123456789" );
444 if ( sscanf(
name +
loc,
"%d", &idx ) != 1 ) {
449 if ( !strncmp(
name,
"GL", 2 ) || !strncmp(
name,
"WAVE", 4 ) ) {
452 if ( idx < 0 || (
UINT4 )idx > vpars->
length - 1 ) {
456 val = vpars->
data[idx];
506 memset( new->fitFlag->data, 0,
sizeof(
UINT4 )*dlength );
509 memset(
err->data, 0,
sizeof(
REAL8 )*dlength );
515 memset( new->fitFlag->data, 0,
sizeof(
UINT4 ) );
523 if (
new == NULL || new->value == NULL ) {
534 new->next = pars->
head;
620 if ( this->fitFlag ) {
658 if ( !strcmp( this->name, upperName ) ) {
671 pars->
head = this->next;
673 parent->
next = this->next;
691 if ( this->fitFlag ) {
698 this->fitFlag = NULL;
739 if ( item->
err != NULL ) {
803 if ( origin == target ) {
832 memcpy( new->data, old->
data, new->length *
sizeof(
REAL8 ) );
852 memcpy( newfit, oldfit, newerr->
length *
sizeof(
UINT4 ) );
869 UINT4 newfit = oldfit[0];
897 #define DEFINE_CONV_FACTOR_FUNCTION( name, convfactor, type ) \
898 void ParConv ## name ( const CHAR *inval, void *out ){ \
899 CHAR *in = XLALStringDuplicate( inval ); \
900 if ( type != CONVSTRING && type != CONVINT ) { \
902 if ( type == CONVFLOAT || type == CONVBINUNITS ){ \
904 for ( INT4 i = 0; i < (INT4)strlen(in); i++ ) { \
905 if ( in[i] == 'D' || in[i] == 'd' ) { in[i] = 'e'; } \
908 if ( type == CONVBINUNITS ){ \
910 if ( fabs( x ) > 1e-7 ) { x *= 1.e-12; } \
914 if ( x > 10000. ) { x = 0.; } \
916 else{ x *= convfactor; } \
918 else if ( type == CONVHMS ) { \
919 XLALTranslateHMStoRAD( &x, in ); \
921 else if ( type == CONVDMS ) { \
922 XLALTranslateDMStoRAD( &x, in ); \
924 else if ( type == CONVMJD ) { \
925 x = XLALTTMJDtoGPS( atof(in) ); \
927 memcpy(out, &x, sizeof(REAL8) ); \
929 else if ( type == CONVSTRING ){ memcpy( out, in, strlen(in)+1 ); } \
930 else if ( type == CONVINT ) { \
932 x = (UINT4)atoi(in); \
933 memcpy(out, &x, sizeof(UINT4) ); \
959 typedef void ( *ParamConversionFunc )(
const CHAR *in,
void *
out );
963 typedef struct tagParConversion {
965 ParamConversionFunc convfunc;
966 ParamConversionFunc converrfunc;
1154 INT4 i = 0, tmpnum = 0;
1157 if (
par == NULL ) {
1160 if (
name == NULL ) {
1174 nread = sscanf(
str,
"%s %s %s", str1, str2, str3 );
1182 if ( !strcmp(
name,
"E" ) ) {
1184 }
else if ( !strcmp(
name,
"E_1" ) ) {
1186 }
else if ( !strcmp(
name,
"E_2" ) ) {
1188 }
else if ( !strcmp(
name,
"E_3" ) ) {
1199 INT4 isfreq = ( !strncmp( nname,
"F", 1 ) && !strcmp(
"F",
pc[
i].
name ) && sscanf( nname + strlen(
"F" ),
"%d", &tmpnum ) == 1 );
1200 INT4 isperiod = ( !strncmp( nname,
"P", 1 ) && !strcmp(
"P",
pc[
i].
name ) && sscanf( nname + strlen(
"P" ),
"%d", &tmpnum ) == 1 );
1201 INT4 iswave = ( ( !strncmp( nname,
"WAVE", 4 ) && ( !strcmp(
"WAVESIN",
pc[
i].
name ) || !strcmp(
"WAVECOS",
pc[
i].
name ) ) ) && strcmp(
"WAVE_OM", nname ) && strcmp(
"WAVEEPOCH", nname ) );
1202 INT4 isfb = ( !strncmp( nname,
"FB", 2 ) && !strcmp(
"FB",
pc[
i].
name ) );
1203 INT4 isgl = ( !strncmp( nname,
"GL", 2 ) && strstr( nname,
pc[
i].
name ) && !strncmp( nname,
pc[
i].
name, strlen( nname ) - 2 ) );
1205 if ( !strcmp( nname,
pc[
i].
name ) || isfreq || isperiod || iswave || isfb || isgl ) {
1206 UINT4 num = 0, nsize = 0;
1208 if (
pc[
i].convfunc == NULL ) {
1214 if ( isfreq || isperiod || isfb ) {
1216 UINT4 *fitFlag = NULL;
1219 if ( strlen( nname ) > strlen(
"FB" ) ) {
1220 if ( sscanf( nname + strlen(
"FB" ),
"%d", &num ) != 1 ) {
1224 }
else if ( isfreq ) {
1225 if ( strlen( nname ) > strlen(
"F" ) ) {
1226 if ( sscanf( nname + strlen(
"F" ),
"%d", &num ) != 1 ) {
1231 if ( strlen( nname ) > strlen(
"P" ) ) {
1232 if ( sscanf( nname + strlen(
"P" ),
"%d", &num ) != 1 ) {
1240 pc[
i].convfunc( str1, val );
1246 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1251 memset(
ptr->data, 0,
sizeof(
REAL8 )*nsize );
1255 memset( eptr->data, 0,
sizeof(
REAL8 )*nsize );
1269 memcpy( fitFlag, ff,
sizeof(
UINT4 )*cptr->
length );
1284 }
else if ( iswave && nread == 2 ) {
1287 if ( strlen( nname ) > strlen(
"WAVE" ) ) {
1288 if ( sscanf( nname + strlen(
"WAVE" ),
"%d", &num ) != 1 ) {
1300 pc[
i].convfunc( str1, val1 );
1301 pc[
i].convfunc( str2, val2 );
1308 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1314 memset( ptr1->
data, 0,
sizeof(
REAL8 )*nsize );
1315 memset( ptr2->data, 0,
sizeof(
REAL8 )*nsize );
1323 memcpy( ptr2->data, cptr2->
data, ptr2->length *
sizeof(
REAL8 ) );
1327 ptr2->data[num] = *(
REAL8 * )val2;
1340 memset( eptr->
data, 0,
sizeof(
REAL8 )*nsize );
1347 }
else if ( isgl ) {
1349 UINT4 *fitFlag = NULL;
1351 if ( sscanf( strstr( nname,
"_" ) + 1,
"%d", &num ) != 1 ) {
1359 pc[
i].convfunc( str1, val );
1365 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1370 memset(
ptr->data, 0,
sizeof(
REAL8 )*nsize );
1374 memset( eptr->data, 0,
sizeof(
REAL8 )*nsize );
1388 memcpy( fitFlag, ff,
sizeof(
UINT4 )*cptr->
length );
1405 pc[
i].convfunc( str1, val );
1416 if ( ( nread == 2 && strcmp( str2,
"1" ) ) || ( nread == 3 && !strcmp( str2,
"1" ) ) ) {
1417 if (
pc[
i].converrfunc == NULL ) {
1426 if ( isfreq || isperiod || isfb || isgl ) {
1437 memcpy( ff, fitFlag,
sizeof(
UINT4 )*
ptr->length );
1440 pc[
i].converrfunc( str2, val );
1442 if ( !strcmp( str2,
"1" ) ) {
1445 pc[
i].converrfunc( str3, val );
1457 pc[
i].converrfunc( str2, val );
1459 if ( !strcmp( str2,
"1" ) ) {
1462 pc[
i].converrfunc( str3, val );
1490 if ( (
fp = fopen( pulsarAndPath,
"r" ) ) == NULL ) {
1500 while ( !feof(
fp ) ) {
1505 if (
str[0] ==
'#' ) {
1529 if ( !strcmp( sini,
"KIN" ) ) {
1534 XLAL_PRINT_ERROR(
"Error... KIN not set in .par file %s\n", pulsarAndPath );
1540 sinid = atof( sini );
1556 CHAR *pulsarAndPath )
1672 output->posepochErr = 0.0;
1676 output->finishTime = INFINITY;
1682 output->eps1dotErr = 0.0;
1683 output->eps2dotErr = 0.0;
1781 output->lambdapinErr = 0.;
1782 output->costhetaErr = 0.;
1790 output->psiTensorErr = 0.;
1791 output->phi0TensorErr = 0.;
1792 output->hScalarBErr = 0.;
1793 output->hScalarLErr = 0.;
1794 output->psiScalarErr = 0.;
1795 output->phi0ScalarErr = 0.;
1796 output->hVectorXErr = 0.;
1797 output->hVectorYErr = 0.;
1798 output->psiVectorErr = 0.;
1799 output->phi0VectorErr = 0.;
1801 output->wave_omErr = 0.0;
1809 if ( (
fp = fopen( pulsarAndPath,
"r" ) ) == NULL ) {
1815 while ( !feof(
fp ) ) {
1817 sprintf( val[
i],
"%s",
"" );
1822 if ( val[
i][0] ==
'#' ) {
1846 if ( !strcmp( val[
i],
"NAME" ) || !strcmp( val[
i],
"name" ) ) {
1849 }
else if ( !strcmp( val[
i],
"PSRJ" ) || !strcmp( val[
i],
"psrj" ) ) {
1852 }
else if ( !strcmp( val[
i],
"PSRB" ) || !strcmp( val[
i],
"psrb" ) ) {
1855 }
else if ( !strcmp( val[
i],
"ra" ) || !strcmp( val[
i],
"RA" ) || !strcmp( val[
i],
"RAJ" ) ) {
1861 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1866 }
else if ( !strcmp( val[
i],
"dec" ) || !strcmp( val[
i],
"DEC" ) || !strcmp( val[
i],
"DECJ" ) ) {
1870 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1875 }
else if ( !strcmp( val[
i],
"pmra" ) || !strcmp( val[
i],
"PMRA" ) ) {
1877 output->pmra =
LAL_PI_180 * atof( val[
i + 1] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1879 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1881 LAL_PI_180 * atof( val[
i + 3] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1884 }
else if ( !strcmp( val[
i],
"pmdec" ) || !strcmp( val[
i],
"PMDEC" ) ) {
1886 output->pmdec =
LAL_PI_180 * atof( val[
j + 1] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1889 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1891 LAL_PI_180 * atof( val[
i + 3] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1894 }
else if ( !strcmp( val[
i],
"pepoch" ) || !strcmp( val[
i],
"PEPOCH" ) ) {
1899 }
else if ( !strcmp( val[
i],
"posepoch" ) || !strcmp( val[
i],
"POSEPOCH" ) ) {
1903 }
else if ( !strcmp( val[
i],
"start" ) || !strcmp( val[
i],
"START" ) ) {
1908 }
else if ( !strcmp( val[
i],
"finish" ) || !strcmp( val[
i],
"FINISH" ) ) {
1912 }
else if ( !strcmp( val[
i],
"f0" ) || !strcmp( val[
i],
"F0" ) ) {
1919 output->f0 = atof( val[
i + 1] );
1922 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1924 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1925 output->f0Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1927 output->f0Err = atof( val[
i + 3] );
1931 }
else if ( !strcmp( val[
i],
"f1" ) || !strcmp( val[
i],
"F1" ) ) {
1935 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1936 output->f1 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1938 output->f1 = atof( val[
i + 1] );
1942 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1944 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1945 output->f1Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1947 output->f1Err = atof( val[
i + 3] );
1951 }
else if ( !strcmp( val[
i],
"f2" ) || !strcmp( val[
i],
"F2" ) ) {
1955 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1956 output->f2 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1958 output->f2 = atof( val[
i + 1] );
1962 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1964 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1965 output->f2Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1967 output->f2Err = atof( val[
i + 3] );
1971 }
else if ( !strcmp( val[
i],
"f3" ) || !strcmp( val[
i],
"F3" ) ) {
1975 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1976 output->f3 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1978 output->f3 = atof( val[
i + 1] );
1982 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1984 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1985 output->f3Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1987 output->f3Err = atof( val[
i + 3] );
1991 }
else if ( !strcmp( val[
i],
"f4" ) || !strcmp( val[
i],
"F4" ) ) {
1995 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1996 output->f4 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1998 output->f4 = atof( val[
i + 1] );
2002 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2004 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2005 output->f4Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2007 output->f4Err = atof( val[
i + 3] );
2011 }
else if ( !strcmp( val[
i],
"f5" ) || !strcmp( val[
i],
"F5" ) ) {
2015 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2016 output->f5 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2018 output->f5 = atof( val[
i + 1] );
2022 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2024 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2025 output->f5Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2027 output->f5Err = atof( val[
i + 3] );
2031 }
else if ( !strcmp( val[
i],
"f6" ) || !strcmp( val[
i],
"F6" ) ) {
2035 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2036 output->f6 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2038 output->f6 = atof( val[
i + 1] );
2042 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2044 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2045 output->f6Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2047 output->f6Err = atof( val[
i + 3] );
2051 }
else if ( !strcmp( val[
i],
"f7" ) || !strcmp( val[
i],
"F7" ) ) {
2055 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2056 output->f7 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2058 output->f7 = atof( val[
i + 1] );
2062 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2064 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2065 output->f7Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2067 output->f7Err = atof( val[
i + 3] );
2071 }
else if ( !strcmp( val[
i],
"f8" ) || !strcmp( val[
i],
"F8" ) ) {
2075 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2076 output->f8 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2078 output->f8 = atof( val[
i + 1] );
2082 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2084 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2085 output->f8Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2087 output->f8Err = atof( val[
i + 3] );
2091 }
else if ( !strcmp( val[
i],
"f9" ) || !strcmp( val[
i],
"F9" ) ) {
2095 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2096 output->f9 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2098 output->f9 = atof( val[
i + 1] );
2102 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2104 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2105 output->f9Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2107 output->f9Err = atof( val[
i + 3] );
2111 }
else if ( !strcmp( val[
i],
"f10" ) || !strcmp( val[
i],
"F10" ) ) {
2115 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2116 output->f10 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2118 output->f10 = atof( val[
i + 1] );
2122 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2124 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2125 output->f10Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2127 output->f10Err = atof( val[
i + 3] );
2131 }
else if ( !strcmp( val[
i],
"WAVE_OM" ) || !strcmp( val[
i],
"wave_om" ) ) {
2132 output->wave_om = atof( val[
i + 1] );
2135 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2136 output->wave_omErr = atof( val[
i + 3] );
2139 }
else if ( !strcmp( val[
i],
"WAVEEPOCH" ) || !strcmp( val[
i],
"waveepoch" ) ) {
2142 }
else if ( strstr( val[
i],
"WAVE" ) != NULL || strstr( val[
i],
"wave" ) != NULL ) {
2145 if ( sscanf( val[
i] + 4,
"%d", &wnum ) != 1 ) {
2146 fprintf( stderr,
"Error reading WAVE number from par file\n" );
2150 if ( wnum >
output->nwaves ) {
2156 output->waveSin[wnum - 1] = atof( val[
i + 1] );
2157 output->waveCos[wnum - 1] = atof( val[
i + 2] );
2160 }
else if ( !strcmp( val[
i],
"binary" ) || !strcmp( val[
i],
"BINARY" ) ) {
2163 }
else if ( !strcmp( val[
i],
"ephem" ) || !strcmp( val[
i],
"EPHEM" ) ) {
2166 }
else if ( !strcmp( val[
i],
"units" ) || !strcmp( val[
i],
"UNITS" ) ) {
2169 }
else if ( !strcmp( val[
i],
"a1" ) || !strcmp( val[
i],
"A1" ) ) {
2170 output->x = atof( val[
i + 1] );
2173 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2174 output->xErr = atof( val[
i + 3] );
2177 }
else if ( !strcmp( val[
i],
"e" ) || !strcmp( val[
i],
"E" ) || !strcmp( val[
i],
"ECC" ) ||
2178 !strcmp( val[
i],
"ecc" ) ) {
2179 output->e = atof( val[
i + 1] );
2182 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2183 output->eErr = atof( val[
i + 3] );
2186 }
else if ( !strcmp( val[
i],
"pb" ) || !strcmp( val[
i],
"PB" ) ) {
2190 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2194 }
else if ( !strcmp( val[
i],
"om" ) || !strcmp( val[
i],
"OM" ) ) {
2198 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2202 }
else if ( !strcmp( val[
i],
"T0" ) ) {
2206 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2210 }
else if ( !strcmp( val[
i],
"Tasc" ) || !strcmp( val[
i],
"TASC" ) ) {
2214 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2218 }
else if ( !strcmp( val[
i],
"eps1" ) || !strcmp( val[
i],
"EPS1" ) ) {
2219 output->eps1 = atof( val[
i + 1] );
2222 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2223 output->eps1Err = atof( val[
i + 3] );
2226 }
else if ( !strcmp( val[
i],
"eps2" ) || !strcmp( val[
i],
"EPS2" ) ) {
2227 output->eps2 = atof( val[
i + 1] );
2230 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2231 output->eps2Err = atof( val[
i + 3] );
2234 }
else if ( !strcmp( val[
i],
"eps1dot" ) || !strcmp( val[
i],
"EPS1DOT" ) ) {
2235 output->eps1dot = atof( val[
i + 1] );
2237 if ( fabs(
output->eps1dot ) > 1
e-7 ) {
2238 output->eps1dot *= 1.e-12;
2242 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2243 output->eps1dotErr = atof( val[
i + 3] );
2246 }
else if ( !strcmp( val[
i],
"eps2dot" ) || !strcmp( val[
i],
"EPS2DOT" ) ) {
2247 output->eps2dot = atof( val[
i + 1] );
2249 if ( fabs(
output->eps2dot ) > 1
e-7 ) {
2250 output->eps2dot *= 1.e-12;
2254 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2255 output->eps2dotErr = atof( val[
i + 3] );
2258 }
else if ( !strcmp( val[
i],
"xpbdot" ) || !strcmp( val[
i],
"XPBDOT" ) ) {
2259 output->xpbdot = atof( val[
i + 1] );
2261 if ( fabs(
output->xpbdot ) > 1
e-7 ) {
2262 output->xpbdot *= 1.e-12;
2266 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2267 output->xpbdotErr = atof( val[
i + 3] );
2270 }
else if ( !strcmp( val[
i],
"omdot" ) || !strcmp( val[
i],
"OMDOT" ) ) {
2274 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2278 }
else if ( !strcmp( val[
i],
"pbdot" ) || !strcmp( val[
i],
"PBDOT" ) ) {
2279 output->Pbdot = atof( val[
i + 1] );
2281 if ( fabs(
output->Pbdot ) > 1
e-7 ) {
2286 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2287 output->PbdotErr = atof( val[
i + 3] );
2290 }
else if ( !strcmp( val[
i],
"xdot" ) || !strcmp( val[
i],
"XDOT" ) ) {
2291 output->xdot = atof( val[
i + 1] );
2293 if ( fabs(
output->xdot ) > 1
e-7 ) {
2298 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2299 output->xdotErr = atof( val[
i + 3] );
2302 }
else if ( !strcmp( val[
i],
"edot" ) || !strcmp( val[
i],
"EDOT" ) ) {
2303 output->edot = atof( val[
i + 1] );
2305 if ( fabs(
output->edot ) > 1
e-7 ) {
2310 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2311 output->edotErr = atof( val[
i + 3] );
2319 if (
output->edot > 10000 ) {
2323 }
else if ( !strcmp( val[
i],
"gamma" ) || !strcmp( val[
i],
"GAMMA" ) ) {
2324 output->gamma = atof( val[
i + 1] );
2327 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2328 output->gammaErr = atof( val[
i + 3] );
2331 }
else if ( !strcmp( val[
i],
"sini" ) || !strcmp( val[
i],
"SINI" ) ) {
2335 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2336 output->sErr = atof( val[
i + 3] );
2339 }
else if ( !strcmp( val[
i],
"mtot" ) || !strcmp( val[
i],
"MTOT" ) ) {
2343 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2347 }
else if ( !strcmp( val[
i],
"m2" ) || !strcmp( val[
i],
"M2" ) ) {
2351 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2355 }
else if ( !strcmp( val[
i],
"a0" ) || !strcmp( val[
i],
"A0" ) ) {
2356 output->a0 = atof( val[
i + 1] );
2359 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2360 output->a0Err = atof( val[
i + 3] );
2363 }
else if ( !strcmp( val[
i],
"b0" ) || !strcmp( val[
i],
"B0" ) ) {
2364 output->b0 = atof( val[
i + 1] );
2367 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2368 output->b0Err = atof( val[
i + 3] );
2371 }
else if ( !strcmp( val[
i],
"dr" ) || !strcmp( val[
i],
"DR" ) ) {
2372 output->dr = atof( val[
i + 1] );
2375 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2376 output->drErr = atof( val[
i + 3] );
2379 }
else if ( !strcmp( val[
i],
"dtheta" ) || !strcmp( val[
i],
"DTHETA" ) ) {
2380 output->dth = atof( val[
i + 1] );
2383 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2384 output->dthErr = atof( val[
i + 3] );
2387 }
else if ( !strcmp( val[
i],
"shapmax" ) || !strcmp( val[
i],
"SHAPMAX" ) ) {
2388 output->shapmax = atof( val[
i + 1] );
2391 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2392 output->shapmaxErr = atof( val[
i + 3] );
2398 else if ( !strcmp( val[
i],
"D_AOP" ) || !strcmp( val[
i],
"d_aop" ) ) {
2403 }
else if ( !strcmp( val[
i],
"KIN" ) || !strcmp( val[
i],
"kin" ) ) {
2407 }
else if ( !strcmp( val[
i],
"KOM" ) || !strcmp( val[
i],
"kom" ) ) {
2414 else if ( !strcmp( val[
i],
"px" ) || !strcmp( val[
i],
"PX" ) ) {
2419 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2420 output->pxErr = atof( val[
i + 3] );
2423 }
else if ( !strcmp( val[
i],
"dist" ) || !strcmp( val[
i],
"DIST" ) ) {
2424 output->dist = atof( val[
i + 1] );
2427 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2428 output->distErr = atof( val[
i + 3] );
2434 else if ( !strcmp( val[
i],
"dm" ) || !strcmp( val[
i],
"DM" ) ) {
2435 output->DM = atof( val[
i + 1] );
2438 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2439 output->DMErr = atof( val[
i + 3] );
2442 }
else if ( !strcmp( val[
i],
"dm1" ) || !strcmp( val[
i],
"DM1" ) ) {
2443 output->DM1 = atof( val[
i + 1] );
2446 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2447 output->DM1Err = atof( val[
i + 3] );
2453 else if ( !strcmp( val[
i],
"a1_2" ) || !strcmp( val[
i],
"A1_2" ) ) {
2454 output->x2 = atof( val[
i + 1] );
2457 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2458 output->x2Err = atof( val[
i + 3] );
2461 }
else if ( !strcmp( val[
i],
"e_2" ) || !strcmp( val[
i],
"E_2" ) ||
2462 !strcmp( val[
i],
"ECC_2" ) || !strcmp( val[
i],
"ecc_2" ) ) {
2463 output->e2 = atof( val[
i + 1] );
2466 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2467 output->e2Err = atof( val[
i + 3] );
2470 }
else if ( !strcmp( val[
i],
"pb_2" ) || !strcmp( val[
i],
"PB_2" ) ) {
2474 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2478 }
else if ( !strcmp( val[
i],
"om_2" ) || !strcmp( val[
i],
"OM_2" ) ) {
2482 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2486 }
else if ( !strcmp( val[
i],
"T0_2" ) ) {
2490 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2494 }
else if ( !strcmp( val[
i],
"a1_3" ) || !strcmp( val[
i],
"A1_3" ) ) {
2495 output->x3 = atof( val[
i + 1] );
2498 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2499 output->x3Err = atof( val[
i + 3] );
2502 }
else if ( !strcmp( val[
i],
"e_3" ) || !strcmp( val[
i],
"E_3" ) ||
2503 !strcmp( val[
i],
"ECC_3" ) || !strcmp( val[
i],
"ecc_3" ) ) {
2504 output->e3 = atof( val[
i + 1] );
2507 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2508 output->e3Err = atof( val[
i + 3] );
2511 }
else if ( !strcmp( val[
i],
"pb_3" ) || !strcmp( val[
i],
"PB_3" ) ) {
2515 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2519 }
else if ( !strcmp( val[
i],
"om_3" ) || !strcmp( val[
i],
"OM_3" ) ) {
2523 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2527 }
else if ( !strcmp( val[
i],
"T0_3" ) ) {
2531 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2538 else if ( val[
i][0] ==
'F' && val[
i][1] ==
'B' ) {
2542 if ( strlen( val[
i] ) == 2 ) {
2545 if ( sscanf( val[
i] + 2,
"%d", &fbnum ) != 1 ) {
2546 fprintf( stderr,
"Error reading FB value from par file\n" );
2552 if (
output->nfb < fbnum + 1 ) {
2559 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2560 output->fb[fbnum] = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2562 output->fb[fbnum] = atof( val[
i + 1] );
2566 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2568 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2569 output->fbErr[fbnum] = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2571 output->fbErr[fbnum] = atof( val[
i + 3] );
2577 else if ( !strcmp( val[
i],
"h0" ) || !strcmp( val[
i],
"H0" ) ) {
2578 output->h0 = atof( val[
i + 1] );
2581 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2582 output->h0Err = atof( val[
i + 3] );
2585 }
else if ( !strcmp( val[
i],
"q22" ) || !strcmp( val[
i],
"Q22" ) ) {
2586 output->Q22 = atof( val[
i + 1] );
2589 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2590 output->Q22Err = atof( val[
i + 3] );
2593 }
else if ( !strcmp( val[
i],
"cosiota" ) || !strcmp( val[
i],
"COSIOTA" ) ||
2594 !strcmp( val[
i],
"ciota" ) || !strcmp( val[
i],
"CIOTA" ) ) {
2595 output->cosiota = atof( val[
i + 1] );
2598 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2599 output->cosiotaErr = atof( val[
i + 3] );
2602 }
else if ( !strcmp( val[
i],
"iota" ) || !strcmp( val[
i],
"IOTA" ) ) {
2603 output->iota = atof( val[
i + 1] );
2606 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2607 output->iotaErr = atof( val[
i + 3] );
2610 }
else if ( !strcmp( val[
i],
"psi" ) || !strcmp( val[
i],
"PSI" ) ) {
2611 output->psi = atof( val[
i + 1] );
2614 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2615 output->psiErr = atof( val[
i + 3] );
2618 }
else if ( !strcmp( val[
i],
"phi0" ) || !strcmp( val[
i],
"PHI0" ) ) {
2619 output->phi0 = atof( val[
i + 1] );
2622 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2623 output->phi0Err = atof( val[
i + 3] );
2626 }
else if ( !strcmp( val[
i],
"aplus" ) || !strcmp( val[
i],
"APLUS" ) ) {
2627 output->Aplus = atof( val[
i + 1] );
2630 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2631 output->AplusErr = atof( val[
i + 3] );
2634 }
else if ( !strcmp( val[
i],
"across" ) || !strcmp( val[
i],
"ACROSS" ) ) {
2635 output->Across = atof( val[
i + 1] );
2638 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2639 output->AcrossErr = atof( val[
i + 3] );
2642 }
else if ( !strcmp( val[
i],
"i21" ) || !strcmp( val[
i],
"I21" ) ) {
2643 output->I21 = atof( val[
i + 1] );
2646 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2647 output->I21Err = atof( val[
i + 3] );
2650 }
else if ( !strcmp( val[
i],
"i31" ) || !strcmp( val[
i],
"I31" ) ) {
2651 output->I31 = atof( val[
i + 1] );
2654 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2655 output->I31Err = atof( val[
i + 3] );
2658 }
else if ( !strcmp( val[
i],
"lambdapin" ) || !strcmp( val[
i],
"LAMBDAPIN" ) ) {
2659 output->lambdapin = atof( val[
i + 1] );
2662 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2663 output->lambdapinErr = atof( val[
i + 3] );
2666 }
else if ( !strcmp( val[
i],
"costheta" ) || !strcmp( val[
i],
"COSTHETA" ) ) {
2667 output->costheta = atof( val[
i + 1] );
2670 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2671 output->costhetaErr = atof( val[
i + 3] );
2674 }
else if ( !strcmp( val[
i],
"theta" ) || !strcmp( val[
i],
"THETA" ) ) {
2675 output->theta = atof( val[
i + 1] );
2678 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2679 output->thetaErr = atof( val[
i + 3] );
2682 }
else if ( !strcmp( val[
i],
"c22" ) || !strcmp( val[
i],
"C22" ) ) {
2683 output->C22 = atof( val[
i + 1] );
2686 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2687 output->C22Err = atof( val[
i + 3] );
2690 }
else if ( !strcmp( val[
i],
"c21" ) || !strcmp( val[
i],
"C21" ) ) {
2691 output->C21 = atof( val[
i + 1] );
2694 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2695 output->C21Err = atof( val[
i + 3] );
2698 }
else if ( !strcmp( val[
i],
"phi22" ) || !strcmp( val[
i],
"PHI22" ) ) {
2699 output->phi22 = atof( val[
i + 1] );
2702 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2703 output->phi22Err = atof( val[
i + 3] );
2706 }
else if ( !strcmp( val[
i],
"phi21" ) || !strcmp( val[
i],
"phi21" ) ) {
2707 output->phi21 = atof( val[
i + 1] );
2710 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2711 output->phi21Err = atof( val[
i + 3] );
2714 }
else if ( !strcmp( val[
i],
"hplus" ) || !strcmp( val[
i],
"HPLUS" ) ) {
2715 output->hPlus = atof( val[
i + 1] );
2718 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2719 output->hPlus = atof( val[
i + 3] );
2722 }
else if ( !strcmp( val[
i],
"hcross" ) || !strcmp( val[
i],
"HCROSS" ) ) {
2723 output->hCross = atof( val[
i + 1] );
2726 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2727 output->hCrossErr = atof( val[
i + 3] );
2730 }
else if ( !strcmp( val[
i],
"psitensor" ) || !strcmp( val[
i],
"PSITENSOR" ) ) {
2731 output->psiTensor = atof( val[
i + 1] );
2734 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2735 output->psiTensorErr = atof( val[
i + 3] );
2738 }
else if ( !strcmp( val[
i],
"phi0tensor" ) || !strcmp( val[
i],
"PHI0TENSOR" ) ) {
2739 output->phi0Tensor = atof( val[
i + 1] );
2742 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2743 output->phi0TensorErr = atof( val[
i + 3] );
2746 }
else if ( !strcmp( val[
i],
"hscalarb" ) || !strcmp( val[
i],
"HSCALARB" ) ) {
2747 output->hScalarB = atof( val[
i + 1] );
2750 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2751 output->hScalarBErr = atof( val[
i + 3] );
2754 }
else if ( !strcmp( val[
i],
"hscalarl" ) || !strcmp( val[
i],
"HSCALARL" ) ) {
2755 output->hScalarL = atof( val[
i + 1] );
2758 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2759 output->hScalarLErr = atof( val[
i + 3] );
2762 }
else if ( !strcmp( val[
i],
"psiscalar" ) || !strcmp( val[
i],
"PSISCALAR" ) ) {
2763 output->psiScalar = atof( val[
i + 1] );
2766 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2767 output->psiScalarErr = atof( val[
i + 3] );
2770 }
else if ( !strcmp( val[
i],
"phi0scalar" ) || !strcmp( val[
i],
"PHI0SCALAR" ) ) {
2771 output->phi0Scalar = atof( val[
i + 1] );
2774 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2775 output->phi0ScalarErr = atof( val[
i + 3] );
2778 }
else if ( !strcmp( val[
i],
"hvectorx" ) || !strcmp( val[
i],
"HVECTORX" ) ) {
2779 output->hVectorX = atof( val[
i + 1] );
2782 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2783 output->hVectorXErr = atof( val[
i + 3] );
2786 }
else if ( !strcmp( val[
i],
"hvectory" ) || !strcmp( val[
i],
"HVECTORY" ) ) {
2787 output->hVectorY = atof( val[
i + 1] );
2790 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2791 output->hVectorYErr = atof( val[
i + 3] );
2794 }
else if ( !strcmp( val[
i],
"psivector" ) || !strcmp( val[
i],
"PSIVECTOR" ) ) {
2795 output->psiVector = atof( val[
i + 1] );
2798 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2799 output->psiVectorErr = atof( val[
i + 3] );
2802 }
else if ( !strcmp( val[
i],
"phi0vector" ) || !strcmp( val[
i],
"PHI0VECTOR" ) ) {
2803 output->phi0Vector = atof( val[
i + 1] );
2806 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2807 output->phi0VectorErr = atof( val[
i + 3] );
2810 }
else if ( !strcmp( val[
i],
"cgw" ) || !strcmp( val[
i],
"CGW" ) ) {
2811 output->cgw = atof( val[
i + 1] );
2814 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2815 output->cgwErr = atof( val[
i + 3] );
2835 if (
output->sstr != NULL ) {
2836 if ( !strcmp(
output->sstr,
"KIN" ) || !strcmp(
output->sstr,
"kin" ) ) {
2840 XLAL_PRINT_ERROR(
"Error... KIN not set in .par file %s\n", pulsarAndPath );
2853 fprintf( stderr,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" );
2855 fprintf( stderr,
"sky position:\tra %.7lf +/- %.3le rads, dec %.7lf +/- %.3le rads\n",
params.
ra,
2858 fprintf( stderr,
"proper motion:\tra %.4le +/- %.1le rads/s, dec %.4le +/- %.1le rads/s\n",
2861 fprintf( stderr,
"epochs:\tperiod %lf (GPS), position %lf (GPS)\n",
params.pepoch,
2863 fprintf( stderr,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n" );
2865 fprintf( stderr,
"Frequency parameters\n" );
2876 if (
params.model != NULL ) {
2877 fprintf( stderr,
"\nBinary parameters:\tmodel %s\n",
params.model );
2879 fprintf( stderr,
"Keplarian parameters:-\n" );
2884 fprintf( stderr,
"\tprojected semi-major axis = %lf +/- %.3le (light sec)\n",
params.x,
2890 fprintf( stderr,
"\tlongitude of periastron = %lf +/- %.3lf (degs)\n",
params.w0,
2893 fprintf( stderr,
"\ttime of periastron = %lf +/- %.3lf (GPS)\n",
params.T0,
params.T0Err );
2896 fprintf( stderr,
"\ttime of ascending node = %lf +/- %.3lf (GPS)\n",
params.Tasc,
2899 fprintf( stderr,
"\tfirst Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps1,
2902 fprintf( stderr,
"\tsecond Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps2,
2905 fprintf( stderr,
"\tsecond Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps2,
2922 INT4 i = 0, numPars = 0,
c = 1, sl = 0;
2928 if ( access( corfile, F_OK ) != 0 ) {
2934 if ( (
fp = fopen( corfile,
"r" ) ) == NULL ) {
2940 while ( !strchr( fgets( onechar, 2,
fp ),
'\n' ) ) {
2944 sl = strlen( firstline );
2947 for (
i = 0;
i < sl;
i++ ) {
2949 if ( !isspace( firstline[
i] ) ) {
2961 for (
i = 0;
i < numPars;
i++ ) {
2964 if (
fscanf(
fp,
"%s", tmpStr ) == EOF ) {
2983 dims->
data[0] = numPars;
2984 dims->
data[1] = numPars;
2990 for (
i = 0;
i < numPars;
i++ ) {
2994 if (
fscanf(
fp,
"%s", tmpStr ) == EOF ) {
2999 if ( strcmp( tmpStr, tmpparams->
data[
i] ) ) {
3001 Parameters not in consistent order!\n" );
3005 for (
j = 0;
j <
i + 1;
j++ ) {
3008 if (
fscanf(
fp,
"%lf", &tmpval ) == EOF ) {
3014 if (
j !=
i && fabs( tmpval ) == 1. ) {
3018 cormat->
data[
i * numPars +
j] = tmpval;
3022 cormat->
data[
j * numPars +
i] = tmpval;
3051 REAL8 mjdInt, mjdFrac;
3052 mjdFrac = modf( MJD, &mjdInt );
3090 TDBtoTT = 0.0016568 * sin( ( 35999.37 *
T + 357.5 ) *
LAL_PI_180 ) +
3091 0.0000224 * sin( ( 32964.5 *
T + 246.0 ) *
LAL_PI_180 ) +
3092 0.0000138 * sin( ( 71998.7 *
T + 355.0 ) *
LAL_PI_180 ) +
3093 0.0000048 * sin( ( 3034.9 *
T + 25.0 ) *
LAL_PI_180 ) +
3094 0.0000047 * sin( ( 34777.3 *
T + 230.0 ) *
LAL_PI_180 );
3120 range, must be > %.1f.\n", MJD,
GPS0MJD );
3126 TCBtoTDB = 1.550506e-8 * Tdiff;
void PulsarSetParam(PulsarParameters *pars, const CHAR *name, const void *value)
Set the value of a parameter in the PulsarParameters structure.
void * PulsarGetParamErr(const PulsarParameters *pars, const CHAR *name)
Get the required parameter error value from the PulsarParameters structure.
PulsarParameters * XLALReadTEMPOParFile(const CHAR *pulsarAndPath)
Read in the parameters from a TEMPO(2) parameter file into a PulsarParameters structure.
static int PulsarHashElemCmp(const void *elem1, const void *elem2)
static void del_elem(void *elem)
LALStringVector * XLALReadTEMPOCorFile(REAL8Array *cormat, CHAR *corfile)
This function will read in a TEMPO-style parameter correlation matrix.
void PulsarSetREAL8ParamErr(PulsarParameters *pars, const CHAR *name, REAL8 value, UINT4 fitFlag)
Set the error value for a REAL8 parameter.
void PulsarAddREAL8Param(PulsarParameters *pars, const CHAR *name, REAL8 value)
Add a REAL8 parameter to the PulsarParameters structure.
void PulsarCopyParams(PulsarParameters *origin, PulsarParameters *target)
Function to copy a PulsarParameters structure.
const UINT4 * PulsarGetParamFitFlag(const PulsarParameters *pars, const CHAR *name)
Get the fit flag array for a given parameter from the PulsarParameters structure.
REAL8 PulsarGetREAL8VectorParamErrIndividual(const PulsarParameters *pars, const CHAR *name)
Return an individual REAL8 value from a REAL8Vector parameter.
REAL8 PulsarGetREAL8ParamErr(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter error value.
const REAL8Vector * PulsarGetREAL8VectorParam(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter.
REAL8 PulsarGetREAL8ParamOrZero(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter if it exists, otherwise return zero.
static const CHAR a2A[256]
Array for conversion from lowercase to uppercase.
#define DEFINE_CONV_FACTOR_FUNCTION(name, convfactor, type)
static PulsarParam * PulsarGetParamItemSlow(const PulsarParameters *pars, const CHAR *name)
Get a pointer to a parameter of a given name from a PulsarParameters structure.
static void strtoupper(CHAR *s)
Convert string to uppercase.
int PulsarCheckParam(const PulsarParameters *pars, const CHAR *name)
Check for the existence of the parameter name in the PulsarParameters structure.
void PulsarSetREAL8VectorParamErr(PulsarParameters *pars, const CHAR *name, const REAL8Vector *value, const UINT4 *fitFlag)
Set the error values for a REAL8Vector parameter.
static PulsarParam * PulsarGetParamItem(const PulsarParameters *pars, const CHAR *name)
Get a pointer to a parameter of a given name from a PulsarParameters structure.
REAL8 XLALTCBMJDtoGPS(REAL8 MJD)
If you have an MJD arrival time on the Earth then this will convert it to the equivalent GPS time in ...
const UINT4Vector * PulsarGetParamFitFlagAsVector(const PulsarParameters *pars, const CHAR *name)
Get the fit flag array for a given parameter from the PulsarParameters structure.
void PulsarClearParams(PulsarParameters *pars)
Free all the parameters from a PulsarParameters structure.
void PulsarSetParamErr(PulsarParameters *pars, const CHAR *name, void *value, const UINT4 *fitFlag, UINT4 len)
Set the value of the error of a parameter in the PulsarParameters structure.
static UINT8 PulsarHash(const void *elem)
const CHAR * PulsarGetStringParam(const PulsarParameters *pars, const CHAR *name)
Return a string parameter.
void PrintPulsarParameters(BinaryPulsarParams params)
function to print out all the pulsar parameters read in from a par file
static INT4 ParseParLine(PulsarParameters *par, const CHAR *name, FILE *fp)
Parse a single line from a pulsar parameter file.
const REAL8Vector * PulsarGetREAL8VectorParamErr(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter error value.
void PulsarAddParam(PulsarParameters *pars, const CHAR *name, void *value, PulsarParamType type)
Add a parameter and value to the PulsarParameters structure.
REAL8 PulsarGetREAL8Param(const PulsarParameters *pars, const CHAR *name)
Return a REAL8 parameter.
void PulsarRemoveParam(PulsarParameters *pars, const CHAR *name)
Remove a given parameter from a PulsarParameters structure.
REAL8 XLALTDBMJDtoGPS(REAL8 MJD)
If you have an MJD arrival time on the Earth then this will convert it to the equivalent GPS time in ...
UINT4 PulsarGetUINT4Param(const PulsarParameters *pars, const CHAR *name)
Return a UINT4 parameter.
REAL8 XLALTTMJDtoGPS(REAL8 MJD)
This function converts a MJD format time corrected to Terrestrial Time (TT) into an equivalent GPS ti...
void PulsarFreeParams(PulsarParameters *pars)
Function to free memory from pulsar parameters.
void PulsarAddStringParam(PulsarParameters *pars, const CHAR *name, const CHAR *value)
Add a string parameter to the PulsarParameters structure.
void PulsarAddREAL8VectorParam(PulsarParameters *pars, const CHAR *name, const REAL8Vector *value)
Add a REAL8Vector parameter to the PulsarParameters structure.
REAL8 PulsarGetREAL8VectorParamIndividual(const PulsarParameters *pars, const CHAR *name)
Return an individual REAL8 value from a REAL8Vector parameter.
ParConversion pc[NUM_PARS]
Initialise conversion structure with most allowed TEMPO2 parameter names and conversion functions (co...
static void * new_elem(const char *name, PulsarParam *itemPtr)
void * PulsarGetParam(const PulsarParameters *pars, const CHAR *name)
Get the required parameter value from the PulsarParameters structure.
void XLALReadTEMPOParFileOrig(BinaryPulsarParams *output, CHAR *pulsarAndPath)
function to read in a TEMPO parameter file
PulsarParamType PulsarGetParamType(const PulsarParameters *pars, const char *name)
Get the required parameter's type.
UINT4 PulsarGetUINT4ParamOrZero(const PulsarParameters *pars, const CHAR *name)
Return a UINT4 parameter if it exists, otherwise return zero.
void PulsarAddUINT4Param(PulsarParameters *pars, const CHAR *name, UINT4 value)
Add a UINT4 parameter to the PulsarParameters structure.
void ParConvKpcToMetres(const CHAR *in, void *out)
Convert the input string from kiloparsecs to metres.
void ParConvToString(const CHAR *in, void *out)
Copy the input string into the output pointer.
void ParConvDegsToRads(const CHAR *in, void *out)
Convert the input string from degrees to radians.
void ParConvInvArcsecsToInvRads(const CHAR *in, void *out)
Convert the input string from 1/acrseconds to 1/radians.
void ParConvDegPerYrToRadPerSec(const CHAR *in, void *out)
Convert the input string from degrees per year to radians per second.
void ParConvSecsToRads(const CHAR *in, void *out)
Convert the input string from seconds to radians.
void ParConvBinaryUnits(const CHAR *in, void *out)
Convert the binary system parameter from a string to a double, but make the check (as performed by TE...
#define LALPULSAR_TEMPO2_MSUN_SI
void ParConvDaysToSecs(const CHAR *in, void *out)
Convert the input string from days to seconds.
void ParConvSolarMassToKg(const CHAR *in, void *out)
Convert the input string from solar masses to kilograms.
PulsarParamType
An enumerated type for denoting the type of a variable.
@ PULSARTYPE_REAL8Vector_t
void ParConvMicrosecToSec(const CHAR *in, void *out)
Convert an input string from microseconds into seconds.
void ParConvMasPerYrToRadPerSec(const CHAR *in, void *out)
Convert the input string from milliarcsecs per year to radians per second.
void ParConvMasToRads(const CHAR *in, void *out)
Convert the input string from milliarcsecs to radians.
void ParConvToInt(const CHAR *in, void *out)
Convert the input string into a unsigned integer number.
void ParConvMJDToGPS(const CHAR *in, void *out)
Convert the input string from a TT MJD value into a GPS time.
void ParConvRAToRads(const CHAR *in, void *out)
Convert a right ascension input string in the format "hh:mm:ss.s" into radians.
void ParConvToFloat(const CHAR *in, void *out)
Conversion functions from units used in TEMPO parameter files into SI units.
void ParConvDecToRads(const CHAR *in, void *out)
Convert a declination input string in the format "dd:mm:ss.s" into radians.
#define PULSAR_PARNAME_MAX
void ParConvArcsecsToRads(const CHAR *in, void *out)
Convert the input string from arcseconds to radians.
REAL8Array * XLALResizeREAL8Array(REAL8Array *, UINT4Vector *)
#define XLAL_EPOCH_J2000_0_JD
UINT8 XLALCityHash64(const char *buf, size_t len)
int XLALHashTblFind(const LALHashTbl *ht, const void *x, const void **y)
LALHashTbl * XLALHashTblCreate(LALHashTblDtorFcn dtor, LALHashTblHashFcn hash, LALHashTblCmpFcn cmp)
int XLALHashTblAdd(LALHashTbl *ht, void *x)
int XLALHashTblRemove(LALHashTbl *ht, const void *x)
void XLALHashTblDestroy(LALHashTbl *ht)
void * XLALCalloc(size_t m, size_t n)
void * XLALMalloc(size_t n)
void * XLALRealloc(void *p, size_t n)
int XLALStringCaseCompare(const char *s1, const char *s2)
size_t XLALStringCopy(char *dst, const char *src, size_t size)
char char * XLALStringDuplicate(const char *s)
int char * XLALStringAppend(char *s, const char *append)
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
void XLALDestroyStringVector(LALStringVector *vect)
int XLALTranslateHMStoRAD(REAL8 *radians, const CHAR *hms)
int XLALTranslateDMStoRAD(REAL8 *radians, const CHAR *dms)
LIGOTimeGPS * XLALTranslateMJDTTtoGPS(LIGOTimeGPS *gps, INT4 mjdDays, REAL8 mjdFracDays)
void XLALDestroyUINT4Vector(UINT4Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
#define XLAL_ERROR_VOID(...)
#define XLAL_ERROR_REAL8(...)
#define XLAL_ERROR_NULL(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_PRINT_WARNING(...)
#define XLAL_CHECK_REAL8(assertion,...)
#define XLAL_PRINT_ERROR(...)
#define XLAL_PRINT_DEPRECATION_WARNING(replacement)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
A structure to contain all pulsar parameters and associated errors.
The PulsarParam list node structure.
void * value
Parameter value.
struct tagPulsarParam * next
void * err
Parameter error/uncertainty.
UINT4Vector * fitFlag
Set to 1 if the parameter has been fit in the par file.
PulsarParamType type
Parameter type e.g.
The PulsarParameters structure to contain a set of pulsar parameters.
PulsarParam * head
A linked list of PulsarParam structures.
LALHashTbl * hash_table
Hash table of parameters.
INT4 nparams
The total number of parameters in the structure.
LALInferenceVariableItem * itemPtr