/*GetOptLineInt parse observed line intensites for optimization routines */ #include #include "cddefines.h" #ifdef DEFERR # undef DEFERR #endif #define DEFERR 0.05 #include "varypar.h" #include "trace.h" #include "ffmtread.h" #include "readar.h" #include "getoptlineint.h" #include "caps.h" void GetOptLineInt(char *chCard ) { char chCap[81]; int lgEOF, lgEOL; long int i; # ifdef DEBUG_FUN fputs( "<+>GetOptLineInt()\n", debug_fp ); # endif /* read observed line fluxes & errors */ VaryPar.nlobs = 0; readar(chCard,&lgEOF); if( lgEOF ) { fprintf( ioQQQ, " Hit EOF while reading line list; use END to end list.\n" ); puts( "[Stop in GetOptLineInt]" ); exit(1); } strcpy( chCap, chCard ); caps(chCap); while( !lgEOF ) { VaryPar.nlobs += 1; if( VaryPar.nlobs > NOBSLM ) { fprintf( ioQQQ, " Too many lines have been entered; the limit is%4ld. Increase variable NOBSLM.\n", NOBSLM ); puts( "[Stop in GetOptLineInt]" ); exit(1); } /* order on line is label (col 1-4), wavelength, flux, error */ strncpy( chVaryPar.chAmLab[VaryPar.nlobs-1], chCard , 4 ); /* null terminate*/ chVaryPar.chAmLab[VaryPar.nlobs-1][4] = 0; i = 5; VaryPar.linam[VaryPar.nlobs-1] = (long)FFmtRead(chCard,&i,76,&lgEOL); VaryPar.amint[VaryPar.nlobs-1] = (float)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { fprintf( ioQQQ, " %80.80s\n", chCard ); fprintf( ioQQQ, " The wavelength and relative intensity MUST be entered on this line. Sorry.\n" ); puts( "[Stop in GetOptLineInt]" ); exit(1); } VaryPar.amierr[VaryPar.nlobs-1] = (float)FFmtRead(chCard,&i,76,&lgEOL); if( VaryPar.amint[VaryPar.nlobs-1] <= 0. ) { fprintf( ioQQQ, " An observed intensity of%10.2e is not allowed. Sorry.\n", VaryPar.amint[VaryPar.nlobs-1] ); puts( "[Stop in GetOptLineInt]" ); exit(1); } if( VaryPar.amierr[VaryPar.nlobs-1] <= 0.0 ) { /* this is the relative error allowed */ VaryPar.amierr[VaryPar.nlobs-1] = (float)DEFERR; } /* check if number is a limit - if '<' appears on the line then it is */ if( strchr( chCard , '<' ) != NULL ) { /* value is an upper limit only, use negative error to flag */ VaryPar.amierr[VaryPar.nlobs-1] = -VaryPar.amierr[VaryPar.nlobs-1]; } /* get next line */ readar(chCard,&lgEOF); if( lgEOF ) { fprintf( ioQQQ, " Hit EOF while reading line list; use END to end list.\n" ); puts( "[Stop in GetOptLineInt]" ); exit(1); } strcpy( chCap, chCard ); caps(chCap); if( strncmp( chCap ,"END" , 3 ) == 0 ) lgEOF = TRUE; } if( trace.lgTrace && trace.lgTrOptm ) { fprintf( ioQQQ, "%4ld lines were entered, they were;\n", VaryPar.nlobs ); for( i=0; i < VaryPar.nlobs; i++ ) { fprintf( ioQQQ, " %4.4s%5ld%10.2e%10.2e\n", chVaryPar.chAmLab[i] , VaryPar.linam[i], VaryPar.amint[i], VaryPar.amierr[i] ); } } # ifdef DEBUG_FUN fputs( " <->GetOptLineInt()\n", debug_fp ); # endif return; }