diff --git a/.github/workflows/iblatlas_ci.yml b/.github/workflows/iblatlas_ci.yml index bc24e0b..e15edf5 100644 --- a/.github/workflows/iblatlas_ci.yml +++ b/.github/workflows/iblatlas_ci.yml @@ -16,12 +16,12 @@ jobs: max-parallel: 4 matrix: os: ["windows-latest", "ubuntu-latest"] - python-version: ["3.8", "3.11"] + python-version: ["3.10", "3.12"] exclude: - os: windows-latest - python-version: 3.8 + python-version: 3.10 - os: ubuntu-latest - python-version: 3.11 + python-version: 3.12 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml index 98ddd76..d52c483 100644 --- a/.github/workflows/pypi_publish.yml +++ b/.github/workflows/pypi_publish.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6259b..51005ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.5.5] +### Modified +- removed instances of `np.NaN` to replace with `np.nan` for numpy 2.0 compatibility +- set python 3.10 as minimum python version + ## [0.5.4] ### Modified - `iblatlas.plots.plot_swanson_vector` option to show colorbar diff --git a/README.md b/README.md index fa5fd6c..cc2c72e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # iblatlas Tools to manipulate hierarchical 3D representations of the mouse brain anatomy for electrophysiolgy experiments. -The tools are mainly using the the Allen CCF although some other atlases can be used. +The tools are mainly using the Allen CCF although some other atlases can be used. **This repository uses minimal requirements, based of standard `matplotlib`, `numpy` and `scipy` libraries, to the exclusion of more complex visualization tools such as `pyqt`.** diff --git a/iblatlas/__init__.py b/iblatlas/__init__.py index e3b5018..9d79628 100644 --- a/iblatlas/__init__.py +++ b/iblatlas/__init__.py @@ -194,4 +194,4 @@ .. [10] Allen Mouse Common Coordinate Framework Technical White Paper (October 2017 v3) http://help.brain-map.org/download/attachments/8323525/Mouse_Common_Coordinate_Framework.pdf """ -__version__ = '0.5.4' +__version__ = '0.5.5' diff --git a/iblatlas/atlas.py b/iblatlas/atlas.py index b2f1a93..3cc846e 100644 --- a/iblatlas/atlas.py +++ b/iblatlas/atlas.py @@ -1493,7 +1493,7 @@ def compute_regions_volume(self, cumsum=False): self.regions.volume = self.regions.volume * (self.res_um / 1e3) ** 3 -def NeedlesAtlas(*args, **kwargs): +def NeedlesAtlas(*args, **kwargs) -> AllenAtlas: """ Instantiates an atlas.BrainAtlas corresponding to the Allen CCF at the given resolution using the IBL Bregma and coordinate system. The Needles atlas defines a stretch along AP diff --git a/iblatlas/genomics/merfish_scrapping/01_ingest_zhuang.py b/iblatlas/genomics/merfish_scrapping/01_ingest_zhuang.py index 3b4e0f7..5afe538 100644 --- a/iblatlas/genomics/merfish_scrapping/01_ingest_zhuang.py +++ b/iblatlas/genomics/merfish_scrapping/01_ingest_zhuang.py @@ -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): @@ -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 diff --git a/iblatlas/plots.py b/iblatlas/plots.py index 44bb2f0..bb47b73 100644 --- a/iblatlas/plots.py +++ b/iblatlas/plots.py @@ -831,7 +831,7 @@ def plot_swanson_vector(acronyms=None, values=None, ax=None, hemisphere=None, br annotate_order='top', annotate_list=None, mask=None, mask_color='w', fontsize=10, show_cbar=False, extend='neither', **kwargs): """ - Function to plot scalar value per allen region on the swanson projection. Plots on a vecortised version of the + Function to plot scalar value per allen region on the swanson projection. Plots on a vectorised version of the swanson projection Parameters diff --git a/iblatlas/regions.py b/iblatlas/regions.py index 0907779..fb9a45c 100644 --- a/iblatlas/regions.py +++ b/iblatlas/regions.py @@ -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] diff --git a/iblatlas/tests/test_atlas.py b/iblatlas/tests/test_atlas.py index 49d9aba..d43229c 100644 --- a/iblatlas/tests/test_atlas.py +++ b/iblatlas/tests/test_atlas.py @@ -42,7 +42,7 @@ def test_rgba(self): def test_get(self): ctx = self.brs.get(688) - self.assertTrue(len(ctx.acronym) == 1 and ctx.acronym == 'CTX') + self.assertEqual('CTX', ctx.acronym) def test_ancestors_descendants(self): # here we use the same brain region as in the alyx test @@ -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 @@ -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')) diff --git a/pyproject.toml b/pyproject.toml index 4718e52..77d0dd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "iblatlas" description = "IBL atlas module" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.10" license = {file = "LICENSE"} authors = [ {name = "IBL staff", email = "info@internationalbrainlab.org"},