KeepCol¶
- class marxs.simulator.KeepCol(colname)[source]¶
Bases:
objectObject that records the value of one column after each simulation step.
KeepColis 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 itsdataattribute.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
- format_positions(atol=None)[source]¶
Format saved position columns as a single array.
KeepColkeeps 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_positionswill only work for columns that store data in homogeneous coordinates, for all other cases, simply callnumpy.asanyarrayon yourKeepColobject.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.atolsets the limit up to which two positions are considered identical. Seenp.allclosefor a detailed description ofatol. Set toNoneto 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.