Skip to content

Commit 63dc76d

Browse files
author
Jordan Benjamin
committed
fix annotations on boolean kwargs, fix usage on boolean kwargs, fix erroneous jet failure on progressmeter
1 parent ed95f81 commit 63dc76d

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

src/Calculations.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ function serial_calculate_structure_function(
722722
distance_bins::AbstractVector{<:Tuple{FT3, FT3}},
723723
::Val{RSAC};
724724
distance_metric::DI.PreMetric = DI.Euclidean(),
725-
verbose = true,
726-
show_progress = true,
725+
verbose::Bool = true,
726+
show_progress::Bool = true,
727727
) where {T1, T2, FT3, RSAC}
728728
N = length(x_vecs)
729729
FT1 = eltype(T1)
@@ -752,7 +752,7 @@ function serial_calculate_structure_function(
752752
iter_inds = eachindex(x_vecs[1])
753753
# Pass Val(length(x_vecs)) to make it a type parameter in the work function
754754
vN = Val(length(x_vecs))
755-
for i in iter_inds
755+
PM.@showprogress enabled = show_progress for i in iter_inds
756756
calculate_structure_function_i!(
757757
output,
758758
counts,
@@ -871,9 +871,9 @@ function calculate_structure_function(
871871
distance_bins::Int;
872872
distance_metric::DI.PreMetric = DI.Euclidean(),
873873
bin_spacing = :logarithmic,
874-
verbose = true,
875-
show_progress = true,
876-
return_sums_and_counts = false,
874+
verbose::Bool = true,
875+
show_progress::Bool = true,
876+
return_sums_and_counts::Bool = false,
877877
) where {T1, T2}
878878
N = length(x_vecs)
879879
"""
@@ -1012,8 +1012,8 @@ function serial_calculate_structure_function(
10121012
distance_bins::AbstractVector{Tuple{FT3, FT3}},
10131013
::Val{RSAC};
10141014
distance_metric::DI.PreMetric = DI.Euclidean(),
1015-
verbose = true,
1016-
show_progress = true,
1015+
verbose::Bool = true,
1016+
show_progress::Bool = true,
10171017
) where {FT1 <: Number, FT2 <: Number, FT3 <: Number, RSAC}
10181018
N3 = length(distance_bins)
10191019
# calculate and bin and mean the pairwise distances
@@ -1038,7 +1038,7 @@ function serial_calculate_structure_function(
10381038
iter_inds = axes(x_arr, 2)
10391039
N = size(x_arr, 1)
10401040
if N == 1
1041-
for i in iter_inds
1041+
PM.@showprogress enabled = show_progress for i in iter_inds
10421042
calculate_structure_function_i!(
10431043
output,
10441044
counts,
@@ -1052,7 +1052,7 @@ function serial_calculate_structure_function(
10521052
)
10531053
end
10541054
elseif N == 2
1055-
for i in iter_inds
1055+
PM.@showprogress enabled = show_progress for i in iter_inds
10561056
calculate_structure_function_i!(
10571057
output,
10581058
counts,
@@ -1066,7 +1066,7 @@ function serial_calculate_structure_function(
10661066
)
10671067
end
10681068
elseif N == 3
1069-
for i in iter_inds
1069+
PM.@showprogress enabled = show_progress for i in iter_inds
10701070
calculate_structure_function_i!(
10711071
output,
10721072
counts,
@@ -1142,9 +1142,9 @@ function calculate_structure_function(
11421142
distance_bins::Int;
11431143
distance_metric::DI.PreMetric = DI.Euclidean(),
11441144
bin_spacing = :logarithmic,
1145-
verbose = true,
1146-
show_progress = true,
1147-
return_sums_and_counts = false,
1145+
verbose::Bool = true,
1146+
show_progress::Bool = true,
1147+
return_sums_and_counts::Bool = false,
11481148
) where {FT1 <: Number, FT2 <: Number}
11491149
"""
11501150
Here we assume that the distance bins are evenly spaced

test/test_jet.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ Test.@testset "JET Stability Audit" begin
2626
show_progress = false,
2727
)
2828
# Test the convenience entry point for correctness (call)
29-
JET.@test_call SFC.calculate_structure_function(
29+
# Only analyze StructureFunctions module code, not external packages like ProgressMeter
30+
# which do compile-time checks for Main.IJulia that may not be present.
31+
# See: https://github.com/timholy/ProgressMeter.jl/issues/348
32+
JET.@test_call target_modules = (SF,) SFC.calculate_structure_function(
3033
sf_type,
3134
x,
3235
u,
@@ -50,7 +53,10 @@ Test.@testset "JET Stability Audit" begin
5053
show_progress = false,
5154
)
5255
# Test the convenience entry point for correctness (call)
53-
JET.@test_call SFC.calculate_structure_function(
56+
# Only analyze StructureFunctions module code, not external packages like ProgressMeter
57+
# which do compile-time checks for Main.IJulia that may not be present.
58+
# See: https://github.com/timholy/ProgressMeter.jl/issues/348
59+
JET.@test_call target_modules = (SF,) SFC.calculate_structure_function(
5460
sf_type,
5561
xa,
5662
ua,

0 commit comments

Comments
 (0)