Skip to content

Commit

Permalink
Merge pull request #22 from ConorMacBride/tidy-profiles
Browse files Browse the repository at this point in the history
Tidy mcalf.profiles
  • Loading branch information
ConorMacBride committed Mar 29, 2021
2 parents 9eaaa7f + c3764c7 commit 3a66dd9
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 260 deletions.
23 changes: 1 addition & 22 deletions src/mcalf/profiles/gaussian.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import numpy as np
from scipy.special import erf


__all__ = ['single_gaussian', 'skew_normal', 'skew_normal_with_gaussian']
__all__ = ['single_gaussian']


def single_gaussian(x, a, b, c, d):
Expand All @@ -28,23 +27,3 @@ def single_gaussian(x, a, b, c, d):
"""
g = a * np.exp(- (x-b)**2.0 / (2.0 * c**2.0))
return g + d


def _skew_normal_with_gaussian(x, a_a=0, alpha=1, xi=0, omega=1, a_e=0, b=0, c=1, d=0):
x1 = (x - xi) / omega
pdf = np.exp(- x1 ** 2.0 / 2.0) / np.sqrt(2.0 * np.pi)
cdf = 0.5 * (1.0 + erf(alpha * x1 / np.sqrt(2.0)))
skewed_normal = 2.0 * pdf * cdf / omega

absorption = a_a * skewed_normal
emission = a_e * np.exp(- (x - b) ** 2.0 / (2.0 * c ** 2.0))

return absorption + emission + d


def skew_normal(x, a_a, alpha, xi, omega, d):
return _skew_normal_with_gaussian(x, a_a=a_a, alpha=alpha, xi=xi, omega=omega, d=d)


def skew_normal_with_gaussian(x, a_a, alpha, xi, omega, a_e, b, c, d): # This can be optimised later
return _skew_normal_with_gaussian(x, a_a=a_a, alpha=alpha, xi=xi, omega=omega, a_e=a_e, b=b, c=c, d=d)

0 comments on commit 3a66dd9

Please sign in to comment.