source — X-ray sources#
This module contains all the facilities for the description of simple X-ray sources,
for both the morphological and spectral part. At the very basic level, a
Source object is the datum of an energy spectrum
and a beam description, and has the primary purpose of generating lists of X-ray
basic properties (time, energy and position in the horizontal plane) than can be
folded into an actual detector simulation.
spectrum = LineForest('Cu', 'K')
beam = GaussianBeam(sigma=0.1)
source = Source(spectrum, beam, rate=10.)
timestamp, energy, x, y = source.rvs()
Note
At this point a Source is a very simple
object describing a parallel beam of photons traveling along the z axis, that is,
orthogonally to the detector plane—the latter will be always assumed to lie
in the x-y plane—with no concept, e.g., of beam divergence. This is an area
where we might want to add functionalities in the future.
Morphology#
The morphological part of the source description is encapsulated in a series of
subclasses of the (purely virtual) BeamBase
class. More specifically:
PointBeamrepresents a point-like beam;DiskBeamrepresents a uniform disk;GaussianBeamrepresents a simple gaussian beam.
Spectrum#
Likewise, the source spectrum is encapsulated in subclasses of the (virtual)
SpectrumBase class and, particularly,
LineForest.
Module documentation#
X-ray source description.
- class hexsample.source.BeamBase(x0: float = 0.0, y0: float = 0.0)[source]#
Base class describing the morphology of a X-ray beam.
Arguments#
- x0float
The x-coordinate of the beam centroid in cm.
- y0float
The y-coordinate of the beam centroid in cm.
- x0: float = 0.0#
- y0: float = 0.0#
- class hexsample.source.PointBeam(x0: float = 0.0, y0: float = 0.0)[source]#
Point-like X-ray beam.
Arguments#
- x0float
The x-coordinate of the beam centroid in cm.
- y0float
The y-coordinate of the beam centroid in cm.
- class hexsample.source.DiskBeam(x0: float = 0.0, y0: float = 0.0, radius: float = 0.1)[source]#
Uniform disk X-ray beam.
Arguments#
- x0float
The x-coordinate of the beam centroid in cm.
- y0float
The y-coordinate of the beam centroid in cm.
- radiusfloat
The disk radius in cm.
- radius: float = 0.1#
- class hexsample.source.GaussianBeam(x0: float = 0.0, y0: float = 0.0, sigma: float = 0.1)[source]#
Azimuthally-simmetric gaussian beam.
Arguments#
- x0float
The x-coordinate of the beam centroid in cm.
- y0float
The y-coordinate of the beam centroid in cm.
- sigmafloat
The beam sigma in cm.
- sigma: float = 0.1#
- class hexsample.source.SpectrumBase[source]#
Base class for a photon energy spectrum.
- class hexsample.source.LineForest(element: str | int, initial_level: str | None = None, excitation_energy: float | None = None)[source]#
Class describing a set of X-ray emission lines for a given element and initial level or excitation energy.
See https://xraypy.github.io/XrayDB/python.html#x-ray-emission-lines for more information.
Arguments#
- elementint or str
atomic number or atomic symbol for the given element
- initial_levelstr, optional
iupac symbol of the initial level
- excitation_energyfloat, optional
excitation energy in eV
- class hexsample.source.Source(spectrum: SpectrumBase, beam: BeamBase, rate: float = 100.0)[source]#
Base class for a X-ray source.
Arguments#
- ratefloat
The photon rate in Hz.
- spectrumSpectrumBase
The source spectrum.
- beamBeamBase
The source beam morphology.