reno.viz.ModelLatex#
- class reno.viz.ModelLatex(model, show_docs=False, start_name=None, stop_name=None, t=None, sample=0, debug=False, ref_list=None, debug_ops=False)#
Bases:
objectAn interactive widget that displays all of the latex equations of a model.
Use with debug=True to display all of the values in the equation at a particular timestep and sample.
NOTE: start_name is exclusive, stop_name is inclusive.
Example
>>> ModelLatex(my_model).widget
>>> ModelLatex(my_model, t=3, sample=0, debug=True).widget
Methods
__init__(model[, show_docs, start_name, ...])Create ModelLatex instance.
Get the name of the reference/equation for the clicked index.
fire_on_name_clicked(name)Trigger the event to notify that a reference/eq was clicked on.
latex_data_with_highlight([hl_name])Construct the latex string with highlighting for the specified name.
on_name_clicked(callback)Register an event handler for when an equation is clicked.
Attributes
This is the actual displayable object, use this to "view" the equations.
- Parameters:
model (reno.Model)
show_docs (bool)
start_name (str)
stop_name (str)
t (int)
sample (int)
debug (bool)
ref_list (list[str | reno.components.Reference])
debug_ops (bool)
- __annotations__ = {}#
- __dict__ = mappingproxy({'__module__': 'reno.viz', '__doc__': 'An interactive widget that displays all of the latex equations of a model.\n\n Use with `debug=True` to display all of the values in the equation at a particular\n timestep and sample.\n\n NOTE: start_name is exclusive, stop_name is inclusive.\n\n Example:\n >>> ModelLatex(my_model).widget\n\n >>> ModelLatex(my_model, t=3, sample=0, debug=True).widget\n ', '__init__': <function ModelLatex.__init__>, 'on_name_clicked': <function ModelLatex.on_name_clicked>, 'fire_on_name_clicked': <function ModelLatex.fire_on_name_clicked>, '_handle_ilatex_click': <function ModelLatex._handle_ilatex_click>, 'find_equation_name_from_index': <function ModelLatex.find_equation_name_from_index>, '_equation_lines_refname_reference': <function ModelLatex._equation_lines_refname_reference>, 'latex_data_with_highlight': <function ModelLatex.latex_data_with_highlight>, '__dict__': <attribute '__dict__' of 'ModelLatex' objects>, '__weakref__': <attribute '__weakref__' of 'ModelLatex' objects>, '__annotations__': {'_name_clicked_callbacks': 'list[Callable[[str], None]]'}})#
- __module__ = 'reno.viz'#
- __weakref__#
list of weak references to the object
- find_equation_name_from_index(i)#
Get the name of the reference/equation for the clicked index.
Returns
Noneif not found or outside the start/stop bounds.- Parameters:
i (int)
- Return type:
str
- fire_on_name_clicked(name)#
Trigger the event to notify that a reference/eq was clicked on.
- Parameters:
name (str)
- Return type:
None
- latex_data_with_highlight(hl_name=None)#
Construct the latex string with highlighting for the specified name.
- Parameters:
hl_name (str)
- Return type:
str
- on_name_clicked(callback)#
Register an event handler for when an equation is clicked.
Callbacks should take a single parameter which is the string name of the equation/ref that was clicked.
- Parameters:
callback (Callable[[str], None])
- Return type:
None
- widget#
This is the actual displayable object, use this to “view” the equations.