StratifiedGeometry
This class defines a stratified geometry, such as geological layers, represented by a collection of GeometrySector. The layers are separated by TopographySurface objects. Within each layer, a uniform atomic composition is assumed, specified by a MaterialDefinition. The density might vary as a DensityGradient.
Constructor
- class StratifiedGeometry(*args: GeometrySector | TopographySurface)
Creates a stratified Monte Carlo geometry from a sequence of alternating GeometrySector and TopographySurface objects. The geometry is specified in reading order, with the first element of the sequence located on top of the geometry. For instance, the following
>>> geometry = goupil.StratifiedGeometry( ... goupil.GeometrySector("N2", 1.205E-03, "Atmosphere"), ... water_surface, ... goupil.GeometrySector("H2O", 1.0, "Water"), ... soil_surface, ... goupil.GeometrySector("SiO2", 2.0, "Soil") ... )
defines a vertical section of water covered by a nitrogen atmosphere and bounded below by a sandy soil.
Note
In the previous example, the soil_surface may extend above the
water_surface. This means that lower layers take precedence over
higher ones in case of overlaps.
Attributes
Note
The attributes of a StratifiedGeometry are read-only. Any modifications require rebuilding the geometry object.
- StratifiedGeometry.materials: tuple[MaterialDefinition]
This attribute lists all geometry materials as a tuple.
- StratifiedGeometry.sectors: tuple[GeometrySector]
This attribute lists all geometry sectors as a tuple.
Warning
Geometry sectors are stored in indexing order. That is, sectors[0]
corresponds to the bottom layer.
Methods
- StratifiedGeometry.locate(states) numpy.ndarray
Locates the specified states within the geometry. The input states must be a structured
numpy.ndarraycontaining the"position"field, e.g. as returned by thestatesfunction. Upon completion, the function returns anumpy.ndarrayof sector indices.
- StratifiedGeometry.material_index(name) int
Returns the index of a material in the list of geometry
materialsbased on itsname. For instance>>> geometry.material_index("SiO2") 0
- StratifiedGeometry.sector_index(description) int
Returns the index of a sector in the list of geometry
sectorsbased on itsdescription. For instance>>> geometry.sector_index("Atmosphere") 2
- StratifiedGeometry.trace(states, lengths=None, density=None) numpy.ndarray
Casts rays through the geometry, starting from the specified states. The states must be a structured
numpy.ndarraycontaining the"position"and"direction"fields, e.g. as returned by thestatesfunction. Upon completion, this function returns anumpy.ndarraycontaining the path length of rays in each geometry sector. Optionally, you can provide a lengthsnumpy.ndarrayof floats, or a single float, indicating the lengths of rays. If no lengths are specified, rays are traced until the geometry outer boundary.If the density parameter is set to
True, this function will return the column depth (grammage) along rays, in each sector, rather than the path length.
- StratifiedGeometry.z(x, y, grid=None) numpy.ndarray
Returns the elevation values of each TopographySurface at coordinates \((x, y)\). The x and y arguments can be
floatornumpy.ndarraywith consistent sizes. If grid is set toTrue, elevation values are computed over a grid that corresponds to the outer product of x and y, similar to theTopographyMap.__call__()method.