Message: Re: Optical Photons Spectrum Not Logged In (login)

## Re: Optical Photons Spectrum

Forum: Processes Involving Optical Photons
Re: Optical Photons Spectrum (Dragos Constantin)
Re: Re: Optical Photons Spectrum (Gumplinger Peter)
Re: Re: Optical Photons Spectrum (Gumplinger Peter)
Re: Re: Optical Photons Spectrum (Gumplinger Peter)
Date: 21 Jan, 2011
From: Benton Pahlka <Benton Pahlka>

 Hi, Just my two cents. For my simulations, I have text files that I read in for each optical property. Each file contains 500 data points, one for each integer wavelength (which I convert to from the energy), in a range from 200 nm to 700 nm (as this is the relevant range for my purposes). I read the files in and store them in an array. This produces very smooth output spectra for me. Benton On Fri, 21 Jan 2011 23:05:55 GMT, Gumplinger Peter wrote: ```> I'll try to explain the photon energy sampling with words although a > simple graph would explain it much better and easier. > > If you have a spectrum that is defined at discrete locations and you > want to sample from this spectrum, you have the two simplest choices: > > (1) You can either brute force sample with the rejection method - slow - > or (2) you can resort to the faster integral method. The integral method > was chosen. > > This means that you need to first integrate the spectrum and make a new > vector which is monotonically increasing and holds the integral of the > spectrum to the left of the bin in question. The (linear) integral of a > spectral bin F(x) is the width of the bin times the average y=f(x) at > the bin's edges. > > During simulation a flat random number is taken from zero to the > integral vector's largest entry: Y_max=F(x_max). For this number (Y) we > now find the corresponding integral vector's left bin, x_i, then sample > x above the bin's lower limit, x_i, by linearly interpolating the > integral vector's entries at the bin edges, F(x_i) and F(x_i+1). > > If you think about it, what that produces is a flat spectrum in x (the > photon energy) within the bin because the line connecting the bin's > edges Y_i=F(x_i) and Y_i+1=F(x_i+1) is a straight line. > ```

1 Re: Optical Photons Spectrum   (Dragos Constantin - 26 Jan, 2011)
 to: "Re: Optical Photons Spectrum"
This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews