Skip to content

Commit

Permalink
Merge pull request #35 from bosscha/dev
Browse files Browse the repository at this point in the history
version of the final reprocessing
  • Loading branch information
bosscha authored Dec 19, 2022
2 parents 8c5429f + 1514757 commit 57f1e07
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/GaiaClustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using PyCall , PyPlot
using VoronoiCells
import GeometryBasics as gb

VERSION= "1.7.2"
VERSION= "1.7.3"

## include all the types
include("types.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ function add_cartesian(s::Df, centering = true)::Df
off[2] = mean(s.data[2,:])
end

lgal = DEG2RAD .* (s.data[1,:] .- off[1])
lgal = DEG2RAD .* (s.data[1,:] .- off[1]) ## to be checked
bgal = DEG2RAD .* (s.data[2,:] .- off[2])

dfresult.data[1,:] = s.data[3,:] .* cos.(bgal) .* cos.(lgal)
Expand Down
59 changes: 37 additions & 22 deletions src/stellarcluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,30 @@ function cycle_extraction_optim(df::GaiaClustering.Df, dfcart::GaiaClustering.Df
nchain= length(mc.qc)
println("## $iter iterations performed...")
println("## $nchain chains")

println("## optimization completed..")
println("## analyzing solutions...")
plot_dbscanfull_mcmc(m.plotdir, "$votname.$cycle", mc , false)

## get the cluster and plot it
println("## extracting the cluster using DBSCAN/WEIGHTING with:")
res= extraction_mcmc(mc, m.votname)
eps= res.epsm[1]
min_nei= trunc(Int,res.mneim[1] + 0.5)
min_cl= trunc(Int,res.mclm[1] + 0.5)
w3d= res.w3dm[1]
wvel= res.wvelm[1]
whrd= res.whrdm[1]

mres = GaiaClustering.modelfull(eps,min_nei,min_cl,w3d,wvel,whrd)
dfcartnorm = getDfcartnorm(dfcart, mres)
labels = clusters(dfcartnorm.data ,eps , 20, min_nei, min_cl)

if length(labels) == 0
FLAGmcmc= 0 ## to force stop even w/o optimization
nchain= 0
println("### no solution found with DBSCAN...")
end
else
println("## setting the weightings/DBSCAN")
eps= m.eps
Expand All @@ -706,39 +730,19 @@ function cycle_extraction_optim(df::GaiaClustering.Df, dfcart::GaiaClustering.Df
if length(labels) == 0
FLAGmcmc= 0 ## to force stop even w/o optimization
nchain= 0
println("### no solution with DBSCAN...")
println("### no solution found with DBSCAN...")
else
FLAGmcmc= -1
nchain= m.minchainreached+1
end
end

if FLAGmcmc== -1 || nchain > m.minchainreached
if optim
println("## optimization completed..")
println("## analyzing solutions...")
plot_dbscanfull_mcmc(m.plotdir, "$votname.$cycle", mc , false)

## get the cluster and plot it
println("## extracting the cluster using DBSCAN/WEIGHTING with:")
res= extraction_mcmc(mc, m.votname)
eps= res.epsm[1]
min_nei= trunc(Int,res.mneim[1] + 0.5)
min_cl= trunc(Int,res.mclm[1] + 0.5)
w3d= res.w3dm[1]
wvel= res.wvelm[1]
whrd= res.whrdm[1]

mres = GaiaClustering.modelfull(eps,min_nei,min_cl,w3d,wvel,whrd)
dfcartnorm = getDfcartnorm(dfcart, mres)
labels = clusters(dfcartnorm.data ,eps , 20, min_nei, min_cl)
end

labelmax , nmax, qc = find_cluster_label2(labels, df, dfcart, m)


### tail, if step 2 extraction ("tail") is requested, here it goes...
if m.tail == "yes"
if m.tail == "yes"
println("## Warning, the TAIL feature is still experimental ...")
println("## Performing step 2 for extraction (tails, clumps, etc) ...")
println("### Cut radius: $(m.maxRadTail) (pc) -- velocity: $(m.maxVelTail) (km/s) -- CMD: $(m.maxDistCmdTail) (mag)")
Expand Down Expand Up @@ -855,6 +859,17 @@ function cycle_extraction_optim(df::GaiaClustering.Df, dfcart::GaiaClustering.Df
insertcols!(scdf, 33, :dec_core => sc_core.dec)
insertcols!(scdf, 33, :ra_core => sc_core.ra)
insertcols!(scdf, 33, :ncore => ncore)
else
insertcols!(scdf, 33, :vraddisp_core => scdf.vraddisp)
insertcols!(scdf, 33, :vbdisp_core => scdf.vbdisp)
insertcols!(scdf, 33, :vldisp_core => scdf.vldisp)
insertcols!(scdf, 33, :zdisp_core => scdf.zdisp)
insertcols!(scdf, 33, :ydisp_core => scdf.ydisp)
insertcols!(scdf, 33, :xdisp_core => scdf.xdisp)
insertcols!(scdf, 33, :distance_core => scdf.distance)
insertcols!(scdf, 33, :dec_core => scdf.dec)
insertcols!(scdf, 33, :ra_core => scdf.ra)
insertcols!(scdf, 33, :ncore => scdf.nstars)
end

## isochrone fitting, if not, placeholder..
Expand Down

0 comments on commit 57f1e07

Please sign in to comment.