Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9a19048
initial commit
ricd99 May 16, 2026
1a40b7f
added basic details
ricd99 May 18, 2026
7a7598d
add data tools
ricd99 May 18, 2026
ca45830
working basic data query script
ricd99 May 18, 2026
44db4cf
fix: acutal working basic query script
ricd99 May 18, 2026
8173aab
request speed, current, and break data; add current threshold
ricd99 May 18, 2026
41f397d
added numpy
ricd99 May 18, 2026
06c8f4a
upgrade data_tools and numpy
ricd99 May 19, 2026
e33b0de
extract cruising period given a cruise test window
ricd99 May 19, 2026
9d3162c
added start and end times for all 6 coast down tests
ricd99 May 19, 2026
b8bee91
imports
ricd99 May 19, 2026
497d631
remove unneccesary units argument on brake_pressed
ricd99 May 19, 2026
801f7f7
data query in notebook without serialization
ricd99 May 19, 2026
52baa41
loop to iterate over each test
ricd99 May 19, 2026
4a17db3
analysis acceleration stub
ricd99 May 20, 2026
2945b00
adjust test windows to include acceleration and braking times
ricd99 May 20, 2026
b80831e
temporarily move away cruise test window extraction code
ricd99 May 20, 2026
3d3cb16
initial plots of each cruise test
ricd99 May 20, 2026
4dcfe9e
rename project and add credit
ricd99 May 20, 2026
46a9e80
remove tests with regen
ricd99 May 20, 2026
f789ef0
compute acceleration
ricd99 May 20, 2026
d845287
initial acceleration vs. time plots
ricd99 May 21, 2026
12964e2
fix graphing logic (allow for 3+ brake presses)
ricd99 May 21, 2026
2ef3eeb
average accel in crusing window calculations
ricd99 May 21, 2026
b0bbced
accoutn for no brake runs and graph average deceleration
ricd99 May 21, 2026
109283b
add scipy import
ricd99 May 21, 2026
ff1f424
acceleration vs speed graphs
ricd99 May 21, 2026
f113882
decelerating force vs speed graphs
ricd99 May 21, 2026
00df78a
refactor: graph entire cruise test graphs in one loop
ricd99 May 22, 2026
b1eeb03
refactor: speed vs accel/force plots in one loop
ricd99 May 22, 2026
736541e
split up code chunks into logical blocks
ricd99 May 22, 2026
980a341
introduction and data acquisition comments
ricd99 May 23, 2026
c743533
fix plot names
ricd99 May 23, 2026
678d023
experimenting with curve smoothing
ricd99 May 23, 2026
729dcdc
fix data saving filepaths
ricd99 May 23, 2026
ac7fa0f
add clarity to comment
ricd99 May 23, 2026
848e869
identify imu static time window
ricd99 May 23, 2026
0764532
imu acceleration vs speed graphs
ricd99 May 23, 2026
30a8ac0
remove attempted serialization
ricd99 May 25, 2026
7d417c0
added comments and removed manually adding metadata
ricd99 May 25, 2026
ab7d39e
change filter parameters
ricd99 May 25, 2026
e589b0a
remove fit line from group plot (savgol)
ricd99 May 25, 2026
8776310
plotted group plot for regular accel, removed fit lines
ricd99 May 25, 2026
f723a4a
plotted group plot for all runs together
ricd99 May 26, 2026
08c83aa
consistent indents
ricd99 May 27, 2026
74b4407
consistenet quotes, separate colors
ricd99 May 27, 2026
ac1ae08
comment about tuning filter values
ricd99 May 27, 2026
36c4c69
add decelerating force plots for imu
ricd99 May 27, 2026
cdcdf2a
remove unneccessary type hinting
ricd99 May 27, 2026
0db50bb
adjust plot titles
ricd99 May 27, 2026
cc41a06
remove unused imports
ricd99 May 29, 2026
1e6f518
new
ricd99 May 30, 2026
c5ba9f4
additional comments
ricd99 Jun 1, 2026
c97d958
added markdown cells for explanation of code and results
ricd99 Jun 1, 2026
d4c86a0
more robust cruise start time idenitifier
ricd99 Jun 9, 2026
8bff79f
remove unccessary trimming of last array element with imu
ricd99 Jun 9, 2026
ab5af0f
continue removing unncessary trimming in np.polyfit section
ricd99 Jun 9, 2026
25e94a3
recalculate with new coefficients
ricd99 Jun 9, 2026
866eec5
restart notebook and final run
ricd99 Jun 9, 2026
d6fc80e
cleanup: add notebook pdf, add comment to data_query.py, delete unuse…
ricd99 Jun 9, 2026
9a2b259
readd title cell and remake pdf
ricd99 Jun 9, 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
24 changes: 24 additions & 0 deletions v4/drag_area_coefficient/PROJECT_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Project Template

This `project_template` folder is designed to be copy-pasted and adapted for every new UBC Solar Race Strategy data analysis project.

---

