rsudp.c_plot (plot data)¶
Plot(q, cha='all', seconds=30, spectrogram=True, fullscreen=False, kiosk=False, deconv=False, screencap=False, alert=True)¶
GUI plotting algorithm, compatible with both Qt5 and TkAgg backends (see
matplotlib.use()). This module can plot seismogram data from a list of 1-4 Shake channels, and calculate and display a spectrogram beneath each.
By default the plotted
“duration”in seconds is
30. The plot will refresh at most once per second, but slower processors may take longer. The longer the duration, the more processor power it will take to refresh the plot, especially when the spectrogram is enabled. To disable the spectrogram, set
falsein the settings file. To put the plot into fullscreen window mode, set
true. To put the plot into kiosk mode, set
seconds (int) – number of seconds to plot. Defaults to 30.
spectrogram (bool) – whether to plot the spectrogram. Defaults to True.
fullscreen (bool) – whether to plot in a fullscreen window. Defaults to False.
kiosk (bool) – whether to plot in kiosk mode (true fullscreen). Defaults to False.
screencap (bool) – whether or not to save screenshots of events. Defaults to False.
alert (bool) – whether to draw the number of events at startup. Defaults to True.
ImportError – if the module cannot import either of the Matplotlib Qt5 or TkAgg backends
Send the streams to the central library deconvolve function.
Let some time elapse in order for the plot canvas to draw properly. Must be separate from
update_plot()to avoid a broadcast error early in plotting.
Get data from the queue and test for whether it has certain strings. ALARM and TERM both trigger specific behavior. ALARM messages cause the event counter to increment, and if
screencap==Truethen aplot image will be saved when the event is
self.save_pctof the way across the plot.
Handles a plot close event. This will trigger a full shutdown of all other processes related to rsudp.
Handles a plot window resize event. This will allow the plot to resize dynamically.
The main loop in the
Get a queue object and increment the queue counter. This is a way to figure out how many channels have arrived in the queue.
The heart of the plotting routine.
Begins by updating the queue to populate a
obspy.core.stream.Streamobject, then setting up the main plot. The first time through the main loop, the plot is not drawn. After that, the plot is drawn every time all channels are updated. Any plots containing a spectrogram and more than 1 channel are drawn at most every second (1000 ms). All other plots are drawn at most every quarter second (250 ms).
savefig(event_time=UTCDateTime(2020, 4, 28, 0, 15, 13, 221122), event_time_str='2020-04-28-001513')¶
Saves the figure and puts an IMGPATH message on the master queue. This message can be used to upload the image to various services.
Get samples per second from the main library.
Sets up the plot. Quite a lot of stuff happens in this function. Matplotlib backends are not threadsafe, so things are a little weird. See code comments for details.
Redraw the plot with new data. Called on every nth loop after the plot is set up, where n is the number of channels times the data packet arrival rate in Hz. This has the effect of making the plot update once per second.