Skip to content

Commit

Permalink
refactor for numpy 2.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
oliche committed Nov 18, 2024
1 parent 02862b1 commit d66f612
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions iblatlas/genomics/merfish_scrapping/01_ingest_zhuang.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def int_after_colon(text):
captured_integer = int(match.group(1))
return float(captured_integer)
else:
return np.NaN
return np.nan


def fcn_groupby_check_unique(df_cells, group, fields):
Expand Down Expand Up @@ -79,7 +79,7 @@ def reindex_missing_rows(df):
elif isinstance(missing_rec[k], int | np.uint32 | np.int32 | np.uint64 | np.int64):
missing_rec[k] = 0
elif isinstance(missing_rec[k], float | np.float32 | np.float64):
missing_rec[k] = np.NaN
missing_rec[k] = np.nan
df = df.reindex(pd.Index(np.arange(np.max(df.index) + 1), name=df.index.name), fill_value=0)
df.iloc[imiss, :] = missing_rec
return df
Expand Down
2 changes: 1 addition & 1 deletion iblatlas/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def propagate_down(self, acronyms, values):
_, user_indices = ismember(user_aids, self.id)
self.compute_hierarchy()
ia, ib = ismember(self.hierarchy, user_indices)
v = np.zeros_like(ia, dtype=np.float64) * np.NaN
v = np.zeros_like(ia, dtype=np.float64) * np.nan
v[ia] = values[ib]
all_values = np.nanmedian(v, axis=0)
indices = np.where(np.any(ia, axis=0))[0]
Expand Down
4 changes: 2 additions & 2 deletions iblatlas/tests/test_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def test_init_from_dict(self):

brain_atlas = _create_mock_atlas()
brain_atlas.compute_surface()
brain_atlas.top = brain_atlas.top * np.NaN
brain_atlas.top = brain_atlas.top * np.nan
ins = Insertion.from_dict(d, brain_atlas=brain_atlas)
# eval the entry point, should be super close
dxyz = ins.trajectory.eval_x(d['x'] / 1e6) - np.array((d['x'], d['y'], d['z'])) / 1e6
Expand Down Expand Up @@ -562,7 +562,7 @@ def test_init_from_track(self):
brain_exit = insertion.get_brain_exit(insertion.trajectory, brain_atlas)
self.assertTrue(brain_exit[2] == brain_atlas.bc.i2z(104))
# test getting no intersection with the brain surface
brain_atlas.srf_xyz *= np.NaN
brain_atlas.srf_xyz *= np.nan
with self.assertRaises(ValueError):
insertion.get_brain_entry(insertion.trajectory, brain_atlas)
self.assertIsNone(insertion.get_brain_entry(insertion.trajectory, brain_atlas, mode='none'))
Expand Down

0 comments on commit d66f612

Please sign in to comment.