Skip to content

Commit a388e92

Browse files
committed
make asdf-astropy required
try another way to fix olddeps test
1 parent 397f8fd commit a388e92

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

photutils/converters/apertures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class CircularApertureConverter(Converter):
1414
Base class for aperture converters.
1515
"""
1616

17-
tags = ['tag:astropy.org:photutils/aperture/circular_aperture-*']
18-
types = ['photutils.aperture.circle.CircularAperture']
17+
tags = ['tag:astropy.org:photutils/aperture/circular_aperture-*'] # noqa: RUF012, E501
18+
types = ['photutils.aperture.circle.CircularAperture'] # noqa: RUF012
1919

20-
def to_yaml_tree(self, obj, tag, ctx):
20+
def to_yaml_tree(self, obj, tag, ctx): # noqa: ARG002
2121
if obj.positions.shape == (2,):
2222
pos = obj.positions.tolist()
2323
else:
@@ -28,7 +28,7 @@ def to_yaml_tree(self, obj, tag, ctx):
2828
'r': obj.r,
2929
}
3030

31-
def from_yaml_tree(self, node, tag, ctx):
31+
def from_yaml_tree(self, node, tag, ctx): # noqa: ARG002
3232
from photutils.aperture.circle import CircularAperture
3333

3434
return CircularAperture(

photutils/converters/functional_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class AiryDiskPSFConverter(TransformConverterBase):
1515
Converter for AiryDiskPSF.
1616
"""
1717

18-
tags = ['tag:astropy.org:photutils/psf/airy_disk_psf-*']
19-
types = ['photutils.psf.AiryDiskPSF']
18+
tags = ['tag:astropy.org:photutils/psf/airy_disk_psf-*'] # noqa: RUF012
19+
types = ['photutils.psf.AiryDiskPSF'] # noqa: RUF012
2020

21-
def to_yaml_tree_transform(self, model, tag, ctx):
21+
def to_yaml_tree_transform(self, model, tag, ctx): # noqa: ARG002
2222
return {
2323
'flux': parameter_to_value(model.flux),
2424
'x_0': parameter_to_value(model.x_0),
@@ -27,7 +27,7 @@ def to_yaml_tree_transform(self, model, tag, ctx):
2727
'bbox_factor': model.bbox_factor,
2828
}
2929

30-
def from_yaml_tree_transform(self, node, tag, ctx):
30+
def from_yaml_tree_transform(self, node, tag, ctx): # noqa: ARG002
3131
from photutils.psf import AiryDiskPSF
3232

