What happened when dctimestep convert the BTDF to matrix?

When BSDF file was employed in the matrix multiplication by dctimestep, what procedures were conducted to convert the BTDF to matrix? I guess the the BTDF values were multiplied by the projected solid angle to obtain the matrix, however, I found the result is not consistent with the result calculated by dctimestep when I write a python code to validate my thoughts.

The solid angle for klems patch is calculated as following formula:

I also read the code of dctimestep, and found the function cm_loadBTDF, however, I can’t find which file were the ccy2rgb and cm_bsdf_recip defined in.

Whenever you can’t find a source routine in Radiance, you can run this from the ray/src directory:

grep '^routine_name(' */*.c

The caret (‘^’) matches the beginning of the line, and this is how most routines are defined in Radiance. This will tell you that the cm_bsdf_recip() routine is in “util/cmbsdf.c”, along with the cm_loadBTDF() function you found already. The ccy2rgb() function is in “common/ccy2rgb.c”.

You are correct that the BTDF is multiplied by the solid angle for each patch, but I’m not surprised you didn’t get the same result. When using the “Transmission Front” matrix, the cm_bsdf_recip() function is called, which converts outgoing indices to incoming patch indices and uses those solid angles as the multipliers.