Skip to content

Commit

Permalink
fixed five layer profile function
Browse files Browse the repository at this point in the history
  • Loading branch information
gschwefer committed Oct 27, 2023
1 parent e7e5870 commit f62213b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ctapipe/atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _exponential(h, a, b, c):


def _inv_exponential(T, a, b, c):
"inverse function for eponetial atmosphere"
"inverse function for exponetial atmosphere"
return -c * np.log((T - a) / b)


Expand All @@ -340,7 +340,7 @@ def _linear(h, a, b, c):

def _inv_linear(T, a, b, c):
"inverse function for linear atmosphere"
return -b / c * (T - a)
return -c / b * (T - a)


def _d_linear(h, a, b, c):
Expand Down Expand Up @@ -379,7 +379,7 @@ def __init__(self, table: Table):
for i, f in enumerate([_exponential] * 4 + [_linear])
]
self._inv_funcs = [
partial(f, a=param_a[i], b=param_b[i], c=param_c[i])
partial(f, a=param_a[4-i], b=param_b[4-i], c=param_c[4-i])
for i, f in enumerate([_inv_linear] + 4 * [_inv_exponential])
]
self._d_funcs = [
Expand Down Expand Up @@ -439,8 +439,8 @@ def integral(self, height) -> u.Quantity:

@u.quantity_input(overburden=u.g / (u.cm * u.cm))
def height_from_overburden(self, overburden) -> u.Quantity:
overburdens_at_heights = self.integral(self.table["height"].to(u.km))
which_func = np.digitize(overburden, overburdens_at_heights) - 1
overburdens_at_heights = np.flip(self.integral(self.table["height"].to(u.km)))
which_func = np.digitize(overburden, overburdens_at_heights)
condlist = [which_func == i for i in range(5)]
return u.Quantity(
np.piecewise(
Expand Down

0 comments on commit f62213b

Please sign in to comment.