Source¶
- class marxs.source.Source(energy=<Quantity 1. keV>, flux=<Quantity 1. 1 / (s cm2)>, polarization=None, geomarea=<Quantity 1. cm2>, **kwargs)[source] [edit on github]¶
Bases:
SimulationSequenceElement
Base class for all photons sources.
This class provides a very general implementation of photons sources. Typically, it is not used directly, but a more specialized subclass, such as
PointSource
for an astronomical source orLabPointSource
for a source at a finite distance.Most of the derived source support the same input argumets as
Source
, thus they are explained in detail here.- Parameters:
- flux
Quantity
or callable This sets the total flux from a source in photons/time/area. Options are:
quantity: Constant (not Poisson distributed) flux.
callable: Function that takes a total exposure time as input and returns an array of photon emission times between 0 and the total exposure time.
- energy
Quantity
or callable orQTable
This input decides the energy of the emitted photons. Possible formats are:
polarization.
Quantity
: Constant energy.astropy.table.Table
: Given this table, the code assumes a piecewise flat spectrum. The “energy” values contain the upper limit of each bin, the “fluxdensity” array the flux density in each bin. The first entry in the “fluxdensity” array is ignored, because the lower bound of this bin is undefined. The code draws an energy from this spectrum for every photon created.A function or callable object: This option allows for full customization. The function must take an array of photon times as input and return an equal length array of photon energies
Quantity
.
- polarization
Quantity
,None
,QTable
, or callable. There are several different ways to set the polarization angle of the photons for a polarized source. In all cases, the angle is measured North through East. (We ignore the special case of a polarized source exactly on a pole.) The default value is
None
(unpolarized source).None
: An unpolarized source. Every photons is assigned a random polarization.Quantity
: Constant polarization angle for all photonsTable
: Table with columns called “angle” and “probabilitydensity”. The summed probability density will automatically be normalized to one. Given this table, the code assumes a piecewise constant probability density. The “angle” values contain the upper limit of each bin. The first entry in the “probabilitydenisty” array is ignored, because the lower bound of this bin is undefined.a callable (function or callable object): This option allows full customization. The function is called with two arrays (time and energy values) as input and must return an array of equal length that contains the polarization angles as
Quantity
object.
- geomarea
astropy.units.Quantity
orNone
Geometric opening area of telescope. If
None
then the flux must be given in photons per time, not per time per unit area.
- flux
Define a new MARXS element.
Methods Summary
__call__
(*args, **kwargs)Call self as a function.
generate_photons
(exposuretime)Central function to generate photons.
generate_polarization
(times, energies)generate_times
(exposuretime)Methods Documentation
- __call__(*args, **kwargs)[source] [edit on github]¶
Call self as a function.
- generate_energies(t: Unit('s'))[source] [edit on github]¶
- generate_photon()[source] [edit on github]¶
- generate_photons(exposuretime: Unit('s'))[source] [edit on github]¶
Central function to generate photons.
Calling this function generates a photon table according to the
flux
,energy
, andpolarization
of this source. The number of photons depends on the total exposure time, which is a parameter of this function. Depending on the setting forflux
the photons could be distributed equally over the interval 0..exposuretime or follow some other distribution.- Parameters:
- exposuretime
astropy.quantity.Quantity
Total exposure time.
- exposuretime
- Returns:
- photons
astropy.table.Table
Table with photon properties.
- photons
- generate_polarization(times: Unit('s'), energies: Unit('keV'))[source] [edit on github]¶
- generate_times(exposuretime: Unit('s'))[source] [edit on github]¶