Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
4ffbecf
Added Plot viewer and added tests
Gauthamhimself Nov 30, 2025
bfca9b7
Added average value for all temperature readings
Gauthamhimself Dec 7, 2025
12d7c4c
Plot Predicted Temperature and Actual Temperature
Gauthamhimself Jan 9, 2026
d8871c1
Add blueMaxDragAnalysis.py for drag analysis
rchatterjee5 Apr 2, 2026
2a8d949
Add speed-drag comparison visualization script
purnimaa24 Apr 2, 2026
4b5e575
Update README with drag calculations and analysis
rchatterjee5 Apr 3, 2026
47413c9
Enhance Drag Calculations section in README
rchatterjee5 Apr 3, 2026
2fd8c5e
Enhance Drag Calculations with new speed graphs
rchatterjee5 Apr 3, 2026
a3641ae
Enhance README with updated drag graphs
purnimaa24 Apr 3, 2026
2bee6cb
sensor_optimal_frequency.py
aanyajain6 Apr 6, 2026
966914a
sensor_optimal_frequency.py
aanyajain6 Apr 6, 2026
2a86aa4
Delete sensor_optimal_frequency.py
aanyajain6 Apr 6, 2026
7a5a1c3
Create sensor_optimal_frequency
aanyajain6 Apr 6, 2026
6925880
Create sensor_optimal_frequency_graphs.md
aanyajain6 Apr 6, 2026
5a2e736
Update sensor_optimal_frequency_graphs.md
aanyajain6 Apr 6, 2026
e9e7b44
Enhance README
rchatterjee5 Apr 6, 2026
3670fc8
moved and some notes
goob10000 Apr 6, 2026
8388c28
Update README.md
rchatterjee5 Apr 7, 2026
a22820b
Create drag_test.md
rchatterjee5 Apr 7, 2026
9ff4f03
changed speeds
rchatterjee5 Apr 7, 2026
339e67c
Update README.md
rchatterjee5 Apr 7, 2026
167d357
Create test
rchatterjee5 Apr 7, 2026
ec13a56
Add files via upload
rchatterjee5 Apr 7, 2026
f65900f
Update and rename test to damping_forces.py
rchatterjee5 Apr 7, 2026
dafd550
Create wheel_speed_br.py
aanyajain6 Apr 9, 2026
4ebb758
Add files via upload
aanyajain6 Apr 9, 2026
fee1af7
Create wheel_speed_fl.py
aanyajain6 Apr 9, 2026
6c5f57f
Add files via upload
aanyajain6 Apr 9, 2026
ccf0a8f
Create wheel_speed_fr.py
aanyajain6 Apr 9, 2026
932b28b
Add files via upload
aanyajain6 Apr 9, 2026
2f255cb
Create wheel_speed_bl.py
aanyajain6 Apr 9, 2026
6f33ac4
Add files via upload
aanyajain6 Apr 9, 2026
213bc39
Create suspension_travel_fr.py
aanyajain6 Apr 9, 2026
e03609b
Add files via upload
aanyajain6 Apr 9, 2026
86cddfa
Create suspension_travel_bl.py
aanyajain6 Apr 9, 2026
43f9448
Add files via upload
aanyajain6 Apr 9, 2026
5091f1c
Create suspension_travel_br.py
aanyajain6 Apr 9, 2026
601c881
Add files via upload
aanyajain6 Apr 9, 2026
26ebb14
Create tire_temp_fl.py
aanyajain6 Apr 9, 2026
55cf578
Add files via upload
aanyajain6 Apr 9, 2026
78ff055
Create tire_temp_bl.py
aanyajain6 Apr 9, 2026
b2689c0
Create tire_temp_bl.py
aanyajain6 Apr 9, 2026
782c112
Add files via upload
aanyajain6 Apr 9, 2026
325235a
Create brake_temp.py
aanyajain6 Apr 9, 2026
afdf391
Add files via upload
aanyajain6 Apr 9, 2026
3dc9dcb
Create apps.py
aanyajain6 Apr 9, 2026
5285d4b
Add files via upload
aanyajain6 Apr 9, 2026
9c37e4b
Create battery_voltage.py
aanyajain6 Apr 9, 2026
6589147
Add files via upload
aanyajain6 Apr 9, 2026
ffe5797
Create battery_current.py
aanyajain6 Apr 9, 2026
fb6d06b
Add files via upload
aanyajain6 Apr 9, 2026
689f544
Create battery_tray_temp.py
aanyajain6 Apr 9, 2026
7f0f610
Add files via upload
aanyajain6 Apr 9, 2026
707649e
Create cell_temp.py
aanyajain6 Apr 9, 2026
c222874
Add files via upload
aanyajain6 Apr 9, 2026
6c2fdae
Create cell_voltage.py
aanyajain6 Apr 9, 2026
c004afe
Add files via upload
aanyajain6 Apr 9, 2026
de53561
examples and notes
goob10000 Apr 10, 2026
9f5283e
added calcYawRate, added InitVelY and InitYawRate in params.json5, in…
NoahSantos06 Apr 11, 2026
6a6be8b
working on replacing brian's tire model with existing one. Need to fi…
NoahSantos06 Apr 12, 2026
d61af8b
fixed an issue where a cosine of a value was used instead of the actu…
Apr 15, 2026
5e3d4f1
Merge pull request #54 from formulaslug/brian-double-bicycle-fix
DanielRhee Apr 15, 2026
d73b55c
Create downforce_from_suspension.py
purnimaa24 Apr 17, 2026
347f204
Implement downforce estimation from suspension data
purnimaa24 Apr 17, 2026
8232958
working on replacing brain's tire model with the existing TireModel
NoahSantos06 Apr 19, 2026
42b3f33
integrated existing tire model with brian's DoubleBicycleModel, but t…
NoahSantos06 Apr 20, 2026
8f4d838
Refactor downforce calculation and improve validation
purnimaa24 Apr 20, 2026
88acf07
Update plot comment to reflect raw travel
purnimaa24 Apr 20, 2026
18ba755
updated downforce calculation code
purnimaa24 Apr 20, 2026
f9fab36
adding codespace work
rchatterjee5 Apr 25, 2026
4d3a5e3
Create graphs
aanyajain6 Apr 28, 2026
b077b88
Update summary.md
aanyajain6 Apr 28, 2026
692c4e8
Update apps.py
aanyajain6 Apr 28, 2026
71c640d
Update battery_current.py
aanyajain6 Apr 28, 2026
ea1b28f
Update battery_tray_temp.py
aanyajain6 Apr 28, 2026
c954bed
Update battery_voltage.py
aanyajain6 Apr 28, 2026
9808897
Update brake_temp.py
aanyajain6 Apr 28, 2026
01e6968
Update cell_temp.py
aanyajain6 Apr 28, 2026
4919f1b
Update cell_voltage.py
aanyajain6 Apr 28, 2026
cb5de08
Update suspension_travel_bl.py
aanyajain6 Apr 28, 2026
5317976
Update suspension_travel_br.py
aanyajain6 Apr 28, 2026
459fd14
Update suspension_travel_fr.py
aanyajain6 Apr 28, 2026
4254075
Update tire_temp_bl.py
aanyajain6 Apr 28, 2026
1875798
Update tire_temp_fl.py
aanyajain6 Apr 28, 2026
7d1362b
Update wheel_speed_bl.py
aanyajain6 Apr 28, 2026
6284e80
Update wheel_speed_br.py
aanyajain6 Apr 28, 2026
cd5b80d
Update wheel_speed_fl.py
aanyajain6 Apr 28, 2026
eaa8115
Update wheel_speed_fr
aanyajain6 Apr 28, 2026
3ffb7bb
codespace changes
rchatterjee5 Apr 29, 2026
90a1211
changes
rchatterjee5 Apr 29, 2026
9bad47f
Correct image syntax in summary.md
goob10000 Apr 30, 2026
78d28a9
Merge pull request #14 from gvinod-cpu/br_temp_plotting
goob10000 May 4, 2026
99017e9
Add files via upload
aanyajain6 May 4, 2026
d87902a
Delete Data/SensorFrequencyAnalysis/import scipy import numpy as np i…
aanyajain6 May 4, 2026
9ac40ae
luca + my code to account for preload
rchatterjee5 May 12, 2026
40aa722
changes for prelpad
rchatterjee5 May 12, 2026
9a8d73c
changes for preload and compression/expansion
rchatterjee5 May 12, 2026
f3fdf0c
Add downforce calculation details to README
rchatterjee5 May 16, 2026
e2b68e2
deleted 2 csvs from git history
goob10000 May 20, 2026
b7857c6
bit of moving and cleanup
goob10000 May 20, 2026
b23f727
Merge pull request #57 from formulaslug/43-drag-and-downforce-calcula…
goob10000 May 20, 2026
b5af27f
Merge pull request #58 from formulaslug/39-determine-sensor-optimal-f…
goob10000 May 20, 2026
7f65507
changed it so the two front tires are two different objects and use t…
NoahSantos06 May 25, 2026
64aec7e
fixed a lateralforce accidentally had both computing with fl object
NoahSantos06 May 25, 2026
50db044
changed all np.ndarray to ndarray[np.float64]
NoahSantos06 May 28, 2026
8a425b2
Fix brake temperature channel labels in Columns.csv
goob10000 Jun 3, 2026
bd21d9f
Update Columns.csv
goob10000 Jun 3, 2026
6998e36
Merge branch 'main-sim-maintenence' into noah-main-sim-maintenence
goob10000 Jul 21, 2026
8263d51
comments and typing cleanup
goob10000 Jul 22, 2026
477ecae
more cleanup and comments
goob10000 Jul 22, 2026
3354906
Delete simulation_output.parquet
goob10000 Jul 22, 2026
2510ab1
fixed some class stuff and switched math lib to np
goob10000 Jul 22, 2026
73ac1d2
fixing class mess
goob10000 Jul 22, 2026
cda090e
make errors go away but not fixed yet
goob10000 Jul 25, 2026
d0ca15a
more
goob10000 Jul 25, 2026
6a162f9
cleaning parameters usage
goob10000 Jul 25, 2026
5d66151
useful stuff
goob10000 Jul 25, 2026
b7fef8b
more typing
goob10000 Jul 26, 2026
5d4f29b
more cleanup
goob10000 Jul 26, 2026
bcd351f
deprecate vehicle params class and more cleanup
goob10000 Jul 26, 2026
54bec76
a few more key fixes
goob10000 Jul 26, 2026
d2f9d2e
welp, another off by 1 error
goob10000 Jul 26, 2026
16cafb6
Merge branch 'main' into noah-main-sim-maintenence
goob10000 Jul 29, 2026
899818a
more stuff
goob10000 Jul 29, 2026
77b81ec
remove self done integral
goob10000 Jul 29, 2026
39a099a
Merge branch 'main' into noah-main-sim-maintenence
goob10000 Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,4 @@ Projects/.DS_Store
.fake
*.joblib
FullVehicleSim/simulation_output.parquet
.vscode/settings.json
29 changes: 15 additions & 14 deletions Data/FSLib/IntegralsAndDerivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from scipy.integrate import RK45
# from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
from scipy.integrate import cumulative_trapezoid


