Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jsliacan/overtaking
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8d310c0e89a8dfba54d87524cd67113296f53f1e
Choose a base ref
..
head repository: jsliacan/overtaking
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e48c1139208c767b3fe2e637d321115f79d59925
Choose a head ref
Showing with 15 additions and 10 deletions.
  1. +5 −5 README.md
  2. +10 −5 src/modularity.py
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,18 +13,18 @@ We have access to various data taken while riding a bike in traffic (focus is on
A non-commercial (DIY) device that we have access to for measuring lateral distance to the road-side of the bike until the next object or up to ~6 meters.

The box measures lateral distance at frequency of 22Hz and creates a record in a csv/txt file with some metadata attached to each such lateral distance measurement (see prinscreen for an idea of what it looks like):
1. Time stamp (if it happens to be a full second, i.e. every 22nd time)
2. GPS position
1. Time stamp (if it happens to be a full second, i.e. every 22nd time)
2. GPS position (lat, long)
3. Speed (of the bike where the box is)
4. Lateral distance to the next object or max out
5. Event (button press: 0/1)
4. Lateral distance to the next object or max out
5. Button press: 0/1


![Box file](figures/box_file_preview.png)

The rider presses a button when an event is happening. Short button press for oncoming pass, long press for overtaking pass.

For this project, we keep the data from alld evices in the following structure. It simplifies the utility functions. Camera files (videos) are too big to casually keep with the rest of the data, so we access them individually.
For this project, we keep the data from all devices in the following structure. It simplifies the utility functions. Camera files (videos) are too big to casually keep with the rest of the data, so we access them individually.

``` text
BikeLogs
15 changes: 10 additions & 5 deletions src/modularity.py
Original file line number Diff line number Diff line change
@@ -138,6 +138,11 @@ def dispersion_score(L):

def strip_and_split(part, lat_dists, threshold):
"""
If the part consists of multiple "events" (has a few horizontal parts with too much time separation)
then split the part into subparts. However, ignore subparts that are too small (<4 in length). Except if
it's the first part on the very left of the interval (contains index 0). Then keep that - it might correspond
to an event that overlaps with the button press.
INPUT:
part - a list representing a part in a partition of vertices (indices corresponding to values in lat_dists
lat_dists - a list of lateral distances associated with a certain button press
@@ -167,13 +172,13 @@ def strip_and_split(part, lat_dists, threshold):
subparts.append(sp)
sp = []

# discard subparts of length 4 or less
# discard subparts of length 3 or less, unless at the beginning (overlap with press)
no_tiny_subparts = []
for sp in subparts:
if len(sp) > 4:
if sp[0] == 0:
no_tiny_subparts.append(sp)
continue
if len(sp) > 3:
no_tiny_subparts.append(sp)

# print("orig. part:", part)
# print("subparts :", subparts)
# print("no_tiny :", no_tiny_subparts)
return no_tiny_subparts