Get canning edge to work on eprobe (with offset hack)
This commit is contained in:
parent
27836238a6
commit
d04067fe0b
32
main.py
32
main.py
@ -189,34 +189,38 @@ def load_data(data_to_load: list[str]) -> dict:
|
|||||||
for i, probe in enumerate(dataInfo["probe-info"]["locations"]):
|
for i, probe in enumerate(dataInfo["probe-info"]["locations"]):
|
||||||
probeCh1 = data[x2_shot]["data"]["scope"][1]
|
probeCh1 = data[x2_shot]["data"]["scope"][1]
|
||||||
probeCh2 = data[x2_shot]["data"]["scope"][2]
|
probeCh2 = data[x2_shot]["data"]["scope"][2]
|
||||||
|
|
||||||
#first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time, probeCh1, plot=True)
|
|
||||||
#shock_point = np.where(scope_time >= first_value)[0][0] # [BUG] Seems to give n+1
|
|
||||||
|
|
||||||
#[HACK] For detection
|
#[HACK] For detection
|
||||||
if i > 0:
|
if i > 0:
|
||||||
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
||||||
offset = data[x2_shot]["shock-point"][f"{privPoint}-g1"][0][i-1] + 50
|
offset = data[x2_shot]["shock-point"][f"{privPoint}-g1"][0] + 150 #[i-1] + 25
|
||||||
else:
|
else:
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
shock_point = np.where(probeCh1[offset:] >= 0.3)[0] + offset
|
shock_point = np.where(probeCh1[offset:] >= 0.3)[0] + offset
|
||||||
first_value = scope_time[shock_point]
|
first_value = scope_time[shock_point]
|
||||||
data[x2_shot]["shock-point"][f"{probe}-g1"] = shock_point, first_value
|
|
||||||
|
|
||||||
#first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time, probeCh2, plot=False)
|
first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time[offset:], probeCh1[offset:], plot=False, sigma=2, post_shock_pressure=0.02)
|
||||||
#shock_point = np.where(scope_time >= first_value)[0][0] # [BUG] Seems to give n+1
|
shock_point = np.where(scope_time[offset:] >= first_value)[0][0] + offset # [BUG] Seems to give n+1
|
||||||
|
|
||||||
|
data[x2_shot]["shock-point"][f"{probe}-g1"] = shock_point, first_value
|
||||||
|
|
||||||
|
|
||||||
#[HACK] For detection
|
#[HACK] For detection
|
||||||
if i > 0:
|
if i > 0:
|
||||||
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
||||||
offset = data[x2_shot]["shock-point"][f"{privPoint}-g2"][0][i-1] + 50
|
offset = data[x2_shot]["shock-point"][f"{privPoint}-g2"][0] + 150 #[i-1] + 25
|
||||||
else:
|
else:
|
||||||
offset = 0
|
offset = 0
|
||||||
shock_point = np.where(probeCh2[offset:] >= 0.3)[0] + offset
|
shock_point = np.where(probeCh2[offset:] >= 0.3)[0] + offset
|
||||||
first_value = scope_time[shock_point]
|
first_value = scope_time[shock_point]
|
||||||
|
|
||||||
|
first_value, first_value_uncertainty, _, _ = canny_shock_finder(scope_time[offset:], probeCh2[offset:], plot=False, sigma=2, post_shock_pressure=0.02)
|
||||||
|
shock_point = np.where(scope_time[offset:] >= first_value)[0][0] + offset # [BUG] Seems to give n+1
|
||||||
data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value
|
data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Return the data & the successfully loaded data keys
|
# Return the data & the successfully loaded data keys
|
||||||
return data, tuple(data.keys())
|
return data, tuple(data.keys())
|
||||||
@ -262,15 +266,15 @@ def genGraph(gData: dict, showPlot: bool = True):
|
|||||||
for i, probe in enumerate(gData["info"]["probe-info"]["locations"]):
|
for i, probe in enumerate(gData["info"]["probe-info"]["locations"]):
|
||||||
graphData["plots"].append({
|
graphData["plots"].append({
|
||||||
"type": "axvLine",
|
"type": "axvLine",
|
||||||
"x": gData["shock-point"][f"{probe}-g1"][1][i],
|
"x": gData["shock-point"][f"{probe}-g1"][1],#[i],
|
||||||
"label": f"{probe}-G1 - Shock Point {gData["shock-point"][f"{probe}-g1"][1][i]:.2f}$\\mu$s",
|
"label": f"{probe}-G1 - Shock Point {gData["shock-point"][f"{probe}-g1"][1]:.2f}$\\mu$s",
|
||||||
#"colour": "gray",
|
#"colour": "gray",
|
||||||
"args":{"zorder":2, "linestyle":"--"}
|
"args":{"zorder":2, "linestyle":"--"}
|
||||||
})
|
})
|
||||||
graphData["plots"].append({
|
graphData["plots"].append({
|
||||||
"type": "axvLine",
|
"type": "axvLine",
|
||||||
"x": gData["shock-point"][f"{probe}-g2"][1][i],
|
"x": gData["shock-point"][f"{probe}-g2"][1],#[i],
|
||||||
"label": f"{probe}-G2 - Shock Point {gData["shock-point"][f"{probe}-g2"][1][i]:.2f}$\\mu$s",
|
"label": f"{probe}-G2 - Shock Point {gData["shock-point"][f"{probe}-g2"][1]:.2f}$\\mu$s",
|
||||||
#"colour": "gray",
|
#"colour": "gray",
|
||||||
"args":{"zorder":2, "linestyle":"--"}
|
"args":{"zorder":2, "linestyle":"--"}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user