44 #define DEF_ERROR 0.05
89 fprintf(
ioQQQ,
" ParseAssertResults called before InitAsserResults\n" );
188 " I could not identify an element name on this line.\n");
189 fprintf(
ioQQQ,
" Sorry.\n" );
210 " The ionization stage is inappropriate for this element.\n");
211 fprintf(
ioQQQ,
" Sorry.\n" );
243 fprintf(
ioQQQ,
"PROBLEM this assert grid command does not have enough values. sorry\n");
260 " The ionization fraction must be less than one.\n");
261 fprintf(
ioQQQ,
" Sorry.\n" );
269 " The ionization ionization fraction is too small, or zero. Check input\n");
270 fprintf(
ioQQQ,
" Sorry.\n" );
310 " I could not identify CO or H2 on this line.\n");
311 fprintf(
ioQQQ,
" Sorry.\n" );
371 if( chLabel[4] !=
'\0' )
374 " The label must be exactly 4 char long, between double quotes.\n");
375 fprintf(
ioQQQ,
" Sorry.\n" );
417 " The asserted quantity is a log, but is too large or small, value is %e.\n",
AssertQuantity[nAsserts] );
418 fprintf(
ioQQQ,
" I would crash if I tried to use it.\n Sorry.\n" );
427 " The relative intensity must be positive, and was %e.\n",
AssertQuantity[nAsserts] );
428 fprintf(
ioQQQ,
" Sorry.\n" );
466 fprintf(
ioQQQ,
" The assert Case B faint option must have a number,"
467 " the relative intensity of the fainest line to assert.\n");
471 if(
Param[nAsserts][4]<=0. )
490 fprintf(
ioQQQ,
" The assert Case B range option must have two numbers,"
491 " the lower and upper limit to the wavelengths in Angstroms.\n");
492 fprintf(
ioQQQ,
" There must be a total of three numbers on the line,"
493 " the relative error followed by the lower and upper limits to the "
494 "wavelength in Angstroms.\n");
518 fprintf(
ioQQQ,
"assert H-like case B did not find an element on this line, sorry %s\n",
525 fprintf(
ioQQQ,
"assert H-like cannot do elements heavier than O, sorry %s\n",
574 " I could not identify an element name on this line.\n");
575 fprintf(
ioQQQ,
" Sorry.\n" );
591 " I could not identify an element name on this line.\n");
592 fprintf(
ioQQQ,
" Sorry.\n" );
621 " There must be a second key: FEII, H-LIke, HMINus, or HE-Like followed by element.\n");
622 fprintf(
ioQQQ,
" Sorry.\n" );
656 " There must be a second key, HEATing or COOLing.\n");
657 fprintf(
ioQQQ,
" Sorry.\n" );
836 " I could not identify H2, H3+, H2+, H2g, H2*, H2H+, CO, O2, SiO, OH, C2 or C3 or on this line.\n");
837 fprintf(
ioQQQ,
" Sorry.\n" );
887 " I did not find a 2, as in H2, as the first number on this line.\n");
889 " The rate should be the second number.\n");
890 fprintf(
ioQQQ,
" Sorry.\n" );
1011 " I could not identify an element name on this line.\n");
1012 fprintf(
ioQQQ,
" Sorry.\n" );
1047 " The ionization stage is inappropriate for this element.\n");
1048 fprintf(
ioQQQ,
" Sorry.\n" );
1082 fprintf(
ioQQQ,
"PROBLEM this assert grid command does not have enough values. sorry\n");
1143 " I could not identify a second keyword on this line.\n");
1144 fprintf(
ioQQQ,
" Sorry.\n" );
1151 if( lgEOL || n2 != 2 )
1534 " Unrecognized command. The line image was==%s==\n",
1537 " The options I know about are: ionization, line, departure coefficient, map, column, "
1538 "temperature, nzone, csupre, htot, itrz, eden, thickness, niter, \n");
1539 fprintf(
ioQQQ,
" Sorry.\n" );
1548 " ParseAssertResults: too many asserts, limit is NASSERT=%d\n",
1566 double relint , absint;
1575 long lgDisambiguate =
false;
1577 char chCaps[5], chFind[5];
1617 ipDisambiguate[i][0] = -1;
1618 ipDisambiguate[i][1] = -1;
1619 ipDisambiguate[i][2] = -1;
1630 if( ipDisambiguate[i][0] <= 0 )
1633 " assert error: lgCheckAsserts could not find a line with label %s ",
1636 fprintf( ioASSERT,
"\n" );
1639 " assert error: The \"punch line labels\" command is a good way to get a list of line labels.\n\n");
1642 RelError[i] = 100000.;
1658 cap4(chFind,chLabelLoc);
1667 if( j==ipDisambiguate[i][0] )
1682 if( strcmp(chCaps,chFind) == 0 )
1684 double relint1, absint1, current_error;
1690 current_error < 2.*fabs(RelError[i]) )
1692 lgDisambiguate =
true;
1695 if( ipDisambiguate[i][1] > 0 )
1697 ipDisambiguate[i][2] = j;
1702 ipDisambiguate[i][1] = j;
1710 PredQuan[i] = relint;
1721 " assert error: lgCheckAsserts could not find a line with label %s ",
1724 fprintf( ioASSERT,
"\n" );
1727 " assert error: The \"punch line labels\" command is a good way to get a list of line labels.\n\n");
1730 RelError[i] = 10000000.;
1738 PredQuan[i] = pow(10.,absint);
1744 double hfrac , hefrac;
1759 " assert error: lgCheckAsserts could not find h ionization fraction \n");
1779 " assert error: lgCheckAsserts could not find h ionization fraction \n");
1787 PredQuan[i] = hefrac-hfrac;
1795 PredQuan[i] = (double)
nzone;
1828 double sumx=0., sumx2=0., average;
1831 for( n=0; n<
nzone; n++ )
1839 average = sumx/
nzone;
1841 sumx = sqrt( (sumx2-
POW2(sumx)/nzone)/(nzone-1) );
1843 PredQuan[i] = sumx / average;
1935 long int nISOCaseB = (long)
Param[i][0];
1936 long int nelemCaseB = (long)
Param[i][1];
1937 char chElemLabelCaseB[5];
1941 sprintf( chNumb ,
"%2li" , nelemCaseB+1-nISOCaseB );
1942 strcat( chElemLabelCaseB , chNumb );
1949 fprintf(ioASSERT,
" Species nHi nLo Wl Computed Asserted error\n");
1951 for(
long int ipLo=1+iCase; ipLo<
MIN2(10,nHighestPrinted-1); ++ipLo )
1953 for(
long int ipHi=ipLo+1; ipHi<
MIN2(25,nHighestPrinted); ++ipHi )
1961 double relint , absint,CBrelint , CBabsint;
1964 if( CBrelint <
Param[i][4] )
1966 CBabsint = pow( 10., CBabsint );
1969 if(
cdLine( chElemLabelCaseB , wl , &relint , &absint ) >0)
1971 absint = pow( 10., absint );
1972 error = (CBabsint - absint)/
MAX2(CBabsint , absint);
1973 double RelativeError = fabs(error) /
AssertError[i];
1975 if( RelativeError < 1. )
1977 if( RelativeError < 0.25 )
1979 fprintf( ioASSERT,
" ChkAssert ");
1981 else if( RelativeError < 0.50 )
1983 fprintf( ioASSERT,
" ChkAssert - ");
1985 else if( RelativeError < 0.75 )
1987 fprintf( ioASSERT,
" ChkAssert -- ");
1989 else if( RelativeError < 0.90 )
1991 fprintf( ioASSERT,
" ChkAssert --- ");
1993 else if( RelativeError < 0.95 )
1995 fprintf( ioASSERT,
" ChkAssert ---- ");
1997 else if( RelativeError < 0.98 )
1999 fprintf( ioASSERT,
" ChkAssert ----- ");
2003 fprintf( ioASSERT,
" ChkAssert ------ ");
2009 fprintf( ioASSERT,
" ChkAssert botch>>");
2011 fprintf(ioASSERT,
" %s %3li %3li ",
2012 chElemLabelCaseB , ipHi , ipLo );
2014 fprintf(ioASSERT,
" %.2e %.2e %10.3f",
2015 absint , CBabsint , error );
2020 fprintf(ioASSERT ,
" botch \n");
2022 fprintf(ioASSERT ,
"\n");
2026 RelError[i] =
MAX2( RelError[i] , fabs(error) );
2034 fprintf(ioASSERT,
"\n");
2040 fprintf(
ioQQQ,
"PROBLEM assert case B for a He is requested but He is not "
2042 fprintf(
ioQQQ,
"Do not turn off He if you want to assert its spectrum.\n");
2046 # define N_CASEB_HEI 11
2047 realnum CaseBWlHeI[N_CASEB_HEI]=
2048 { 10830.f, 3889.f, 3188.f, 5016.f, 3965.f, 7065.f, 5876.f, 4471.f,
2049 4026.f, 6678.f, 4922.f };
2052 fprintf(ioASSERT,
" Wl Computed Asserted error\n");
2060 double relint , absint,CBrelint , CBabsint;
2062 if( CBrelint <
Param[i][4] )
2064 CBabsint = pow( 10., CBabsint );
2066 if(
cdLine( chElemLabelCaseB , wl , &relint , &absint ) >0)
2068 absint = pow( 10., absint );
2069 error = (CBabsint - absint)/
MAX2(CBabsint , absint);
2070 double RelativeError = fabs(error) /
AssertError[i];
2072 if( RelativeError < 1. )
2074 if( RelativeError < 0.25 )
2076 fprintf( ioASSERT,
" ChkAssert ");
2078 else if( RelativeError < 0.50 )
2080 fprintf( ioASSERT,
" ChkAssert - ");
2082 else if( RelativeError < 0.75 )
2084 fprintf( ioASSERT,
" ChkAssert -- ");
2086 else if( RelativeError < 0.90 )
2088 fprintf( ioASSERT,
" ChkAssert --- ");
2090 else if( RelativeError < 0.95 )
2092 fprintf( ioASSERT,
" ChkAssert ---- ");
2094 else if( RelativeError < 0.98 )
2096 fprintf( ioASSERT,
" ChkAssert ----- ");
2100 fprintf( ioASSERT,
" ChkAssert ------ ");
2106 fprintf( ioASSERT,
" ChkAssert botch>>");
2109 fprintf(ioASSERT,
" %.2e %.2e %10.3f",
2110 absint , CBabsint , error );
2115 fprintf(ioASSERT ,
" botch \n");
2117 fprintf(ioASSERT ,
"\n");
2121 RelError[i] =
MAX2( RelError[i] , fabs(error) );
2127 fprintf(ioASSERT,
"\n");
2141 fprintf(
ioQQQ,
"PROBLEM asserted element %ld is not turned on!\n",ipZ);
2170 fprintf(
ioQQQ,
"PROBLEM asserted element %ld is not turned on!\n",ipZ);
2197 double BigError , StdDev;
2203 RelError[i] = StdDev;
2220 strcpy( chWeight ,
"VOLUME" );
2225 strcpy( chWeight ,
"RADIUS" );
2241 " assert error: lgCheckAsserts could not find a line with label %s %f \n",
2251 PredQuan[i] = relint;
2265 fprintf(
ioQQQ,
" PROBLEM lgCheckAsserts did not find v=%li, J=%li for H2 column density.\n",
2287 " assert error: lgCheckAsserts could not find a molecule with label %s %f \n",
2298 PredQuan[i] = relint;
2320 " assert error: lgCheckAsserts could not find a molecule with label %s %f \n",
2329 PredQuan[i] = relint;
2342 " assert error: lgCheckAsserts cannot check map since map not done.\n");
2353 " assert error: lgCheckAsserts cannot check map since temperature not within range.\n");
2392 strcpy( chWeight ,
"VOLUME" );
2397 strcpy( chWeight ,
"RADIUS" );
2407 if( nd < 0 || nd >=
gv.
nBin ) {
2409 fprintf(
ioQQQ,
"Use 1 for first grain that is turned on, " );
2410 fprintf(
ioQQQ,
"2 for second, etc....\n" );
2411 fprintf(
ioQQQ,
"Old style grain numbers are not valid anymore !!\n" );
2436 " assert error: lgCheckAsserts could not find an ion with label %s ion %li \n",
2447 PredQuan[i] = relint;
2457 if( nd < 0 || nd >=
gv.
nBin ) {
2459 fprintf(
ioQQQ,
"Use 1 for first grain that is turned on, " );
2460 fprintf(
ioQQQ,
"2 for second, etc....\n" );
2461 fprintf(
ioQQQ,
"Old style grain numbers are not valid anymore !!\n" );
2474 " assert error: lgCheckAsserts received an insane chAssertType=%s, impossible\n",
2520 if( lgDisambiguate )
2524 double relint1, relint2, absint1;
2528 fprintf( ioASSERT,
"=============Line Disambiguation=======================================================\n" );
2529 fprintf( ioASSERT,
" Wavelengths || Intensities \n" );
2530 fprintf( ioASSERT,
"Label line match1 match2 match3 || asserted match1 match2 match3\n" );
2534 if( ipDisambiguate[i][1] > 0 )
2538 fprintf( ioASSERT ,
" " );
2540 fprintf( ioASSERT ,
" " );
2541 prt_wl( ioASSERT ,
LineSv[ipDisambiguate[i][1]].wavelength );
2542 fprintf( ioASSERT ,
" " );
2543 if( ipDisambiguate[i][2] > 0 )
2545 prt_wl( ioASSERT ,
LineSv[ipDisambiguate[i][2]].wavelength );
2546 cdLine_ip( ipDisambiguate[i][2], &relint2, &absint1 );
2550 fprintf( ioASSERT ,
"--------" );
2553 fprintf( ioASSERT ,
" ||" );
2555 cdLine_ip( ipDisambiguate[i][1], &relint1, &absint1 );
2559 fprintf( ioASSERT ,
" %10.3e %10.3e %10.3e %10.3e\n",
2567 fprintf( ioASSERT ,
" %10.4f %10.4f %10.4f %10.4f\n",
2575 fprintf( ioASSERT,
"\n" );
2582 fprintf( ioASSERT,
"=============Results of asserts: Cloudy %s ",
t_version::Inst().chVersion );
2591 fprintf(ioASSERT,
"%s", ctime(&now) );
2595 fprintf(ioASSERT,
"\n" );
2600 fprintf( ioASSERT,
" No errors were found. Summary follows.\n");
2604 fprintf( ioASSERT,
" Errors were found. Summary follows.\n");
2608 " Label line computed asserted Rel Err Set err\n");
2612 double prtPredQuan, prtAssertQuantity;
2622 prtPredQuan = PredQuan[i];
2634 fprintf( ioASSERT,
" ChkAssert ");
2636 else if( relative < 0.50 )
2638 fprintf( ioASSERT,
" ChkAssert - ");
2640 else if( relative < 0.75 )
2642 fprintf( ioASSERT,
" ChkAssert -- ");
2644 else if( relative < 0.90 )
2646 fprintf( ioASSERT,
" ChkAssert --- ");
2648 else if( relative < 0.95 )
2650 fprintf( ioASSERT,
" ChkAssert ---- ");
2652 else if( relative < 0.98 )
2654 fprintf( ioASSERT,
" ChkAssert ----- ");
2658 fprintf( ioASSERT,
" ChkAssert ------ ");
2664 fprintf( ioASSERT,
" ChkAssert botch>>");
2669 fprintf( ioASSERT ,
"%4s ",
2676 fprintf( ioASSERT ,
" %10.3e %c %10.3e %7.3f %7.3f ",
2685 fprintf( ioASSERT ,
" %10.4f %c %10.4f %7.3f %7.3f ",
2694 enum {DEBUG_LOC=
false};
2710 fprintf(
ioQQQ,
"\t%li %li %li %li %li %li",
2727 fprintf( ioASSERT ,
"%4s %6i %10.4f %c %10.4f %7.3f %7.3f ",
2742 if( !lg1OK[i] && (fabs(RelError[i]) > 3.*
AssertError[i]) && lgFound[i] )
2744 fprintf( ioASSERT ,
" <<BIG BOTCH!!\n");
2749 fprintf( ioASSERT ,
"\n");
2752 fprintf( ioASSERT ,
" \n");
2759 fprintf( ioASSERT,
" BIG BOTCHED ASSERTS!!! Big Botched Asserts!!! \n");
2763 fprintf( ioASSERT,
" BOTCHED ASSERTS!!! Botched Asserts!!! \n");
2768 fprintf(ioASSERT,
"\n The mean of the %li assert Case A, B relative "
2769 "residuals is %.2f\n\n" ,