3333
return AiryDiskPSF(

photutils/converters/tests/test_apertures.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"""
44
Tests for the photutils aperture converters.
55
"""
6+
import asdf
67
import numpy as np
78

8-
import asdf
99
from photutils.aperture import CircularAperture
1010

11-
1211
apertures = [
1312
CircularAperture(positions=[(1, 2), (3, 4)], r=5),
14-
CircularAperture(positions=[(5, 6)], r=7),
13+
CircularAperture(positions=(5, 6), r=7),
1514
]
1615

1716

@@ -21,11 +20,11 @@ def test_aperture_converters(tmp_path):
2120
"""
2221
for aperture in apertures:
2322
with asdf.AsdfFile() as af:
24-
af["aperture"] = aperture
25-
af.write_to(tmp_path / "aperture.asdf")
23+
af['aperture'] = aperture
24+
af.write_to(tmp_path / 'aperture.asdf')
2625

27-
with asdf.open(tmp_path / "aperture.asdf") as af:
28-
aperture2 = af["aperture"]
26+
with asdf.open(tmp_path / 'aperture.asdf') as af:
27+
aperture2 = af['aperture']
2928

3029
assert np.all(aperture.positions == aperture2.positions)
3130
assert aperture.r == aperture2.r

photutils/converters/tests/test_psf.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
"""
44
Tests for the photutils PSF converters.
55
"""
6-
from astropy import units as u
76
import asdf
7+
from astropy import units as u
88

99
from photutils.psf import AiryDiskPSF
1010

11-
1211
psfs = [
13-
AiryDiskPSF(flux=1*u.Jy, x_0=0*u.arcsec, y_0=0*u.arcsec,
14-
radius=1*u.arcsec, bbox_factor=2),
15-
AiryDiskPSF(flux=2*u.Jy, x_0=1*u.arcsec, y_0=1*u.arcsec,
16-
radius=2*u.arcsec, bbox_factor=3),
12+
AiryDiskPSF(flux=1 * u.Jy, x_0=0 * u.arcsec, y_0=0 * u.arcsec,
13+
radius=1 * u.arcsec, bbox_factor=2),
14+
AiryDiskPSF(flux=2 * u.Jy, x_0=1 * u.arcsec, y_0=1 * u.arcsec,
15+
radius=2 * u.arcsec, bbox_factor=3),
1716
]
1817

1918

@@ -23,11 +22,11 @@ def test_psf_converters(tmp_path):
2322
"""
2423
for psf in psfs:
2524
with asdf.AsdfFile() as af:
26-
af["psf"] = psf
27-
af.write_to(tmp_path / "psf.asdf")
25+
af['psf'] = psf
26+
af.write_to(tmp_path / 'psf.asdf')
2827

29-
with asdf.open(tmp_path / "psf.asdf") as af:
30-
psf2 = af["psf"]
28+
with asdf.open(tmp_path / 'psf.asdf') as af:
29+
psf2 = af['psf']
3130

3231
assert psf.flux == psf2.flux
3332
assert psf.x_0 == psf2.x_0

photutils/resources/manifests/photutils-1.0.0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ tags:
1111
- tag_uri: tag:astropy.org:photutils/psf/airy_disk_psf-1.0.0
1212
schema_uri: asdf://astropy.org/photutils/schemas/psf/airy_disk_psf-1.0.0
1313
title: AiryDiskPSF
14-
description: ASDF schema for serializing a photutils AiryDiskPSF.
14+
description: ASDF schema for serializing a photutils AiryDiskPSF.

photutils/resources/schemas/aperture/circular_aperture-1.0.0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ properties:
4141
The radius of the circular aperture in pixels.
4242
type: number
4343
required: [positions, r]
44-
...
44+
...

photutils/resources/schemas/psf/airy_disk_psf-1.0.0.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ examples:
2222
radius: 5.0
2323
x_0: 24.3
2424
y_0: 25.2
25-
25+
2626
2727
allOf:
2828
- $ref: "http://stsci.edu/schemas/asdf/transform/transform-1.4.0"
@@ -53,4 +53,4 @@ allOf:
5353
description: Factor by which to multiply the radius to determine the size of the bounding box.
5454

5555
required: [flux, x_0, y_0, radius]
56-
...
56+
...

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ classifiers = [
3333
dynamic = ['version']
3434
requires-python = '>=3.11'
3535
dependencies = [
36-
'astropy >= 6.1.4',
36+
'astropy >= 6.1.7',
3737
'numpy >= 2.0',
3838
'scipy >= 1.13',
39+
'asdf-astropy>=0.10',
3940
]
4041

4142
[project.urls]
@@ -48,7 +49,6 @@ Documentation = 'https://photutils.readthedocs.io/en/stable/'
4849

4950
[project.optional-dependencies]
5051
all = [
51-
'asdf-astropy',
5252
'bottleneck >= 1.4',
5353
'gwcs >= 0.20',
5454
'matplotlib >= 3.9',
@@ -242,6 +242,8 @@ exclude = [
242242
'\._.*', # private functions/methods
243243
'^test_*', # test code
244244
'^conftest.*$', # pytest configuration
245+
'to_yaml_tree', # ASDF converter
246+
'from_yaml_tree', # ASDF converter
245247

246248
# PR01: private classes/functions
247249
'SigmaClipSentinelDefault$',

0 commit comments

Comments
 (0)