Skip to content

Commit

Permalink
avoid overflow messages by clipping before exponentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Nov 27, 2024
1 parent 11927c0 commit 7317b57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion py/rvspecfit/vel_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def firstguess(specdata,
class VSiniMapper:

def __init__(self, min_vsini, max_vsini):
self.log_min_vsini = np.log(min_vsini)
self.log_max_vsini = np.log(max_vsini)
self.min_vsini = min_vsini
self.max_vsini = max_vsini

Expand All @@ -106,7 +108,7 @@ def inverse(self, x):
""" Undo the transformation.
Return proper vsini
"""
return np.clip(np.exp(x), self.min_vsini, self.max_vsini)
return np.exp(np.clip(x, self.log_min_vsini, self.log_max_vsini))


class ParamMapper:
Expand Down

0 comments on commit 7317b57

Please sign in to comment.