Skip to content

Commit

Permalink
Merge pull request #47 from bosscha/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bosscha authored May 13, 2023
2 parents 570254c + 2754639 commit 71ed84c
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .pydevproject

This file was deleted.

1 change: 1 addition & 0 deletions scripts/extra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function _extra(m::GaiaClustering.meta, optim)
@printf("## %s \n",specialstr("Duration: $durationstr hours","YELLOW"))
@printf("## %s \n",specialstr("Votable done: $(m.votname)","YELLOW"))
println("##\n##")

end
##################################### MAIN
let
Expand Down
2 changes: 1 addition & 1 deletion src/GaiaClustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##
## Julia 1.0 compliant
##
## Use the astropy python package to read a votable.
## astropy python package to read a votable.

module GaiaClustering

Expand Down
4 changes: 4 additions & 0 deletions src/_build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function extra(m::GaiaClustering.meta, optim)
@printf("## %s \n",specialstr("Duration: $durationstr hours","YELLOW"))
@printf("## %s \n",specialstr("Votable done: $(m.votname)","YELLOW"))
println("##\n##")

debug_red("Cleaning ...")
df=0 ; dfcart= 0 ; dfcartnorm= 0
GC.gc()
end
########
function get_gaia_data(radius, tol, ra, dec, name, rect, table= "gaiadr3.gaia_source")
Expand Down
8 changes: 8 additions & 0 deletions src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ function filter_data(gaia, dist_range = [0., 2000], vra_range = [-250,250],
vdec = 4.74e-3 .* pmdec .* distance
vl = 4.74e-3 .* pml .* distance
vb = 4.74e-3 .* pmb .* distance

debug_red("Cleaning...")
GC.gc()
catch
println("## Issues with the ZPT correction...")
end
Expand Down Expand Up @@ -221,6 +224,11 @@ function filter_data(gaia, dist_range = [0., 2000], vra_range = [-250,250],
println("## Filtering done ...")
println(yellow("## Stars selected: $ndata"))

debug_red("Cleaning ZPT , data, etc...")
zcorr= 0
nu_eff_used_in_astrometry= 0 ; pseudocolour= 0 ; ecl_lat= 0 ; astrometric_params_solved= 0
GC.gc()

return(s)
end

Expand Down
2 changes: 1 addition & 1 deletion src/install.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## install package for Gaia.Clustering

using Pkg
ENV["PYTHON"] = "/usr/bin/python3"
ENV["PYTHON"] = "/home/stephane/Downloads/.venv/bin/python"

Pkg.add("PyCall")
Pkg.build("PyCall")
Expand Down
2 changes: 1 addition & 1 deletion src/isochrones.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function perform_isochrone_fitting(df, isomodeldir)
arrIso = read_serial_mist(isomodeldir)

if size(arrIso)[1] == 0
println("### Isochrone model not set properly...")
println("### Isochrone model in $isomodeldir not set properly...")
exit()
end

Expand Down
19 changes: 19 additions & 0 deletions src/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ function plot_dbscan_mcmc(plotdir, voname, mc::GaiaClustering.mc , showplot = tr
figname = plotdir*"/"*voname*".mcmc.png"
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end


Expand Down Expand Up @@ -197,6 +199,8 @@ function plot_dbscanfull_mcmc(plotdir, voname, mc::mcfull , showplot = true)
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
end
PyPlot.plt.close()
GC.gc()
end


Expand Down Expand Up @@ -279,6 +283,8 @@ function plot_cluster(plotdir, voname, indx, sc::GaiaClustering.SCproperties, df
figname = plotdir*"/"*voname*".cluster.png"
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end

function plot_cluster2(plotdir, voname, indx, sc::GaiaClustering.SCproperties2, df::GaiaClustering.Df,
Expand Down Expand Up @@ -405,6 +411,8 @@ function plot_cluster2(plotdir, voname, indx, sc::GaiaClustering.SCproperties2,
figname = plotdir*"/"*voname*".cluster.png"
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end

## Raw data of the field with Principal Component plots of the extracted cluster
Expand Down Expand Up @@ -532,6 +540,8 @@ function plot_rawdata(plotdir, voname, indx, sc::GaiaClustering.SCproperties2, d
PyPlot.plt.savefig(figname)

if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end

# plot the astrometric data
Expand Down Expand Up @@ -649,6 +659,8 @@ function plot_astrom(plotdir, voname, indx, sc::GaiaClustering.SCproperties2, df
figname = plotdir*"/"*voname*".astrom.png"
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end

###### plot the isochrone solution and CMD
Expand Down Expand Up @@ -700,6 +712,8 @@ function plot_isochrone(plotdir, voname, df, iso , txt_iso, showplot = true)
figname = plotdir*"/"*voname*".isochrone.png"
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end
PyPlot.plt.close()
GC.gc()
end

### plot the step 2 process (tails, etc)
Expand Down Expand Up @@ -906,6 +920,9 @@ function plot_tail(plotdir, voname, dftail , dfstep1, dfstep2, dist, fit, err,
debug_red(figname)
PyPlot.plt.savefig(figname)
if showplot PyPlot.plt.show() end

PyPlot.plt.close()
GC.gc()
end

## levels of a density image
Expand Down Expand Up @@ -942,4 +959,6 @@ function plot_sky(ra,dec ; radius=10, figname= "allsky.png")
r= ra */180) .- π ; d= dec */180)
PyPlot.plt.scatter(r,d,s=radius, facecolor="green", alpha=0.5)
PyPlot.plt.savefig(figname)
PyPlot.plt.close()
GC.gc()
end
4 changes: 3 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ end

function debug_red(msg)
##
println(red("##_debug_###### $msg"))
# println(red("##_debug_###### $msg"))
end

### check if two directories exist, if not issue a warning and extinction
### useful for ocdir and plotdir
function checkdir(dir1 , dir2, stopped=true)
debug_red(pwd())

if !isdir(dir1) || !isdir(dir2)
println("## Error... directory $dir1 or $dir2 does not exist...")
if stopped
Expand Down

0 comments on commit 71ed84c

Please sign in to comment.