Skip to content

Commit

Permalink
Release commit created with Cranko.
Browse files Browse the repository at this point in the history
+++ cranko-release-info-v1
[[projects]]
qnames = ["toasty", "pypa"]
version = "0.19.0"
age = 0

+++
  • Loading branch information
cranko committed Dec 14, 2023
2 parents fdf9c26 + d3ff252 commit 35ef3ee
Show file tree
Hide file tree
Showing 26 changed files with 292 additions and 165 deletions.
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs
15 changes: 0 additions & 15 deletions .readthedocs.yml

This file was deleted.

20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# toasty 0.19.0 (2023-12-14)

- Implement a `--tiling-method` argument for `toasty view` (#97, @pkgw). This
allows you to force the choice of a specific method. In particular, sometimes
it is helpful to force the use of TOAST to get the most accurate display over
large angular sizes.
- Fix an outdated usage that broke processing of all-sky plate carrée ecliptic
images with Astropy 6.x (#99, @pkgw)
- Fix TOASTing of multi-plane (e.g, RGB) images that don't cover the whole sky
(#99, @pkgw). This fixes processing of RGB images that have lots of pixels but
don't necessarily cover huge solid angles.
- In `toasty tile-study`, if we're getting WCS information from a FITS file but
its dimensions disagree with the input image, try rescaling the pixel size if
the overall image shape is the same (#99, @pkgw). This reproduces behavior
already implemented for AVM processing, and helps if, say, you want to process
a large image where you've submitted a scaled-down version of it to
Astrometry.Net.
- Various fixes to the test suite and CI system.


# toasty 0.18.1 (2022-09-07)

- Fix tiling on macOS+Py3.7 due to an unexpectedly unimplemented API (#94,
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
<!--pypi-begin-->
[toasty] is a Python library that helps you create “tile pyramids” from
astronomical image data as used in the [TOAST] format. These multi-resolution
maps can be viewed in software such as the [AAS] [WorldWide Telescope].
maps can be viewed in software such as [WorldWide Telescope].

[toasty]: https://toasty.readthedocs.io/
[TOAST]: https://doi.org/10.3847/1538-4365/aaf79e
[AAS]: https://aas.org/
[WorldWide Telescope]: http://www.worldwidetelescope.org/

[toasty] was originally written by [Chris Beaumont], benefited from
contributions by Clara Brasseur (Space Telescope Science Institute), and is
currently maintained as part of the AAS [WorldWide Telescope] project.
currently maintained as part of the [WorldWide Telescope] project.

[Chris Beaumont]: https://chrisbeaumont.org/
<!--pypi-end-->
Expand Down Expand Up @@ -100,13 +99,13 @@ and [PyPI](https://pypi.org/project/toasty/#history).

## Legalities

[toasty] is copyright Chris Beaumont, Clara Brasseur, and the AAS WorldWide
[toasty] is copyright Chris Beaumont, Clara Brasseur, and the WorldWide
Telescope Team. It is licensed under the [MIT License](./LICENSE).


## Acknowledgments

[toasty] is part of the AAS WorldWide Telescope system, a [.NET Foundation]
[toasty] is part of the WorldWide Telescope system, a [.NET Foundation]
project managed by the non-profit [American Astronomical Society] (AAS). Work
on WWT has been supported by the AAS, the US [National Science Foundation]
(grants [1550701], [1642446], and [2004840]), the [Gordon and Betty Moore Foundation], and
Expand Down
20 changes: 10 additions & 10 deletions ci/azure-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ parameters:
type: object
default:

- name: linux_38
- name: linux_310
vmImage: ubuntu-20.04
vars:
PYTHON_SERIES: "3.8"
PYTHON_SERIES: "3.10"

- name: linux_39
vmImage: ubuntu-20.04
vars:
PYTHON_SERIES: "3.9"

- name: macos_38
vmImage: macos-10.15
- name: macos_310
vmImage: macos-11
vars:
PYTHON_SERIES: "3.8"
PYTHON_SERIES: "3.10"

- name: macos_39
vmImage: macos-10.15
vmImage: macos-11
vars:
PYTHON_SERIES: "3.9"

- name: windows_38
vmImage: windows-2019
- name: windows_310
vmImage: windows-2022
vars:
PYTHON_SERIES: "3.8"
PYTHON_SERIES: "3.10"

- name: windows_39
vmImage: windows-2019
vmImage: windows-2022
vars:
PYTHON_SERIES: "3.9"

Expand Down
10 changes: 5 additions & 5 deletions ci/azure-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
- ${{ if parameters.isMainDev }}:
- job: dummy_setup_only
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest
steps:
- template: azure-job-setup.yml

- ${{ if parameters.isRelease }}:
- job: branch_and_tag
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest
variables:
- group: Deployment Credentials
steps:
Expand All @@ -44,7 +44,7 @@ jobs:
- job: github_releases
dependsOn: branch_and_tag # otherwise, GitHub creates the tag itself
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest
variables:
- group: Deployment Credentials
steps:
Expand All @@ -61,7 +61,7 @@ jobs:
- job: python_publish
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest
variables:
- group: Deployment Credentials
steps:
Expand All @@ -88,7 +88,7 @@ jobs:
- job: zenodo_publish
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest
variables:
- group: Deployment Credentials

Expand Down
2 changes: 1 addition & 1 deletion ci/azure-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:

- job: sdist
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-latest

# Need Zenodo credentials to generate DOIs during formal releases. But make
# sure not to provide credentials otherwise (although Azure has its own checks
Expand Down
12 changes: 6 additions & 6 deletions ci/zenodo.json5
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
],
"language": "eng",
"license": "MIT",
"publication_date": "2022-09-07",
"title": "toasty 0.18.1",
"publication_date": "2023-12-14",
"title": "toasty 0.19.0",
"upload_type": "software",
"version": "0.18.1"
"version": "0.19.0"
},
"conceptdoi": "10.5281/zenodo.7055476",
"record_id": "7058238",
"doi": "10.5281/zenodo.7058238",
"bucket_link": "https://zenodo.org/api/files/e5ca7ed0-557d-4271-b77e-d9fe78addae0"
"record_id": "10383112",
"doi": "10.5281/zenodo.10383112",
"bucket_link": "https://zenodo.org/api/files/0f1838fd-9749-4f07-a18c-79180e5ffd9f"
}
14 changes: 13 additions & 1 deletion docs/cli/view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Detailed Usage
[--hdu-index INDEX[,INDEX,...]]
[--parallelism COUNT, -j COUNT]
[--tile-only]
[--tiling-method METHOD]
{FITS [FITS ...]}
The ``FITS`` argument(s) give the path(s) of one or more input FITS files. These
Expand Down Expand Up @@ -67,6 +68,17 @@ parallism to use in the tiling and downsampling process. On operating systems
that support parallel processing, the default is to use all CPUs. To disable
parallel processing, explicitly specify a factor of 1.
The ``--tiling-method METHOD`` argument indicates the target projection to use
when tiling the data. The default value, ``auto``, causes Toasty to use a
heuristic to automatically determine the best method. Other valid values are
``tan`` (to use a tangential/gnomonic projection, only valid for relatively
small areas on the sky), ``toast`` (for `TOAST`_, best in WWT for large-area
images), or ``hips`` (for `HiPS`_).
.. _TOAST: https://docs.worldwidetelescope.org/data-guide/1/spherical-projections/toast-projection/
.. _HiPS: https://www.ivoa.net/documents/HiPS/
The ``--appurl`` option can be used to override the base URL for the preview app
that will be used. This can be helpful when developing new features in one of
these apps.
Expand Down Expand Up @@ -109,7 +121,7 @@ The basic usage of this mode is
.. code-block:: shell
toasty view -t HOST FITS1 [FITS2...]
toasty view -t HOST [other arguments...] FITS1 [FITS2...]
where ``HOST`` is the hostname of the machine with the image(s), and the
``FITSn`` values are the paths of the images on the machine relative to the
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
author = "Chris Beaumont and the AAS WorldWide Telescope Team"
copyright = "2014-2020, " + author

release = "0.18.1" # cranko project-version
release = "0.19.0" # cranko project-version
version = ".".join(release.split(".")[:2])

extensions = [
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright 2013-2022 Chris Beaumont and the AAS WorldWide Telescope team
# Copyright 2013-2023 Chris Beaumont and the WorldWide Telescope team
# Licensed under the MIT License

from Cython.Distutils import build_ext # in pyproject.toml
Expand Down Expand Up @@ -36,15 +36,15 @@ def get_long_desc():

setup_args = dict(
name="toasty", # cranko project-name
version="0.18.1", # cranko project-version
description="Generate TOAST image tile pyramids from existing image data",
version="0.19.0", # cranko project-version
description="Generate image tile pyramids from existing image data",
long_description=get_long_desc(),
long_description_content_type="text/markdown",
url="https://toasty.readthedocs.io/",
license="MIT",
platforms="Linux, Mac OS X",
author="Chris Beaumont, AAS WorldWide Telescope Team",
author_email="wwt@aas.org",
author="Chris Beaumont, WorldWide Telescope Team",
author_email="hello@worldwidetelescope.org",
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
Expand Down
61 changes: 55 additions & 6 deletions toasty/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ def show_impl(settings):
print(doi)
elif settings.show_command == "version":
# This string constant will be rewritten by Cranko during releases:
version = "0.18.1" # cranko project-version
version = "0.19.0" # cranko project-version
print(version)
elif settings.show_command == "version-doi":
# This string constant will be rewritten by Cranko during releases:
doi = "10.5281/zenodo.7058238"
doi = "10.5281/zenodo.10383112"
if not doi.startswith("10."):
warn("this DOI is a fake value used for development builds")
print(doi)
Expand Down Expand Up @@ -641,10 +641,33 @@ def tile_study_impl(settings):
elif img.shape[:2] != (wcs_height, wcs_width):
warn(
f"image `{settings.imgpath}` has shape {img.shape}, but "
f"WCS reference file `{settings.fits_wcs}` has shape ({wcs_height}, {wcs_width}); "
f"astrometry may not transfer correctly"
f"WCS reference file `{settings.fits_wcs}` has shape ({wcs_height}, {wcs_width})"
)

# Cribbing some code from pyavm ...
scale_x = img.shape[1] / wcs_width
scale_y = img.shape[0] / wcs_height

if abs(scale_x - scale_y) / (scale_x + scale_y) >= 0.005:
warn(
"the aspect ratios are not compatible; I'll proceed, but astrometry is unlikely transfer correctly"
)
scale = 1.0
else:
warn("the aspect ratios are compatible, so I'll try rescaling")
scale = scale_x

wcs.wcs.crpix *= scale

if hasattr(wcs.wcs, "cd"):
wcs.wcs.cd /= scale
else:
wcs.wcs.cdelt /= scale

if hasattr(wcs, "naxis1"):
wcs.naxis1 = img.shape[1]
wcs.naxis2 = img.shape[0]

img._wcs = wcs # <= hack alert, but I think this is OK
img.ensure_negative_parity()
builder.apply_wcs_info(img.wcs, img.width, img.height)
Expand Down Expand Up @@ -884,6 +907,12 @@ def view_getparser(parser):
action="store_true",
help="Tile the data but do not open for viewing",
)
parser.add_argument(
"--tiling-method",
default="auto",
choices=["auto", "tan", "toast", "hips"],
help="The target projection when tiling: `auto`, `tan`, `toast`, or `hips`",
)
parser.add_argument(
"paths",
metavar="PATHS",
Expand All @@ -895,15 +924,28 @@ def view_getparser(parser):

def view_locally(settings):
from wwt_data_formats.server import preview_wtml
from . import TilingMethod
from .collection import CollectionLoader
from .fits_tiler import FitsTiler

if settings.tiling_method == "auto":
tiling_method = TilingMethod.AUTO_DETECT
elif settings.tiling_method == "tan":
tiling_method = TilingMethod.TAN
elif settings.tiling_method == "toast":
tiling_method = TilingMethod.TOAST
elif settings.tiling_method == "hips":
tiling_method = TilingMethod.HIPS
else:
# This shouldn't happen since argparse should validate the input
die(f"unhandled tiling method `{settings.tiling_method}`")

coll = CollectionLoader.create_from_args(settings).load_paths(settings.paths)

# Ignore any astropy WCS/FITS warnings, which can spew a lot of annoying output.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
tiler = FitsTiler(coll)
tiler = FitsTiler(coll, tiling_method=tiling_method)
tiler.tile(cli_progress=True, parallel=settings.parallelism)

rel_wtml_path = os.path.join(tiler.out_dir, "index_rel.wtml")
Expand Down Expand Up @@ -941,7 +983,14 @@ def view_tunneled(settings):
# We give SSH `-T` to prevent warnings about not allocating pseudo-TTYs.

ssh_argv = ["ssh", "-T", settings.tunnel]
toasty_argv = ["exec", "toasty", "view", "--tile-only"]
toasty_argv = [
"exec",
"toasty",
"view",
"--tile-only",
f"--tiling-method={settings.tiling_method}",
]

if settings.parallelism:
toasty_argv += ["--parallelism", str(settings.parallelism)]
toasty_argv += [shlex.quote(p) for p in settings.paths]
Expand Down
2 changes: 1 addition & 1 deletion toasty/multi_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create_mwcs_descriptor(coll_desc):
# ImageDescription helper to ensure we get that.

wcs, shape = find_optimal_celestial_wcs(
((desc.in_shape, desc.in_wcs) for desc in self._descs),
[(desc.in_shape, desc.in_wcs) for desc in self._descs],
auto_rotate=True,
projection="TAN",
)
Expand Down
Loading

0 comments on commit 35ef3ee

Please sign in to comment.