Skip to content

Commit

Permalink
Merge pull request #1112 from wright-group/npfloat
Browse files Browse the repository at this point in the history
Numpy deprecated np.float as an alias for float, use np.float64
  • Loading branch information
kameyer226 committed Jan 5, 2023
2 parents 3e7c8c3 + b292070 commit 3d51eb3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

## Changed
### Fixed
- numpy deprecated the `np.float` alias, so use `np.float64` to be more precise

### Changed
- data.join now has MultidimensionalAxisError exception message
- `Axis`: space character ("\s") in expressions are culled.
- fixed `interact2D` bug: channel/axes can now be specified with non-zero index arguments
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/artists/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def mpl_to_in(mpl, total, n):
return (total / (n + mpl * (n - 1))) * mpl

# calculate column widths, width_ratio
subplot_ratios = np.array([i for i in cols if not i == "cbar"], dtype=np.float)
subplot_ratios = np.array([i for i in cols if not i == "cbar"], dtype=np.float64)
subplot_ratios /= sum(subplot_ratios)
subplot_widths = total_subplot_width * subplot_ratios
width_ratios = []
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_pycmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _no_collapse_fill(data, headers, file_, shape, verbose):
file_.seek(0)
arr = np.genfromtxt(file_, max_rows=frame_size)
while arr.size > 0:
index = tuple(arr[0, 0 : len(shape) - 1].astype(np.int))
index = tuple(arr[0, 0 : len(shape) - 1].astype(np.int64))
if verbose:
print(index)
for i, (kind, name) in enumerate(zip(headers["kind"], headers["name"])):
Expand Down
4 changes: 2 additions & 2 deletions tests/dataset/ipow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_d1_d2():
value = random.randint(0, 5)
original_max = data.ai0.max()
data.ai0 **= value
assert data.ai0.max() == original_max**value
assert np.isclose(data.ai0.max(), original_max**value)
data.close()


Expand All @@ -41,7 +41,7 @@ def test_w1():
value = random.randint(0, 5)
original_max = data.signal.max()
data.signal **= value
assert data.signal.max() == original_max**value
assert np.isclose(data.signal.max(), original_max**value)
data.close()


Expand Down

0 comments on commit 3d51eb3

Please sign in to comment.