rendered paste body#include<stdio.h>
double F_get_photons(double t, double LAMBDA, double RADIANCE, double PIX_A);
double F_get_photons(double t, double LAMBDA, double RADIANCE, double PIX_A)
{
double j;
double pi=3.141592; // PI the famous number
double h=6.63e-34; // Planck constant Js
double c=3.00e8; // c speed of light m/s
double f=8; // f, f-number of the illumination system
double phot;
double a; //area of the pixel
printf("Lambda: %.10f ->",LAMBDA);
LAMBDA = LAMBDA*1e-9; // from nm to m
printf("%.10f \n",LAMBDA);
printf("Texp: %.10f ->",t);
t=t*1e-9; //from ns to s
printf("%.10f \n",t);
printf("Area: %.10f ->",PIX_A);
a=PIX_A*1e-12; // from um^2 to m^2
printf("%.15f \n",a);
j=pi*RADIANCE/(1+(2*f)*(2*f)); //irradiance
printf("Radiance %.15f \n",j);
phot=j*a*t*LAMBDA/(h*c); //number of photons
// phot =5;
printf("photon %f \n",phot);
return phot;
}
main(){
printf("%f\n", F_get_photons(100.0, 1.0, 1.0, 1.0) ) ;
}