Graphs#
Frames#
Graph Frame#
- class mhi.enerplot.GraphFrame(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
Graph Frame
A container which can hold one or more Graph Panels, stacked vertically, with a common x-axis.
- add_overlay_graph() GraphPanel#
Add a new overly graph panel to the Graph Frame.
- Returns:
the newly added graph panel.
- Return type:
- add_poly_graph() GraphPanel#
Add a new poly-graph panel to the Graph Frame.
- Returns:
the newly added graph panel.
- Return type:
- zoom(xmin: float | None = None, xmax: float | None = None, *, compute_x_grid: bool = True) None#
Alter the x-axis viewport for all graph panels in this graph frame
Added in version 2.2.1.
- attributes(**kwargs) Dict[str, Any]#
Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current attributes.
See also
- extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#
Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
width – The component’s new width
height – The component’s new height
- Returns:
the current extents of the component
- find([classid,] [key=value, ...])#
Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- find_all([classid,] [key=value, ...])#
Find all components that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the list of matching components
- find_first([classid,] [key=value, ...])#
Find a component that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- list(classid: str | None = None) List[Component]#
List all the components contained inside this object, possibly restricted to a certain classid.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
- Returns:
the list of components
- lock_markers(lock: bool = True, *, delta: float | None = None) None#
Lock (or unlock) markers to a fixed offset from each other.
- Parameters:
lock – set to
Falseto unlock the markerdelta – used to specify lock offset (optional)
Examples:
fft.lock_markers() fft.lock_markers(delta=1/50) fft.lock_markers(False)
- property main: Enerplot#
A reference to the
Applicationobject that returned thisRemotableobject.
- panel(index: int) GraphPanel#
Return the indexed panel
- position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#
Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
- Returns:
the current location of the component
- properties(paramlist: str = '', **kwargs) Dict[str, Any]#
Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current property values
See also
- relink_all(datafile: DataFile) None#
Relink the channel data to the given datafile
- Parameters:
datafile (DataFile) – the datafile to link channel data to.
- set_markers(x: float | None = None, o: float | None = None, *, delta: float | None = None) None#
Set the X and/or O marker positions.
If both
xandoare specified,deltacannot be given.If
deltais given, the O-marker is positioned the specified distance after the X-marker, unless theovalue is specified in which case the X-marker is positioned the specified distance before the O-marker.If the markers were hidden, they will automatically be shown.
If the markers are “locked together”, they will remain locked together, but with their relative offset defined by their new positions.
- Parameters:
x – new x-marker position
o – new o-marker position
delta – distance between x & o markers
Examples
The following are equivalent, and set the markers 1 cycle apart, assuming a 60Hz waveform:
graph_frame.set_markers(0.1, 0.11666667) graph_frame.set_markers(0.1, delta=0.01666667) graph_frame.set_markers(0.1, delta=1/60) graph_frame.set_markers(delta=1/60, x=0.1) graph_frame.set_markers(delta=1/60, o=0.11666667)
- show_glyphs(show: bool = True) None#
Set the curve glyph visibility.
- Parameters:
show – Set to
Falseto turn off the curve glyphs.
- show_grid(show: bool = True) None#
Set the grid’s visibility.
- Parameters:
show – Set to
Falseto turn off the grid.
- show_markers(show: bool = True) None#
Show (or hide) the X/O markers
- Parameters:
show – Set to
Falseto turn off the markers.
- show_ticks(show: bool = True) None#
Set the tick visibility.
- Parameters:
show – Set to
Falseto turn off the tick markers.
- show_x_intercept(show: bool = True) None#
Set the X intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the X-intercept visibility.
- show_y_intercept(show: bool = True) None#
Set the Y intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the Y-intercept visibility.
- size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#
Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
- Parameters:
width – The component’s new width
height – The component’s new height
- Returns:
the current size of the component
- zoom_extents(x_extents: bool = True, y_extents: bool = True) None#
Reset the graph’s zoom to the X and/or Y extents. By default, both X and Y axis zoom is affected.
- Parameters:
x_extents – set to False to not affect X-axis
y_extents – set to False to not affect Y-axis
Plot Frame#
- class mhi.enerplot.PlotFrame(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
Plot Frame
A container which holds a X-Y plot graph containing 1 or more curves.
- add_curves(*channels: Channel)#
Add one or more channels to the X-Y plot.
For every pair of channels added, one X-Y curve is created.
- Parameters:
*channels (Channel) – curves to add to X-Y plot frame
- attributes(**kwargs) Dict[str, Any]#
Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current attributes.
See also
- extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#
Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
width – The component’s new width
height – The component’s new height
- Returns:
the current extents of the component
- find([classid,] [key=value, ...])#
Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- find_all([classid,] [key=value, ...])#
Find all components that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the list of matching components
- find_first([classid,] [key=value, ...])#
Find a component that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- list(classid: str | None = None) List[Component]#
List all the components contained inside this object, possibly restricted to a certain classid.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
- Returns:
the list of components
- property main: Enerplot#
A reference to the
Applicationobject that returned thisRemotableobject.
- position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#
Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
- Returns:
the current location of the component
- properties(paramlist: str = '', **kwargs) Dict[str, Any]#
Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current property values
See also
- relink_all(datafile: DataFile) None#
Relink the channel data to the given datafile
- Parameters:
datafile (DataFile) – the datafile to link channel data to.
- show_glyphs(show: bool = True) None#
Set the curve glyph visibility.
- Parameters:
show – Set to
Falseto turn off the curve glyphs.
- show_grid(show: bool = True) None#
Set the grid’s visibility.
- Parameters:
show – Set to
Falseto turn off the grid.
- show_ticks(show: bool = True) None#
Set the tick visibility.
- Parameters:
show – Set to
Falseto turn off the tick markers.
- show_x_intercept(show: bool = True) None#
Set the X intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the X-intercept visibility.
- show_y_intercept(show: bool = True) None#
Set the Y intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the Y-intercept visibility.
- size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#
Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
- Parameters:
width – The component’s new width
height – The component’s new height
- Returns:
the current size of the component
- zoom(xmin=None, xmax=None, ymin=None, ymax=None, *, compute_x_grid: bool = True, compute_y_grid: bool = True) None#
Alter the graph’s viewport
- zoom_extents(x_extents: bool = True, y_extents: bool = True) None#
Reset the graph’s zoom to the X and/or Y extents. By default, both X and Y axis zoom is affected.
- Parameters:
x_extents – set to False to not affect X-axis
y_extents – set to False to not affect Y-axis
FFT Graph Frame#
- class mhi.enerplot.FFTFrame(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
FFT Graph Frame
A container which holds an overlay graph, as well as a magnitude and phase graph for automatic harmonic analysis of the curve(s) in the overlay graph.
- add_curves(*channels: Channel) None#
Add one or more channels to the FFT Graph
- Parameters:
*channels (Channel) – curves to add to graph
- attributes(**kwargs) Dict[str, Any]#
Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current attributes.
See also
- extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#
Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
width – The component’s new width
height – The component’s new height
- Returns:
the current extents of the component
- find([classid,] [key=value, ...])#
Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- find_all([classid,] [key=value, ...])#
Find all components that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the list of matching components
- find_first([classid,] [key=value, ...])#
Find a component that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- list(classid: str | None = None) List[Component]#
List all the components contained inside this object, possibly restricted to a certain classid.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
- Returns:
the list of components
- lock_markers(lock: bool = True, *, delta: float | None = None) None#
Lock (or unlock) markers to a fixed offset from each other.
- Parameters:
lock – set to
Falseto unlock the markerdelta – used to specify lock offset (optional)
Examples:
fft.lock_markers() fft.lock_markers(delta=1/50) fft.lock_markers(False)
- property main: Enerplot#
A reference to the
Applicationobject that returned thisRemotableobject.
- panel(index: int) GraphPanel#
Return the indexed panel
- position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#
Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
- Returns:
the current location of the component
- properties(paramlist: str = '', **kwargs) Dict[str, Any]#
Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current property values
See also
- relink_all(datafile: DataFile) None#
Relink the channel data to the given datafile
- Parameters:
datafile (DataFile) – the datafile to link channel data to.
- set_markers(x: float | None = None, o: float | None = None, *, delta: float | None = None) None#
Set the X and/or O marker positions.
If both
xandoare specified,deltacannot be given.If
deltais given, the O-marker is positioned the specified distance after the X-marker, unless theovalue is specified in which case the X-marker is positioned the specified distance before the O-marker.If the markers were hidden, they will automatically be shown.
If the markers are “locked together”, they will remain locked together, but with their relative offset defined by their new positions.
- Parameters:
x – new x-marker position
o – new o-marker position
delta – distance between x & o markers
Examples
The following are equivalent, and set the markers 1 cycle apart, assuming a 60Hz waveform:
graph_frame.set_markers(0.1, 0.11666667) graph_frame.set_markers(0.1, delta=0.01666667) graph_frame.set_markers(0.1, delta=1/60) graph_frame.set_markers(delta=1/60, x=0.1) graph_frame.set_markers(delta=1/60, o=0.11666667)
- show_glyphs(show: bool = True) None#
Set the curve glyph visibility.
- Parameters:
show – Set to
Falseto turn off the curve glyphs.
- show_grid(show: bool = True) None#
Set the grid’s visibility.
- Parameters:
show – Set to
Falseto turn off the grid.
- show_markers(show: bool = True) None#
Show (or hide) the X/O markers
- Parameters:
show – Set to
Falseto turn off the markers.
- show_ticks(show: bool = True) None#
Set the tick visibility.
- Parameters:
show – Set to
Falseto turn off the tick markers.
- show_x_intercept(show: bool = True) None#
Set the X intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the X-intercept visibility.
- show_y_intercept(show: bool = True) None#
Set the Y intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the Y-intercept visibility.
- size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#
Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
- Parameters:
width – The component’s new width
height – The component’s new height
- Returns:
the current size of the component
- zoom(xmin=None, xmax=None, ymin=None, ymax=None, *, compute_x_grid: bool = True, compute_y_grid: bool = True) None#
Alter the graph’s viewport
- zoom_extents(x_extents: bool = True, y_extents: bool = True) None#
Reset the graph’s zoom to the X and/or Y extents. By default, both X and Y axis zoom is affected.
- Parameters:
x_extents – set to False to not affect X-axis
y_extents – set to False to not affect Y-axis
Graph Panel#
- class mhi.enerplot.GraphPanel(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
Graph Panel
- add_curves(*channels: Channel) None#
Add one or more channels to a graph
- Parameters:
*channels (Channel) – curves to add to graph
- attributes(**kwargs) Dict[str, Any]#
Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current attributes.
See also
- extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#
Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
width – The component’s new width
height – The component’s new height
- Returns:
the current extents of the component
- find([classid,] [key=value, ...])#
Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- find_all([classid,] [key=value, ...])#
Find all components that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the list of matching components
- find_first([classid,] [key=value, ...])#
Find a component that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- list(classid: str | None = None) List[Component]#
List all the components contained inside this object, possibly restricted to a certain classid.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
- Returns:
the list of components
- property main: Enerplot#
A reference to the
Applicationobject that returned thisRemotableobject.
- position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#
Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
- Returns:
the current location of the component
- properties(paramlist: str = '', **kwargs) Dict[str, Any]#
Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current property values
See also
- show_glyphs(show: bool = True) None#
Set the curve glyph visibility.
- Parameters:
show – Set to
Falseto turn off the curve glyphs.
- show_grid(show: bool = True) None#
Set the grid’s visibility.
- Parameters:
show – Set to
Falseto turn off the grid.
- show_ticks(show: bool = True) None#
Set the tick visibility.
- Parameters:
show – Set to
Falseto turn off the tick markers.
- show_x_intercept(show: bool = True) None#
Set the X intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the X-intercept visibility.
- show_y_intercept(show: bool = True) None#
Set the Y intercept visibility on or off
- Parameters:
show – Set to
Falseto turn off the Y-intercept visibility.
- size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#
Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
- Parameters:
width – The component’s new width
height – The component’s new height
- Returns:
the current size of the component
- zoom(xmin=None, xmax=None, ymin=None, ymax=None, *, compute_x_grid: bool = True, compute_y_grid: bool = True) None#
Alter the graph’s viewport
- zoom_extents(x_extents: bool = True, y_extents: bool = True) None#
Reset the graph’s zoom to the X and/or Y extents. By default, both X and Y axis zoom is affected.
- Parameters:
x_extents – set to False to not affect X-axis
y_extents – set to False to not affect Y-axis
Curves#
- class mhi.enerplot.Curve(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
Graph Curve
- extents() Tuple[Tuple[float, float], Tuple[float, float]]#
The domain and range of this Curve
- Returns:
domain (minimum x, maximum x) and range (minimum y, maximum y)
- properties(**kwargs)#
Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current property values
See also
- attributes(**kwargs) Dict[str, Any]#
Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
- Parameters:
**kwargs – key=value arguments
- Returns:
The component’s current attributes.
See also
- decreasing() bool#
Test if a trace contains strictly decreasing values.
- Returns:
Trueif every value is smaller than the previous one.
- static div(a, b, inf=inf, nan=nan) float#
Handle x/0 and 0/0 without raising DivisionByZeroException
- property domain#
Domain (x-axis values, such as time) of the trace
- find([classid,] [key=value, ...])#
Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- find_all([classid,] [key=value, ...])#
Find all components that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the list of matching components
- find_first([classid,] [key=value, ...])#
Find a component that matches the given criteria, or None if no matching component can be found.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
key=value – additional parameters which must be matched.
- Returns:
the found component or None
- increasing() bool#
Test if a trace contains strictly increasing values.
A strictly increasing trace is suitable to use as the domain of a dataset.
- Returns:
Trueif every value is larger than the previous one.
- list(classid: str | None = None) List[Component]#
List all the components contained inside this object, possibly restricted to a certain classid.
- Parameters:
classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.
- Returns:
the list of components
- property main: Enerplot#
A reference to the
Applicationobject that returned thisRemotableobject.
- position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#
Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
- Parameters:
x – The component’s new x location on the sheet
y – The component’s new y location on the sheet
- Returns:
the current location of the component
- property read_only#
Whether or not the data is immutable
- size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#
Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
- Parameters:
width – The component’s new width
height – The component’s new height
- Returns:
the current size of the component