htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit b3bedf06f7100a3c98d4f088803991efd53fdb77
parent 59a22ee1441fd8435237d3b15badd9e507906389
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 21 Apr 2020 15:46:16 +0200

Transform the unit of the LW radiance in W/m^2/sr/nm

Diffstat:
Mdoc/htrdr-image.5.txt | 14+++++++-------
Msrc/htrdr_cie_xyz.c | 3+++
Msrc/htrdr_draw_radiance.c | 6+++++-
Msrc/htrdr_ran_lw.c | 4++--
4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/doc/htrdr-image.5.txt b/doc/htrdr-image.5.txt @@ -34,18 +34,18 @@ If the image is a regular rendering in the visible part of the spectrum, the pixel components are actually 4 pairs of floating points data representing the pixel color encoded in the CIE 1931 XYZ color space and the per radiative path computation time. The first, second and third pair encode the estimated -radiance in W.sr^-1.m^-2 of the X, Y and Z pixel components, respectively. The -first value of each pair is the expected value of the estimated radiance while -the second one is its associated standard deviation. The fourth pair saves the -estimate in microseconds of the per radiative path computation time and its -standard error. +integrated radiance in W.sr^-1.m^-2 of the X, Y and Z pixel components, +respectively. The first value of each pair is the expected value of the +estimated radiance while the second one is its associated standard deviation. +The fourth pair saves the estimate in microseconds of the per radiative path +computation time and its standard error. If the image is an infrared rendering, the first and second pixel components store the expected value and the standard error, respectively, of the estimated brightness temperature in Kelvin. The third and fourth component save the expected value and standard deviation of the pixel radiance in -W.sr^-1.m^-2. The fifth and sixth pixel components are unused. Finally the -last 2 pixel components save, as for a regular rendering, the estimate in +W.sr^-1.m^-2.nm^-1. The fifth and sixth pixel components are unused. Finally +the last 2 pixel components save, as for a regular rendering, the estimate in microseconds of the per radiative path computation time and its standard error. diff --git a/src/htrdr_cie_xyz.c b/src/htrdr_cie_xyz.c @@ -143,6 +143,9 @@ sample_cie_xyz d = 0.5 * (f_max + f_min) * cie->band_len; delta = b*b - 4*a*(c-d*r1); + if(delta < 0 && eq_eps(delta, 0, 1.e-6)) { + delta = 0; + } ASSERT(delta > 0); sqrt_delta = sqrt(delta); diff --git a/src/htrdr_draw_radiance.c b/src/htrdr_draw_radiance.c @@ -631,7 +631,7 @@ draw_pixel_lw /* Retrieve the PDF to sample this sky band */ band_pdf = htrdr_ran_lw_get_sky_band_pdf(htrdr->ran_lw, iband); - /* Compute the luminance */ + /* Compute the luminance in W/m^2/sr/m */ weight = htrdr_compute_radiance_lw (htrdr, ithread, rng, ray_org, ray_dir, wlen, iband, iquad); weight /= band_pdf; @@ -679,6 +679,10 @@ draw_pixel_lw BRIGHTNESS_TEMPERATURE(pixel->radiance.E + pixel->radiance.SE, temp_max); pixel->radiance_temperature.SE = temp_max - temp_min; #undef BRIGHTNESS_TEMPERATURE + + /* Transform the pixel radiance from W/m^2/sr/m to W/m^/sr/nm */ + pixel->radiance.E *= 1.0e-9; + pixel->radiance.SE *= 1.0e-9; } static res_T diff --git a/src/htrdr_ran_lw.c b/src/htrdr_ran_lw.c @@ -164,7 +164,7 @@ compute_sky_bands_pdf wlens[1] *= 1.e-9; /* Compute the probability of the current band */ - pdf[i] = planck(wlens[0], wlens[1], ran_lw->ref_temperature); + pdf[i] = blackbody_fraction(wlens[0], wlens[1], ran_lw->ref_temperature); /* Update the norm */ sum += pdf[i]; @@ -302,7 +302,7 @@ res_T htrdr_ran_lw_create (struct htrdr* htrdr, const double range[2], /* Must be included in [1000, 100000] nanometers */ - const size_t nbands, /* # bands used to discretized the CIE tristimulus */ + const size_t nbands, /* # bands used to discretized CDF */ const double ref_temperature, struct htrdr_ran_lw** out_ran_lw) {