SimulationSequenceElement

class marxs.base.SimulationSequenceElement(**kwargs)[source] [edit on github]

Bases: MarxsElement

Base class for all elements in a simulation that processes photons.

Define a new MARXS element.

Attributes Summary

id_col

String that names an id column for output.

output_columns

This is a list of strings that names the output properties.

Methods Summary

__call__(photons, *args, **kwargs)

Call self as a function.

add_output_cols(photons[, colnames])

Add output columns to the photon array.

Attributes Documentation

id_col = None

String that names an id column for output.

Set this to a string to add an automatic numbering to the output. This is especially useful if there are several identical optical components that are used in parallel, e.g. there are four identical CCDs. Setting id_col = "CCD_ID" and passing an id_num=1, 2, 3, 4 keyword respectively to each CCD will add a column CCD_ID with a value of 1,2,3, or 4 for each photon hitting one of those CCDs.

Currently, this will not work with all optical elements.

output_columns = []

This is a list of strings that names the output properties.

This gives the names of the output properties from this optical element. process_photon or process_photons are responsible for calculating the values of these properties. For example, for a mirror of nested shells one might set output_columns = ['mirror_shell'] to pass the information on which shell the interaction took place to the user.

The following properties are always included in the output and do not need to be listed here:

dirnumpy.ndarray

4-d direction vector of ray in homogeneous coordinates

posnumpy.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 continues. Set to 0 if the photon is absorbed, to 1 if it passes the optical element and to number between 0 and 1 to express a probability that the photons passes.

Methods Documentation

__call__(photons, *args, **kwargs)[source] [edit on github]

Call self as a function.

add_output_cols(photons, colnames=[])[source] [edit on github]

Add output columns to the photon array.

This function takes the column names that are added to photons from several sources:

Parameters:
photonsastropy.table.Table

Table columns are added to.

colnameslist of elements

Each element can be a string (in this case a float column with initial value np.nan is added) or a dictionay of arguments for astropy.table.column.Column. If the dictionay has a keys “value” then the column will be initialized to that value. Column names to be added; in addition several object properties can be used to set the column names, see description above.