Skip to content

Commit

Permalink
binslop
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardBerman committed Aug 9, 2024
1 parent 35f4bd9 commit f1dc8c0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/corr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module astrocorr
corr_metric=corr_metric_default,
splitter=split_galaxy_cells!,
max_depth=3,
bin_slop=3,
bin_slop=nothing,
verbose=false)
@assert length(ra) == length(dec) == length(corr1) == length(corr2) "ra, dec, corr1, and corr2 must be the same length"

Expand Down Expand Up @@ -199,7 +199,7 @@ module astrocorr
corr_metric=corr_metric,
splitter=split_galaxy_cells!,
max_depth=3,
bin_slop=3,
bin_slop=nothing,
verbose=false)
@assert length(ra) == length(dec) == length(corr1) == length(corr2) "ra, dec, corr1, and corr2 must be the same length"

Expand Down Expand Up @@ -343,7 +343,7 @@ module astrocorr
corr_metric=corr_metric,
splitter=split_galaxy_cells!,
max_depth=3,
bin_slop=3,
bin_slop=nothing,
verbose=false) where {T,S}
@assert length(ra) == length(dec) == length(corr1) == length(corr2) "ra, dec, corr1, and corr2 must be the same length"

Expand Down Expand Up @@ -460,7 +460,7 @@ module astrocorr
corr_metric=corr_metric_default,
correlator=treecorr,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
return correlator(ra,
dec,
Expand Down Expand Up @@ -493,7 +493,7 @@ module astrocorr
corr_metric=corr_metric_default,
correlator=treecorr,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
return correlator(ra,
dec,
Expand Down Expand Up @@ -526,7 +526,7 @@ module astrocorr
corr_metric=corr_metric_default,
correlator=treecorr,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
return correlator(ra,
dec,
Expand Down Expand Up @@ -559,7 +559,7 @@ module astrocorr
corr_metric=corr_metric_default,
correlator=treecorr,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
return correlator(ra,
dec,
Expand Down Expand Up @@ -592,7 +592,7 @@ module astrocorr
corr_metric=corr_metric_default_point_point,
correlator=treecorr,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
return correlator(ra,
dec,
Expand Down Expand Up @@ -629,7 +629,7 @@ module astrocorr
correlator=treecorr,
splitter=split_galaxy_cells!,
max_depth=100,
bin_slop=3,
bin_slop=nothing,
verbose=false)
println("Position Position Correlation")
DD_cat = Galaxy_Catalog([pos.ra for pos in x if pos.value == "DATA"],
Expand Down
12 changes: 10 additions & 2 deletions src/kdtree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function initialize_circles(galaxies::Vector{Galaxy}; sky_metric=Vincenty_Formul
return initial_circle
end

function split_galaxy_cells!(leaves::Vector{KD_Galaxy_Tree}, θ_bins::Vector{Float64}, count::Int64; sky_metric=Vincenty_Formula, bin_slop=3)
function split_galaxy_cells!(leaves::Vector{KD_Galaxy_Tree}, θ_bins::Vector{Float64}, count::Int64; sky_metric=Vincenty_Formula, bin_slop=nothing)
galaxy_circles = [leaf.root for leaf in leaves]
# circle_ra = [circle.center[1] for circle in galaxy_circles]
# circle_dec = [circle.center[2] for circle in galaxy_circles]
Expand All @@ -114,6 +114,14 @@ function split_galaxy_cells!(leaves::Vector{KD_Galaxy_Tree}, θ_bins::Vector{Flo
#@assert size(distance_matrix) == size(galaxy_radius_adj)
#split_matrix = comparison_matrix .> b
b = log10(θ_bins[length(θ_bins)] - θ_bins[1])/length(θ_bins)

if bin_slop === nothing
if b < 0.1
bin_slop = 1
else
bin_slop = 0.1 / b
end
end

@threads for i in 1:length(galaxy_circles)
for j in 1:length(galaxy_circles)
Expand Down Expand Up @@ -199,7 +207,7 @@ function split_galaxy_cells!(leaves::Vector{KD_Galaxy_Tree}, θ_bins::Vector{Flo
end
end

function populate(galaxies::Vector{Galaxy}, θ_bins::Vector{Float64}; sky_metric=Vincenty_Formula, splitter=split_galaxy_cells!, max_depth=100, bin_slop=3)
function populate(galaxies::Vector{Galaxy}, θ_bins::Vector{Float64}; sky_metric=Vincenty_Formula, splitter=split_galaxy_cells!, max_depth=100, bin_slop=nothing)
tree = initialize_circles(galaxies, sky_metric=sky_metric)

split_number = 1
Expand Down

0 comments on commit f1dc8c0

Please sign in to comment.