Skip to content

Commit 93bcb01

Browse files
author
cranko
committed
Release commit created with Cranko.
+++ cranko-release-info-v1 [[projects]] qnames = ["pwkit", "pypa"] version = "1.3.0" age = 0 +++
2 parents 6ac2b57 + 9f73383 commit 93bcb01

File tree

18 files changed

+461
-279
lines changed

18 files changed

+461
-279
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# pwkit 1.3.0 (2025-04-25)
2+
3+
- Add support for CASA 6! (#25, @pkgw). It's still incomplete, and there
4+
may be some lingering bugs, but I am currently able to run most of my
5+
processing pipeline on real VLA data.
6+
- In `imtool show`, pressing `f` or `p` will now fit a source at the position of
7+
the mouse cursor. The `f` key will fit either a point or a Gaussian, depending
8+
on what fits better; `p` will force a point-source fit.
9+
- Fix `pwkit.astutil.get_2mass_epoch` to use HTTPS to contact the Vizier API
10+
- More Numpy 2 compatibility fixes, including the use of `np.asarray` with a
11+
`float` dtype instead of `np.asfarray`. This could potentially reduce
12+
efficiency if the input was a `float32` and we're upgrading it to a `float64`.
13+
14+
The DOI of this release is [10.5281/zenodo.15283107][vdoi].
15+
16+
[vdoi]: https://doi.org/10.5281/zenodo.15283107
17+
18+
119
# pwkit 1.2.2 (2024-10-11)
220

321
- Correct fixup processing of args with non-None defaults in `pwkit.kwargv` (#24)

ci/zenodo.json5

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
],
3131
"language": "eng",
3232
"license": "MIT",
33-
"publication_date": "2024-10-11",
34-
"title": "pwkit 1.2.2",
33+
"publication_date": "2025-04-25",
34+
"title": "pwkit 1.3.0",
3535
"upload_type": "software",
36-
"version": "1.2.2"
36+
"version": "1.3.0"
3737
},
3838
"conceptdoi": "10.5281/zenodo.8052838",
39-
"record_id": "13920308",
40-
"doi": "10.5281/zenodo.13920308",
41-
"bucket_link": "https://zenodo.org/api/files/0d206d5e-7361-4515-a15f-c30195b93dbb"
39+
"record_id": "15283107",
40+
"doi": "10.5281/zenodo.15283107",
41+
"bucket_link": "https://zenodo.org/api/files/baf95e42-dfdc-4337-acbd-874b9931721b"
4242
}

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
]
1212

1313
project = "pwkit"
14-
release = "1.2.2" # cranko project-version
14+
release = "1.3.0" # cranko project-version
1515
version = ".".join(release.split(".")[:2])
1616

1717
copyright = "2015-2023, Peter K. G. Williams and collaborators"

docs/source/foundations/numerical.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ Making functions that auto-broadcast their arguments
7272
array of the same shape as the argument(s).
7373

7474
If *force_float* is true (the default), the input arrays will be converted to
75-
floating-point types if necessary (with :func:`numpy.asfarray`) before being
76-
passed to the function.
75+
floating-point types if necessary before being passed to the function.
7776

7877
Example::
7978

pwkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
__all__ = "Holder PKError binary_type reraise_context text_type unicode_to_str".split()
1111

12-
__version__ = "1.2.2" # cranko project-version
12+
__version__ = "1.3.0" # cranko project-version
1313

1414
# Archaic Python 2/3 compatibility support
1515

pwkit/astimage.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,16 +998,21 @@ def delete(self):
998998

999999

10001000
try:
1001-
import casac
1001+
import casatools # CASA 6
10021002

10031003
CASAImage = CasaCImage
10041004
except ImportError:
10051005
try:
1006-
from pyrap.images import image
1006+
import casac # CASA 5
10071007

1008-
CASAImage = PyrapImage
1008+
CASAImage = CasaCImage
10091009
except ImportError:
1010-
CASAImage = _CasaUnsupportedImage
1010+
try:
1011+
from pyrap.images import image # ancient history
1012+
1013+
CASAImage = PyrapImage
1014+
except ImportError:
1015+
CASAImage = _CasaUnsupportedImage
10111016

