Skip to content

Commit 02075b4

Browse files
Adjust (sub)types
1 parent 6ec4872 commit 02075b4

File tree

16 files changed

+86
-103
lines changed

16 files changed

+86
-103
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributionFunctions"
22
uuid = "c869f47d-2815-40f9-b874-25ebe83f43af"
3-
version = "0.0.8dev"
3+
version = "0.0.9dev"
44

55
[deps]
66
OrbitalElements = "a3b07092-bde3-4843-b84f-c597d614ec7b"

src/Analytic/RazorThinDiscs/mestel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
MestelDistribution(EL::Tuple{Float64,Float64},df::MestelDisc)
1414
Mestel distribution function.
1515
"""
16-
function Distribution(EL::Tuple{Float64,Float64},df::MestelDisc)::Float64
16+
function DistributionFunction(EL::Tuple{Float64,Float64},df::MestelDisc)::Float64
1717

1818
return MestelDistribution(EL,df)
1919
end

src/Analytic/RazorThinDiscs/miyamoto.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using HypergeometricFunctions
1010
1111
Miyamoto distribution function for Kuzmin-Toomre disc.
1212
"""
13-
function Distribution(E::Float64, L::Float64; mM::Int64=1)
13+
function DistributionFunction(E::Float64, L::Float64; mM::Int64=1)
1414
return (
1515
(2mM + 3)
1616
* (-E)^(2mM + 2)

src/Analytic/RazorThinDiscs/razorthindiscs.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ const IntorFloat = Union{Int64,Float64}
88
#####################################
99
# Disc distribution functions (analytic)
1010
#####################################
11-
abstract type DiscDistributionFunction <: DistributionFunction end
12-
abstract type MestelPotentialDistributionFunction <: DiscDistributionFunction end
13-
abstract type ZangDistributionFunction <: MestelPotentialDistributionFunction end
11+
abstract type DiscDF <: DiscEnergyAngularMomentumDF end
12+
abstract type MestelPotentialDF <: DiscDF end
13+
abstract type ZangDF <: MestelPotentialDF end
1414

1515
const MestelPotentials = Union{MestelPotential,TaperedMestel}
1616

1717

1818
# @IMPROVE, these potentials are not specific at all: but need to be either MestelPotential or TaperedMestel
19-
struct MestelDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: MestelPotentialDistributionFunction
19+
struct MestelDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: MestelPotentialDF
2020
potential::modelT # potential model
2121
q::qT # velocity dispersion parameter
2222
G::Float64 # gravitational constant (not in MestelPotential or TaperedMestel, so needed here)
2323
end
2424

25-
struct ZangDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: ZangDistributionFunction
25+
struct ZangDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: ZangDF
2626
potential::modelT # potential model
2727
q::qT # velocity dispersion parameter
2828
ν::Int64 # inner taper
@@ -32,7 +32,7 @@ struct ZangDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: ZangDistributionFunc
3232
G::Float64 # gravitational constant (not in MestelPotential or TaperedMestel, so needed here)
3333
end
3434

35-
struct TruncatedZangDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: ZangDistributionFunction
35+
struct TruncatedZangDisc{modelT<:MestelPotentials,qT<:IntorFloat} <: ZangDF
3636
potential::modelT # potential model
3737
q::qT # velocity dispersion parameter
3838
ν::Int64 # inner taper
@@ -48,7 +48,7 @@ end
4848
4949
radial velocity dispersion of the tapered Mestel DF
5050
"""
51-
function σMestelDistribution(df::MestelPotentialDistributionFunction)::Float64
51+
function σMestelDistribution(df::MestelPotentialDF)::Float64
5252
return df.potential.V0 / sqrt(df.q+1)
5353
end
5454

@@ -57,7 +57,7 @@ end
5757
5858
normalization constant of the tapered Mestel DF.
5959
"""
60-
function NormConstMestelDistribution(df::MestelPotentialDistributionFunction)::Float64
60+
function NormConstMestelDistribution(df::MestelPotentialDF)::Float64
6161
σ = σMestelDistribution(df)
6262
return (df.potential.V0)^(2) / ( 2^(df.q/2+1) * (pi)^(3/2) * df.G * gamma(0.5+0.5*df.q) * (σ)^(df.q+2) * (df.potential.R0)^(df.q+1) )
6363
end
@@ -66,7 +66,7 @@ end
6666
MestelDistribution(EL::Tuple{Float64,Float64},df::MestelDisc)
6767
Mestel distribution function.
6868
"""
69-
function MestelDistribution(EL::Tuple{Float64,Float64},df::MestelPotentialDistributionFunction)::Float64
69+
function MestelDistribution(EL::Tuple{Float64,Float64},df::MestelPotentialDF)::Float64
7070

7171
E,L = EL
7272
σ = σMestelDistribution(df)
@@ -79,17 +79,17 @@ end
7979
MesteldFdE(EL::Tuple{Float64,Float64},df::MestelDisc)
8080
Mestel DF derivative w.r.t. E.
8181
"""
82-
function MesteldFdE(EL::Tuple{Float64,Float64},df::MestelPotentialDistributionFunction)::Float64
82+
function MesteldFdE(EL::Tuple{Float64,Float64},df::MestelPotentialDF)::Float64
8383

8484
σ = σMestelDistribution(df)
85-
return - Distribution(EL,df) /^2)
85+
return - DistributionFunction(EL,df) /^2)
8686
end
8787

