porescene.config module¶
Configuration objects that control how a PoreNetwork and its images are rendered.
This module bundles the settings used throughout porescene:
PropertyConfiguration– visualization of a single property.ImageConfiguration– resolution of the rendered images.VideoConfiguration– frame settings for rendered videos.SceneConfiguration– overall scene, material and property settings.AxesConfiguration– coordinate axes, ticks and labels.
- class porescene.config.AxesConfiguration(extent, tick_interval=None, unit_display='MICRO', num_ticks=6)[source]¶
Bases:
objectSettings for the coordinate axes, ticks and labels of a scene.
- classmethod from_dict(extent, data)[source]¶
Creates an
AxesConfigurationfrom a dictionary.Ticks and axis labels are derived from
extent(the size of the volume) together with the optionaltick_intervalandunit_displaykeys; the remaining keys override the derived values.- Return type:
Self
- property enable_labels_ticks: tuple[bool, bool, bool]¶
Toggle to show/hide the labels of the major axis ticks.
When set to
None, an axis is labelled only if it carries ticks – either the ones calibrated fromextentor ones assigned explicitly. An axis whose ticks were cleared falls back to the evenly spaced ticks ofnum_ticks, which carry no calibrated values, so it is drawn with bare ticks rather than misleading numbers.
- property num_ticks: int¶
Number of major ticks aimed for along the longest axis.
Sizes the derived
tick_interval, and is met only approximately there, since the interval is rounded to a value the ticks read well at. For an axis whose ticks were cleared, the count is instead exact: the ticks are spread evenly betweenvalue_startandvalue_end, and are drawn without labels unlessenable_labels_tickssays otherwise. Values below2are raised to2, since a single tick has no spacing to place minor ticks by.
- property num_ticks_minor: int¶
Number of minor ticks drawn between two adjacent major ticks.
When set to
None, a suitable number is derived from the spacing of the major ticks, following the convention of matplotlib’sAutoMinorLocator: a major step whose leading digit is 1 or 5 – such as 100 or 50 – is divided into 5 intervals, giving 4 minor ticks, while any other step is divided into 4 intervals, giving 3 minor ticks. This keeps the minor ticks on round values instead of, say, splitting a step of 20 into fifths of 4. Falls back to4when the major tick spacing is still unknown.
- property spacing: float¶
Gap kept around the axes, in scene units.
Offsets the axis lines from the volume and the tick labels from the outer end of their ticks, so neither sits flush against what it belongs to.
- property tick_interval: float¶
Spacing between major ticks, in the displayed unit.
Unless given at construction, the interval is derived from
extent: it is the value from the 1-2-5-10 series that puts roughlynum_ticksticks on the longest axis. All three axes share it, so the ticks stay to scale and a shorter axis simply carries fewer of them.
- property ticks_x: Sequence[float]¶
Tick values shown along the x-axis.
Falls back to evenly spaced ticks, see
num_ticks.
- property ticks_y: Sequence[float]¶
Tick values shown along the y-axis.
Falls back to evenly spaced ticks, see
num_ticks.
- class porescene.config.ImageConfiguration[source]¶
Bases:
objectSettings for the resolution of the rendered images.
- classmethod from_dict(data)[source]¶
Creates an
ImageConfigurationfrom a dictionary.Only the
widthandheightkeys are read; other keys are ignored.- Return type:
Self
- class porescene.config.PropertyConfiguration(name, colors=(), /, gradient_class=<class 'porescene.color.gradient.SmoothGradient'>, heading=None, subheading=None, text=(), align=CompassDirection.NORTH, orientation=Orientation.HORIZONTAL, precision=0, min=None, max=None, use_global_boundaries=False, factor=1.0, func_transform=<function PropertyConfiguration.<lambda>>, fit=True, color_nan=None, color_below=None, color_above=None)[source]¶
Bases:
objectSettings for the visualization of a specific property of the system.
- property align: CompassDirection¶
Point of alignment of the layout image.
- property color_above: Color | None¶
Color of values above the range.
See also
Gradient.color_above.
- property color_below: Color | None¶
Color of values below the range.
See also
Gradient.color_below.
- property color_nan: Color | None¶
Color of NaN values.
See also
Gradient.color_nan.
- property colors: list[Color]¶
Colors of the gradient to visualize the property.
See also
Gradient.colors.
- property factor: float¶
A factor to scale the values of a property on overlays. Does not apply to anything rendering or model related.
- property func_transform: Callable¶
A transformation function to scale the values of a property on overlays. Does not apply to anything rendering or model related.
- property orientation: Orientation¶
Orientation of the layout image. There are two types available: vertical (‘V’) and horizontal (‘H’).
- class porescene.config.SceneConfiguration(enable_spheres=True, enable_cylinders=True, enable_clusters=True, enable_axes=True, enable_solid=True, enable_void=False, versions_solid=None, versions_void=None, material_spheres='PLASTIC_ROUGH', material_cylinders='PLASTIC_ROUGH', material_clusters='PLASTIC_ROUGH', material_solid='SOLID_DEFAULT', material_void='ICE', palette=None)[source]¶
Bases:
objectSettings for the visualization of a
PoreNetwork.- add_property(prop)[source]¶
Add the
PropertyConfigurationfor a property of the pnm.
- get_property(name)[source]¶
Returns the
PropertyConfigurationfor given name.- Return type: