SimulationSequenceElement¶
- class marxs.base.SimulationSequenceElement(**kwargs)[source]¶
Bases:
MarxsElementBase class for all elements in a simulation that processes photons.
Define a new MARXS element.
Attributes Summary
String that names an id column for output.
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 anid_num=1, 2, 3, 4keyword respectively to each CCD will add a columnCCD_IDwith 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: list[str] = []¶
This is a list of strings that names the output properties.
This gives the names of the output properties from this optical element.
process_photonorprocess_photonsare responsible for calculating the values of these properties. For example, for a mirror of nested shells one might setoutput_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:
- 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
dirthis 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.
- dir
Methods Documentation
- add_output_cols(photons, colnames=[])[source]¶
Add output columns to the photon array.
This function takes the column names that are added to
photonsfrom several sources:id_col(if notNone)the
colnamesparameter.
Parameters¶
- photons
astropy.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.nanis added) or a dictionary of arguments forastropy.table.column.Column. If the dictionary 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.