As with any template, use it as you see fit. **Feel free to remove unnecessary directories**.
The structure is in place to help guide new projects and to maintain consistency within this code repository.

However, **all new data analysis projects must**:



1. **Be completed in a new, standalone folder.**

If your work depends on the results of another project and the new project is still clearly distinct, either re-derive the values or add the required data to the new project's `/data` folder. Be sure to document where any data comes from.

2. **Use a project-specific [UV](https://docs.astral.sh/uv/) environment to manage dependencies**

// TODO: Add guide for UV

3. **Include documentation**

Documentation is required so that anyone can understand and reproduce your work. For Jupyter data analysis projects, writing out your process and thoughts in markdown is a simple and effective way to document your work. Be sure to include **your name**, **the date** and the **project name**.
13 changes: 13 additions & 0 deletions v4/drag_area_coefficient/data/DATA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Data

Use this folder to store any **project-specific** data such as `.csv`,
`.npy`, `.npz`, or `.pkl` files.

Ensure that large files (>50MB) are being tracked by Git LFS (Large File Storage),
so that the repository does not grow unnecessarily.

To list files under Git LFS, run:

```
git lfs ls-files
```
1,271 changes: 1,271 additions & 0 deletions v4/drag_area_coefficient/drag_area_coefficient.ipynb

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions v4/drag_area_coefficient/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[project]
name = "drag-area-coefficient"
version = "0.1.0"
requires-python = ">=3.14"
dependencies = [
"numpy>=2.4.6",
"ubc-solar-data-tools>=2.0.0",
]
25 changes: 25 additions & 0 deletions v4/drag_area_coefficient/results/RESULTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Results

Use this folder to store the results of your analysis,
like PDF files, images, tables or other data.

---

Jupyter notebooks alone can be complete enough as results,
but consider exporting them to PDF files to make the result more accessible.

To export a Jupyter notebook to pdf, the quickest way is to use a web converter.
https://onlineconvertfree.com/convert/ipynb/ works pretty well.

A command-line tool can be helpful if you want more control over the output or need to convert many files.
To convert to PDF on the command-line,

1. Install `nbconvert`

`uv add nbconvert`

You'll also need to install [Pandoc](https://minrk-nbconvert.readthedocs.io/en/stable/install.html#installing-pandoc) to convert to PDF.

2. Export the file

`\your_project> nbconvert .\example_notebook.ipynb --to pdf`
Binary file not shown.
4 changes: 4 additions & 0 deletions v4/drag_area_coefficient/scripts/SCRIPTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Scripts

This directory is for any scripts that are better suited in a distinct
Python (or other type of) file rather than inline in a Jupyter notebook.
66 changes: 66 additions & 0 deletions v4/drag_area_coefficient/scripts/data_query.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""
Experimenting with querying data from InfluxDB. Not used in the final analysis.
"""


import numpy as np
from data_tools.collections import TimeSeries
from data_tools.query import DBClient
from datetime import datetime

PACK_CURRENT_THRESHOLD = 0.10682 # pack current never reads 0; its lowest value is this constant (constant is rounded up here)

if __name__ == "__main__":
client = DBClient()

start_times = [datetime.fromisoformat("2026-04-02T20:02:30Z"),
datetime.fromisoformat("2026-04-02T20:07:10Z"),
datetime.fromisoformat("2026-04-02T20:26:05Z"),
datetime.fromisoformat("2026-04-02T20:35:40Z"),
datetime.fromisoformat("2026-04-02T21:05:25Z"),
datetime.fromisoformat("2026-04-02T21:10:30Z"),]

stop_times = [datetime.fromisoformat("2026-04-02T20:03:10Z"),
datetime.fromisoformat("2026-04-02T20:07:30Z"),
datetime.fromisoformat("2026-04-02T20:26:24Z"),
datetime.fromisoformat("2026-04-02T20:36:15Z"),
datetime.fromisoformat("2026-04-02T21:05:40Z"),
datetime.fromisoformat("2026-04-02T21:10:40Z"),]

for start, stop in zip(start_times, stop_times):
motor_rotating_speed: TimeSeries = client.query_time_series(
start=start,
stop=stop,
field="MotorRotatingSpeed",
units="km/h"
)

pack_current: TimeSeries = client.query_time_series(
start=start,
stop=stop,
field="PackCurrent",
units="A"
)

brake_pressed: TimeSeries = client.query_time_series(
start=start,
stop=stop,
field="BrakePressed",
)

cruise_start_index = np.where(pack_current <= PACK_CURRENT_THRESHOLD)[0][0]
cruise_end_index = np.where(brake_pressed > 0)[0][0]

cruise_start_time = pack_current.datetime_x_axis[cruise_start_index]
cruise_end_time = brake_pressed.datetime_x_axis[cruise_end_index]

cruise_speed: TimeSeries = motor_rotating_speed.slice(cruise_start_time, cruise_end_time)
cruise_speed.meta = motor_rotating_speed.meta
cruise_speed.plot()







Loading