Skip to content

Commit

Permalink
Update default param values and suppress some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Yang He committed Aug 1, 2020
1 parent c2f8e64 commit b07dc35
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/compute_distances_given_params.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ max_incl_sys = 0.
dists_include_split = ["delta_f", "mult_CRPD_r", "periods_KS", "period_ratios_KS", "durations_KS", "duration_ratios_nonmmr_KS", "duration_ratios_mmr_KS", "depths_KS", "radius_ratios_KS"]
dists_include_all = ["delta_f", "mult_CRPD_r", "periods_KS", "period_ratios_KS", "durations_KS", "duration_ratios_nonmmr_KS", "duration_ratios_mmr_KS", "depths_KS", "radius_ratios_KS"]

data_table = CSV.read("../emulator/GP_files/durations_KS/Active_params_distances_table_best100000_every10.txt", delim=" ", allowmissing=:none)
data_table = CSV.read("../emulator/GP_files/durations_KS/Active_params_distances_table_best100000_every10.txt")
n_params = length(make_vector_of_active_param_keys(sim_param))
params_keys = names(data_table)[1:n_params]
@assert all(make_vector_of_active_param_keys(sim_param) .== String.(params_keys))
Expand Down
3 changes: 2 additions & 1 deletion src/mr_model/MRpredict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ end


##### For timing the functions:

