ECE532 Biomedical Optics
© 1998 Steven L. Jacques, Scott A. Prahl
Oregon Graduate Institute

Time-resolved Monte Carlo

Save data in output file: "trmc.out"

The output file "trmc.out" is created by the following code to allow graphing by the user's favorite graphics program. The data begins with a 3-line header citing the values Nphotons and dr, and spedifying the units of the output in relative fluence rate F/Uo [cm-2 s-1]. The data is arranged with column titles as follows:

/**** SAVE
*   Convert data to photon concentration [cm^-3] and save to file called "trmc.out".
target = fopen("trmc.out", "w");

/* print header */
fprintf(target, "number of photons = %f\n", Nphotons);
fprintf(target, "dr = %5.5f [cm] \n", dr);
fprintf(target, "Output is relative fluence rate F/Uo [cm^-2 s^-2].\n");

/* print column titles */
fprintf(target, "r [cm] \t %5.3f ns \t %5.3f ns \t %5.3f ns \t %5.3f ns\n", 
                 T[0]*1e9, T[1]*1e9, T[2]*1e9, T[3]*1e9);

/* print data:  radial position, Photon fluence rate @ T[it]. */
for (ir=0; ir<NR; ir++) {        /* Don't printout the overflow bin. */
  	r = (ir + 0.5)*dr;
    fprintf(target, "%5.4f", r);
  	shellvolume = 4.0*PI*r*r*dr; /* per spherical shell */
  	for (it=0; it<4; it++) {
    	F[ir][it] = c*Csph[ir][it]/Nphotons/shellvolume;
    	fprintf(target, "\t%5.3e", F[ir][it]);
    fprintf(target, "\n");


NextMonte Carlo