Make nice canning graph

This commit is contained in:
Cal Wing 2024-10-23 14:20:57 +10:00
parent 313ef7d1de
commit 7d6b3403f5
2 changed files with 10 additions and 2 deletions

View File

@ -360,6 +360,9 @@ def canny_shock_finder(time_list, pressure_list, sigma = 4, derivative_threshold
data_ax.plot(time_list*plot_time_scale, pressure_list, '-o', label = 'original data') data_ax.plot(time_list*plot_time_scale, pressure_list, '-o', label = 'original data')
data_ax.grid(True)
convolution_ax.grid(True)
convolution_ax.plot(time_list*plot_time_scale, first_order_data, '-o', label='first order gaussian (sigma = {0})'.format(sigma)) convolution_ax.plot(time_list*plot_time_scale, first_order_data, '-o', label='first order gaussian (sigma = {0})'.format(sigma))
convolution_ax.plot(time_list*plot_time_scale, second_order_data, '-o', label='second order gaussian (sigma = {0})'.format(sigma)) convolution_ax.plot(time_list*plot_time_scale, second_order_data, '-o', label='second order gaussian (sigma = {0})'.format(sigma))
convolution_ax.plot(time_list*plot_time_scale, suppressed_data, '-o', label='first order with non-max suppression') convolution_ax.plot(time_list*plot_time_scale, suppressed_data, '-o', label='first order with non-max suppression')

View File

@ -319,7 +319,12 @@ def load_data(data_path: str, data={}) -> dict:
for i, probe in enumerate(dataInfo["probe-info"]["locations"]): for i, probe in enumerate(dataInfo["probe-info"]["locations"]):
# Get the canny-args # Get the canny-args
cArgs = dataInfo["canny-args"] cArgs = dataInfo["canny-args"]
doCannyPlot = False doCannyPlot = x2_shot == "x2s5829" and probe == "st2" and False
plotValues = {
"plot_title": f"Canny Shock Finding Result for {x2_shot} - ST1 Gauge 1",
"plot_time_unit": "$\\mu$s",
"y_label": "Voltage Reading (V)",
}
if i in range(len(cArgs)): if i in range(len(cArgs)):
sigma = cArgs[i]["sigma"] sigma = cArgs[i]["sigma"]
post_sup_thresh = cArgs[i]["post_pres"] post_sup_thresh = cArgs[i]["post_pres"]
@ -336,7 +341,7 @@ def load_data(data_path: str, data={}) -> dict:
# Find G1 Shock Time # Find G1 Shock Time
if 1 in dataInfo["probe-info"]["gauges"]: if 1 in dataInfo["probe-info"]["gauges"]:
first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time, probeCh1, sigma=sigma, post_suppression_threshold=post_sup_thresh, plot=doCannyPlot, start_time=time_offset, print_func=None) first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time, probeCh1, sigma=sigma, post_suppression_threshold=post_sup_thresh, plot=doCannyPlot, start_time=time_offset, print_func=None, **plotValues)
if first_value is None: if first_value is None:
print(f"[ERROR] {x2_shot} - {probe}-g1 could not be detected using: Sigma = {sigma}, post_suppression_threshold = {post_sup_thresh}") print(f"[ERROR] {x2_shot} - {probe}-g1 could not be detected using: Sigma = {sigma}, post_suppression_threshold = {post_sup_thresh}")
raise ValueError(f"{probe}-g1 not detected") raise ValueError(f"{probe}-g1 not detected")