fix: better plotting with moonquake detection

This commit is contained in:
2024-10-06 13:52:14 +02:00
parent 47a1e7af75
commit 29e6a86d3d
2 changed files with 11 additions and 5 deletions

View File

@@ -13,11 +13,13 @@ def process_file(file: str, matched_filter, outfolder):
st = read(file) st = read(file)
arrival, likelyhood = detect_moonquakes.do_detection(st, matched_filter) arrival, likelyhood = detect_moonquakes.do_detection(st, matched_filter)
outfile = outfolder.joinpath(path.basename(file) + "_correlation.svg") outfile = outfolder.joinpath(path.basename(file) + "_correlation.svg")
fig,ax = plt.subplots(1,1,figsize=(10,3)) fig,ax = plt.subplots(1,1,figsize=(20,6))
ax.plot(st.traces[0].times(), likelyhood) ax.plot(st.traces[0].times(), likelyhood)
ax.axvline(x = arrival, color='green',label='Est. Arrival') ax.axvline(x = arrival, color='green',label='Est. Arrival')
ax.set_xlabel("Likelyhood of event") ax.legend(loc='upper left')
ax.set_ylabel("Time [sec]") ax.set_ylabel('Likelyhood of activity')
ax.set_xlabel('Time (s)')
ax.set_title(f'Correlation of seismic data with average sample.', fontweight='bold')
# plt.show() # plt.show()
plt.savefig(outfile) plt.savefig(outfile)
plt.close(fig) plt.close(fig)

View File

@@ -31,11 +31,15 @@ def main():
estimated_arrival, likelyhood = do_detection(st, matched_filter) estimated_arrival, likelyhood = do_detection(st, matched_filter)
print(arrival - estimated_arrival) print(arrival - estimated_arrival)
# Plot trace # Plot trace
outfile = outfolder.joinpath(test_filename + "_correlation.svg") outfile = outfolder.joinpath(test_filename + "_correlation.png")
fig,ax = plt.subplots(1,1,figsize=(10,3)) fig,ax = plt.subplots(1,1,figsize=(20,6))
ax.plot(st.traces[0].times(), likelyhood) ax.plot(st.traces[0].times(), likelyhood)
ax.axvline(x = arrival, color='red',label='Rel. Arrival') ax.axvline(x = arrival, color='red',label='Rel. Arrival')
ax.axvline(x = estimated_arrival, color='green',label='Est. Arrival') ax.axvline(x = estimated_arrival, color='green',label='Est. Arrival')
ax.legend(loc='upper left')
ax.set_ylabel('Likelyhood of activity')
ax.set_xlabel('Time (s)')
ax.set_title(f'Correlation of seismic data with average sample.', fontweight='bold')
# plt.show() # plt.show()
plt.savefig(outfile) plt.savefig(outfile)
plt.close(fig) plt.close(fig)