/*cdLine get the predicted line intensity, also pointer to line in stack */ #include #include "cddefines.h" #include "linesave.h" #include "norm.h" #include "fourpi.h" #include "cap4.h" #include "cddrive.h" /* following routine provides a debugging hook into the main line array * loops over whole array and finds every line that matches length, * the wavelength, the argument to the function * put breakpoint inside if test */ long debugLine( long int length ) { long j, kount; kount = 0; for( j=0; j < LineSave.nsum; j++ ) { /* check wavelength and chLabel for a match */ if( LineSv[j].lin == length ) { printf("%s\n", LineSv[j].chALab); ++kount; } } printf(" hits = %li\n", kount ); return(kount); } /* returns pointer to line in array stack if we found the line, * or FALSE==0 if we did not find the line */ long int cdLine(char *chLabel, /* wavelength of line as printed by code*/ long int length, /* linear intensity relative to normalization line*/ double *relint, /* log of luminosity or intensity of line */ double *absint ) { char chCaps[5], chFind[5]; long int ipobs, j; # ifdef DEBUG_FUN fputs( "<+>cdLine()\n", debug_fp ); # endif /* change chLabel to all caps */ cap4(chFind,chLabel); /* now go through entire line stack, do not do 0, which is H-beta and * in stack further down - this is to stop query for H-beta from returning * 0, the flag for line not found */ for( j=1; j < LineSave.nsum; j++ ) { /* check wavelength and chLabel for a match */ if( LineSv[j].lin == length ) { /* change chLabel to all caps to be like input chALab */ cap4(chCaps , (char*)LineSv[j].chALab); /* now see if labels agree */ if( strcmp(chCaps,chFind) == 0 ) { /* match, so set pointer */ ipobs = j; /* does the normalization line have a positive intensity*/ if( LineSv[norm.ipNormWavL].sumlin > 0. ) { *relint = LineSv[ipobs].sumlin/LineSv[norm.ipNormWavL].sumlin* norm.ScaleNormLine; } else { *relint = 0.; } /* return log of current line intensity if it is positive */ if( LineSv[ipobs].sumlin > 0. ) { *absint = log10(LineSv[ipobs].sumlin) + fourpi.pirsq; } else { /* line intensity is actually zero, return small number */ *absint = -37.; } # ifdef DEBUG_FUN fputs( " <->cdLine()\n", debug_fp ); # endif /* we found the line, return pointer to its location */ return ipobs; } } } *absint = 0.; *relint = 0.; # ifdef DEBUG_FUN fputs( " <->cdLine()\n", debug_fp ); # endif /* if we fell down to here we did not find the line */ return 0; }