Skip to content

Commit

Permalink
fix scaling when dealing with masked arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
saransh13 committed Dec 19, 2024
1 parent 95e7586 commit 674e2d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hexrdgui/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@ def none(x):


def sqrt(x):
if isinstance(x, np.ma.masked_array):
return np.sqrt(x.filled(np.nan) -
np.nanmin(x.filled(np.nan)))
return np.sqrt(x - np.nanmin(x))


def log(x):
if isinstance(x, np.ma.masked_array):
return np.log(x.filled(np.nan) -
np.nanmin(x.filled(np.nan)) + 1)
return np.log(x - np.nanmin(x) + 1)


def log_log_sqrt(x):
if isinstance(x, np.ma.masked_array):
return np.log(np.log(np.sqrt(x.filled(np.nan) -
np.nanmin(x.filled(np.nan))) + 1) + 1)
return np.log(np.log(np.sqrt(x - np.nanmin(x)) + 1) + 1)


Expand Down

0 comments on commit 674e2d6

Please sign in to comment.