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 )] ) ) {
116typedef 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) ); \
959typedef void ( *ParamConversionFunc )(
const CHAR *in,
void *
out );
963typedef struct tagParConversion {
965 ParamConversionFunc convfunc;
966 ParamConversionFunc converrfunc;
1156 INT4 i = 0, tmpnum = 0;
1159 if (
par == NULL ) {
1162 if (
name == NULL ) {
1176 nread = sscanf(
str,
"%s %s %s", str1, str2, str3 );
1184 if ( !strcmp(
name,
"E" ) ) {
1186 }
else if ( !strcmp(
name,
"E_1" ) ) {
1188 }
else if ( !strcmp(
name,
"E_2" ) ) {
1190 }
else if ( !strcmp(
name,
"E_3" ) ) {
1201 INT4 isfreq = ( !strncmp( nname,
"F", 1 ) && !strcmp(
"F",
pc[
i].
name ) && sscanf( nname + strlen(
"F" ),
"%d", &tmpnum ) == 1 );
1202 INT4 isperiod = ( !strncmp( nname,
"P", 1 ) && !strcmp(
"P",
pc[
i].
name ) && sscanf( nname + strlen(
"P" ),
"%d", &tmpnum ) == 1 );
1203 INT4 iswave = ( ( !strncmp( nname,
"WAVE", 4 ) && ( !strcmp(
"WAVESIN",
pc[
i].
name ) || !strcmp(
"WAVECOS",
pc[
i].
name ) ) ) && strcmp(
"WAVE_OM", nname ) && strcmp(
"WAVEEPOCH", nname ) );
1204 INT4 isfb = ( !strncmp( nname,
"FB", 2 ) && !strcmp(
"FB",
pc[
i].
name ) );
1205 INT4 isgl = ( !strncmp( nname,
"GL", 2 ) && strstr( nname,
pc[
i].
name ) && !strncmp( nname,
pc[
i].
name, strlen( nname ) - 2 ) );
1207 if ( !strcmp( nname,
pc[
i].
name ) || isfreq || isperiod || iswave || isfb || isgl ) {
1208 UINT4 num = 0, nsize = 0;
1210 if (
pc[
i].convfunc == NULL ) {
1216 if ( isfreq || isperiod || isfb ) {
1218 UINT4 *fitFlag = NULL;
1221 if ( strlen( nname ) > strlen(
"FB" ) ) {
1222 if ( sscanf( nname + strlen(
"FB" ),
"%d", &num ) != 1 ) {
1226 }
else if ( isfreq ) {
1227 if ( strlen( nname ) > strlen(
"F" ) ) {
1228 if ( sscanf( nname + strlen(
"F" ),
"%d", &num ) != 1 ) {
1233 if ( strlen( nname ) > strlen(
"P" ) ) {
1234 if ( sscanf( nname + strlen(
"P" ),
"%d", &num ) != 1 ) {
1242 pc[
i].convfunc( str1, val );
1248 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1253 memset(
ptr->data, 0,
sizeof(
REAL8 )*nsize );
1257 memset( eptr->data, 0,
sizeof(
REAL8 )*nsize );
1271 memcpy( fitFlag, ff,
sizeof(
UINT4 )*cptr->
length );
1286 }
else if ( iswave && nread == 2 ) {
1289 if ( strlen( nname ) > strlen(
"WAVE" ) ) {
1290 if ( sscanf( nname + strlen(
"WAVE" ),
"%d", &num ) != 1 ) {
1302 pc[
i].convfunc( str1, val1 );
1303 pc[
i].convfunc( str2, val2 );
1310 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1316 memset( ptr1->
data, 0,
sizeof(
REAL8 )*nsize );
1317 memset( ptr2->data, 0,
sizeof(
REAL8 )*nsize );
1325 memcpy( ptr2->data, cptr2->
data, ptr2->length *
sizeof(
REAL8 ) );
1329 ptr2->data[num] = *(
REAL8 * )val2;
1342 memset( eptr->
data, 0,
sizeof(
REAL8 )*nsize );
1349 }
else if ( isgl ) {
1351 UINT4 *fitFlag = NULL;
1353 if ( sscanf( strstr( nname,
"_" ) + 1,
"%d", &num ) != 1 ) {
1361 pc[
i].convfunc( str1, val );
1367 nsize = ( cptr->
length > num + 1 ) ? cptr->
length : ( num + 1 );
1372 memset(
ptr->data, 0,
sizeof(
REAL8 )*nsize );
1376 memset( eptr->data, 0,
sizeof(
REAL8 )*nsize );
1390 memcpy( fitFlag, ff,
sizeof(
UINT4 )*cptr->
length );
1407 pc[
i].convfunc( str1, val );
1418 if ( ( nread == 2 && strcmp( str2,
"1" ) ) || ( nread == 3 && !strcmp( str2,
"1" ) ) ) {
1419 if (
pc[
i].converrfunc == NULL ) {
1428 if ( isfreq || isperiod || isfb || isgl ) {
1439 memcpy( ff, fitFlag,
sizeof(
UINT4 )*
ptr->length );
1442 pc[
i].converrfunc( str2, val );
1444 if ( !strcmp( str2,
"1" ) ) {
1447 pc[
i].converrfunc( str3, val );
1459 pc[
i].converrfunc( str2, val );
1461 if ( !strcmp( str2,
"1" ) ) {
1464 pc[
i].converrfunc( str3, val );
1492 if ( (
fp = fopen( pulsarAndPath,
"r" ) ) == NULL ) {
1502 while ( !feof(
fp ) ) {
1507 if (
str[0] ==
'#' ) {
1531 if ( !strcmp( sini,
"KIN" ) ) {
1536 XLAL_PRINT_ERROR(
"Error... KIN not set in .par file %s\n", pulsarAndPath );
1542 sinid = atof( sini );
1558 CHAR *pulsarAndPath )
1674 output->posepochErr = 0.0;
1678 output->finishTime = INFINITY;
1684 output->eps1dotErr = 0.0;
1685 output->eps2dotErr = 0.0;
1783 output->lambdapinErr = 0.;
1784 output->costhetaErr = 0.;
1792 output->psiTensorErr = 0.;
1793 output->phi0TensorErr = 0.;
1794 output->hScalarBErr = 0.;
1795 output->hScalarLErr = 0.;
1796 output->psiScalarErr = 0.;
1797 output->phi0ScalarErr = 0.;
1798 output->hVectorXErr = 0.;
1799 output->hVectorYErr = 0.;
1800 output->psiVectorErr = 0.;
1801 output->phi0VectorErr = 0.;
1803 output->wave_omErr = 0.0;
1811 if ( (
fp = fopen( pulsarAndPath,
"r" ) ) == NULL ) {
1817 while ( !feof(
fp ) ) {
1819 sprintf( val[
i],
"%s",
"" );
1824 if ( val[
i][0] ==
'#' ) {
1848 if ( !strcmp( val[
i],
"NAME" ) || !strcmp( val[
i],
"name" ) ) {
1851 }
else if ( !strcmp( val[
i],
"PSRJ" ) || !strcmp( val[
i],
"psrj" ) ) {
1854 }
else if ( !strcmp( val[
i],
"PSRB" ) || !strcmp( val[
i],
"psrb" ) ) {
1857 }
else if ( !strcmp( val[
i],
"ra" ) || !strcmp( val[
i],
"RA" ) || !strcmp( val[
i],
"RAJ" ) ) {
1863 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1868 }
else if ( !strcmp( val[
i],
"dec" ) || !strcmp( val[
i],
"DEC" ) || !strcmp( val[
i],
"DECJ" ) ) {
1872 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1877 }
else if ( !strcmp( val[
i],
"pmra" ) || !strcmp( val[
i],
"PMRA" ) ) {
1879 output->pmra =
LAL_PI_180 * atof( val[
i + 1] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1881 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1883 LAL_PI_180 * atof( val[
i + 3] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1886 }
else if ( !strcmp( val[
i],
"pmdec" ) || !strcmp( val[
i],
"PMDEC" ) ) {
1888 output->pmdec =
LAL_PI_180 * atof( val[
j + 1] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1891 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1893 LAL_PI_180 * atof( val[
i + 3] ) / ( 60.0 * 60.0 * 1000.*365.25 * 86400. );
1896 }
else if ( !strcmp( val[
i],
"pepoch" ) || !strcmp( val[
i],
"PEPOCH" ) ) {
1901 }
else if ( !strcmp( val[
i],
"posepoch" ) || !strcmp( val[
i],
"POSEPOCH" ) ) {
1905 }
else if ( !strcmp( val[
i],
"start" ) || !strcmp( val[
i],
"START" ) ) {
1910 }
else if ( !strcmp( val[
i],
"finish" ) || !strcmp( val[
i],
"FINISH" ) ) {
1914 }
else if ( !strcmp( val[
i],
"f0" ) || !strcmp( val[
i],
"F0" ) ) {
1921 output->f0 = atof( val[
i + 1] );
1924 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1926 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1927 output->f0Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1929 output->f0Err = atof( val[
i + 3] );
1933 }
else if ( !strcmp( val[
i],
"f1" ) || !strcmp( val[
i],
"F1" ) ) {
1937 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1938 output->f1 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1940 output->f1 = atof( val[
i + 1] );
1944 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1946 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1947 output->f1Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1949 output->f1Err = atof( val[
i + 3] );
1953 }
else if ( !strcmp( val[
i],
"f2" ) || !strcmp( val[
i],
"F2" ) ) {
1957 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1958 output->f2 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1960 output->f2 = atof( val[
i + 1] );
1964 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1966 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1967 output->f2Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1969 output->f2Err = atof( val[
i + 3] );
1973 }
else if ( !strcmp( val[
i],
"f3" ) || !strcmp( val[
i],
"F3" ) ) {
1977 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1978 output->f3 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
1980 output->f3 = atof( val[
i + 1] );
1984 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
1986 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
1987 output->f3Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
1989 output->f3Err = atof( val[
i + 3] );
1993 }
else if ( !strcmp( val[
i],
"f4" ) || !strcmp( val[
i],
"F4" ) ) {
1997 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
1998 output->f4 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2000 output->f4 = atof( val[
i + 1] );
2004 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2006 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2007 output->f4Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2009 output->f4Err = atof( val[
i + 3] );
2013 }
else if ( !strcmp( val[
i],
"f5" ) || !strcmp( val[
i],
"F5" ) ) {
2017 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2018 output->f5 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2020 output->f5 = atof( val[
i + 1] );
2024 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2026 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2027 output->f5Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2029 output->f5Err = atof( val[
i + 3] );
2033 }
else if ( !strcmp( val[
i],
"f6" ) || !strcmp( val[
i],
"F6" ) ) {
2037 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2038 output->f6 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2040 output->f6 = atof( val[
i + 1] );
2044 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2046 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2047 output->f6Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2049 output->f6Err = atof( val[
i + 3] );
2053 }
else if ( !strcmp( val[
i],
"f7" ) || !strcmp( val[
i],
"F7" ) ) {
2057 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2058 output->f7 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2060 output->f7 = atof( val[
i + 1] );
2064 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2066 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2067 output->f7Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2069 output->f7Err = atof( val[
i + 3] );
2073 }
else if ( !strcmp( val[
i],
"f8" ) || !strcmp( val[
i],
"F8" ) ) {
2077 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2078 output->f8 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2080 output->f8 = atof( val[
i + 1] );
2084 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2086 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2087 output->f8Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2089 output->f8Err = atof( val[
i + 3] );
2093 }
else if ( !strcmp( val[
i],
"f9" ) || !strcmp( val[
i],
"F9" ) ) {
2097 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2098 output->f9 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2100 output->f9 = atof( val[
i + 1] );
2104 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2106 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2107 output->f9Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2109 output->f9Err = atof( val[
i + 3] );
2113 }
else if ( !strcmp( val[
i],
"f10" ) || !strcmp( val[
i],
"F10" ) ) {
2117 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2118 output->f10 = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2120 output->f10 = atof( val[
i + 1] );
2124 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2126 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2127 output->f10Err = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2129 output->f10Err = atof( val[
i + 3] );
2133 }
else if ( !strcmp( val[
i],
"WAVE_OM" ) || !strcmp( val[
i],
"wave_om" ) ) {
2134 output->wave_om = atof( val[
i + 1] );
2137 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2138 output->wave_omErr = atof( val[
i + 3] );
2141 }
else if ( !strcmp( val[
i],
"WAVEEPOCH" ) || !strcmp( val[
i],
"waveepoch" ) ) {
2144 }
else if ( strstr( val[
i],
"WAVE" ) != NULL || strstr( val[
i],
"wave" ) != NULL ) {
2147 if ( sscanf( val[
i] + 4,
"%d", &wnum ) != 1 ) {
2148 fprintf( stderr,
"Error reading WAVE number from par file\n" );
2152 if ( wnum >
output->nwaves ) {
2158 output->waveSin[wnum - 1] = atof( val[
i + 1] );
2159 output->waveCos[wnum - 1] = atof( val[
i + 2] );
2162 }
else if ( !strcmp( val[
i],
"binary" ) || !strcmp( val[
i],
"BINARY" ) ) {
2165 }
else if ( !strcmp( val[
i],
"ephem" ) || !strcmp( val[
i],
"EPHEM" ) ) {
2168 }
else if ( !strcmp( val[
i],
"units" ) || !strcmp( val[
i],
"UNITS" ) ) {
2171 }
else if ( !strcmp( val[
i],
"a1" ) || !strcmp( val[
i],
"A1" ) ) {
2172 output->x = atof( val[
i + 1] );
2175 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2176 output->xErr = atof( val[
i + 3] );
2179 }
else if ( !strcmp( val[
i],
"e" ) || !strcmp( val[
i],
"E" ) || !strcmp( val[
i],
"ECC" ) ||
2180 !strcmp( val[
i],
"ecc" ) ) {
2181 output->e = atof( val[
i + 1] );
2184 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2185 output->eErr = atof( val[
i + 3] );
2188 }
else if ( !strcmp( val[
i],
"pb" ) || !strcmp( val[
i],
"PB" ) ) {
2192 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2196 }
else if ( !strcmp( val[
i],
"om" ) || !strcmp( val[
i],
"OM" ) ) {
2200 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2204 }
else if ( !strcmp( val[
i],
"T0" ) ) {
2208 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2212 }
else if ( !strcmp( val[
i],
"Tasc" ) || !strcmp( val[
i],
"TASC" ) ) {
2216 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2220 }
else if ( !strcmp( val[
i],
"eps1" ) || !strcmp( val[
i],
"EPS1" ) ) {
2221 output->eps1 = atof( val[
i + 1] );
2224 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2225 output->eps1Err = atof( val[
i + 3] );
2228 }
else if ( !strcmp( val[
i],
"eps2" ) || !strcmp( val[
i],
"EPS2" ) ) {
2229 output->eps2 = atof( val[
i + 1] );
2232 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2233 output->eps2Err = atof( val[
i + 3] );
2236 }
else if ( !strcmp( val[
i],
"eps1dot" ) || !strcmp( val[
i],
"EPS1DOT" ) ) {
2237 output->eps1dot = atof( val[
i + 1] );
2239 if ( fabs(
output->eps1dot ) > 1
e-7 ) {
2240 output->eps1dot *= 1.e-12;
2244 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2245 output->eps1dotErr = atof( val[
i + 3] );
2248 }
else if ( !strcmp( val[
i],
"eps2dot" ) || !strcmp( val[
i],
"EPS2DOT" ) ) {
2249 output->eps2dot = atof( val[
i + 1] );
2251 if ( fabs(
output->eps2dot ) > 1
e-7 ) {
2252 output->eps2dot *= 1.e-12;
2256 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2257 output->eps2dotErr = atof( val[
i + 3] );
2260 }
else if ( !strcmp( val[
i],
"xpbdot" ) || !strcmp( val[
i],
"XPBDOT" ) ) {
2261 output->xpbdot = atof( val[
i + 1] );
2263 if ( fabs(
output->xpbdot ) > 1
e-7 ) {
2264 output->xpbdot *= 1.e-12;
2268 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2269 output->xpbdotErr = atof( val[
i + 3] );
2272 }
else if ( !strcmp( val[
i],
"omdot" ) || !strcmp( val[
i],
"OMDOT" ) ) {
2276 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2280 }
else if ( !strcmp( val[
i],
"pbdot" ) || !strcmp( val[
i],
"PBDOT" ) ) {
2281 output->Pbdot = atof( val[
i + 1] );
2283 if ( fabs(
output->Pbdot ) > 1
e-7 ) {
2288 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2289 output->PbdotErr = atof( val[
i + 3] );
2292 }
else if ( !strcmp( val[
i],
"xdot" ) || !strcmp( val[
i],
"XDOT" ) ) {
2293 output->xdot = atof( val[
i + 1] );
2295 if ( fabs(
output->xdot ) > 1
e-7 ) {
2300 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2301 output->xdotErr = atof( val[
i + 3] );
2304 }
else if ( !strcmp( val[
i],
"edot" ) || !strcmp( val[
i],
"EDOT" ) ) {
2305 output->edot = atof( val[
i + 1] );
2307 if ( fabs(
output->edot ) > 1
e-7 ) {
2312 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2313 output->edotErr = atof( val[
i + 3] );
2321 if (
output->edot > 10000 ) {
2325 }
else if ( !strcmp( val[
i],
"gamma" ) || !strcmp( val[
i],
"GAMMA" ) ) {
2326 output->gamma = atof( val[
i + 1] );
2329 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2330 output->gammaErr = atof( val[
i + 3] );
2333 }
else if ( !strcmp( val[
i],
"sini" ) || !strcmp( val[
i],
"SINI" ) ) {
2337 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2338 output->sErr = atof( val[
i + 3] );
2341 }
else if ( !strcmp( val[
i],
"mtot" ) || !strcmp( val[
i],
"MTOT" ) ) {
2345 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2349 }
else if ( !strcmp( val[
i],
"m2" ) || !strcmp( val[
i],
"M2" ) ) {
2353 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2357 }
else if ( !strcmp( val[
i],
"a0" ) || !strcmp( val[
i],
"A0" ) ) {
2358 output->a0 = atof( val[
i + 1] );
2361 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2362 output->a0Err = atof( val[
i + 3] );
2365 }
else if ( !strcmp( val[
i],
"b0" ) || !strcmp( val[
i],
"B0" ) ) {
2366 output->b0 = atof( val[
i + 1] );
2369 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2370 output->b0Err = atof( val[
i + 3] );
2373 }
else if ( !strcmp( val[
i],
"dr" ) || !strcmp( val[
i],
"DR" ) ) {
2374 output->dr = atof( val[
i + 1] );
2377 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2378 output->drErr = atof( val[
i + 3] );
2381 }
else if ( !strcmp( val[
i],
"dtheta" ) || !strcmp( val[
i],
"DTHETA" ) ) {
2382 output->dth = atof( val[
i + 1] );
2385 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2386 output->dthErr = atof( val[
i + 3] );
2389 }
else if ( !strcmp( val[
i],
"shapmax" ) || !strcmp( val[
i],
"SHAPMAX" ) ) {
2390 output->shapmax = atof( val[
i + 1] );
2393 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2394 output->shapmaxErr = atof( val[
i + 3] );
2400 else if ( !strcmp( val[
i],
"D_AOP" ) || !strcmp( val[
i],
"d_aop" ) ) {
2405 }
else if ( !strcmp( val[
i],
"KIN" ) || !strcmp( val[
i],
"kin" ) ) {
2409 }
else if ( !strcmp( val[
i],
"KOM" ) || !strcmp( val[
i],
"kom" ) ) {
2416 else if ( !strcmp( val[
i],
"px" ) || !strcmp( val[
i],
"PX" ) ) {
2421 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2422 output->pxErr = atof( val[
i + 3] );
2425 }
else if ( !strcmp( val[
i],
"dist" ) || !strcmp( val[
i],
"DIST" ) ) {
2426 output->dist = atof( val[
i + 1] );
2429 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2430 output->distErr = atof( val[
i + 3] );
2436 else if ( !strcmp( val[
i],
"dm" ) || !strcmp( val[
i],
"DM" ) ) {
2437 output->DM = atof( val[
i + 1] );
2440 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2441 output->DMErr = atof( val[
i + 3] );
2444 }
else if ( !strcmp( val[
i],
"dm1" ) || !strcmp( val[
i],
"DM1" ) ) {
2445 output->DM1 = atof( val[
i + 1] );
2448 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2449 output->DM1Err = atof( val[
i + 3] );
2455 else if ( !strcmp( val[
i],
"a1_2" ) || !strcmp( val[
i],
"A1_2" ) ) {
2456 output->x2 = atof( val[
i + 1] );
2459 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2460 output->x2Err = atof( val[
i + 3] );
2463 }
else if ( !strcmp( val[
i],
"e_2" ) || !strcmp( val[
i],
"E_2" ) ||
2464 !strcmp( val[
i],
"ECC_2" ) || !strcmp( val[
i],
"ecc_2" ) ) {
2465 output->e2 = atof( val[
i + 1] );
2468 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2469 output->e2Err = atof( val[
i + 3] );
2472 }
else if ( !strcmp( val[
i],
"pb_2" ) || !strcmp( val[
i],
"PB_2" ) ) {
2476 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2480 }
else if ( !strcmp( val[
i],
"om_2" ) || !strcmp( val[
i],
"OM_2" ) ) {
2484 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2488 }
else if ( !strcmp( val[
i],
"T0_2" ) ) {
2492 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2496 }
else if ( !strcmp( val[
i],
"a1_3" ) || !strcmp( val[
i],
"A1_3" ) ) {
2497 output->x3 = atof( val[
i + 1] );
2500 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2501 output->x3Err = atof( val[
i + 3] );
2504 }
else if ( !strcmp( val[
i],
"e_3" ) || !strcmp( val[
i],
"E_3" ) ||
2505 !strcmp( val[
i],
"ECC_3" ) || !strcmp( val[
i],
"ecc_3" ) ) {
2506 output->e3 = atof( val[
i + 1] );
2509 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2510 output->e3Err = atof( val[
i + 3] );
2513 }
else if ( !strcmp( val[
i],
"pb_3" ) || !strcmp( val[
i],
"PB_3" ) ) {
2517 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2521 }
else if ( !strcmp( val[
i],
"om_3" ) || !strcmp( val[
i],
"OM_3" ) ) {
2525 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2529 }
else if ( !strcmp( val[
i],
"T0_3" ) ) {
2533 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2540 else if ( val[
i][0] ==
'F' && val[
i][1] ==
'B' ) {
2544 if ( strlen( val[
i] ) == 2 ) {
2547 if ( sscanf( val[
i] + 2,
"%d", &fbnum ) != 1 ) {
2548 fprintf( stderr,
"Error reading FB value from par file\n" );
2554 if (
output->nfb < fbnum + 1 ) {
2561 if ( (
loc = strstr( val[
i + 1],
"D" ) ) != NULL || (
loc = strstr( val[
i + 1],
"d" ) ) != NULL ) {
2562 output->fb[fbnum] = atof( val[
i + 1] ) * pow( 10, atof(
loc + 1 ) );
2564 output->fb[fbnum] = atof( val[
i + 1] );
2568 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2570 if ( (
loc = strstr( val[
i + 3],
"D" ) ) != NULL || (
loc = strstr( val[
i + 3],
"d" ) ) != NULL ) {
2571 output->fbErr[fbnum] = atof( val[
i + 3] ) * pow( 10, atof(
loc + 1 ) );
2573 output->fbErr[fbnum] = atof( val[
i + 3] );
2579 else if ( !strcmp( val[
i],
"h0" ) || !strcmp( val[
i],
"H0" ) ) {
2580 output->h0 = atof( val[
i + 1] );
2583 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2584 output->h0Err = atof( val[
i + 3] );
2587 }
else if ( !strcmp( val[
i],
"q22" ) || !strcmp( val[
i],
"Q22" ) ) {
2588 output->Q22 = atof( val[
i + 1] );
2591 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2592 output->Q22Err = atof( val[
i + 3] );
2595 }
else if ( !strcmp( val[
i],
"cosiota" ) || !strcmp( val[
i],
"COSIOTA" ) ||
2596 !strcmp( val[
i],
"ciota" ) || !strcmp( val[
i],
"CIOTA" ) ) {
2597 output->cosiota = atof( val[
i + 1] );
2600 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2601 output->cosiotaErr = atof( val[
i + 3] );
2604 }
else if ( !strcmp( val[
i],
"iota" ) || !strcmp( val[
i],
"IOTA" ) ) {
2605 output->iota = atof( val[
i + 1] );
2608 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2609 output->iotaErr = atof( val[
i + 3] );
2612 }
else if ( !strcmp( val[
i],
"psi" ) || !strcmp( val[
i],
"PSI" ) ) {
2613 output->psi = atof( val[
i + 1] );
2616 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2617 output->psiErr = atof( val[
i + 3] );
2620 }
else if ( !strcmp( val[
i],
"phi0" ) || !strcmp( val[
i],
"PHI0" ) ) {
2621 output->phi0 = atof( val[
i + 1] );
2624 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2625 output->phi0Err = atof( val[
i + 3] );
2628 }
else if ( !strcmp( val[
i],
"aplus" ) || !strcmp( val[
i],
"APLUS" ) ) {
2629 output->Aplus = atof( val[
i + 1] );
2632 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2633 output->AplusErr = atof( val[
i + 3] );
2636 }
else if ( !strcmp( val[
i],
"across" ) || !strcmp( val[
i],
"ACROSS" ) ) {
2637 output->Across = atof( val[
i + 1] );
2640 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2641 output->AcrossErr = atof( val[
i + 3] );
2644 }
else if ( !strcmp( val[
i],
"i21" ) || !strcmp( val[
i],
"I21" ) ) {
2645 output->I21 = atof( val[
i + 1] );
2648 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2649 output->I21Err = atof( val[
i + 3] );
2652 }
else if ( !strcmp( val[
i],
"i31" ) || !strcmp( val[
i],
"I31" ) ) {
2653 output->I31 = atof( val[
i + 1] );
2656 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2657 output->I31Err = atof( val[
i + 3] );
2660 }
else if ( !strcmp( val[
i],
"lambdapin" ) || !strcmp( val[
i],
"LAMBDAPIN" ) ) {
2661 output->lambdapin = atof( val[
i + 1] );
2664 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2665 output->lambdapinErr = atof( val[
i + 3] );
2668 }
else if ( !strcmp( val[
i],
"costheta" ) || !strcmp( val[
i],
"COSTHETA" ) ) {
2669 output->costheta = atof( val[
i + 1] );
2672 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2673 output->costhetaErr = atof( val[
i + 3] );
2676 }
else if ( !strcmp( val[
i],
"theta" ) || !strcmp( val[
i],
"THETA" ) ) {
2677 output->theta = atof( val[
i + 1] );
2680 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2681 output->thetaErr = atof( val[
i + 3] );
2684 }
else if ( !strcmp( val[
i],
"c22" ) || !strcmp( val[
i],
"C22" ) ) {
2685 output->C22 = atof( val[
i + 1] );
2688 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2689 output->C22Err = atof( val[
i + 3] );
2692 }
else if ( !strcmp( val[
i],
"c21" ) || !strcmp( val[
i],
"C21" ) ) {
2693 output->C21 = atof( val[
i + 1] );
2696 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2697 output->C21Err = atof( val[
i + 3] );
2700 }
else if ( !strcmp( val[
i],
"phi22" ) || !strcmp( val[
i],
"PHI22" ) ) {
2701 output->phi22 = atof( val[
i + 1] );
2704 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2705 output->phi22Err = atof( val[
i + 3] );
2708 }
else if ( !strcmp( val[
i],
"phi21" ) || !strcmp( val[
i],
"phi21" ) ) {
2709 output->phi21 = atof( val[
i + 1] );
2712 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2713 output->phi21Err = atof( val[
i + 3] );
2716 }
else if ( !strcmp( val[
i],
"hplus" ) || !strcmp( val[
i],
"HPLUS" ) ) {
2717 output->hPlus = atof( val[
i + 1] );
2720 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2721 output->hPlus = atof( val[
i + 3] );
2724 }
else if ( !strcmp( val[
i],
"hcross" ) || !strcmp( val[
i],
"HCROSS" ) ) {
2725 output->hCross = atof( val[
i + 1] );
2728 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2729 output->hCrossErr = atof( val[
i + 3] );
2732 }
else if ( !strcmp( val[
i],
"psitensor" ) || !strcmp( val[
i],
"PSITENSOR" ) ) {
2733 output->psiTensor = atof( val[
i + 1] );
2736 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2737 output->psiTensorErr = atof( val[
i + 3] );
2740 }
else if ( !strcmp( val[
i],
"phi0tensor" ) || !strcmp( val[
i],
"PHI0TENSOR" ) ) {
2741 output->phi0Tensor = atof( val[
i + 1] );
2744 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2745 output->phi0TensorErr = atof( val[
i + 3] );
2748 }
else if ( !strcmp( val[
i],
"hscalarb" ) || !strcmp( val[
i],
"HSCALARB" ) ) {
2749 output->hScalarB = atof( val[
i + 1] );
2752 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2753 output->hScalarBErr = atof( val[
i + 3] );
2756 }
else if ( !strcmp( val[
i],
"hscalarl" ) || !strcmp( val[
i],
"HSCALARL" ) ) {
2757 output->hScalarL = atof( val[
i + 1] );
2760 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2761 output->hScalarLErr = atof( val[
i + 3] );
2764 }
else if ( !strcmp( val[
i],
"psiscalar" ) || !strcmp( val[
i],
"PSISCALAR" ) ) {
2765 output->psiScalar = atof( val[
i + 1] );
2768 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2769 output->psiScalarErr = atof( val[
i + 3] );
2772 }
else if ( !strcmp( val[
i],
"phi0scalar" ) || !strcmp( val[
i],
"PHI0SCALAR" ) ) {
2773 output->phi0Scalar = atof( val[
i + 1] );
2776 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2777 output->phi0ScalarErr = atof( val[
i + 3] );
2780 }
else if ( !strcmp( val[
i],
"hvectorx" ) || !strcmp( val[
i],
"HVECTORX" ) ) {
2781 output->hVectorX = atof( val[
i + 1] );
2784 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2785 output->hVectorXErr = atof( val[
i + 3] );
2788 }
else if ( !strcmp( val[
i],
"hvectory" ) || !strcmp( val[
i],
"HVECTORY" ) ) {
2789 output->hVectorY = atof( val[
i + 1] );
2792 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2793 output->hVectorYErr = atof( val[
i + 3] );
2796 }
else if ( !strcmp( val[
i],
"psivector" ) || !strcmp( val[
i],
"PSIVECTOR" ) ) {
2797 output->psiVector = atof( val[
i + 1] );
2800 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2801 output->psiVectorErr = atof( val[
i + 3] );
2804 }
else if ( !strcmp( val[
i],
"phi0vector" ) || !strcmp( val[
i],
"PHI0VECTOR" ) ) {
2805 output->phi0Vector = atof( val[
i + 1] );
2808 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2809 output->phi0VectorErr = atof( val[
i + 3] );
2812 }
else if ( !strcmp( val[
i],
"cgw" ) || !strcmp( val[
i],
"CGW" ) ) {
2813 output->cgw = atof( val[
i + 1] );
2816 if ( atoi( val[
i + 2] ) == 1 &&
i + 2 <
k ) {
2817 output->cgwErr = atof( val[
i + 3] );
2837 if (
output->sstr != NULL ) {
2838 if ( !strcmp(
output->sstr,
"KIN" ) || !strcmp(
output->sstr,
"kin" ) ) {
2842 XLAL_PRINT_ERROR(
"Error... KIN not set in .par file %s\n", pulsarAndPath );
2855 fprintf( stderr,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" );
2857 fprintf( stderr,
"sky position:\tra %.7lf +/- %.3le rads, dec %.7lf +/- %.3le rads\n",
params.
ra,
2860 fprintf( stderr,
"proper motion:\tra %.4le +/- %.1le rads/s, dec %.4le +/- %.1le rads/s\n",
2863 fprintf( stderr,
"epochs:\tperiod %lf (GPS), position %lf (GPS)\n",
params.pepoch,
2865 fprintf( stderr,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n" );
2867 fprintf( stderr,
"Frequency parameters\n" );
2878 if (
params.model != NULL ) {
2879 fprintf( stderr,
"\nBinary parameters:\tmodel %s\n",
params.model );
2881 fprintf( stderr,
"Keplarian parameters:-\n" );
2886 fprintf( stderr,
"\tprojected semi-major axis = %lf +/- %.3le (light sec)\n",
params.x,
2892 fprintf( stderr,
"\tlongitude of periastron = %lf +/- %.3lf (degs)\n",
params.w0,
2895 fprintf( stderr,
"\ttime of periastron = %lf +/- %.3lf (GPS)\n",
params.T0,
params.T0Err );
2898 fprintf( stderr,
"\ttime of ascending node = %lf +/- %.3lf (GPS)\n",
params.Tasc,
2901 fprintf( stderr,
"\tfirst Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps1,
2904 fprintf( stderr,
"\tsecond Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps2,
2907 fprintf( stderr,
"\tsecond Laplace-Lagrange parameter (eps1) = %le +/- %.3le\n",
params.eps2,
2924 INT4 i = 0, numPars = 0,
c = 1, sl = 0;
2930 if ( access( corfile, F_OK ) != 0 ) {
2936 if ( (
fp = fopen( corfile,
"r" ) ) == NULL ) {
2942 while ( !strchr( fgets( onechar, 2,
fp ),
'\n' ) ) {
2946 sl = strlen( firstline );
2949 for (
i = 0;
i < sl;
i++ ) {
2951 if ( !isspace( firstline[
i] ) ) {
2963 for (
i = 0;
i < numPars;
i++ ) {
2966 if (
fscanf(
fp,
"%s", tmpStr ) == EOF ) {
2985 dims->
data[0] = numPars;
2986 dims->
data[1] = numPars;
2992 for (
i = 0;
i < numPars;
i++ ) {
2996 if (
fscanf(
fp,
"%s", tmpStr ) == EOF ) {
3001 if ( strcmp( tmpStr, tmpparams->
data[
i] ) ) {
3003Parameters not in consistent order!\n" );
3007 for (
j = 0;
j <
i + 1;
j++ ) {
3010 if (
fscanf(
fp,
"%lf", &tmpval ) == EOF ) {
3016 if (
j !=
i && fabs( tmpval ) == 1. ) {
3020 cormat->
data[
i * numPars +
j] = tmpval;
3024 cormat->
data[
j * numPars +
i] = tmpval;
3053 REAL8 mjdInt, mjdFrac;
3054 mjdFrac = modf( MJD, &mjdInt );
3092 TDBtoTT = 0.0016568 * sin( ( 35999.37 *
T + 357.5 ) *
LAL_PI_180 ) +
3093 0.0000224 * sin( ( 32964.5 *
T + 246.0 ) *
LAL_PI_180 ) +
3094 0.0000138 * sin( ( 71998.7 *
T + 355.0 ) *
LAL_PI_180 ) +
3095 0.0000048 * sin( ( 3034.9 *
T + 25.0 ) *
LAL_PI_180 ) +
3096 0.0000047 * sin( ( 34777.3 *
T + 230.0 ) *
LAL_PI_180 );
3122 range, must be > %.1f.\n", MJD,
GPS0MJD );
3128 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.
const REAL8Vector * PulsarGetREAL8VectorParam(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter.
static int PulsarHashElemCmp(const void *elem1, const void *elem2)
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 del_elem(void *elem)
static PulsarParam * PulsarGetParamItem(const PulsarParameters *pars, const CHAR *name)
Get a pointer to a parameter of a given name from a PulsarParameters structure.
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 REAL8Vector * PulsarGetREAL8VectorParamErr(const PulsarParameters *pars, const CHAR *name)
Return a REAL8Vector parameter error value.
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.
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 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.
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 ...
void * PulsarGetParam(const PulsarParameters *pars, const CHAR *name)
Get the required parameter value from the PulsarParameters structure.
PulsarParameters * XLALReadTEMPOParFile(const CHAR *pulsarAndPath)
Read in the parameters from a TEMPO(2) parameter file into a 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.
LALStringVector * XLALReadTEMPOCorFile(REAL8Array *cormat, CHAR *corfile)
This function will read in a TEMPO-style parameter correlation matrix.
static UINT8 PulsarHash(const void *elem)
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.
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.
const CHAR * PulsarGetStringParam(const PulsarParameters *pars, const CHAR *name)
Return a string parameter.
static void * new_elem(const char *name, PulsarParam *itemPtr)
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.
void * PulsarGetParamErr(const PulsarParameters *pars, const CHAR *name)
Get the required parameter error value from 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...
const UINT4 * PulsarGetParamFitFlag(const PulsarParameters *pars, const CHAR *name)
Get the fit flag array for a given parameter from the PulsarParameters structure.
const UINT4Vector * PulsarGetParamFitFlagAsVector(const PulsarParameters *pars, const CHAR *name)
Get the fit flag array for a given parameter 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)
int XLALHashTblAdd(LALHashTbl *ht, void *x)
int XLALHashTblRemove(LALHashTbl *ht, const void *x)
LALHashTbl * XLALHashTblCreate(LALHashTblDtorFcn dtor, LALHashTblHashFcn hash, LALHashTblCmpFcn cmp)
void XLALHashTblDestroy(LALHashTbl *ht)
void * XLALMalloc(size_t n)
void * XLALCalloc(size_t m, size_t n)
void * XLALRealloc(void *p, size_t n)
char char * XLALStringDuplicate(const char *s)
int XLALStringCaseCompare(const char *s1, const char *s2)
size_t XLALStringCopy(char *dst, const char *src, size_t size)
int char * XLALStringAppend(char *s, const char *append)
void XLALDestroyStringVector(LALStringVector *vect)
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
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)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
#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