plot#

This module commands provide a simple way to plot the data, while supporting different plot types, including:

  • Time-series plot.

  • Frequency based plot.

  • Cross-correlation plot.

hwpwn.plot.time(title: str | None = None, grid: bool = True, pngfile: str | None = None, legend: str = 'UR', alpha: float = 1.0, ylabel: str = 'x', yscale: float = 1.0, xunit: str = 'NA', yunit: str = 'NA', xlabel: str = 'Time', linewidth: float = 1.0, show: bool = True, xstart: float | None = None, xend: float | None = None)#

Time-series plot of the data. The x-axis in the data is used as the time-series axis for all the signals and triggers. This command supports providing multiple parameters but all are optional.

Parameters:
  • title – The title of the plot, shown in the top center location.

  • grid – If set to True enables grid.

  • pngfile – If not None, will save the plot to a PNG file whose location is given by this parameter.

  • legend – If not None, will show the legend in the location specified: UR=upper-right, UL=upper-left, LR=lower-right, or LL=lower-left. By default it’s set to UR (upper-right).

  • alpha – A float number that sets the opacity of the signals plotted (0 completely transparent, 1.0 completely visible.)

  • ylabel – The label shown in the y-axis.

  • yscale – Allows to adjust plot values scale with this factor.

  • xunit – A string with the x-axis unit name (i.e., S, mA, etc.)

  • yunit – A string with the y-axis unit name (i.e., V, mA, etc.)

  • xlabel – A string with the x-axis label (by default, will be set to “Time”).

  • linewidth – The width of the signal lines (by default set to 1.0).

  • show – Whether or not to show the plot. If pngfile is used and this is set to False, it will not show the plot and will only save it to a PNG file.

  • xstart – Allows to set a x-axis start interval for the plot, so that only a subset of the data is plotted.

  • xend – Allows to set a x-axis end interval for the plot, so that only a subset of the data is plotted.

hwpwn.plot.freq(title: str = 'Frequency Response', grid: bool = True, pngfile: str | None = None, legend: str = 'UR', ylabel: str | None = None, yunit: str = 'NA', ts: str = '1.0', show: bool = True, yscale: str = 'log', xscale: str = 'log')#

Frequency response plot for all signals.

Parameters:
  • title – The title of the plot, shown in the top center location.

  • grid – If set to True enables grid.

  • pngfile – If not None, will save the plot to a PNG file whose location is given by this parameter.

  • legend – If set to True, will show the legend of the signals plotted.

  • ylabel – The label shown in the y-axis.

  • yscale – Allows to adjust plot values scale with this factor.

  • yunit – A string with the y-axis unit name (i.e., V, mA, etc.)

  • show – Whether or not to show the plot. If pngfile is used and this is set to False, it will not show the plot and will only save it to a PNG file.

  • legend – If not None, will show the legend in the location specified: UR=upper-right, UL=upper-left, LR=lower-right, or LL=lower-left. By default it’s set to UR (upper-right).

  • ts – The sample period.

  • xscale – The type of scale to use for the x-axis. Accepted values are ‘log’ and ‘linear’. By default it is set to ‘log’.

hwpwn.plot.xcorr(sig1: str, sig2: str, title: str = 'Cross Correlation', grid: bool = True, pngfile: str | None = None, legend: str = 'UR', linewidth: float = 1.0, minlag: int | None = None, maxlag: int | None = None, mode: str = 'full', show: bool = False)#

Cross-correlation plots between two signals.

Parameters:
  • sig1 – The first signal name.

  • sig2 – The second signal name.

  • title – The title of the plot, shown in the top center location.

  • grid – If set to True enables grid.

  • pngfile – If not None, will save the plot to a PNG file whose location is given by this parameter.

  • legend – If set to True, will show the legend of the signals plotted.

  • linewidth – The width of the signal lines (by default set to 1.0).

  • minlag – Crop the x-axis lag value starting from this minlag.

  • maxlag – Crop the x-axis lag value ending at this maxlag.

  • mode – The cross-correlation mode to employ (refer to numpy correlate function documentation.)

  • show – Whether or not to show the plot. If pngfile is used and this is set to False, it will not show the plot and will only save it to a PNG file.

  • legend – If not None, will show the legend in the location specified: UR=upper-right, UL=upper-left, LR=lower-right, or LL=lower-left. By default it’s set to UR (upper-right).

hwpwn.plot.phasecorr(sig1: str, sig2: str, title: str = 'Phase Correlation', grid: bool = True, pngfile: str | None = None, legend: str = 'UR', linewidth: float = 1.0)#

Phase correlation analysis plot.

Parameters:
  • sig1 – The first signal name.

  • sig2 – The second signal name.

  • title – The title of the plot, shown in the top center location.

  • grid – If set to True enables grid.

  • pngfile – If not None, will save the plot to a PNG file whose location is given by this parameter.

  • legend – If set to True, will show the legend of the signals plotted.

  • linewidth – The width of the signal lines (by default set to 1.0).

  • legend – If not None, will show the legend in the location specified: UR=upper-right, UL=upper-left, LR=lower-right, or LL=lower-left. By default it’s set to UR (upper-right).