8888
"""
8989
MesteldFdL(E, L[, C, q, sigma])
9090
Mestel DF derivative w.r.t. E.
9191
"""
92-
function MesteldFdL(EL::Tuple{Float64,Float64},df::MestelPotentialDistributionFunction)::Float64
92+
function MesteldFdL(EL::Tuple{Float64,Float64},df::MestelPotentialDF)::Float64
9393

9494
E,L = EL
9595
σ = σMestelDistribution(df)

src/Analytic/RazorThinDiscs/truncatedzang.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ end
3131
3232
Zang star distribution function enforcing ra <= Rmax.
3333
"""
34-
function Distribution(EL::Tuple{Float64,Float64},df::TruncatedZangDisc)::Float64
34+
function DistributionFunction(EL::Tuple{Float64,Float64},df::TruncatedZangDisc)::Float64
3535

3636
# will return zero if outside truncated region
3737
result = truncationcriteria(EL::Tuple{Float64,Float64},df::TruncatedZangDisc)

src/Analytic/RazorThinDiscs/zang.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end
1717
ZangInnerTaper(EL::Tuple{Float64,Float64},df::ZangDisc)
1818
Zang inner tapering.
1919
"""
20-
function ZangInnerTaper(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
20+
function ZangInnerTaper(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
2121

2222
E,L = EL
2323
return (L^df.ν) / ( (df.Rin*df.potential.V0)^(df.ν) + (L^df.ν) )
@@ -27,7 +27,7 @@ end
2727
ZangInnerTaperdL(EL::Tuple{Float64,Float64},df::ZangDisc)
2828
Zang inner tapering derivative.
2929
"""
30-
function ZangInnerTaperdL(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
30+
function ZangInnerTaperdL(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
3131

3232
E,L = EL
3333
return (df.Rin*df.potential.V0)^(df.ν) * df.ν * (L)^(df.ν-1) / ( (df.Rin*df.potential.V0)^(df.ν) + (L)^(df.ν) )^(2)
@@ -37,7 +37,7 @@ end
3737
Zang_outer_tapering(EL::Tuple{Float64,Float64},df::ZangDisc)
3838
Zang outer tapering.
3939
"""
40-
function ZangOuterTaper(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
40+
function ZangOuterTaper(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
4141

4242
E,L = EL
4343
return (df.Rout*df.potential.V0)^(df.μ) / ( (df.Rout*df.potential.V0)^(df.μ) + (L^df.μ) )
@@ -46,7 +46,7 @@ end
4646
Zang_outer_tapering_dL(EL::Tuple{Float64,Float64},df::ZangDisc)
4747
Zang outer tapering derivative.
4848
"""
49-
function ZangOuterTaperdL(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
49+
function ZangOuterTaperdL(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
5050

5151
E,L = EL
5252
return - (df.Rout*df.potential.V0)^(df.μ) * df.μ * (L)^(df.μ-1) / ( (df.Rout*df.potential.V0)^(df.μ) + (L)^(df.μ) )^(2)
@@ -60,23 +60,23 @@ end
6060
F(EL::Tuple{Float64,Float64},df::ZangDisc)
6161
Zang star distribution function.
6262
"""
63-
function Distribution(EL::Tuple{Float64,Float64},df::ZangDisc)::Float64
63+
function DistributionFunction(EL::Tuple{Float64,Float64},df::ZangDisc)::Float64
6464
return MestelDistribution(EL,df) * ZangOuterTaper(EL,df) * ZangInnerTaper(EL,df)
6565
end
6666

6767
"""
6868
dFdE(EL::Tuple{Float64,Float64},df::ZangDisc)
6969
Zang star DF derivative w.r.t. E.
7070
"""
71-
function DFDE(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
71+
function DFDE(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
7272
return MesteldFdE(EL,df) * ZangOuterTaper(EL,df) * ZangInnerTaper(EL,df)
7373
end
7474

7575
"""
7676
dFdL(EL::Tuple{Float64,Float64},df::ZangDisc)
7777
Zang star DF derivative w.r.t. L.
7878
"""
79-
function DFDL(EL::Tuple{Float64,Float64},df::ZangDistributionFunction)::Float64
79+
function DFDL(EL::Tuple{Float64,Float64},df::ZangDF)::Float64
8080

8181
mesDF = MestelDistribution(EL,df)
8282
intap = ZangInnerTaper(EL,df)

src/Analytic/Spheres/Isochrone/isochrone.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
# Isochrone distribution functions (analytic)
33
#####################################
44

5-
struct IsotropicIsochrone{modelT<:IsochronePotential} <: EnergyOnlyDistributionFunction
5+
struct IsotropicIsochrone{modelT<:IsochronePotential} <: ErgodicDF
66
potential::modelT # Potential model
77
end
8-
struct OsipkovMerrittIsochroneEL{modelT<:IsochronePotential} <: SphericalEnergyAngularMomentumDistributionFunction
8+
struct OsipkovMerrittIsochroneEL{modelT<:IsochronePotential} <: SphericalEnergyAngularMomentumDF
99
ra::Float64 # Anisotropy radius
1010
potential::modelT # Potential model
1111
end
12-
struct OsipkovMerrittIsochroneJL{modelT<:IsochronePotential} <: SphericalEnergyAngularMomentumDistributionFunction
12+
struct OsipkovMerrittIsochroneJL{modelT<:IsochronePotential} <: SphericalEnergyAngularMomentumDF
1313
ra::Float64 # Anisotropy radius
1414
potential::modelT # Potential model
1515
end
1616

1717
# create a type union for all isochrone distribution functions
18-
const IsochroneDistributionFunction = Union{IsotropicIsochrone,OsipkovMerrittIsochroneEL,OsipkovMerrittIsochroneJL}
18+
const IsochroneDF = Union{IsotropicIsochrone,OsipkovMerrittIsochroneEL,OsipkovMerrittIsochroneJL}
1919

2020
# unify the osipkov-merritt models
2121
const OsipkovMerrittIsochrone = Union{OsipkovMerrittIsochroneEL,OsipkovMerrittIsochroneJL}
2222

2323
"""
2424
the Isochrone distribution function scale
2525
"""
26-
function dfscale(df::IsochroneDistributionFunction)
26+
function dfscale(df::IsochroneDF)
2727
return (df.potential.G*df.potential.M*df.potential.bc)^(-3/2)
2828
end
2929

src/Analytic/Spheres/Isochrone/isotropic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
"""Distribution(E[,bc,M,G])
1414
the isotropic DF
1515
"""
16-
function Distribution(EL::Tuple{Float64,Float64}, df::IsotropicIsochrone)
16+
function DistributionFunction(EL::Tuple{Float64,Float64}, df::IsotropicIsochrone)
1717
E,L = EL
1818

1919
scaleEnergy = - df.potential.G * df.potential.M / df.potential.bc

src/Analytic/Spheres/Isochrone/osipkovmerritt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end
5353
Saha distribution function
5454
ra is the anisotropy radius
5555
"""
56-
function Distribution(EL::Tuple{Float64,Float64}, df::OsipkovMerrittIsochrone)::Float64
56+
function DistributionFunction(EL::Tuple{Float64,Float64}, df::OsipkovMerrittIsochrone)::Float64
5757

5858
Q = osipkovmerritt_Q(EL, df)
5959
scaleDF = dfscale(df)

src/Analytic/Spheres/Plummer/isotropic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
"""
1414
The distribution function for the isotropic Plummer model
1515
"""
16-
function Distribution(EL::Tuple{Float64,Float64}, df::IsotropicPlummer)
16+
function DistributionFunction(EL::Tuple{Float64,Float64}, df::IsotropicPlummer)
1717
E,L = EL
1818

1919
scaleEnergy = - df.potential.G * df.potential.M / df.potential.bc

src/Analytic/Spheres/Plummer/osipkovmerrit.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function OsipkovMerrittPlummerEL(ra::Float64; potential::PlummerPotential=Numeri
99
return OsipkovMerrittPlummerEL(ra,potential)
1010
end
1111
function OsipkovMerrittPlummerJL(ra::Float64; potential::PlummerPotential=NumericalPlummer())
12+
# this doesn't exist. use (E,L) instead
1213
return OsipkovMerrittPlummerJL(ra,potential)
1314
end
1415

@@ -51,7 +52,7 @@ end
5152
"""
5253
the anisotropic distribution function from PlummerPlus
5354
"""
54-
function Distribution(EL::Tuple{Float64,Float64}, df::OsipkovMerrittPlummer)
55+
function DistributionFunction(EL::Tuple{Float64,Float64}, df::OsipkovMerrittPlummer)
5556

5657
Q = osipkovmerritt_Q(EL, df)
5758
scaleDF = dfscale(df)

src/Analytic/Spheres/Plummer/plummer.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
#####################################
22
# Plummer distribution functions (analytic)
33
#####################################
4-
struct IsotropicPlummer{modelT<:PlummerPotential} <: EnergyOnlyDistributionFunction
4+
struct IsotropicPlummer{modelT<:PlummerPotential} <: ErgodicDF
55
potential::modelT # Potential model
66
end
7-
struct OsipkovMerrittPlummerEL{modelT<:PlummerPotential} <: SphericalEnergyAngularMomentumDistributionFunction
7+
struct OsipkovMerrittPlummerEL{modelT<:PlummerPotential} <: SphericalEnergyAngularMomentumDF
88
ra::Float64 # Anisotropy radius
99
potential::modelT # Potential model
1010
end
11-
struct OsipkovMerrittPlummerJL{modelT<:PlummerPotential} <: SphericalActionDistributionFunction
11+
struct OsipkovMerrittPlummerJL{modelT<:PlummerPotential} <: SphericalActionDF
1212
ra::Float64 # Anisotropy radius
1313
potential::modelT # Potential model
1414
end
1515

1616
# create a type union for all Plummer distribution functions
17-
const PlummerDistributionFunction = Union{IsotropicPlummer,OsipkovMerrittPlummerEL,OsipkovMerrittPlummerJL}
17+
const PlummerDF = Union{IsotropicPlummer,OsipkovMerrittPlummerEL,OsipkovMerrittPlummerJL}
1818

1919
# unify the osipkov-merritt methods
2020
const OsipkovMerrittPlummer = Union{OsipkovMerrittPlummerEL,OsipkovMerrittPlummerJL}
2121

2222
"""
2323
the Plummer distribution function scale
2424
"""
25-
function dfscale(df::PlummerDistributionFunction)
25+
function dfscale(df::PlummerDF)
2626
return (df.potential.G*df.potential.M*df.potential.bc)^(-3/2)
2727
end
2828

src/DistributionFunctions.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ module DistributionFunctions
33
#####################################
44
# Dependencies
55
#####################################
6-
using OrbitalElements # potentials, resonances
6+
using OrbitalElements # potentials
77

88

99
#####################################
1010
# Exports
1111
#####################################
1212
export DistributionFunction
13-
export Distribution,DFDE,DFDL,gradient
13+
14+
# functions common to all DistributionFunction
15+
export distribution,gradient
1416

1517
# types for multiple dispatch
16-
export EnergyOnlyDistributionFunction,EnergyAngularMomentumDistributionFunction,ActionDistributionFunction
18+
export ErgodicDF,EnergyAngularMomentumDF,ActionDF
1719

1820
# spheres
19-
export PlummerDistributionFunction,IsotropicPlummer,OsipkovMerrittPlummerEL,OsipkovMerrittPlummerJL
20-
export IsochroneDistributionFunction,IsotropicIsochrone,OsipkovMerrittIsochroneEL,OsipkovMerrittIsochroneJL
21+
# change to DF
22+
export PlummerDF,IsotropicPlummer,OsipkovMerrittPlummerEL,OsipkovMerrittPlummerJL
23+
export IsochroneDF,IsotropicIsochrone,OsipkovMerrittIsochroneEL,OsipkovMerrittIsochroneJL
2124

2225
# discs
26+
# add DF here
2327
export MestelDisc,ZangDisc,TruncatedZangDisc
2428

2529

0 commit comments

Comments
 (0)