Skip to content

Commit

Permalink
Merge pull request #532 from WilhelmusLab/feat(long-tracker)--add-sep…
Browse files Browse the repository at this point in the history
…arate-uuid-function

Feat(long tracker): add separate UUID function
  • Loading branch information
hollandjg authored Dec 19, 2024
2 parents 0f9ff23 + 0e0f6c2 commit d2aeb89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tracker/long_tracker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Trajectories are built in two steps:
- "orientation"
- "perimeter"
- "mask": 2D array of booleans
- "ID": unique identifier
- "passtime": A timestamp for the floe
- "psi": the psi-s curve for the floe
- "uuid": a universally unique identifier for each segmented floe
- `condition_thresholds`: 3-tuple of thresholds (each a named tuple) for deciding whether to match floe `i` from day `k` to floe j from day `k+1`
- `mc_thresholds`: thresholds for area mismatch and psi-s shape correlation
Expand Down
12 changes: 12 additions & 0 deletions src/tracker/tracker-funcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,3 +683,15 @@ function dropcols!(df, colstodrop)
select!(df, Not(colstodrop))
return nothing
end

function adduuid!(df::DataFrame)
df.uuid = [randstring(12) for _ in 1:nrow(df)]
return df
end

function adduuid!(dfs::Vector{DataFrame})
for (i, df) in enumerate(dfs)
adduuid!(dfs[i])
end
return dfs
end
4 changes: 1 addition & 3 deletions src/tracker/tracker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ function _pairfloes(
sort_floes_by_area!(props)

# Assign a unique ID to each floe in each image
for (i, prop) in enumerate(props)
props[i].uuid = [randstring(12) for _ in 1:nrow(prop)]
end
adduuid!(props)

add_passtimes!(props, passtimes)

Expand Down

0 comments on commit d2aeb89

Please sign in to comment.