10121017

10131018
class FITSImage(AstroImage):

pwkit/astutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def _observe_from_bcrs(self, observer):
846846
del Star, T0
847847

848848

849-
_vizurl = "http://vizier.u-strasbg.fr/viz-bin/asu-tsv"
849+
_vizurl = "https://vizier.u-strasbg.fr/viz-bin/asu-tsv"
850850

851851

852852
def get_2mass_epoch(tmra, tmdec, debug=False):

pwkit/cli/imtool.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def _print(self, path):
333333
if im.toworld is not None:
334334
latax, lonax = im._latax, im._lonax
335335
delta = 1e-6
336-
p = 0.5 * (np.asfarray(im.shape) - 1)
336+
p = 0.5 * (np.asarray(im.shape, dtype=float) - 1)
337337
w1 = im.toworld(p)
338338
p[latax] += delta
339339
w2 = im.toworld(p)
@@ -346,7 +346,7 @@ def _print(self, path):
346346
if im.pclat is not None:
347347
print("center =", fmtradec(im.pclon, im.pclat), "# pointing")
348348
elif im.toworld is not None:
349-
w = im.toworld(0.5 * (np.asfarray(im.shape) - 1))
349+
w = im.toworld(0.5 * (np.asarray(im.shape, dtype=float) - 1))
350350
print("center =", fmtradec(w[lonax], w[latax]), "# lattice")
351351

352352
if im.shape is not None:
@@ -429,7 +429,7 @@ def okeys(**kwargs):
429429
if im.toworld is not None:
430430
latax, lonax = im._latax, im._lonax
431431
delta = 1e-6
432-
p = 0.5 * (np.asfarray(im.shape) - 1)
432+
p = 0.5 * (np.asarray(im.shape, dtype=float) - 1)
433433
w1 = im.toworld(p)
434434
p[latax] += delta
435435
w2 = im.toworld(p)
@@ -446,7 +446,7 @@ def okeys(**kwargs):
446446
lon=fmthours(im.pclon),
447447
)
448448
elif im.toworld is not None:
449-
w = im.toworld(0.5 * (np.asfarray(im.shape) - 1))
449+
w = im.toworld(0.5 * (np.asarray(im.shape, dtype=float) - 1))
450450
dest_section["center"] = okeys(
451451
kind="lattice",
452452
lat=fmtdeglat(w[latax]),
@@ -582,8 +582,41 @@ def invoke(self, args, **kwargs):
582582
if no_coords:
583583
toworld = None
584584

585+
def extra_keypress_handler(
586+
viewer: "Viewer", keyname: str, modmask: "Gdk.ModifierType"
587+
) -> bool:
588+
if keyname in "fp" and int(modmask) == 0:
589+
# "f" - fit a source at current cursor position
590+
# "p" - same, forcing a point source
591+
from ..immodel import fit_one_source
592+
593+
x, y = viewer.viewport.get_pointer_data_coords()
594+
x = int(round(x))
595+
y = int(
596+
round(img.shape[0] - 1 - y)
597+
) # need to account for yflip here
598+
print(f"Fitting source at initial position: (x,y) = ({x!r}, {y!r})")
599+
600+
def report_func(key: str, fmt: str, value):
601+
print(key, "=", fmt % value, sep="")
602+
603+
fit_one_source(
604+
img,
605+
x,
606+
y,
607+
forcepoint=keyname == "p",
608+
report_func=report_func,
609+
)
610+
return True
611+
612+
return False
613+
585614
ndshow.view(
586-
data, title=path + " — Array Viewer", toworld=toworld, yflip=True
615+
data,
616+
title=path + " — Array Viewer",
617+
toworld=toworld,
618+
yflip=True,
619+
extra_keypress_handler=extra_keypress_handler,
587620
)
588621

589622
sys.exit(int(anyfailures))

0 commit comments

Comments
 (0)