diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8eaa2b8..575531a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,13 +39,13 @@ jobs: coverage: codecov posargs: -n auto libraries: | - apt: + choco: - ffmpeg brew: - ffmpeg envs: | - windows: py310 - - macos: py39-oldestdeps + - macos: py39 docs: needs: [core] diff --git a/.gitignore b/.gitignore index e5ad27f..ff58272 100644 --- a/.gitignore +++ b/.gitignore @@ -210,6 +210,7 @@ docs/generated docs/sg_execution_times.rst docs/whatsnew/latest_changelog.txt irispy/_version.py +.sourcery.yaml ### Pycharm(?) .idea diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7f1f832..f74f7d9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,12 +11,12 @@ repos: args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$" - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.1.8' + rev: 'v0.1.9' hooks: - id: ruff args: ['--fix', '--unsafe-fixes'] - repo: https://github.com/psf/black - rev: 23.12.0 + rev: 23.12.1 hooks: - id: black exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" diff --git a/irispy/data/test/compress.py b/irispy/data/test/compress.py index 86bd341..8c73cd4 100644 --- a/irispy/data/test/compress.py +++ b/irispy/data/test/compress.py @@ -28,14 +28,14 @@ def compress(files: list) -> None: continue if hdu.data.ndim == 2: factor = (0.1, 1) - if hdu.data.ndim == 3: + elif hdu.data.ndim == 3: factor = (0.1, 0.1, 0.1) hdu.data = zoom(hdu.data, factor, order=0) - if hdu.data.ndim == 3: - hdu.header["NAXIS1"] = hdu.data.shape[2] - hdu.header["NAXIS2"] = hdu.data.shape[1] - hdu.header["NAXIS3"] = hdu.data.shape[0] if hdu.data.ndim == 2: hdu.header["NAXIS1"] = hdu.data.shape[1] hdu.header["NAXIS2"] = hdu.data.shape[0] + elif hdu.data.ndim == 3: + hdu.header["NAXIS1"] = hdu.data.shape[2] + hdu.header["NAXIS2"] = hdu.data.shape[1] + hdu.header["NAXIS3"] = hdu.data.shape[0] hdus.writeto(f"{file.split('.fits')[0]}_test.fits", overwrite=True) diff --git a/irispy/spectrograph.py b/irispy/spectrograph.py index 0e2ef95..bd58467 100644 --- a/irispy/spectrograph.py +++ b/irispy/spectrograph.py @@ -187,7 +187,7 @@ def convert_to(self, new_unit_type, time_obs=None, response_version=4): # Get wavelength for each pixel. obs_wavelength = self.axis_world_coords(2) - if new_unit_type == "DN" or new_unit_type == "photons": + if new_unit_type in ["DN", "photons"]: if self.unit.is_equivalent(utils.RADIANCE_UNIT): # Convert from radiance to counts/s new_data_quantities = utils.convert_or_undo_photons_per_sec_to_radiance( @@ -212,10 +212,7 @@ def convert_to(self, new_unit_type, time_obs=None, response_version=4): mask=self.mask, ) self._extra_coords = self.extra_coords - if new_unit_type == "DN": - new_unit = utils.DN_UNIT[detector_type] - else: - new_unit = u.photon + new_unit = utils.DN_UNIT[detector_type] if new_unit_type == "DN" else u.photon new_data_arrays, new_unit = utils.convert_between_DN_and_photons( (self.data, self.uncertainty.array), self.unit, diff --git a/tox.ini b/tox.ini index cd7ede8..e6d5e3b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{39,310,311}{,-oldestdeps,-devdeps,-online} + py{39,310,311}{,-devdeps,-online} build_docs codestyle isolated_build = true @@ -13,7 +13,6 @@ changedir = .tmp/{envname} description = run tests devdeps: with the latest developer version of key dependencies - oldestdeps: with the oldest supported version of key dependencies online: that require remote data setenv = MPLBACKEND = agg @@ -27,8 +26,6 @@ deps = # The devdeps factor is intended to be used to install the latest developer version of key dependencies. devdeps: git+https://github.com/sunpy/sunraster devdeps: git+https://github.com/sunpy/ndcube - # Oldest deps we pin against. - oldestdeps: sunraster<0.5 # These are specific online extras we use to run the online tests. online: pytest-rerunfailures online: pytest-timeout