Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove unused code #326

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Folds = "41a02a25-b8f0-4f67-bc48-60067656b558"
Git = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
ImageAxes = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac"
Expand Down Expand Up @@ -54,7 +53,6 @@ TiledIteration = "06e1c1a7-607b-532d-9fad-de7d9aa2abac"
UpdateJulia = "770da0de-323d-4d28-9202-0e205c1e0aff"

[compat]
julia = "1.8"
AxisArrays = "0.4.6"
Clustering = "0.15.2"
ColorTypes = "0.11.4"
Expand All @@ -64,7 +62,6 @@ DataFrames = "1.5.0"
DataStructures = "0.18.13"
FFTW = "1.6.0"
FileIO = "1.16.1"
Folds = "0.2.8"
Git = "1.3.0"
HDF5 = "0.16.14"
ImageAxes = "0.6.10"
Expand Down Expand Up @@ -93,6 +90,7 @@ StaticArrays = "1.5.25"
StatsBase = "0.33.21"
TiledIteration = "0.3.1"
UpdateJulia = "0.4.2"
julia = "1.8"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
1 change: 0 additions & 1 deletion src/IceFloeTracker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ using DSP
using StaticArrays
using OffsetArrays: centered
using Serialization: serialize, deserialize
using Folds

export readdlm,
padnhood,
Expand Down
21 changes: 0 additions & 21 deletions src/tracker/matchcorr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,3 @@ function corr(p1::T, p2::T) where {T<:AbstractArray}
cc, _ = maximum.(IceFloeTracker.crosscorr(p1, p2; normalize=true))
return cc
end

function matchcorr_simple(
f1::T, f2::T, psi::F=0.95, size::S=16, comp::F=0.25
) where {T<:AbstractArray{Bool,2},S<:Int64,F<:Float64}

# check if the floes are too small and size are comparable
sz = size.([f1, f2])
if (any([(sz...)...] .< size) || getsizecomparability(sz...) > comp)
@warn "Floes are too small or their sizes are not comparable"
return NaN
end

_psi = buildψs.([f1, f2])
c = corr(_psi...)

if c < psi
@warn "correlation too low, c: $c"
return NaN
end
return c
end
69 changes: 0 additions & 69 deletions src/tracker/tracker-funcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,43 +160,6 @@ function mean(x::T, y::T)::Float64 where {T<:Real}
return (x + y) / 2
end

"""
propmatrix2df(propmatrix)

Convert floe properties matrix `propmatrix` to a dataframe-like struct with fields `area`, `major_axis_length`, `minor_axis_length`, `convex_area`, `x_coord`, `y_coord` for the tacker step. Used for development purposes. TODO: remove this function when development is complete.
"""
function propmatrix2df(propmatrix)
# convert props_day1 to dataframe with column names area, majoraxis, minoraxis, convex_area, coords
return DataFrame(
propmatrix,
[
:area,
:perimeter,
:major_axis_length,
:minor_axis_length,
:orientation,
:row_centroid,
:col_centroid,
:convex_area,
:solidity,
:left,
:top,
:width,
:height,
],
)
# Props((col for col in eachcol(propmatrix[:, [1, 3, 4, 8, 6, 7]]))...)
end

"""
poprow!(df::DataFrame, idx::Int64)

"""
function poprow!(df::DataFrame, idx::Int64)
deleteat!(df, idx)
return nothing
end

"""
makeemptydffrom(df::DataFrame)

Expand Down Expand Up @@ -395,19 +358,6 @@ function getpropsday1day2(properties, dayidx::Int64)
return copy(properties[dayidx]), copy(properties[dayidx + 1])
end

"""
addmorematches!(matchingfloes, props_day, numtodadd=5)

Add `numtodadd` more matches to `matchingfloes` using the floes in `props_day`.
"""
function addmorematches!(matchingfloes, props_day, numtodadd=5)
for j in 1:numtodadd
s = rand(1:4)
appendrow!(matchingfloes, props_day[s, :], randratios(), s)
end
return nothing
end

"""
getbestmatchdata(idx, r, props_day1, matching_floes)

Expand Down Expand Up @@ -506,18 +456,6 @@ end

isnotnan(x) = !isnan(x)

# generate random ratio data
function randratios()
return (
area=rand(),
majoraxis=rand(),
minoraxis=rand(),
convex_area=rand(),
area_under=rand(),
corr=rand(),
)
end

# match_corr related functions

"""
Expand All @@ -530,13 +468,6 @@ function corr(p1, p2)
return cc
end

"""
myargmax(mms)

Return the index of the maximum value in `mms` and the maximum value.
"""
myargmax(mms) = (max=maximum(mms), idx=argmax(mms) + 1)

"""
normalizeangle(revised,t=180)

Expand Down
Loading