GalaxyGenerator
Documentation for GalaxyGenerator.
GalaxyGenerator.DoubleSchechterMassFunctionGalaxyGenerator.SchechterMassFunctionGalaxyGenerator.inverse_cdf!
GalaxyGenerator.DoubleSchechterMassFunction — Type
DoubleSchechterMassFunction(ϕ1, α1, Mstar0_1, ϕ2, α2, Mstar0_2)A double Schechter mass function model, essentially just the sum of two Schechter models with different parameters. Let $S(\phi_*, \alpha, M_{*,0}, M_*)$ be the single Schechter mass function SchechterMassFunction, then this function is simply $S(\phi_{*,1}, \alpha_1, M_{*,0_1}, M_*) + S(\phi_{*,2}, \alpha_2, M_{*,0_2}, M_*)$.
Calling an instance of DoubleSchechterMassFunction with a stellar mass (in solar masses) will return the value of the mass function.
DoubleSchechterMassFunction(ϕ1, α1, Mstar0_1, ϕ2, α2, Mstar0_2, mmin, mmax; npoints=1000)
DoubleSchechterMassFunction(s::DoubleSchechterMassFunction, mmin, mmax; npoints=1000)These constructors support random sampling from the returned instance s via rand(s), rand(s, 1000) and so on. For speed a look-up table of the inverse CDF is used for sampling; coverage of this look-up table is defined by the keyword arguments mmin and mmax which give the limits of the look-up table in solar masses. The number of elements in this look-up table is npoints; more points gives greater sampling accuracy at the cost of increased memory and decreased sampling speed. The default npoints=1000 is typically sufficient.
julia> s = DoubleSchechterMassFunction(1.0, 1.2, 1e6, 1.0, 1.1, 1e7) # Basic instance
DoubleSchechterMassFunction{Float64, Nothing}(SchechterMassFunction{Float64, Nothing}(1.0, 1.2, 1.0e6, nothing), SchechterMassFunction{Float64, Nothing}(1.0, 1.1, 1.0e7, nothing), nothing)
julia> s(1e6) isa Float64 # Call to evaluate mass function
true
julia> s2 = DoubleSchechterMassFunction(s, 1e6, 1e11; npoints=1000); # instance with inverse CDF cache
julia> rand(s2) isa Float64 # s2 supports random sampling
trueGalaxyGenerator.SchechterMassFunction — Type
SchechterMassFunction(ϕ, α, Mstar0)The Schechter mass function model, defined as
\[S = \text{log}(10) \ \phi_* \left( \frac{M_*}{M_{*,0}} \right)^{\alpha+1} \text{exp} \left(- \frac{M_*}{M_{*,0}} \right)\]
Calling an instance of SchechterMassFunction with a stellar mass (in solar masses) will return the value of the mass function.
SchechterMassFunction(ϕ, α, Mstar0, mmin, mmax; npoints=1000)
SchechterMassFunction(s::SchechterMassFunction, mmin, mmax; npoints=1000)These constructors support random sampling from the returned instance s via rand(s), rand(s, 1000) and so on. For speed a look-up table of the inverse CDF is used for sampling; coverage of this look-up table is defined by the keyword arguments mmin and mmax which give the limits of the look-up table in solar masses. The number of elements in this look-up table is npoints; more points gives greater sampling accuracy at the cost of increased memory and decreased sampling speed. The default npoints=1000 is typically sufficient.
julia> s = SchechterMassFunction(1.0, 1.2, 1e6) # Basic instance
SchechterMassFunction{Float64, Nothing}(1.0, 1.2, 1.0e6, nothing)
julia> s(1e6) isa Float64 # call to evaluate mass function
true
julia> s2 = SchechterMassFunction(s, 1e6, 1e11; npoints=1000); # instance with inverse CDF cache
julia> rand(s2) isa Float64 # s2 supports random sampling
trueGalaxyGenerator.inverse_cdf! — Method
inverse_cdf!(y, x)Given x and y arrays that fulfill f(x) = y, compute and return an interpolator for the inverse CDF of the function f(x). y is mutated in-place to contain the CDF.