ThinLens¶
- class marxs.optics.ThinLens(**kwargs)[source] [edit on github]¶
Bases:
FlatOpticalElement
Focus rays with the thin lens approximation
This implements the so called “thin lens” approximation, see https://en.wikipedia.org/wiki/Thin_lens for details.
This class represents a lens that is (except for the thin lens approximation) perfect: There is no absorption and no wavelength dependence of the refraction. There is no physical material that allows to manufacture an X-ray lens in the same shape as traditional glass lenses, but this class can be used as an “effective” model. It is computationally cheap and if the details of the mirror are not important to the simulation, a thin lens might provide an approximation for X-ray focussing.
Examples
>>> import matplotlib.pyplot as plt >>> from astropy.coordinates import SkyCoord >>> import astropy.units as u >>> from marxs import source, optics >>> mysource = source.PointSource(coords=SkyCoord(30., 30., unit="deg")) >>> mypointing = source.FixedPointing(coords=SkyCoord(30., 30., unit='deg')) >>> myslit = optics.RectangleAperture(zoom=2) >>> lens = optics.ThinLens(focallength=10,zoom=40)
>>> photons = mysource.generate_photons(11 * u.s) >>> photons = mypointing(photons) >>> photons = myslit(photons) >>> photons = lens(photons)
>>> mdet = optics.FlatDetector(pixsize=0.01, position=np.array([-9.6, 0, 0]), zoom=1e5) >>> photons = mdet(photons) >>> fig = plt.plot(photons['det_x'], photons['det_y'], 's')
Define a new MARXS element.
Attributes Summary
Dictionary for display specifications, e.g. color.
Methods Summary
process_photon
(dir, pos, energy, polarization)Simulate interaction of optical element with a single photon.
Attributes Documentation
- display = {'color': (0.0, 0.5, 0.0), 'opacity': 0.5}¶
Dictionary for display specifications, e.g. color
Methods Documentation
- process_photon(dir, pos, energy, polarization)[source] [edit on github]¶
Simulate interaction of optical element with a single photon.
This is called from the
process_photons
method in a loop over all photons. That method also collects the output values and inserts them into the photon list.process_photon
can return any number of values in additon to the required dir, pos, etc.. Define a class attributeoutput_columns
as a list of strings to determine how into which column these numbers should be inserted.- Parameters:
- dir
numpy.ndarray
4-d direction vector of ray in homogeneous coordinates
- pos
numpy.ndarray
4-d position of last interaction pf the photons with any optical element in homogeneous coordinates. Together with
dir
this determines the equation of the ray.- energyfloat
Photon energy in keV.
- polarizationfloat
Polarization angle of the photons.
- dir
- Returns:
- dir
numpy.ndarray
4-d direction vector of ray in homogeneous coordinates
- pos
numpy.ndarray
4-d position of last interaction pf the photons with any optical element in homogeneous coordinates. Together with
dir
this determines the equation of the ray.- energyfloat
Photon energy in keV.
- polarizationfloat
Polarization angle of the photons.
- probabilityfloat
Probability that the photon passes this optical element. Set to 0 if the photon is absorbed, to 1 if it passes and to number between 0 and 1 to express a probability that the photons passes.
- otherfloats
One number per entry in
output_columns
.
- dir