Skip to content

Commit

Permalink
Further speed up station plotting using threading
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Jan 26, 2025
1 parent 3708ba2 commit 2df5ea3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sourcespec/ssp_plot_stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
import contextlib
import warnings
import threading
from copy import deepcopy
import numpy as np
import cartopy.crs as ccrs
Expand Down Expand Up @@ -868,9 +869,12 @@ def plot_stations(config, sspec_output):
basemap_data = _make_basemap(config, maxdist)
# make a copy of the basemap data for the second plot, before modifying it
basemap_data2 = deepcopy(basemap_data)
_make_station_map(
# plot the first map in a separate thread to avoid blocking
# the plotting of the second map
map_thread = threading.Thread(target=_make_station_map, args=(
config, basemap_data, lonlat_dist, st_ids,
mag, mag_outliers, summary_mag, summary_mag_err, 'mag')
mag, mag_outliers, summary_mag, summary_mag_err, 'mag'))
map_thread.start()
fc = np.array([stationpar[k]['fc'].value for k in st_ids])
fc_outliers = np.array([stationpar[k]['fc'].outlier for k in st_ids])
summary_fc = summary_values['fc']
Expand Down

0 comments on commit 2df5ea3

Please sign in to comment.