Skip to content

Commit

Permalink
Improve code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
AramisDuf committed Oct 29, 2024
1 parent 2eb509e commit 5a988d1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/spcqe/extrapolate_asymptotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ def safe_exp(exp_input):
return exp_output

def safe_log(log_input):
return np.where(
log_input <= 0,
-np.inf, # Return -inf for invalid log input
np.log(log_input)
)
log_output = np.empty_like(log_input)
log_output[log_input <= 0] = -np.inf
log_output[log_input > 0] = np.log(log_input[log_input > 0])
return log_output


def plot_pdf(ax, transf, label):
Expand Down

0 comments on commit 5a988d1

Please sign in to comment.