Skip to content

Commit

Permalink
Fix builds (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis authored Dec 30, 2023
1 parent 84d3695 commit 9985d2d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ docs/generated
docs/sg_execution_times.rst
docs/whatsnew/latest_changelog.txt
irispy/_version.py
.sourcery.yaml

### Pycharm(?)
.idea
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)$"
Expand Down
10 changes: 5 additions & 5 deletions irispy/data/test/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 2 additions & 5 deletions irispy/spectrograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9985d2d

Please sign in to comment.