Skip to content
Snippets Groups Projects
Verified Commit 3966fee1 authored by Tobias Hangleiter's avatar Tobias Hangleiter
Browse files

Reduce plot updates

parent 75e6346c
Branches Rpc
No related tags found
1 merge request!36Threaded acquisition
......@@ -19,6 +19,7 @@ _styleT = Union[None, _styleT, List[_styleT]]
class PlotManager:
# TODO: blit?
PLOT_TYPES = ('main', 'cumulative', 'time')
LINE_TYPES = ('processed', 'raw')
......@@ -27,7 +28,7 @@ class PlotManager:
plot_negative_frequencies: bool = True, plot_absolute_frequencies: bool = True,
plot_amplitude: bool = True, plot_density: bool = True,
plot_cumulative_normalized: bool = False, plot_style: _styleT = 'fast',
plot_update_mode: str = 'fast', plot_dB_scale: bool = False, prop_cycle=None,
plot_update_mode: str = 'never', plot_dB_scale: bool = False, prop_cycle=None,
raw_unit: str = 'V', processed_unit: str = 'V',
uses_windowed_estimator: bool = True, figure_kw: Optional[Mapping] = None,
subplot_kw: Optional[Mapping] = None, gridspec_kw: Optional[Mapping] = None,
......
......@@ -155,7 +155,7 @@ class Spectrometer:
are given by :attr:`matplotlib.style.available`. Set to None to
disable styling and use default parameters. Note that line
styles in ``prop_cycle`` override style settings.
plot_update_mode : {'fast', 'always', 'never'}, default 'fast'
plot_update_mode : {'fast', 'always', 'never'}
Determines how often the event queue of the plot is flushed.
- 'fast' : queue is only flushed after all plot calls are
......@@ -166,6 +166,9 @@ class Spectrometer:
done, but slows down the entire plotting by a factor of
order unity.
- 'never' : Queue is never flushed explicitly.
When `threaded_acquisition` is True, this should not need to be
changed and defaults to never. If not, defaults to 'fast'.
plot_dB_scale : bool, default False
Plot data in dB relative to a reference spectrum instead of
in absolute units. The reference spectrum defaults to the first
......@@ -257,7 +260,7 @@ class Spectrometer:
plot_absolute_frequencies: bool = True, plot_amplitude: bool = True,
plot_density: bool = True, plot_cumulative_normalized: bool = False,
plot_style: _styleT = 'fast',
plot_update_mode: Literal['fast', 'always', 'never'] = 'fast',
plot_update_mode: Literal['fast', 'always', 'never'] | None = None,
plot_dB_scale: bool = False, threaded_acquisition: bool = True,
purge_raw_data: bool = False, prop_cycle=None, savepath: _pathT = None,
compress: bool = True, raw_unit: str = 'V', processed_unit: str = 'V',
......@@ -272,6 +275,8 @@ class Spectrometer:
self.savepath = savepath or '~/python_spectrometer/' + datetime.now().strftime('%Y-%m-%d')
self.compress = compress
self.threaded_acquisition = threaded_acquisition
if plot_update_mode is None:
plot_update_mode = 'never' if self.threaded_acquisition else 'fast'
if purge_raw_data:
warnings.warn('Enabling purge raw data might break some plotting features!',
UserWarning, stacklevel=2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment