From 15147570007d2ee85c06c976f3a20c7e380a6b33 Mon Sep 17 00:00:00 2001 From: stephane Date: Mon, 19 Dec 2022 12:57:13 +0100 Subject: [PATCH] version the final reprocessing --- src/GaiaClustering.jl | 2 +- src/data.jl | 2 +- src/stellarcluster.jl | 59 +++++++++++++++++++++++++++---------------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/GaiaClustering.jl b/src/GaiaClustering.jl index c339c6c..ddd574b 100755 --- a/src/GaiaClustering.jl +++ b/src/GaiaClustering.jl @@ -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") diff --git a/src/data.jl b/src/data.jl index 8ccd76b..f8a2793 100755 --- a/src/data.jl +++ b/src/data.jl @@ -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) diff --git a/src/stellarcluster.jl b/src/stellarcluster.jl index 0a792a4..d6bd08b 100755 --- a/src/stellarcluster.jl +++ b/src/stellarcluster.jl @@ -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 @@ -706,7 +730,7 @@ 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 @@ -714,31 +738,11 @@ function cycle_extraction_optim(df::GaiaClustering.Df, dfcart::GaiaClustering.Df 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)") @@ -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..