Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 committed Aug 2, 2024
1 parent fb99c1a commit be2477b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion adloc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def invert_location(picks, stations, config, estimator, events_init=None, iter=0
if "ncpu" in config:
NCPU = config["ncpu"]
else:
NCPU = mp.cpu_count() - 1
NCPU = min(32, mp.cpu_count() - 1)

jobs = []
events_inverted = []
Expand Down
4 changes: 2 additions & 2 deletions docs/run_ransac.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
events_init["depth_km"] = events_init["depth(m)"] / 1000.0
events_init["time"] = pd.to_datetime(events_init["time"])

picks = picks[picks["phase_time"] < pd.to_datetime("2019-07-05 00:00:00")]
events_init = events_init[events_init["time"] < pd.to_datetime("2019-07-05 00:00:00")]
# picks = picks[picks["phase_time"] < pd.to_datetime("2019-07-05 00:00:00")]
# events_init = events_init[events_init["time"] < pd.to_datetime("2019-07-05 00:00:00")]

stations = pd.read_csv(stations_file, sep="\t")
stations.rename({"station": "station_id", "elevation(m)": "elevation_m"}, axis=1, inplace=True)
Expand Down
12 changes: 9 additions & 3 deletions docs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,14 @@ def plotting_ransac(stations, figure_path, config, picks, events_init, events, i
ax[1, 2].hist(picks[picks["mask"] == 1.0]["residual_amplitude"], bins=30, edgecolor="white")
ax[1, 2].set_title("Pick residual (log10 cm/s)")
plt.savefig(os.path.join(figure_path, f"hist_{iter}.png"), bbox_inches="tight", dpi=300)
plt.close(fig)

xmin, xmax = config["xlim_km"]
ymin, ymax = config["ylim_km"]
zmin, zmax = config["zlim_km"]
vmin, vmax = config["zlim_km"]
events = events.sort_values("time", ascending=True)
s = max(0.1, min(10, 5000 / len(events)))
alpha = 0.8
fig, ax = plt.subplots(2, 3, figsize=(18, 8), gridspec_kw={"height_ratios": [2, 1]})
# fig, ax = plt.subplots(2, 3, figsize=(15, 8), gridspec_kw={"height_ratios": [2, 1]})
Expand All @@ -208,11 +211,12 @@ def plotting_ransac(stations, figure_path, config, picks, events_init, events, i
events["y_km"],
c=events["z_km"],
cmap="viridis_r",
s=1,
s=s,
marker="o",
vmin=vmin,
vmax=vmax,
alpha=alpha,
linewidth=0.,
)
# set ratio 1:1
ax[0, 0].set_aspect("equal", "box")
Expand Down Expand Up @@ -296,11 +300,12 @@ def plotting_ransac(stations, figure_path, config, picks, events_init, events, i
events["z_km"],
c=events["z_km"],
cmap="viridis_r",
s=1,
s=s,
marker="o",
vmin=vmin,
vmax=vmax,
alpha=alpha,
linewidth=0.,
)
# ax[1, 0].set_aspect("equal", "box")
ax[1, 0].set_xlim([xmin, xmax])
Expand All @@ -315,11 +320,12 @@ def plotting_ransac(stations, figure_path, config, picks, events_init, events, i
events["z_km"],
c=events["z_km"],
cmap="viridis_r",
s=1,
s=s,
marker="o",
vmin=vmin,
vmax=vmax,
alpha=alpha,
linewidth=0.,
)
# ax[1, 1].set_aspect("equal", "box")
ax[1, 1].set_xlim([ymin, ymax])
Expand Down

0 comments on commit be2477b

Please sign in to comment.