Compare commits
8 Commits
5a9c378d9e
...
27836238a6
Author | SHA1 | Date | |
---|---|---|---|
|
27836238a6 | ||
|
d87316d662 | ||
|
0ba4f93e7e | ||
|
7d6c0514f6 | ||
|
5a24ab0bc1 | ||
|
a95399fb04 | ||
|
321fc27dbb | ||
|
651abf1fba |
@ -465,10 +465,10 @@ def canny_shock_finder(time_list, pressure_list, sigma = 4, derivative_threshold
|
||||
ax.tick_params(which='both', direction='out')
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
ax.xaxis.set_ticks_position('bottom')
|
||||
for tick in ax.yaxis.get_major_ticks():
|
||||
tick.label.set_fontsize(font_sizes['tick_size'])
|
||||
for tick in ax.xaxis.get_major_ticks():
|
||||
tick.label.set_fontsize(font_sizes['tick_size'])
|
||||
#for tick in ax.yaxis.get_major_ticks():
|
||||
# tick.label.set_fontsize(font_sizes['tick_size'])
|
||||
#for tick in ax.xaxis.get_major_ticks():
|
||||
# tick.label.set_fontsize(font_sizes['tick_size'])
|
||||
|
||||
ax.legend(prop={'size':font_sizes['legend_text_size']}, loc = 'best')
|
||||
|
||||
|
@ -12,9 +12,15 @@ shot-info:
|
||||
config: "x2s5823.config"
|
||||
info: "x2s5823.txt"
|
||||
|
||||
pcb-refs:
|
||||
- "st1"
|
||||
- "st3"
|
||||
|
||||
probe-info:
|
||||
type: "Fat"
|
||||
locations: # In order of pulse
|
||||
- "st2"
|
||||
overhang: 1 # mm
|
||||
c2c: 5.6 # mm
|
||||
gauge-diam: 3.05 # mm
|
||||
gauge-c2c: 4 #mm
|
||||
@ -26,6 +32,6 @@ probe-info:
|
||||
trigger:
|
||||
type: "channel"
|
||||
channel: 4
|
||||
alignment-offset: 601000 # ns
|
||||
alignment-offset: 0 # 601 # us [TODO] Make this auto-magic
|
||||
delay: 100 # us
|
||||
|
||||
|
@ -12,9 +12,15 @@ shot-info:
|
||||
config: "x2s5824.config"
|
||||
info: "x2s5824.txt"
|
||||
|
||||
pcb-refs:
|
||||
- "st1"
|
||||
- "st3"
|
||||
|
||||
probe-info:
|
||||
type: "Thin"
|
||||
locations: # In order of pulse
|
||||
- "st2"
|
||||
overhang: 1 # mm
|
||||
c2c: 5.6 # mm
|
||||
gauge-diam: 0.8 # mm
|
||||
gauge-c2c: 1.8 #mm
|
||||
@ -26,7 +32,7 @@ probe-info:
|
||||
trigger: # Redundant?
|
||||
type: "channel"
|
||||
channel: 4
|
||||
alignment-offset: 499500 # ns
|
||||
alignment-offset: 0 # 601 # us [TODO] Make this auto-magic
|
||||
delay: 100 # us
|
||||
|
||||
|
||||
|
38
data/x2s5827/_info.yaml
Normal file
38
data/x2s5827/_info.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
# Data Info File
|
||||
# Cal Wing - Oct 24
|
||||
|
||||
long_name: "Shot 2 (x2s5827) - Thin Probe Pair (ST2 & ST3) - 2024-10-16"
|
||||
name: "Shot 3"
|
||||
date: "2024-10-16"
|
||||
time: "18:40"
|
||||
|
||||
shot-info:
|
||||
name: "x2s5827"
|
||||
tdms: "x2s5827.tdms"
|
||||
config: "x2s5827.config"
|
||||
info: "x2s5827.txt"
|
||||
|
||||
pcb-refs:
|
||||
- "st1"
|
||||
|
||||
probe-info:
|
||||
type: "Thin"
|
||||
locations: # In order of pulse
|
||||
- "st2"
|
||||
- "st3"
|
||||
overhang: 1 # mm
|
||||
c2c: 5.6 # mm
|
||||
gauge-diam: 0.8 # mm
|
||||
gauge-c2c: 1.8 #mm
|
||||
data-record:
|
||||
type: "scope"
|
||||
config: "eProbe-Scope.txt"
|
||||
data: "eProbe-Scope.csv"
|
||||
|
||||
trigger: # Redundant?
|
||||
type: "channel"
|
||||
channel: 4
|
||||
alignment-offset: 0 # 601 # us [TODO] Make this auto-magic
|
||||
delay: 100 # us
|
||||
|
||||
|
7680
data/x2s5827/eProbe-Scope.csv
Normal file
7680
data/x2s5827/eProbe-Scope.csv
Normal file
File diff suppressed because it is too large
Load Diff
18
data/x2s5827/eProbe-Scope.txt
Normal file
18
data/x2s5827/eProbe-Scope.txt
Normal file
@ -0,0 +1,18 @@
|
||||
ANALOG
|
||||
Ch 1 Scale 500mV/, Pos 1.25000V, Coup DC, BW Limit Off, Inv Off, Imp 1M Ohm
|
||||
Probe 10.000000 : 1, Skew 0.0s
|
||||
Ch 2 Scale 500mV/, Pos 1.25000V, Coup DC, BW Limit Off, Inv Off, Imp 1M Ohm
|
||||
Probe 10.000000 : 1, Skew 0.0s
|
||||
Ch 4 Scale 1.00V/, Pos 2.85000V, Coup DC, BW Limit Off, Inv Off, Imp 1M Ohm
|
||||
Probe 1.0000000 : 1, Skew 0.0s
|
||||
|
||||
TRIGGER
|
||||
Sweep Mode Auto, Coup DC, Noise Rej Off, HF Rej Off, Holdoff 40.0ns
|
||||
Mode Edge, Source Ch 4, Slope Rising, Level 1.00000V
|
||||
|
||||
HORIZONTAL
|
||||
Mode Normal, Ref Center, Main Scale 500.0us/, Main Delay -100.000000us
|
||||
|
||||
ACQUISITION
|
||||
Mode High Res, Realtime On, Vectors On, Persistence Off
|
||||
|
BIN
data/x2s5827/x2s5827.cfg
Normal file
BIN
data/x2s5827/x2s5827.cfg
Normal file
Binary file not shown.
49
data/x2s5827/x2s5827.config
Normal file
49
data/x2s5827/x2s5827.config
Normal file
@ -0,0 +1,49 @@
|
||||
# x2s5827 config file
|
||||
# This files contains a text version of the National Instruments PXI unit configuration data.
|
||||
# Channels are represented as one line per configured signal with tab-separated values.
|
||||
#
|
||||
# Line content and types of values (first item is item 0):
|
||||
# i item type comments
|
||||
# --------------------------------------------------------------------------------------------------------
|
||||
# 0 signal name string
|
||||
# 1 channel ID string legacy I/O channel designation
|
||||
# 2 external gain float 1 if there is no external amplifier connected
|
||||
# 3 sensitivity float volts per measured unit (of the transducer)
|
||||
# 4 units string name of units for physical quantity (e.g. kPa)
|
||||
# 5 position float position of transducer (in mm)
|
||||
# 6 serial number string transducer identity
|
||||
# 7 PXI channel ID string non-legacy channel ID and trigger source
|
||||
#---------------------------------------------------------------------------------------------------------
|
||||
|
||||
sd1 2 0 9 1 9.500000E-4 kPa 0.000 112A24-9609 PXI1Slot2/ai0
|
||||
sd2 2 1 9 1 9.500000E-4 kPa 0.000 113A22-9535 PXI1Slot2/ai1
|
||||
sd3 2 3 9 1 6.820000E-4 kPa 0.000 112A24-2676 PXI1Slot2/ai3
|
||||
st1 2 4 9 1 1.482000E-2 kPa 0.000 112A22-35071 PXI1Slot2/ai4
|
||||
st2 5 4 9 1 1.168700E-2 kPa 0.000 112A22-35070 PXI1Slot5/ai4
|
||||
st3 2 6 9 1 1.450000E-2 kPa 0.000 112A22-19126 PXI1Slot2/ai6
|
||||
at1 3 0 9 1 1.443000E-2 kPa 0.000 112A22-35098 PXI1Slot3/ai0
|
||||
at2 3 1 9 1 1.450000E-2 kPa 0.000 112A22-9050 PXI1Slot3/ai1
|
||||
at3 3 2 9 1 1.447980E-2 kPa 0.000 112A22-19124 PXI1Slot3/ai2
|
||||
at4 3 3 9 1 1.435000E-2 kPa 0.000 112A22-34424 PXI1Slot3/ai3
|
||||
at5 3 4 9 1 1.447000E-2 kPa 0.000 112A22-34425 PXI1Slot3/ai4
|
||||
at6 3 5 9 1 1.442000E-2 kPa 0.000 112A22-34426 PXI1Slot3/ai5
|
||||
at7 2 7 9 1 1.451000E-2 kPa 0.000 112A22-35096 PXI1Slot2/ai7
|
||||
at8 3 7 9 1 1.490000E-2 kPa 0.000 112A22-35079 PXI1Slot3/ai7
|
||||
pimax4 5 1 9 1 1.000000E-3 mV 0.000 pimax4 PXI1Slot5/ai1
|
||||
trigbox 5 7 9 1 1.000000E-3 mV 0.000 trigbox PXI1Slot5/ai7(Trigger)
|
||||
trigbox_delay 5 5 9 1 1.000000E-3 mV 0.000 trigbox_delay PXI1Slot5/ai5
|
||||
pt1 5 2 9 1 8.500000E-4 kPa 0.000 SN-22554 PXI1Slot5/ai2
|
||||
irc800 8 4 9 1 1.000000E-3 mV 0.000 irc800 PXI1Slot8/ai4
|
||||
shimadzu 8 6 9 1 1.000000E-3 mV 0.000 shimadzu PXI1Slot8/ai6
|
||||
pimax3 8 7 9 1 1.000000E-3 mV 0.000 pimax3 PXI1Slot8/ai7
|
||||
Phantom 8 2 9 1 1.000000E-3 mV 0.000 phantom PXI1Slot8/ai2
|
||||
pt2 6 1 9 1 1.440000E-3 kPa 0.000 SN 22556 PXI1Slot6/ai1
|
||||
pt3 6 2 9 1 1.810000E-3 kPa 0.000 SN 7446 PXI1Slot6/ai2
|
||||
pt4 6 3 9 1 7.300000E-4 kPa 0.000 SN LW30649 PXI1Slot6/ai3
|
||||
pt5 8 3 9 1 7.350000E-4 kPa 0.000 SN LW30651 PXI1Slot8/ai3
|
||||
pt6 6 5 9 1 7.290000E-4 kPa 0.000 SN LW30652 PXI1Slot6/ai5
|
||||
pt7 6 6 9 1 7.220000E-4 kPa 0.000 SN 22514 PXI1Slot6/ai6
|
||||
pt8 3 6 9 1 1.430000E-3 kPa 0.000 SN 16785 PXI1Slot3/ai6
|
||||
pt9 5 0 9 1 1.010000E-3 kPa 0.000 SN 7430 PXI1Slot5/ai0
|
||||
photodiode 8 0 9 1 1.000000E+0 mV 0.000 photodiode PXI1Slot8/ai0
|
||||
phantom_aperture 4 4 9 1 1.000000E-3 mV 0.000 phantom_aperture PXI1Slot4/ai4
|
20024
data/x2s5827/x2s5827.lvm
Normal file
20024
data/x2s5827/x2s5827.lvm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
data/x2s5827/x2s5827.tdms
Normal file
BIN
data/x2s5827/x2s5827.tdms
Normal file
Binary file not shown.
BIN
data/x2s5827/x2s5827.tdms_index
Normal file
BIN
data/x2s5827/x2s5827.tdms_index
Normal file
Binary file not shown.
161
data/x2s5827/x2s5827.txt
Normal file
161
data/x2s5827/x2s5827.txt
Normal file
@ -0,0 +1,161 @@
|
||||
--------------------------------------------------------------------------------
|
||||
Project.........................................Mars entry non-equilibrium expanding flows
|
||||
Run number................................ x2s5827
|
||||
Date............................................16/10/2024
|
||||
Blame...........................................Mragank, Matt, Chengxin, Sam
|
||||
Condition................................... Mars condition, high density, Mars mixture
|
||||
Reservoir..................................... 6.75 MPa
|
||||
Driver............................................83520 Pa 90% He, 92.8 kPa Argon
|
||||
Primary diaphragm.................... 2 mm scored, cold rolled steel 6U374
|
||||
Shock tube................................... 62308 Pa ( Mars mixture)
|
||||
Secondary diaphragm................ 10 micron mylar
|
||||
Acceleration tube....................... 250 Pa lab air (set on new gauge on the bottom of the dump tank)
|
||||
Trig.............................................. Pt5 (changed as wedge is ahead of pitot probes) slot8ai3 on tee piece 8ai4 - cable pt5
|
||||
Lab environment...................... N/A
|
||||
Driver Condition........................x2-lwp-2.0-90-0
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
EXPERIMENT SETUP
|
||||
|
||||
pitot rake
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
EQUIPMENT
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1x photodiode (350 - 1100nm)
|
||||
1xShimadzu -- in use
|
||||
1xmini-spec (200-1000nm)
|
||||
Phantom
|
||||
|
||||
|
||||
|
||||
-------------------------- SUSS Spectral Overview ----------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
Dichroic 1 (UV/VIS): DMLP650L
|
||||
Dichroic 2 (VIS/IR): DMLP900L
|
||||
UV FOV: 8mm
|
||||
VIS FOV: 8mm
|
||||
IR FOV: 8mm
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---UV---
|
||||
--------------------------------------------------------------------------------
|
||||
N/A
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---Visible---
|
||||
--------------------------------------------------------------------------------
|
||||
Spectrometer: Acton Spectrapro 2300i
|
||||
Centre Wavelength: 775
|
||||
Grating: 150
|
||||
Camera: PIMAX4
|
||||
Gain: 50
|
||||
Delay: 80 us
|
||||
Exposure: 50 us
|
||||
Trigger level: 1V
|
||||
Slit: 100 um
|
||||
Filter:
|
||||
Trigger: A3 cable from trigger box port 0
|
||||
Monitor: T1 Cable
|
||||
Aperture: 12.5 mm
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---IR---
|
||||
--------------------------------------------------------------------------------
|
||||
Spectrometer: Acton Spectrapro 2500
|
||||
Centre Wavelength: 1300
|
||||
Grating: 75
|
||||
Camera: IRC800
|
||||
Delay: 100us setted in DAQ with 800 counts
|
||||
Exposure: 20 us
|
||||
Slit: 1000 um
|
||||
Filter:
|
||||
Trigger: T2 cable from trigger box port1
|
||||
Monitor: PDTP1G Cable
|
||||
Aperture: 12.5 mm
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Shimadzu
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Window : BK7 Diam 209mm top
|
||||
Lens: Nikon AF Micro NIKKOR 200MM with 780-unknown? filter
|
||||
Aperture-Number 16
|
||||
Frame Rates 500.000 kFPS
|
||||
Exposure: 1/2
|
||||
Gain: x2(/x50)
|
||||
Mode: External
|
||||
Trigger @: 0/0 (0-99=100frames)
|
||||
point: 10
|
||||
Delay: 0 microseconds
|
||||
Polarity: Pos
|
||||
Monitor Expose: off
|
||||
Filter:
|
||||
Cables: Trigger: H6 cable from trigger box port 1
|
||||
Monitor: H4 Cable
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
PHOTODIODE
|
||||
--------------------------------------------------------------------------------
|
||||
Location: Circle around stagnation point, pt5.
|
||||
Filter: 777nm hydrogen filter actually. not sure which one...
|
||||
Model number: (350-1100)
|
||||
Lens: Unknown
|
||||
Gain: 70
|
||||
Fibre optic cable: Red
|
||||
Aperture: None
|
||||
BNC: A4
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
MINI-SPEC (200 - 1000nm)
|
||||
--------------------------------------------------------------------------------
|
||||
Location: Pt5 looking out into the flow
|
||||
Filter: none
|
||||
Window: 3mm fused silica from OGP optics.
|
||||
Cable: New red cable
|
||||
Lens: N/A
|
||||
Delay: 80 us + 8 us internal
|
||||
Integration time: 20 us
|
||||
Aperture: N/A
|
||||
Trigger level: 1 V
|
||||
Filter: N/A
|
||||
Trigger: A5 cable from trigger box port 0, with vis
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Phantom
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Window : side
|
||||
Lens: Nikon AF Micro NIKKOR 105 mm focus
|
||||
Aperture-Number 11
|
||||
Frame Rates 110000.000 FPS
|
||||
Exposure: 1 us
|
||||
Gain: N/A
|
||||
Mode: External
|
||||
Delay: 0 microseconds
|
||||
Polarity: Pos
|
||||
Monitor Expose: off
|
||||
Filter:
|
||||
Cables: Trigger: B3 cable from trigger box port 2
|
||||
Monitor: H4 Cable
|
||||
|
||||
|
||||
UV phantom as well
|
||||
|
||||
LOG
|
||||
X2s5815
|
||||
Bad shot - very messy - oring ruptured in the secondary may have over pressurised with additional LAB Air.
|
||||
X2s5816
|
||||
Fired at 1.32Pa instead of 13.2pa.....
|
||||
x2s5826
|
||||
Phantom aperture was 18 in description for prev shot but was set to 22 for the prev shot
|
||||
Phantom trig signal changed from falling to rising
|
||||
|
288
main.py
288
main.py
@ -19,18 +19,25 @@ folders = ["./images"]
|
||||
for folder in folders:
|
||||
if not os.path.isdir(folder): os.mkdir(folder)
|
||||
|
||||
# Load Data
|
||||
# Data Paths
|
||||
DATA_PATH = "./data"
|
||||
DATA_INFO = "_info.yaml"
|
||||
TUNNEL_INFO_FILE = "./tunnel-info.yaml"
|
||||
SAMPLES_TO_AVG = 500
|
||||
|
||||
with open(TUNNEL_INFO_FILE, 'r') as file:
|
||||
TUNNEL_INFO = yaml.safe_load(file)
|
||||
|
||||
data_to_load = [
|
||||
"x2s5823",
|
||||
"x2s5824"
|
||||
"x2s5824",
|
||||
"x2s5827"
|
||||
]
|
||||
|
||||
data = {}
|
||||
|
||||
for dp in data_to_load:
|
||||
# ==== Data Loading & Processing ====
|
||||
def load_data(data_to_load: list[str]) -> dict:
|
||||
data = {}
|
||||
for dp in data_to_load:
|
||||
data_path = f"{DATA_PATH}/{dp}/"
|
||||
data_info_path = data_path + DATA_INFO
|
||||
if not os.path.exists(data_info_path):
|
||||
@ -38,19 +45,25 @@ for dp in data_to_load:
|
||||
print(f"[WARN] Not Loading Data '{dp}'")
|
||||
continue
|
||||
|
||||
# Load Shot Data Info YAML File (Cal)
|
||||
with open(data_info_path, 'r') as file:
|
||||
# Load data info (Cal)
|
||||
dataInfo = yaml.safe_load(file)
|
||||
|
||||
# Grab the shot name
|
||||
x2_shot = dataInfo["shot-info"]["name"]
|
||||
|
||||
x2_tdms_data = TdmsFile.read(data_path + dataInfo["shot-info"]['tdms'], raw_timestamps=False)
|
||||
# Load Raw Data
|
||||
# TDMS File (X2 DAQ Data)
|
||||
x2_tdms_data = TdmsFile.read(data_path + dataInfo["shot-info"]['tdms'], raw_timestamps=True)
|
||||
x2_channels = x2_tdms_data.groups()[0].channels()
|
||||
x2_channel_names = tuple(c.name for c in x2_channels)
|
||||
|
||||
# Scope info _if it exists_
|
||||
if dataInfo["probe-info"]["data-record"]["type"] == "scope":
|
||||
scope_data_path = data_path + dataInfo["probe-info"]["data-record"]["data"]
|
||||
scope_config_path = data_path + dataInfo["probe-info"]["data-record"]["config"]
|
||||
scope_config_path = data_path + dataInfo["probe-info"]["data-record"]["config"] # [TODO] Read this file
|
||||
|
||||
# Generate Headers
|
||||
# Generate Data Headers - This could be better
|
||||
with open(scope_data_path, 'r') as dfile:
|
||||
scope_header = []
|
||||
|
||||
@ -70,108 +83,213 @@ for dp in data_to_load:
|
||||
|
||||
scope_header.append(outStr)
|
||||
|
||||
#scope_data = pd.read_csv(scope_data_path, names=scope_header, skiprows=2)
|
||||
# Load the Scope CSV Data
|
||||
scope_data = np.loadtxt(scope_data_path, delimiter=',', skiprows=2)
|
||||
|
||||
|
||||
# Build a data object (this could be cached - or partially cached if I was clever enough)
|
||||
# Raw Data is always added - processing comes after
|
||||
data[x2_shot] = {
|
||||
"info": dataInfo,
|
||||
"shot_time": np.datetime64(f"{dataInfo["date"]}T{dataInfo["time"]}"),
|
||||
"raw-data":{
|
||||
"probe_headers": scope_header,
|
||||
"probes": scope_data,
|
||||
"x2": x2_channels,
|
||||
"x2-channels": x2_channel_names,
|
||||
"x2-tdms": x2_tdms_data
|
||||
},
|
||||
"time": {
|
||||
"x2": None,
|
||||
"trigger_index": None
|
||||
},
|
||||
"data": {
|
||||
"x2": {} # Only pop channels with a voltage scale in ./tunnel-info.yaml
|
||||
}
|
||||
}
|
||||
|
||||
loaded_data = list(data.keys())
|
||||
# === Process the data ===
|
||||
# Generate X2 time arrays
|
||||
time_data = x2_channels[0]
|
||||
|
||||
ns_time = time_data[:].as_datetime64('ns')
|
||||
x2_time_seconds = (ns_time - ns_time[0]) # timedelta64[ns]
|
||||
x2_time_us = x2_time_seconds.astype("float64") / 1000 # Scale to us
|
||||
|
||||
#second_fractions = np.array(time_data[:].second_fractions, dtype=int) # 2^-64 ths of a second
|
||||
#x2_time_seconds = (second_fractions - second_fractions[0]) / (2**(-64)) # 0 time data and convert to seconds
|
||||
#x2_time_us = x2_time_seconds * 1000 # Scale to us
|
||||
|
||||
# --- Un Scale Data ---
|
||||
for channel, vScale in TUNNEL_INFO["volt-scale"].items():
|
||||
# Get the channel index from its name
|
||||
chIndex = x2_channel_names.index(channel)
|
||||
|
||||
# Calculate the average noise offset
|
||||
avg_noise = x2_channels[chIndex][0:SAMPLES_TO_AVG].mean()
|
||||
|
||||
# Save the channel data
|
||||
data[x2_shot]["data"]["x2"][channel] = (x2_channels[chIndex][:] - avg_noise) * vScale
|
||||
|
||||
# Process Trigger Info
|
||||
trigger_volts = data[x2_shot]["data"]["x2"]["trigbox"] # Use a mean to offset
|
||||
x2_trigger_index = np.where(trigger_volts > 1)[0][0]
|
||||
x2_trigger_time = x2_time_us[x2_trigger_index]
|
||||
|
||||
# Add the time data
|
||||
data[x2_shot]["time"] = {
|
||||
"x2": x2_time_us,
|
||||
"trigger_index": x2_trigger_index
|
||||
}
|
||||
|
||||
|
||||
# Scope timing _if it exists_
|
||||
if dataInfo["probe-info"]["data-record"]["type"] == "scope":
|
||||
trigger_info = dataInfo["probe-info"]["data-record"]["trigger"] # Get the scope trigger info
|
||||
|
||||
# Calc the scope time & apply any manual offsets
|
||||
scope_time = (scope_data[:, 0] - scope_data[0, 0]) * 1e6 # to us
|
||||
scope_time -= trigger_info["alignment-offset"] # manual offset delay
|
||||
|
||||
# Trigger Alignment
|
||||
scope_trigger_volts = (scope_data[:, 3] - scope_data[0:SAMPLES_TO_AVG, 3].mean()) # Use a mean here too
|
||||
scope_trigger_index = np.where(scope_trigger_volts > 1)[0][0]
|
||||
scope_trigger_time = scope_time[scope_trigger_index]
|
||||
|
||||
scope_alignment = x2_trigger_time - scope_trigger_time
|
||||
|
||||
scope_time += scope_alignment
|
||||
|
||||
# Offset any trigger delays
|
||||
scope_time += trigger_info["delay"] # us delay from the actual trigger signal to the scope received trigger
|
||||
|
||||
data[x2_shot]["time"]["scope"] = scope_time
|
||||
data[x2_shot]["time"]["scope-offset"] = scope_alignment
|
||||
|
||||
data[x2_shot]["data"]["scope"] = {}
|
||||
for i, header in enumerate(scope_header):
|
||||
if i == 0: continue # Don't record time
|
||||
|
||||
# Python reference so its the same object
|
||||
ref = scope_data[:, i]
|
||||
data[x2_shot]["data"]["scope"][i] = ref
|
||||
data[x2_shot]["data"]["scope"][header] = ref
|
||||
|
||||
|
||||
# Find Shock Times
|
||||
# X2 - Canning Edge
|
||||
data[x2_shot]["shock-point"] = {}
|
||||
for ref in dataInfo["pcb-refs"]:
|
||||
refData = data[x2_shot]["data"]["x2"][ref]
|
||||
first_value, first_value_uncertainty, _, _ = canny_shock_finder(x2_time_us, refData, plot=False)
|
||||
shock_point = np.where(x2_time_us >= first_value)[0][0] # [BUG] Seems to give n+1
|
||||
|
||||
data[x2_shot]["shock-point"][ref] = shock_point, first_value
|
||||
|
||||
for i, probe in enumerate(dataInfo["probe-info"]["locations"]):
|
||||
probeCh1 = data[x2_shot]["data"]["scope"][1]
|
||||
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
|
||||
if i > 0:
|
||||
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
||||
offset = data[x2_shot]["shock-point"][f"{privPoint}-g1"][0][i-1] + 50
|
||||
else:
|
||||
offset = 0
|
||||
|
||||
shock_point = np.where(probeCh1[offset:] >= 0.3)[0] + offset
|
||||
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)
|
||||
#shock_point = np.where(scope_time >= first_value)[0][0] # [BUG] Seems to give n+1
|
||||
|
||||
#[HACK] For detection
|
||||
if i > 0:
|
||||
privPoint = dataInfo["probe-info"]["locations"][i-1]
|
||||
offset = data[x2_shot]["shock-point"][f"{privPoint}-g2"][0][i-1] + 50
|
||||
else:
|
||||
offset = 0
|
||||
shock_point = np.where(probeCh2[offset:] >= 0.3)[0] + offset
|
||||
first_value = scope_time[shock_point]
|
||||
data[x2_shot]["shock-point"][f"{probe}-g2"] = shock_point, first_value
|
||||
|
||||
|
||||
# Return the data & the successfully loaded data keys
|
||||
return data, tuple(data.keys())
|
||||
|
||||
data, loaded_data = load_data(data_to_load)
|
||||
print("Loaded Data")
|
||||
|
||||
|
||||
def process_data(gData):
|
||||
x2_time = (gData["x2"][0][:] - gData["x2"][0][0]).astype('timedelta64[ns]') # Convert x2 to timedelta64[ns]
|
||||
|
||||
trigger_info = gData["info"]["probe-info"]["data-record"]["trigger"] # Get the scope trigger info
|
||||
|
||||
# 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')
|
||||
|
||||
#start_time = np.datetime64(f"{gData["info"]["date"]}T{gData["info"]["time"]}")
|
||||
|
||||
start_time = 0
|
||||
x2_timesteps = np.array([0 for _ in x2_time])
|
||||
|
||||
for i, dt in enumerate(x2_time):
|
||||
dt = dt.astype("int")
|
||||
if i == 0:
|
||||
x2_timesteps[i] = start_time + dt # should be 0
|
||||
else:
|
||||
x2_timesteps[i] = x2_timesteps[i-1] + dt
|
||||
|
||||
return x2_time, scope_time, x2_timesteps
|
||||
|
||||
|
||||
def genGraph(gData):
|
||||
x2_time, scope_time = process_data(gData)
|
||||
|
||||
#[TODO] Refactor
|
||||
def genGraph(gData: dict, showPlot: bool = True):
|
||||
graphData = {
|
||||
"title": f"Shock response Time\nFor {gData['info']['long_name']}",
|
||||
"xLabel": "Time (ns)",
|
||||
"xLabel": "Time ($\\mu$s)",
|
||||
"yLabel": "Voltage Reading (V)",
|
||||
"grid": True,
|
||||
"plots": [
|
||||
{
|
||||
"x": x2_time,
|
||||
"y": (gData["x2"][4][:] - gData["x2"][4][0]) * 0.0148,
|
||||
"label": "ST1"
|
||||
},
|
||||
{
|
||||
"x": x2_time,
|
||||
"y": (gData["x2"][6][:] - gData["x2"][6][0]) * 0.0148,
|
||||
"label": "ST3"
|
||||
},
|
||||
{
|
||||
"x": x2_time,
|
||||
"y": (gData["x2"][16][:] - gData["x2"][16][0])/1000,
|
||||
"label": "Trigger"
|
||||
},
|
||||
|
||||
{
|
||||
"x": scope_time,
|
||||
"y": (gData["probes"][:, 1] - gData["probes"][0, 1]),
|
||||
"label": "ST2-G1"
|
||||
},
|
||||
{
|
||||
"x": scope_time,
|
||||
"y": (gData["probes"][:, 2] - gData["probes"][0, 2]),
|
||||
"label": "ST2-G2"
|
||||
},
|
||||
{
|
||||
"x": scope_time,
|
||||
"y": (gData["probes"][:, 3] - gData["probes"][0, 3]),
|
||||
"label": "ST2-Trigger"
|
||||
},
|
||||
|
||||
]
|
||||
"plots": []
|
||||
}
|
||||
|
||||
makeGraph(graphData)
|
||||
for label in gData["info"]["pcb-refs"] + ["trigbox"]:
|
||||
graphData["plots"].append({
|
||||
"x": gData["time"]["x2"],
|
||||
"y": gData["data"]["x2"][label],
|
||||
"label": label
|
||||
})
|
||||
|
||||
#print("Graphing Data")
|
||||
#genGraph(data[loaded_data[0]])
|
||||
#genGraph(data[loaded_data[1]])
|
||||
if label in gData["info"]["pcb-refs"]:
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"x": gData["shock-point"][label][1],
|
||||
"label": f"{label} - Shock Point {gData["shock-point"][label][1]:.2f}$\\mu$s",
|
||||
"colour": "gray",
|
||||
"args":{"zorder":2, "linestyle":"--"}
|
||||
})
|
||||
|
||||
|
||||
# Try to process things
|
||||
gData = data[loaded_data[0]]
|
||||
x2_time, scope_time, x2_timestamps = process_data(gData)
|
||||
for label, d in [("1 [V]", "G1"),("2 [V]", "G2"), ("4 [V]", "Gauge Trigger")]:
|
||||
graphData["plots"].append({
|
||||
"x": gData["time"]["scope"],
|
||||
"y": gData["data"]["scope"][label],
|
||||
"label": d
|
||||
})
|
||||
|
||||
time = (gData["x2"][0][:] - gData["x2"][0][0])
|
||||
for i, probe in enumerate(gData["info"]["probe-info"]["locations"]):
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"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",
|
||||
#"colour": "gray",
|
||||
"args":{"zorder":2, "linestyle":"--"}
|
||||
})
|
||||
graphData["plots"].append({
|
||||
"type": "axvLine",
|
||||
"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",
|
||||
#"colour": "gray",
|
||||
"args":{"zorder":2, "linestyle":"--"}
|
||||
})
|
||||
|
||||
x2_out = canny_shock_finder(time, (gData["x2"][4][:] - gData["x2"][4][0]) * 0.0148)
|
||||
makeGraph(graphData, doProgramBlock=False, showPlot=showPlot, figSavePath="./images/{0}.png")
|
||||
|
||||
print(x2_out)
|
||||
|
||||
# This forces matplotlib to hang untill I tell it to close all windows
|
||||
|
||||
print("Graphing Data")
|
||||
#genGraph(data[loaded_data[0]], showPlot=False)
|
||||
#genGraph(data[loaded_data[1]], showPlot=False)
|
||||
genGraph(data[loaded_data[2]], showPlot=False)
|
||||
|
||||
|
||||
#x2_out = canny_shock_finder(x2_time, (gData["raw-data"]["x2"][16][:] - gData["raw-data"]["x2"][16][0]))
|
||||
|
||||
#print(x2_out)
|
||||
|
||||
# This forces matplotlib to hang until I tell it to close all windows
|
||||
pltKeyClose()
|
||||
|
||||
print("Done")
|
||||
|
37
tunnel-info.yaml
Normal file
37
tunnel-info.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
distance:
|
||||
sd1: 2577 #mm
|
||||
sd2: 2810 #mm
|
||||
sd3: 3043 #mm
|
||||
|
||||
st1: 4231 #mm
|
||||
st2: 4746 #mm
|
||||
st3: 5260 #mm
|
||||
|
||||
at1: 6437 #mm
|
||||
at2: 6615 #mm
|
||||
at3: 6796 #mm
|
||||
|
||||
at4: 7590 #mm
|
||||
at5: 7846 #mm
|
||||
at6: 8096 #mm
|
||||
|
||||
|
||||
volt-scale:
|
||||
sd1: 0.00095 #V/kPa
|
||||
sd2: 0.00095 #V/kPa
|
||||
sd3: 0.000682 #V/kPa
|
||||
|
||||
st1: 0.01482 #V/kPa
|
||||
st2: 0.011687 #V/kPa
|
||||
st3: 0.0145 #V/kPa
|
||||
|
||||
at1: 0.01443 #V/kPa
|
||||
at2: 0.0145 #V/kPa
|
||||
at3: 0.0144798 #V/kPa
|
||||
|
||||
at4: 0.01435 #V/kPa
|
||||
at5: 0.01447 #V/kPa
|
||||
at6: 0.01442 #V/kPa
|
||||
|
||||
trigbox: 0.001 #V / mV
|
||||
trigbox_delay: 0.001 #V / mV
|
Loading…
x
Reference in New Issue
Block a user