Miscellaneous Utilities¶
Shader and ShaderProgram wrapper classes for vertex and fragment shaders used in Interactive Data Visualization
- class yt_idv.opengl_support.ColormapTexture(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
Texture1D- colormap_name¶
A casting version of the unicode trait.
- class yt_idv.opengl_support.Framebuffer(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraits- property data¶
The color buffer, indexed [y, x, channel] with row 0 at the bottom.
- db_tex¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- property depth_data¶
The depth buffer, indexed [y, x] with row 0 at the bottom.
- fb_id¶
A casting version of the int trait.
- fb_tex¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- initialized¶
A boolean (True, False) trait.
- rb_id¶
A casting version of the int trait.
- viewport¶
An instance of a Python tuple.
- class yt_idv.opengl_support.GLValue(default_value: Any = traitlets.Undefined, allow_none: bool = False, read_only: bool | None = None, help: str | None = None, config: Any | None = None, **kwargs: Any)[source]¶
Bases:
TraitType- default_value: t.Any = GL_NONE¶
- info_text: str = 'An OpenGL constant.'¶
- class yt_idv.opengl_support.Texture(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraits- channels¶
- data¶
A numpy array trait type.
- mag_filter¶
- min_filter¶
- texture_name¶
A casting version of the int trait.
- class yt_idv.opengl_support.Texture1D(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
Texture- boundary_x¶
- dim_enum¶
- dims = 1¶
- class yt_idv.opengl_support.Texture2D(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
Texture- boundary_x¶
- boundary_y¶
- channels = 1¶
- dim_enum¶
- dims = 2¶
- class yt_idv.opengl_support.Texture3D(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
Texture- allocate(dims, dtype='float32', channels=1)[source]¶
Allocate uninitialized storage of shape dims, without uploading data.
Like _set_data, the sampling state is set along with the storage.
- boundary_x¶
- boundary_y¶
- boundary_z¶
- dim_enum¶
- dims = 3¶
- class yt_idv.opengl_support.Texture3DIterator(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraits- items¶
A trait which allows any value.
- class yt_idv.opengl_support.TextureAtlas(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraitsMany 3D blocks packed into a single Texture3D.
The atlas is laid out once, when it is created, from the blocks’ sizes and padding; to change the layout, create a new atlas. No axis of it is larger than GL_MAX_3D_TEXTURE_SIZE, and if the blocks don’t fit, creating it raises a ValueError. Block i’s interior starts at offsets[i], and padding texels on every side of it (filled by __setitem__ with the block’s edge values) keep linear interpolation from reading a neighboring block.
If a vertex array is given, the offsets and sizes are added to it as the integer vertex attributes offset_attribute_name and size_attribute_name (ivec3s in the shaders), one per block, so the sizes have to be given in the vertex array’s block order.
- channels¶
A casting version of the int trait.
- dims¶
A numpy array trait type.
- dtype¶
A casting version of the unicode trait.
- mag_filter¶
- min_filter¶
- offset_attribute_name¶
A casting version of the unicode trait.
- offsets¶
A numpy array trait type.
- padding¶
A casting version of the int trait.
- size_attribute_name¶
A casting version of the unicode trait.
- sizes¶
A numpy array trait type.
- texture¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- vertex_array¶
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- class yt_idv.opengl_support.TextureBoundary(default_value: Any = traitlets.Undefined, allow_none: bool = False, read_only: bool | None = None, help: str | None = None, config: Any | None = None, **kwargs: Any)[source]¶
Bases:
TraitType- default_value: t.Any = GL_CLAMP_TO_EDGE¶
- info_text: str = 'A boundary type of mirror, clamp, or repeat'¶
- class yt_idv.opengl_support.TransferFunctionTexture(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
Texture2D
- class yt_idv.opengl_support.VertexArray(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraits- attributes¶
An instance of a Python list.
- each¶
A casting version of the int trait.
- id¶
A casting version of the int trait.
- index_id¶
A casting version of the int trait.
- indices¶
A numpy array trait type.
- name¶
A casting version of the unicode trait.
- class yt_idv.opengl_support.VertexAttribute(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraits- data¶
A numpy array trait type.
- divisor¶
A casting version of the int trait.
- each¶
A casting version of the int trait.
- id¶
A casting version of the int trait.
- integer¶
A boolean (True, False) trait.
- name¶
A casting version of the unicode trait.
- opengl_type¶
A casting version of the int trait.
Shader and ShaderProgram wrapper classes for vertex and fragment shaders used in Interactive Data Visualization
- class yt_idv.shader_objects.PreprocessorDefinitionState[source]¶
Bases:
object- add_definition(shader_type: str, value: tuple[str, str])[source]¶
add a definition for specified shader_type, will overwrite existing definitions.
- clear_definition(shader_type: str, value: tuple[str, str])[source]¶
remove the definition of value for specified shader_type
- class yt_idv.shader_objects.Shader(*args: t.Any, **kwargs: t.Any)[source]¶
Bases:
HasTraitsCreates a shader from source
- Parameters:
source (str) – This can either be a string containing a full source of a shader, an absolute path to a source file or a filename of a shader residing in the ./shaders/ directory.
allow_null (bool) – If True (default) then shader compilation errors will be caught and printed without raising exception (convenient for general use and for developing new shaders). If False, any compilation errors will raise a RunTimeError (useful for CI testing).
- allow_null¶
A boolean (True, False) trait.
- blend_equation¶
- blend_equation_separate¶
An instance of a Python tuple.
- blend_func¶
An instance of a Python tuple.
- blend_func_separate¶
An instance of a Python tuple.
- property defines¶
- depth_test¶
- info¶
A casting version of the unicode trait.
- preprocessor_defs¶
An instance of a Python list.
- property shader¶
- shader_name¶
A casting version of the unicode trait.
- shader_type¶
An enum of strings where the case should be ignored.
- source¶
A trait which allows any value.
- use_separate_blend¶
A boolean (True, False) trait.
- class yt_idv.shader_objects.ShaderProgram(vertex_shader=None, fragment_shader=None, geometry_shader=None, preprocessor_defs=None)[source]¶
Bases:
objectWrapper class that compiles and links vertex and fragment shaders into a shader program.
- Parameters:
vertex_shader (string) – or
yt.visualization.volume_rendering.shader_objects.VertexShaderThe vertex shader used in the Interactive Data Visualization pipeline.fragment_shader (string) – or
yt.visualization.volume_rendering.shader_objects.FragmentShaderThe fragment shader used in the Interactive Data Visualization pipeline.geometry_shader (string) – or
yt_idv.shader_objects.GeometryShaderThe geometry shader used in the pipeline; optional.preprocessor_defs (PreprocessorDefinitionState) – a PreprocessorDefinitionState instance defining any preprocessor definitions if used; optional.
- class yt_idv.shader_objects.ShaderTrait(default_value: Any = traitlets.Undefined, allow_none: bool = False, read_only: bool | None = None, help: str | None = None, config: Any | None = None, **kwargs: Any)[source]¶
Bases:
TraitType- default_value: t.Any = None¶
- info_text: str = 'A shader (vertex, fragment or geometry)'¶
- class yt_idv.simple_gui.SimpleGUI(window)[source]¶
Bases:
object- callbacks = None¶
- context = None¶
- draw = False¶
- property keyboard_event_handled¶
- property mouse_event_handled¶
- renderer = None¶
- window = None¶
- class yt_idv.traitlets_support.FontTrait(default_value: Any = traitlets.Undefined, allow_none: bool = False, read_only: bool | None = None, help: str | None = None, config: Any | None = None, **kwargs: Any)[source]¶
Bases:
TraitType- info_text: str = 'A font instance from matplotlib'¶
- class yt_idv.traitlets_support.YTPositionTrait(default_value: Any = traitlets.Undefined, allow_none: bool = False, read_only: bool | None = None, help: str | None = None, config: Any | None = None, **kwargs: Any)[source]¶
Bases:
TraitType- default_value: t.Any = None¶
- info_text: str = 'A position in code_length'¶