Start messing with data funcitons
This commit is contained in:
parent
9a8cf1a2c2
commit
97669563d7
@ -16,8 +16,8 @@ shot-info:
|
|||||||
probe-info:
|
probe-info:
|
||||||
type: "Thin"
|
type: "Thin"
|
||||||
c2c: 5.6 # mm
|
c2c: 5.6 # mm
|
||||||
gauge-diam: 3.05 # mm
|
gauge-diam: 0.8 # mm
|
||||||
gauge-c2c: 4 #mm
|
gauge-c2c: 1.8 #mm
|
||||||
data-record:
|
data-record:
|
||||||
type: "scope"
|
type: "scope"
|
||||||
config: "eProbe-Scope.txt"
|
config: "eProbe-Scope.txt"
|
||||||
@ -26,7 +26,7 @@ probe-info:
|
|||||||
trigger: # Redundant?
|
trigger: # Redundant?
|
||||||
type: "channel"
|
type: "channel"
|
||||||
channel: 4
|
channel: 4
|
||||||
alignment-offset: 0 # ns
|
alignment-offset: 499500 # ns
|
||||||
delay: 100 # us
|
delay: 100 # us
|
||||||
|
|
||||||
|
|
||||||
|
37
main.py
37
main.py
@ -11,6 +11,8 @@ import yaml
|
|||||||
from nptdms import TdmsFile
|
from nptdms import TdmsFile
|
||||||
from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC
|
from makeGraph import makeGraph, pltKeyClose, UQ_COLOURS as UQC
|
||||||
|
|
||||||
|
from canny_shock_finder import canny_shock_finder
|
||||||
|
|
||||||
# Folder correction
|
# Folder correction
|
||||||
# Make sure the relevant folders folder exists
|
# Make sure the relevant folders folder exists
|
||||||
folders = ["./images"]
|
folders = ["./images"]
|
||||||
@ -83,17 +85,25 @@ loaded_data = list(data.keys())
|
|||||||
print("Loaded Data")
|
print("Loaded Data")
|
||||||
|
|
||||||
|
|
||||||
|
def process_data(gData):
|
||||||
|
x2_time = (gData["x2"][0][:] - gData["x2"][0][0]).astype('timedelta64[ns]') # Convert x2 to timedelta64[ns]
|
||||||
|
|
||||||
print("Graphing Data")
|
trigger_info = gData["info"]["probe-info"]["data-record"]["trigger"] # Get the scope trigger info
|
||||||
gData = data[loaded_data[0]]
|
|
||||||
|
|
||||||
x2_time = (gData["x2"][0][:] - gData["x2"][0][0]).astype('timedelta64[ns]')
|
# Convert the scope times into timedelta64 & apply config offsets & delays
|
||||||
|
scope_time = np.array([ pd.Timedelta(t, 's').to_numpy() for t in (gData["probes"][:, 0] - gData["probes"][0, 0])])
|
||||||
|
scope_time =- np.timedelta64(trigger_info["alignment-offset"], 'ns')
|
||||||
|
scope_time =+ np.timedelta64(trigger_info["delay"], 'us')
|
||||||
|
|
||||||
|
|
||||||
trigger_info = gData["info"]["probe-info"]["data-record"]["trigger"]
|
|
||||||
scope_time = np.array([ pd.Timedelta(t, 's').to_numpy() for t in (gData["probes"][:, 0] - gData["probes"][0, 0])]) - np.timedelta64(trigger_info["alignment-offset"], 'ns') + np.timedelta64(trigger_info["delay"], 'us')
|
|
||||||
|
|
||||||
graphData = {
|
return x2_time, scope_time
|
||||||
|
|
||||||
|
|
||||||
|
def genGraph(gData):
|
||||||
|
x2_time, scope_time = process_data(gData)
|
||||||
|
|
||||||
|
graphData = {
|
||||||
"title": f"Shock response Time\nFor {gData["info"]["long_name"]}",
|
"title": f"Shock response Time\nFor {gData["info"]["long_name"]}",
|
||||||
"xLabel": "Time (ns)",
|
"xLabel": "Time (ns)",
|
||||||
"yLabel": "Voltage Reading (V)",
|
"yLabel": "Voltage Reading (V)",
|
||||||
@ -132,8 +142,19 @@ graphData = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makeGraph(graphData)
|
||||||
|
|
||||||
|
|
||||||
|
gData = data[loaded_data[0]]
|
||||||
|
x2_time, scope_time = process_data(gData)
|
||||||
|
|
||||||
makeGraph(graphData)
|
x2_out = canny_shock_finder(x2_time, (gData["x2"][4][:] - gData["x2"][4][0]) * 0.0148, plot=False)
|
||||||
|
|
||||||
|
print(x2_out)
|
||||||
|
input("foo")
|
||||||
|
|
||||||
|
#print("Graphing Data")
|
||||||
|
#genGraph(data[loaded_data[0]])
|
||||||
|
#genGraph(data[loaded_data[1]])
|
Loading…
x
Reference in New Issue
Block a user