# lat = "VDM_GPS_Latitude"
Expand Down Expand Up @@ -67,20 +68,20 @@ def mag (a, b, c):
# print(f"mag = {np.sqrt(a**2 + b**2 + c**2)}")
return np.sqrt(a**2 + b**2 + c**2)

def in_place_integrate (derivative, dt=0.01): #Rimann sum that returns an array of the intergral at that point. Assumes dt of 0.01
if len(derivative.shape) == 1:
width = 1
else:
width = derivative.shape[1]
container = derivative[0]
out = np.zeros((derivative.shape[0], width))
out[0] = container*dt
for i in range(1, derivative.shape[0]):
container += dt*derivative[i]
# print(f"added {0.01*derivative[i]} to {container}")
out[i] = container
# print(f"out of integral is {out}")
return out
def in_place_integrate (derivative, t, initial=0): #Rimann sum that returns an array of the intergral at that point. Assumes dt of 0.01
# if len(derivative.shape) == 1:
# width = 1
# else:
# width = derivative.shape[1]
# container = derivative[0]
# out = np.zeros((derivative.shape[0], width))
# out[0] = container*dt
# for i in range(1, derivative.shape[0]):
# container += dt*derivative[i]
# # print(f"added {0.01*derivative[i]} to {container}")
# out[i] = container
# # print(f"out of integral is {out}")
return cumulative_trapezoid(derivative, t, initial)

