demographics
Documentation for demographics.
demographics.demographicsdemographics.C0demographics.C1demographics.C2demographics.KEPLER_DR25_PARAMSdemographics.αdemographics.βdemographics.ctl_advanced_searchdemographics.ctl_advanced_search_rowsdemographics.draw_inclination_angledemographics.draw_num_planetsdemographics.draw_orbital_eccentricitydemographics.draw_periastron_angledemographics.get_P_detdemographics.hr_cdppdemographics.impact_parameterdemographics.mass_ratio_simdemographics.mast_querydemographics.mean_planet_Ndemographics.orbit_seperation_simdemographics.random_a_simdemographics.random_q_simdemographics.set_filtersdemographics.set_min_maxdemographics.transit_SNRdemographics.transit_duration
demographics.demographics — Module
Demographics package for simulating stellar and planetary systems.
demographics.C0 — Constant
Baseline CDPP coefficient.
demographics.C1 — Constant
First magnitude coefficient.
demographics.C2 — Constant
Second magnitude coefficient.
demographics.KEPLER_DR25_PARAMS — Constant
Kepler DR25 detection coefficients for calculating detection probability, given number of transits and expected SNR. Taken from Hsu et al. (2019)
demographics.α — Constant
α coefficient for beta distributions of eccentricities
demographics.β — Constant
β coefficient for beta distribution of eccentricities
demographics.ctl_advanced_search — Method
ctl_advanced_search(filter_param::String, min_val::T, max_val::T) where T<:AbstractFloat -> nothingArguments
filter_param::String: The parameter name to filter on.min_val::T: The minimum value for the filter.max_val::T: The maximum value for the filter.
Returns
nothing
Description
Perform an advanced search on the CTL catalog using the specified filter parameter and value range, and print the count of matching sources.
demographics.ctl_advanced_search_rows — Method
ctl_advanced_search_rows(filter_param::String, min_val::T, max_val::T, columns::String) where T<:AbstractFloat -> out_dataArguments
filter_param::String: The parameter name to filter on.min_val::T: The minimum value for the filter.max_val::T: The maximum value for the filter.columns::String: Comma-separated string of columns to retrieve.
Returns
out_data::Dict: The parsed JSON response containing the requested rows.
Description
Perform an advanced search on the CTL catalog using the specified filter parameter and value range, and retrieve the specified columns.
demographics.draw_inclination_angle — Method
draw_inclination_angle(N) -> cosi_arrayArguments
N::Int: Number of planets.
Returns
cosi_array: Array of cosine of inclination angle for the planets.
Description
Draw inclination angles cosine for N planets from a uniform distribution between 0 and 1
demographics.draw_num_planets — Method
draw_num_planets(meanN) -> num_planetsArguments
meanN::Float64: Mean number of planets per star.
Returns
num_planets::Int: number of actual planets for one star.
Description
Draw the number of planets for one star from a Poisson distribution with mean ⟨N⟩.
demographics.draw_orbital_eccentricity — Method
draw_orbital_eccentricity(N,α,β) -> e_arrayArguments
N::Int: Number of planets.α::Float64: Alpha parameter for the Beta distribution.β::Float64: Beta parameter for the Beta distribution.
Returns
e_array: Array of orbital eccentricities for the planets.
Description
Draw orbital eccentricities for N planets from a Beta distribution with parameters α and β. Van Eylen & Albrecht 2015
demographics.draw_periastron_angle — Method
draw_periastron_angle(N) -> ω_arrayArguments
N::Int: Number of planets.
Returns
ω_array: Array of periastron angles for the planets.
Description
Draw periastron angles for N planets from a uniform distribution between -π and π
demographics.get_P_det — Method
get_P_det(x,C,A,B) -> P_detArguments
x::Float64: expected SNR of the transiting planetc::Float64: maximum detection probability at high SNRα::Float64: gamma function parameter (depend on number of transit)β::Float64: gamma function parameter (depend on number of transit)
Returns
P_det::Float64: detection probability
Description
Calculates the detection probability of a transiting planet given a SNR, unlike simple assumptions of detection of planet based on SNR, this takes a probabilistic approach. Hsu et al. (2019)
demographics.hr_cdpp — Method
hr_cdpp(T)
Arguments
T::Float64: TESS magnitude of the star.
Returns
Float64: 1-hour CDPP in ppm.
Description
- Calculate one hour CDPP to get detectibility metric for TESS data.
- Equation 1 from Kunimoto et al. (2022).
demographics.impact_parameter — Method
impact_parameter(a,cosi,e,Rₛ,ω) -> bArguments
a::Float64: Semi-major axis of the planet's orbit.cosi::Float64: Cosine of the inclination angle.e::Float64: Orbital eccentricity.Rₛ::Float64: Radius of the star.ω::Float64: Periastron angle.
Returns
b::Float64: Impact parameter of the transit.
Description
Calculate the impact parameter of a transiting exoplanet given its orbital parameters and the host star's radius.
demographics.mass_ratio_sim — Method
mass_ratio_sim(q_max, q_min, n) -> q_meanArguments
q_max::Float64: Maximum mass ratio (planet mass / star mass).q_min::Float64: Minimum mass ratio (planet mass / star mass).n::Float64: Power-law index for the mass ratio distribution.
Returns
q_mean::Float64: Mean of planet star mass ratio.
Description
Calculate mean planet/star mass ratio from distribution parameter. Priyadarshi et. al. (2025)
demographics.mast_query — Method
mast_query(request::Dict) -> head,contentArguments
request::Dict: A dictionary representing the MAST API request.
Returns
head::Dict: The header of the MAST API response.content::Dict: The content of the MAST API response.
Description
Send a POST request to the MAST API with the given request dictionary and return the response header and content.
demographics.mean_planet_N — Method
mean_planet_N(β, q_mean) -> NArguments
β::Float64: sum of all planet mass / stellar mass.q_mean::Float64: Mean of planet star mass ratio.
Returns
N::Float64: Mean number of planets per star.
Description
Calculates mean of number of planets around a star based on mean mass. Priyadarshi et. al. (2025)
demographics.orbit_seperation_sim — Method
orbit_seperation_sim(a_max, a_min, n) -> a_meanArguments
a_max::Float64: Maximum orbital separation.a_min::Float64: Minimum orbital separation.n::Float64: Power-law index for the orbital separation distribution.
Returns
a::Float64: Mean of orbital separation.
Description Calculate mean orbit seperation of planet distribution from parameters. Priyadarshi et. al. (2025)
demographics.random_a_sim — Method
random_a_sim(u, a_max, a_min, n) -> aArguments
u::Float64: Random uniform variable between 0 and 1.a_max::Float64: Maximum orbital separation.a_min::Float64: Minimum orbital separation.n::Float64: Power-law index for the orbital separation distribution.
Returns
a::Float64: Randomly sampled orbital separation.
Description
Returns a randomly sampled orbit seperation value based on the distribution.
demographics.random_q_sim — Method
random_q_sim(u, q_max, q_min, n) -> qArguments
u::Float64: Random uniform variable between 0 and 1.q_max::Float64: Maximum mass ratio (planet mass / star mass).q_min::Float64: Minimum mass ratio (planet mass / star mass).n::Float64: Power-law index for the mass ratio distribution.
Returns
q::Float64: Randomly sampled planet star mass ratio.
Description
Randomly sampled planet star mass ratio.
demographics.set_filters — Method
set_filters(parameters::Dict) -> filtersArguments
parameters::Dict: A dictionary of filter parameters.
Returns
filters::Vector{Dict}: A vector of filter dictionaries suitable for MAST API requests.
Description
Convert a dictionary of filter parameters into a vector of filter dictionaries for MAST API requests.
demographics.set_min_max — Method
set_min_max(min, max) -> filterArguments
min: Minimum value for the filter.max: Maximum value for the filter.
Returns
filter::Vector{Dict}: A vector containing a single dictionary with "min" and "max" keys.
Description
Create a filter dictionary with specified minimum and maximum values for MAST API requests.
demographics.transit_SNR — Method
transit_SNR(Rₚ,Rₛ,CDPP,T_dur,δ,Cont) -> SNRArguments
Rₚ::Float64: Radius of the planet.Rₛ::Float64: Radius of the star.CDPP::Float64: Combined Differential Photometric Precision of the star.T_dur::Float64: Duration of the transit in hours.δ::Float64: Transit depth.Cont::Float64: Star's contamination ratio from CTL.
Returns
SNR::Float64: Signal-to-noise ratio of the transit.
Description
Calculate the signal-to-noise ratio (SNR) of a transit given the planet and star parameters.
demographics.transit_duration — Method
transit_duration(a, Rₛ, Rₚ, e, ω, cosi, P) -> T_durArguments
a::Float64: Semi-major axis of the planet's orbit.Rₛ::Float64: Radius of the star.Rₚ::Float64: Radius of the planet.e::Float64: Orbital eccentricity.ω::Float64: Periastron angle.cosi::Float64: Cosine of the inclination angle.P::Float64: Orbital period of the planet.b::Float64: Impact parameter of the transit.
Returns
T_dur::Float64: Duration of the transit in hour.
Description
Calculate the duration of a transit for a planet given its orbital parameters and the host star's radius