#=
sim_param = setup_sim_param_model()
#Radii = ones(10000)*ExoplanetsSysSim.earth_radius
Radii = (10 .^(range(MR_param.Radius_min+0.01, stop=MR_param.Radius_max-0.01, length=10000)))*ExoplanetsSysSim.earth_radius
Expand All @@ -609,3 +609,4 @@ println("Testing and timing M-R from normal density around Earth-like rocky and
println("Testing and timing M-R from lognormal mass around Earth-like rocky and combining with Ning2018 table:")
@time Masses = map(r -> generate_planet_mass_from_radius_lognormal_mass_around_earthlike_rocky(r, sim_param), Radii)
@time Masses = map(r -> generate_planet_mass_from_radius_Ning2018_table_above_lognormal_mass_earthlike_rocky_below(r, sim_param), Radii)
=#
34 changes: 17 additions & 17 deletions src/param_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function setup_sim_param_model(args::Vector{String} = Array{String}(undef, 0)) #
sim_param = SimParam()

# How many targets to generate:
add_param_fixed(sim_param,"num_targets_sim_pass_one", 88912) # Note this is used for the number of stars in the simulations, not necessarily related to number of Kepler targets
add_param_fixed(sim_param,"num_kepler_targets", 88912) # Note this is used for the number of Kepler targets for the observational catalog
add_param_fixed(sim_param,"num_targets_sim_pass_one", 86760) # Note this is used for the number of stars in the simulations, not necessarily related to number of Kepler targets
add_param_fixed(sim_param,"num_kepler_targets", 86760) # Note this is used for the number of Kepler targets for the observational catalog

# For generating target star properties:
add_param_fixed(sim_param,"star_table_setup", ExoplanetsSysSim.StellarTable.setup_star_table)
Expand All @@ -23,16 +23,16 @@ function setup_sim_param_model(args::Vector{String} = Array{String}(undef, 0)) #
# For generating planetary system properties:
add_param_fixed(sim_param,"generate_planetary_system", generate_planetary_system_clustered) # For Non-clustered model: "generate_planetary_system_non_clustered"

add_param_active(sim_param,"f_stars_with_planets_attempted_color_slope", 0.6)
add_param_active(sim_param,"f_stars_with_planets_attempted_at_med_color", 0.6)
add_param_active(sim_param,"f_stars_with_planets_attempted_color_slope", 0.9)
add_param_active(sim_param,"f_stars_with_planets_attempted_at_med_color", 0.88)
add_param_fixed(sim_param,"med_color", 0.81)
#add_param_active(sim_param,"f_stars_with_planets_attempted", 0.6)
add_param_fixed(sim_param,"generate_num_clusters", generate_num_clusters_ZTP)
add_param_fixed(sim_param,"generate_num_planets_in_cluster", generate_num_planets_in_cluster_ZTP)
add_param_active(sim_param,"log_rate_clusters", log(2.0))
add_param_fixed(sim_param,"max_clusters_in_sys", 10)
add_param_active(sim_param,"log_rate_planets_per_cluster", log(2.3))
add_param_fixed(sim_param,"max_planets_in_cluster", 10)
add_param_active(sim_param,"log_rate_clusters", log(1.0))
add_param_fixed(sim_param,"max_clusters_in_sys", 20)
add_param_active(sim_param,"log_rate_planets_per_cluster", log(1.6))
add_param_fixed(sim_param,"max_planets_in_cluster", 20)

# Generate_num_planets_in_cluster currently calls:
add_param_fixed(sim_param,"generate_periods", ExoplanetsSysSim.generate_periods_power_law)
Expand All @@ -42,7 +42,7 @@ function setup_sim_param_model(args::Vector{String} = Array{String}(undef, 0)) #
#add_param_fixed(sim_param,"power_law_P2", 0.5)
#add_param_fixed(sim_param,"power_law_r", -2.5)
add_param_active(sim_param,"power_law_r1", -1.4)
add_param_active(sim_param,"power_law_r2", -4.8)
add_param_active(sim_param,"power_law_r2", -5.2)
add_param_fixed(sim_param,"min_period", 3.0)
add_param_fixed(sim_param,"max_period", 300.0)
#add_param_fixed(sim_param,"break_period", 10.0)
Expand All @@ -63,16 +63,16 @@ function setup_sim_param_model(args::Vector{String} = Array{String}(undef, 0)) #
add_param_fixed(sim_param,"generate_e_omega", ExoplanetsSysSim.generate_e_omega_rayleigh)
#add_param_active(sim_param,"sigma_hk_color_slope", 0.04)
#add_param_active(sim_param,"sigma_hk_at_med_color", 0.02)
add_param_active(sim_param,"sigma_hk", 0.018)
add_param_active(sim_param,"sigma_hk", 0.25)

# Generate_num_planets_in_cluster currently use these for the stability tests:
add_param_active(sim_param,"num_mutual_hill_radii", 8.0)
add_param_active(sim_param,"num_mutual_hill_radii", 10.0)
add_param_fixed(sim_param,"f_amd_crit", 1.0) # fraction of critical AMD to distribute

#add_param_fixed(sim_param,"generate_planet_mass_from_radius", generate_planet_mass_from_radius_Ning2018_table)
add_param_fixed(sim_param,"generate_planet_mass_from_radius", generate_planet_mass_from_radius_Ning2018_table_above_lognormal_mass_earthlike_rocky_below)
add_param_active(sim_param,"sigma_log_radius_in_cluster", 0.3)
add_param_active(sim_param,"sigma_logperiod_per_pl_in_cluster", 0.2)
add_param_active(sim_param,"sigma_logperiod_per_pl_in_cluster", 0.25)

# Functions to calculate observables from physical system properties:
add_param_fixed(sim_param,"calc_target_obs_single_obs", ExoplanetsSysSim.calc_target_obs_single_obs)
Expand Down Expand Up @@ -115,19 +115,19 @@ function write_model_params(f, sim_param::SimParam)
println(f, "# max_planets_in_clusters: ", get_int(sim_param,"max_planets_in_cluster"))
end

if string(get_function(sim_param,"generate_periods")) == "ExoplanetsSysSim.generate_periods_power_law"
if string(get_function(sim_param,"generate_periods")) == "generate_periods_power_law"
println(f, "# power_law_P: ", get_real(sim_param,"power_law_P"))
elseif string(get_function(sim_param,"generate_periods")) == "ExoplanetsSysSim.generate_periods_broken_power_law"
elseif string(get_function(sim_param,"generate_periods")) == "generate_periods_broken_power_law"
println(f, "# power_law_P1: ", get_real(sim_param,"power_law_P1"))
println(f, "# power_law_P2: ", get_real(sim_param,"power_law_P2"))
println(f, "# break_period: ", get_real(sim_param,"break_period"))
end
println(f, "# min_period: ", get_real(sim_param,"min_period"))
println(f, "# max_period: ", get_real(sim_param,"max_period"))

if string(get_function(sim_param,"generate_sizes")) == "ExoplanetsSysSim.generate_sizes_power_law"
if string(get_function(sim_param,"generate_sizes")) == "generate_sizes_power_law"
println(f, "# power_law_r: ", get_real(sim_param,"power_law_r"))
elseif string(get_function(sim_param,"generate_sizes")) == "ExoplanetsSysSim.generate_sizes_broken_power_law"
elseif string(get_function(sim_param,"generate_sizes")) == "generate_sizes_broken_power_law"
println(f, "# power_law_r1: ", get_real(sim_param,"power_law_r1"))
println(f, "# power_law_r2: ", get_real(sim_param,"power_law_r2"))
println(f, "# break_radius (R_earth): ", get_real(sim_param,"break_radius")/ExoplanetsSysSim.earth_radius)
Expand All @@ -144,7 +144,7 @@ function write_model_params(f, sim_param::SimParam)
println(f, "# num_mutual_hill_radii: ", get_real(sim_param,"num_mutual_hill_radii"))
println(f, "# f_amd_crit: ", get_real(sim_param,"f_amd_crit"))

if string(get_function(sim_param,"generate_planet_mass_from_radius")) == "ExoplanetsSysSim.generate_planet_mass_from_radius_powerlaw"
if string(get_function(sim_param,"generate_planet_mass_from_radius")) == "generate_planet_mass_from_radius_powerlaw"
println(f, "# mr_power_index: ", get_real(sim_param,"mr_power_index"))
println(f, "# mr_max_mass (M_earth): ", get_real(sim_param,"mr_max_mass")/ExoplanetsSysSim.earth_mass)
elseif string(get_function(sim_param,"generate_planet_mass_from_radius")) == "generate_planet_mass_from_radius_Ning2018"
Expand Down
2 changes: 1 addition & 1 deletion src/spherical_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Calculate the angle between two orbits using the spherical law of Cosines.
function calc_incl_spherical_cosine_law(i1::Float64, i2::Float64, ΔΩ::Float64)
cos_i = cos(i1)*cos(i2) + sin(i1)*sin(i2)*cos(ΔΩ)
if cos_i > 1 || cos_i < -1
@warn "cos_i = $(cos_i); rounding result." maxlog=10
#@warn "cos_i = $(cos_i); rounding result." maxlog=10
cos_i = round(cos_i)
end
return acos(cos_i)
Expand Down

0 comments on commit b07dc35

Please sign in to comment.