fibomat.beam_simulation.markers module#
- class fibomat.beam_simulation.markers.Tail(dwell_points: ndarray, tail_length: int, size: float)[source]#
Bases:
Visual- VERTEX_SHADER = '\n #version 120\n uniform float u_size;\n\n attribute vec2 a_position;\n attribute vec4 a_color;\n\n varying vec4 v_fg_color;\n varying vec4 v_bg_color;\n varying float v_radius;\n varying float v_linewidth;\n varying float v_antialias;\n void main (void) {\n v_radius = u_size;\n v_linewidth = 1.0;\n v_antialias = 1.0;\n v_fg_color = vec4(0.0,0.0,0.0,0.1);\n v_bg_color = a_color;\n gl_Position = $transform(vec4(a_position,0,1));\n gl_PointSize = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);\n }\n '#
- FRAGMENT_SHADER = '\n #version 120\n varying vec4 v_fg_color;\n varying vec4 v_bg_color;\n varying float v_radius;\n varying float v_linewidth;\n varying float v_antialias;\n void main()\n {\n float size = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);\n float t = v_linewidth/2.0-v_antialias;\n float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size);\n float d = abs(r - v_radius) - t;\n if( d < 0.0 )\n gl_FragColor = v_fg_color;\n else\n {\n float alpha = d/v_antialias;\n alpha = exp(-alpha*alpha);\n if (r > v_radius)\n gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);\n else\n gl_FragColor = mix(v_bg_color, v_fg_color, alpha);\n }\n }\n '#
- attach(filt, view=None)#
Attach a Filter to this visual
Each filter modifies the appearance or behavior of the visual.
Parameters#
- filtobject
The filter to attach.
- viewinstance of VisualView | None
The view to use.
- bounds(axis, view=None)#
Get the bounds of the Visual
Parameters#
- axisint
The axis.
- viewinstance of VisualView
The view to use.
- detach(filt, view=None)#
Detach a filter.
Parameters#
- filtobject
The filter to detach.
- viewinstance of VisualView | None
The view to use.
- freeze()#
Freeze the object so that only existing properties can be set
- get_transform(map_from='visual', map_to='render')#
Return a transform mapping between any two coordinate systems.
Parameters#
- map_fromstr
The starting coordinate system to map from. Must be one of: visual, scene, document, canvas, framebuffer, or render.
- map_tostr
The ending coordinate system to map to. Must be one of: visual, scene, document, canvas, framebuffer, or render.
- set_gl_state(preset=None, **kwargs)#
Define the set of GL state parameters to use when drawing.
The arguments are forwarded to
vispy.gloo.wrappers.set_state().Parameters#
- presetstr
Preset to use.
- **kwargsdict
Keyword arguments.
- property transform#
- property transforms#
- unfreeze()#
Unfreeze the object so that additional properties can be added
- update()#
Update the Visual
- update_gl_state(*args, **kwargs)#
Modify the set of GL state parameters to use when drawing.
The arguments are forwarded to
vispy.gloo.wrappers.set_state().Parameters#
- view()#
Return a new view of this visual.
- property view_program#
- property visible#
- class fibomat.beam_simulation.markers.DwellPoints(dwell_points: ndarray)[source]#
Bases:
Visual- VERTEX_SHADER = '\n #version 120\n uniform float u_size;\n uniform vec4 u_color;\n uniform float u_alpha_border;\n\n attribute vec2 a_position;\n\n varying vec4 v_fg_color;\n varying vec4 v_bg_color;\n varying float v_radius;\n varying float v_linewidth;\n varying float v_antialias;\n void main (void) {\n v_radius = u_size;\n v_linewidth = 1.0;\n v_antialias = 1.0;\n v_fg_color = vec4(0.0,0.0,0.0,u_alpha_border);\n v_bg_color = u_color;\n gl_Position = $transform(vec4(a_position,0,1));\n gl_PointSize = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);\n }\n '#
- FRAGMENT_SHADER = '\n #version 120\n varying vec4 v_fg_color;\n varying vec4 v_bg_color;\n varying float v_radius;\n varying float v_linewidth;\n varying float v_antialias;\n void main()\n {\n float size = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);\n float t = v_linewidth/2.0-v_antialias;\n float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size);\n float d = abs(r - v_radius) - t;\n if( d < 0.0 )\n gl_FragColor = v_fg_color;\n else\n {\n float alpha = d/v_antialias;\n alpha = exp(-alpha*alpha);\n if (r > v_radius)\n gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);\n else\n gl_FragColor = mix(v_bg_color, v_fg_color, alpha);\n }\n }\n '#
- attach(filt, view=None)#
Attach a Filter to this visual
Each filter modifies the appearance or behavior of the visual.
Parameters#
- filtobject
The filter to attach.
- viewinstance of VisualView | None
The view to use.
- bounds(axis, view=None)#
Get the bounds of the Visual
Parameters#
- axisint
The axis.
- viewinstance of VisualView
The view to use.
- detach(filt, view=None)#
Detach a filter.
Parameters#
- filtobject
The filter to detach.
- viewinstance of VisualView | None
The view to use.
- draw()#
- freeze()#
Freeze the object so that only existing properties can be set
- get_transform(map_from='visual', map_to='render')#
Return a transform mapping between any two coordinate systems.
Parameters#
- map_fromstr
The starting coordinate system to map from. Must be one of: visual, scene, document, canvas, framebuffer, or render.
- map_tostr
The ending coordinate system to map to. Must be one of: visual, scene, document, canvas, framebuffer, or render.
- set_gl_state(preset=None, **kwargs)#
Define the set of GL state parameters to use when drawing.
The arguments are forwarded to
vispy.gloo.wrappers.set_state().Parameters#
- presetstr
Preset to use.
- **kwargsdict
Keyword arguments.
- property transform#
- property transforms#
- unfreeze()#
Unfreeze the object so that additional properties can be added
- update()#
Update the Visual
- update_gl_state(*args, **kwargs)#
Modify the set of GL state parameters to use when drawing.
The arguments are forwarded to
vispy.gloo.wrappers.set_state().Parameters#
- view()#
Return a new view of this visual.
- property view_program#
- property visible#