mirror of
https://github.com/Derisis13/SeismStart.git
synced 2025-12-06 19:42:49 +01:00
feat: histogram creation and training report
This commit is contained in:
19
create_histogram.py
Normal file
19
create_histogram.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import json
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
with open("training_report.json") as jsonfile:
|
||||||
|
from_json = json.load(jsonfile)
|
||||||
|
values = np.array(list(from_json.values()))
|
||||||
|
values = values.__abs__()
|
||||||
|
fig,ax = plt.subplots()
|
||||||
|
|
||||||
|
ax.hist(values, bins=200 )
|
||||||
|
# ax.set_xscale('log')
|
||||||
|
ax.set_yscale('log')
|
||||||
|
ax.set_ylabel('Number of detections')
|
||||||
|
ax.set_xlabel('Error (s)')
|
||||||
|
ax.set_title(f'Histogram of error relative to marked start over the training dataset', fontweight='bold')
|
||||||
|
plt.show()
|
||||||
|
|
||||||
@@ -5,6 +5,7 @@ import create_matched_filter
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
import json
|
||||||
|
|
||||||
IMGDIR = "./images"
|
IMGDIR = "./images"
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ def main():
|
|||||||
matched_filter = create_matched_filter.create_matched_filter()
|
matched_filter = create_matched_filter.create_matched_filter()
|
||||||
outfolder = Path(IMGDIR + "/lunar/training/")
|
outfolder = Path(IMGDIR + "/lunar/training/")
|
||||||
outfolder.mkdir(parents=True, exist_ok=True)
|
outfolder.mkdir(parents=True, exist_ok=True)
|
||||||
|
data = {}
|
||||||
for row in tqdm(CAT_LUNAR.iloc):
|
for row in tqdm(CAT_LUNAR.iloc):
|
||||||
arrival_time = datetime.strptime(row['time_abs(%Y-%m-%dT%H:%M:%S.%f)'],'%Y-%m-%dT%H:%M:%S.%f')
|
arrival_time = datetime.strptime(row['time_abs(%Y-%m-%dT%H:%M:%S.%f)'],'%Y-%m-%dT%H:%M:%S.%f')
|
||||||
test_filename = row.filename
|
test_filename = row.filename
|
||||||
@@ -29,7 +31,8 @@ def main():
|
|||||||
test_filename = test_filename.replace('HR00', 'HR02')
|
test_filename = test_filename.replace('HR00', 'HR02')
|
||||||
st, arrival = from_mseed(test_filename, LUNAR_DATA_DIR, arrival_time)
|
st, arrival = from_mseed(test_filename, LUNAR_DATA_DIR, arrival_time)
|
||||||
estimated_arrival, likelyhood = do_detection(st, matched_filter)
|
estimated_arrival, likelyhood = do_detection(st, matched_filter)
|
||||||
print(arrival - estimated_arrival)
|
diff = (arrival - estimated_arrival)
|
||||||
|
data.update({test_filename: diff})
|
||||||
# Plot trace
|
# Plot trace
|
||||||
outfile = outfolder.joinpath(test_filename + "_correlation.png")
|
outfile = outfolder.joinpath(test_filename + "_correlation.png")
|
||||||
fig,ax = plt.subplots(1,1,figsize=(20,6))
|
fig,ax = plt.subplots(1,1,figsize=(20,6))
|
||||||
@@ -43,6 +46,8 @@ def main():
|
|||||||
# plt.show()
|
# plt.show()
|
||||||
plt.savefig(outfile)
|
plt.savefig(outfile)
|
||||||
plt.close(fig)
|
plt.close(fig)
|
||||||
|
with open("training_report.json", "w") as jsonfile:
|
||||||
|
json.dump(data, jsonfile, indent=2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
78
training_report.json
Normal file
78
training_report.json
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"xa.s12.00.mhz.1970-01-19HR00_evid00002": 0.24066037737065926,
|
||||||
|
"xa.s12.00.mhz.1970-03-25HR00_evid00003": 0.23924528301904502,
|
||||||
|
"xa.s12.00.mhz.1970-03-26HR00_evid00004": 0.3406603773619281,
|
||||||
|
"xa.s12.00.mhz.1970-04-25HR00_evid00006": 0.03041509434024192,
|
||||||
|
"xa.s12.00.mhz.1970-04-26HR00_evid00007": 0.24566037736076396,
|
||||||
|
"xa.s12.00.mhz.1970-06-15HR00_evid00008": 0.16924528303206898,
|
||||||
|
"xa.s12.00.mhz.1970-06-26HR00_evid00009": 0.3368301886948757,
|
||||||
|
"xa.s12.00.mhz.1970-07-20HR00_evid00010": 0.1922452830185648,
|
||||||
|
"xa.s12.00.mhz.1970-07-20HR00_evid00011": 23880.19224528302,
|
||||||
|
"xa.s12.00.mhz.1970-09-26HR00_evid00013": 0.3038301886845147,
|
||||||
|
"xa.s12.00.mhz.1970-10-24HR00_evid00014": -19930.466264150935,
|
||||||
|
"xa.s12.00.mhz.1970-11-12HR00_evid00015": 0.43207547170459293,
|
||||||
|
"xa.s12.00.mhz.1970-12-11HR00_evid00017": 0.353245283022261,
|
||||||
|
"xa.s12.00.mhz.1970-12-27HR00_evid00019": 0.16224528301972896,
|
||||||
|
"xa.s12.00.mhz.1970-12-31HR00_evid00021": 7.81194339623471,
|
||||||
|
"xa.s12.00.mhz.1971-01-15HR00_evid00022": 0.4212452830252005,
|
||||||
|
"xa.s12.00.mhz.1971-01-28HR00_evid00023": 0.21883018868538784,
|
||||||
|
"xa.s12.00.mhz.1971-01-29HR00_evid00024": 0.25883018868626095,
|
||||||
|
"xa.s12.00.mhz.1971-02-09HR00_evid00026": 0.04741509434097679,
|
||||||
|
"xa.s12.00.mhz.1971-03-25HR00_evid00028": 0.07541509434668114,
|
||||||
|
"xa.s12.00.mhz.1971-04-13HR02_evid00029": 0.3684285660419846,
|
||||||
|
"xa.s12.00.mhz.1971-04-17HR00_evid00030": 0.29224528302438557,
|
||||||
|
"xa.s12.00.mhz.1971-05-12HR00_evid00031": -5999.806339622635,
|
||||||
|
"xa.s12.00.mhz.1971-05-12HR00_evid00032": 0.19366037736472208,
|
||||||
|
"xa.s12.00.mhz.1971-05-13HR00_evid00033": 0.043415094340161886,
|
||||||
|
"xa.s12.00.mhz.1971-05-23HR00_evid00034": 52.252716981151025,
|
||||||
|
"xa.s12.00.mhz.1971-06-12HR00_evid00035": 0.3766603773619863,
|
||||||
|
"xa.s12.00.mhz.1971-09-25HR00_evid00042": 0.3296603773596871,
|
||||||
|
"xa.s12.00.mhz.1971-10-18HR00_evid00043": -42839.51133962264,
|
||||||
|
"xa.s12.00.mhz.1971-10-20HR00_evid00044": 0.2542452830239199,
|
||||||
|
"xa.s12.00.mhz.1971-10-31HR00_evid00045": 0.25924528302130057,
|
||||||
|
"xa.s12.00.mhz.1971-11-14HR00_evid00046": 0.3036603773598472,
|
||||||
|
"xa.s12.00.mhz.1972-01-04HR00_evid00049": 0.335830188683758,
|
||||||
|
"xa.s12.00.mhz.1972-03-12HR00_evid00052": 0.2622452830255497,
|
||||||
|
"xa.s12.00.mhz.1972-05-11HR00_evid00055": 0.3296603773633251,
|
||||||
|
"xa.s12.00.mhz.1972-06-16HR00_evid00060": 0.33683018868032377,
|
||||||
|
"xa.s12.00.mhz.1972-07-17HR00_evid00067": -50759.95758490565,
|
||||||
|
"xa.s12.00.mhz.1972-07-17HR00_evid00068": 0.04241509435814805,
|
||||||
|
"xa.s12.00.mhz.1972-07-28HR00_evid00070": 0.3168301886798872,
|
||||||
|
"xa.s12.00.mhz.1972-07-31HR00_evid00071": 0.057245283023803495,
|
||||||
|
"xa.s12.00.mhz.1972-12-02HR00_evid00083": 0.2402452830247057,
|
||||||
|
"xa.s12.00.mhz.1972-12-03HR00_evid00084": 0.12724528301987448,
|
||||||
|
"xa.s12.00.mhz.1973-01-18HR00_evid00088": 106.20592452831625,
|
||||||
|
"xa.s12.00.mhz.1973-01-31HR00_evid00091": 0.08424528301929968,
|
||||||
|
"xa.s12.00.mhz.1973-03-01HR00_evid00093": 0.10783018868096406,
|
||||||
|
"xa.s12.00.mhz.1973-03-13HR00_evid00094": 0.43366037735904683,
|
||||||
|
"xa.s12.00.mhz.1973-03-24HR00_evid00097": 0.29966037736448925,
|
||||||
|
"xa.s12.00.mhz.1973-05-14HR00_evid00104": 952.5841320754719,
|
||||||
|
"xa.s12.00.mhz.1973-06-05HR00_evid00107": -30720.073584905655,
|
||||||
|
"xa.s12.00.mhz.1973-06-05HR00_evid00108": -0.0735849056582083,
|
||||||
|
"xa.s12.00.mhz.1973-06-18HR00_evid00109": 0.09441509434054751,
|
||||||
|
"xa.s12.00.mhz.1973-06-27HR00_evid00112": 0.44924528303090483,
|
||||||
|
"xa.s12.00.mhz.1973-07-03HR00_evid00113": 0.37366037735773716,
|
||||||
|
"xa.s12.00.mhz.1973-07-04HR00_evid00114": 0.1352452830196853,
|
||||||
|
"xa.s12.00.mhz.1973-07-20HR00_evid00117": 9.880679245281499,
|
||||||
|
"xa.s12.00.mhz.1973-07-28HR00_evid00120": 0.40424528301900864,
|
||||||
|
"xa.s12.00.mhz.1973-07-29HR00_evid00121": 2040.190830188687,
|
||||||
|
"xa.s12.00.mhz.1973-08-21HR00_evid00127": 0.2536603773623938,
|
||||||
|
"xa.s12.00.mhz.1974-01-10HR00_evid00136": 34362.789867924526,
|
||||||
|
"xa.s12.00.mhz.1974-02-07HR00_evid00137": 0.0988301886827685,
|
||||||
|
"xa.s12.00.mhz.1974-02-12HR00_evid00138": 885.5622641509544,
|
||||||
|
"xa.s12.00.mhz.1974-03-25HR00_evid00140": 0.08124528302869294,
|
||||||
|
"xa.s12.00.mhz.1974-04-08HR00_evid00141": 0.14524528302354156,
|
||||||
|
"xa.s12.00.mhz.1974-04-19HR00_evid00142": 0.11124528302752879,
|
||||||
|
"xa.s12.00.mhz.1974-04-26HR00_evid00144": 0.3302452830175753,
|
||||||
|
"xa.s12.00.mhz.1974-04-27HR00_evid00145": 0.03324528302619001,
|
||||||
|
"xa.s12.00.mhz.1974-06-25HR00_evid00149": -0.0711698113204875,
|
||||||
|
"xa.s12.00.mhz.1974-07-06HR00_evid00150": -40619.966584905655,
|
||||||
|
"xa.s12.00.mhz.1974-07-06HR00_evid00151": 0.033415094345400576,
|
||||||
|
"xa.s12.00.mhz.1974-07-11HR00_evid00152": 0.320245283019176,
|
||||||
|
"xa.s12.00.mhz.1974-07-17HR00_evid00153": 0.2268301886797417,
|
||||||
|
"xa.s12.00.mhz.1974-10-14HR00_evid00156": 0.36249056604719954,
|
||||||
|
"xa.s12.00.mhz.1975-04-12HR00_evid00191": 0.26583018868404906,
|
||||||
|
"xa.s12.00.mhz.1975-05-04HR00_evid00192": 0.44866037736210274,
|
||||||
|
"xa.s12.00.mhz.1975-06-24HR00_evid00196": 50661.04401886792,
|
||||||
|
"xa.s12.00.mhz.1975-06-26HR00_evid00198": 0.13724528302009276
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user