def integrate_with_tCol (col, timeCol):
if col.len() != timeCol.len():
Expand Down
32 changes: 32 additions & 0 deletions Data/README_TRACTIVE_THERMAL_MODELING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Run Thermal Modeling
Todo

### Run Tests

```bash
python -m unittest discover -s test
```

#### Plot the curve
```bash
python ./TractiveBatteryThermalModelViewer.py -h
usage: TractiveBatteryThermalModelViewer.py [-h] --path_parquet PATH_PARQUET [--column-name COLUMN_NAME] [--t-end T_END] [--initial-temp INITIAL_TEMP]

View tractive battery thermal model as a function of current draw.

options:
-h, --help show this help message and exit
--path_parquet PATH_PARQUET
Path to the Parquet file containing current data.
--column-name COLUMN_NAME
Name of the current column in the Parquet file (default: SME_TEMP_BusCurrent).
--t-end T_END End time in seconds for the simulation (default: 60).
--initial-temp INITIAL_TEMP
Initial temperature in °C (default: 22).
```

Example Command :

```
python TractiveBatteryThermalModelViewer.py --path_parquet <file_name>
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/01112026/011026-23.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ETC_STATUS_PEDAL_TRAVEL"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [6, 6.5, 7]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("APPS - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("APPS - Frequency Spectrum")
plt.show()
Binary file added Data/SensorFrequencyAnalysis/apps_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Data/SensorFrequencyAnalysis/apps_log_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/battery_current.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/11222025/11222025_22.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ACC_POWER_CURRENT"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [5, 6, 7]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Battery Current - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Battery Current - Frequency Spectrum")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/battery_tray_temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/11222025/11222025_1.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ACC_TRAY_TEMPS_BUSBAR"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [4, 5, 6]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Battery Tray Temp - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Battery Tray Temp - Frequency Spectrum")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/battery_voltage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/01112026/011026-14.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ACC_POWER_PACK_VOLTAGE"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [4.5, 5.5, 6.5]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Battery Voltage - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Battery Voltage - Frequency Spectrum")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Data/SensorFrequencyAnalysis/brake_temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/brake_temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/11222025/11222025_1.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["IZZE_BRAKETEMP_S1_CH1"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [5.5, 6.5, 7.5]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Brake Temp - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Brake Temp - Frequency Spectrum")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/cell_temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/11222025/11222025_1.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ACC_SEG0_TEMPS_CELL0"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [4.5, 5.5, 6.5]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Cell Temp - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Cell Temp - Frequency Spectrum")
plt.show()
Binary file added Data/SensorFrequencyAnalysis/cell_temp_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Data/SensorFrequencyAnalysis/cell_voltage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import scipy
import numpy as np
import polars as pl
import matplotlib.pyplot as plt

df = pl.read_parquet('/Users/aanyajain/Documents/GitHub/fs-data/FS-3/01112026/011026-14.parquet')
df = df.fill_null(strategy="forward").fill_null(strategy="backward")
signal = df["ACC_SEG0_VOLTS_CELL0"].to_numpy()

fft = scipy.fft.fft(signal)
freqs = scipy.fft.fftfreq(len(signal), d=0.01)

attempts = [1.5, 2.5, 3.5]
ffts = []
iffts = []
for i, attempt in enumerate(attempts):
ffts.append(fft.copy())
ffts[-1][np.log(np.abs(fft)) < attempt] = 0
ifft = scipy.fft.ifft(ffts[-1])
iffts.append(ifft)

RMSs = [np.sqrt(np.mean((ifft.real - signal)**2)) for ifft in iffts]
plt.plot(attempts, RMSs)
plt.xlabel("Attempt")
plt.ylabel("RMS")
plt.title("Cell Voltage - RMS vs Attempt")
plt.show()

plt.plot(signal, label="Real")
for ifft, attempt in zip(iffts, attempts):
plt.plot(ifft.real, label=f"Attempt {attempt}")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.legend()
plt.show()

plt.scatter(freqs, np.log(np.abs(fft)), s=0.25)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("Cell Voltage - Frequency Spectrum")
plt.show()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading