KeepCol¶
- class marxs.simulator.KeepCol(colname)[source] [edit on github]¶
Bases:
object
Object that records the value of one column after each simulation step.
KeepCol
is meant to be used with the preprocess_steps or postprocess_steps parameters ofSequence
. It will make a copy of one column in the photon table before or after each processing step and keep this copy in itsdata
attribute.- Parameters:
- colnamestring
name of column
- Attributes:
- datalist
List of saved data. This will be empty initially.
Methods Summary
__call__
(photons)Call self as a function.
format_positions
([atol])Format saved position columns as a single array.
Methods Documentation
- __call__(photons)[source] [edit on github]¶
Call self as a function.
- format_positions(atol=None)[source] [edit on github]¶
Format saved position columns as a single array.
KeepCol
keeps the value of a column (e.g. the photon position) at every step of the simulation. This function reformats that list of columns for use graphical display programs. Note thatformat_positions
will only work for columns that store data in homogeneous coordinates, for all other cases, simply callnumpy.asanyarray
on yourKeepCol
object.- Parameters:
- atolfloat or None
Sometimes several consecutive elements record identical photon positions in
keepcol
. Those are removed from the output to speed up rendering in 3D programs.atol
sets the limit up to which two positions are considered identical. Seenp.allclose
for a detailed description ofatol
. Set toNone
to skip this step.
- Returns:
- posnp.array
Array of shape (N, n, 3), where N is the number of photons and n the number of unique photon positions in euclidean coordinates.