Skip to content

Commit

Permalink
Small corrections in different functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Le Losq committed Apr 11, 2023
1 parent 9bf774f commit 1c34064
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions rampy/peak_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def peakarea(shape,**options):
return area, esearea
else:
return area

except ValueError:
print("amp and HWHM should be provided")

elif (shape == "lorentzian") or (shape == "pseudovoigt") or (shape == "pearson7"): # other shapes: trapezoidal integration
try:
amp=options.get("amp")
Expand Down
10 changes: 4 additions & 6 deletions rampy/spectranization.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def shiftsp(sp, shift):


def flipsp(sp):
"""Flip an array along the row dimension (dim = 1) if the row values are in decreasing order.
"""Flip or sort an array along the row dimension (dim = 1) if the row values are in decreasing order.
Starting from rampy v0.5, the new version is using argsort, such that the X values can be in any order.
Parameters
----------
Expand All @@ -133,11 +135,7 @@ def flipsp(sp):
sp : ndarray
The same array but sorted such that the values in the first column are in increasing order.
"""
if sp[-1,0] < sp[0,0]:
sp = np.flip(sp,0)
return sp
else:
return sp
return sp[sp[:, 0].argsort()] # we actually use argsort to sort the array in ascending order

def resample(x,y,x_new,**kwargs):
"""Resample a y signal associated with x, along the x_new values.
Expand Down
2 changes: 1 addition & 1 deletion rampy/tlcorrection.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ def tlcorrection(x,y,temp,wave, **kwargs):
elif normalisation == 'no':
print("No normalisation...")
else:
Error("Set the optional normalisation parameter to area, intensity or no.")
raise print("Set the optional normalisation parameter to area, intensity or no.")

return x, ycorr, ese*ycorr

0 comments on commit 1c34064

Please sign in to comment.