Wcs nddata

From VectorSpaceLab/AREX-Skill · View interactive version

Wcs nddata is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Operate Astropy FITS WCS and NDData/CCDData workflows, including pixel-world conversion, WCS validation, masks, uncertainties, units, and metadata.

How to use this skill

Skill file

WCS and NDData Router

Use this sub-skill when an Astropy task centers on the relationship between

image-like array pixels and physical/world coordinates, or on carrying image

data together with masks, uncertainties, units, metadata, and WCS.

Load This When

origin-aware WCS calls.

world_to_pixel, world_to_array_index, or array_index_to_world.

VarianceUncertainty, InverseVariance, a unit, metadata, or a WCS object.

or WCS-preserving slicing/cutouts are part of the task.

Route Away When

unified I/O are the main topic; use ../tables-io/SKILL.md.

convolution is the main topic; use ../visualization-convolution/SKILL.md.

EarthLocation dominate after the WCS conversion step; use

../time-coordinates/SKILL.md.

../units-constants/SKILL.md.

is the main topic; use ../cli-config-data/SKILL.md.

First Actions

  1. Identify the input object: FITS header, FITS file/HDU, existing WCS, array,

NDData, CCDData, or a world-coordinate object.

  1. Record the pixel convention before transforming coordinates.
  2. Prefer the high-level WCS API for user-facing coordinates and Astropy objects.
  3. Use low-level or legacy WCS methods when the caller needs raw numeric arrays,

explicit origin, or distortion-pipeline control.

  1. Inspect pixel_n_dim, world_n_dim, array_shape, pixel_shape,

world_axis_physical_types, and world_axis_units before assuming axis order.

  1. For NumPy indexing, prefer world_to_array_index or

world_to_array_index_values, not rounded world_to_pixel outputs.

  1. For WCS construction from headers, decide whether relax, fix,

translate_units, naxis, and preserve_units matter.

  1. For image containers, check data shape, unit, mask convention, uncertainty

type, metadata type, and whether WCS should be attached at construction.

  1. Validate with a small round-trip or temporary-file smoke before giving final

operational code.

API Selection Rules

dict-like header cards, or a filename, and can also create an empty WCS with

naxis=.

world objects such as SkyCoord or Quantity when the WCS describes those

axes.

an origin argument.

table, and core WCS corrections when present; pass origin=0 for NumPy-style

pixels or origin=1 for FITS/DS9-style coordinates.

use them only when that distinction is intentional.

(row, column, ...); pixel_to_world and world_to_pixel use pixel order

(x, y, ...).

to SI. Use preserve_units=True when the original header units are the

required output/input units.

higher-dimensional WCS must be reduced or cut out.

NDData Selection Rules

wcs, meta, unit, and optional PSF information.

ndarray-like behavior are needed.

is required, and a FITS BUNIT card is used when reading/writing units.

ignored.

StdDevUncertainty, VarianceUncertainty, or InverseVariance.

loaded from FITS, WCS keywords are converted to a WCS object automatically.

keep pixel/world consistency; confirm distortion limitations first.

Reference Files

constructor signatures, WCS methods, NDData classes, and CLI/API notes.

recipes: WCS construction, round-trips, WCS header writing, wcslint,

NDData/CCDData, FITS round-trips, and cutouts.

handling, axis/order bugs, non-standard headers, WCS convergence failures,

mask/uncertainty pitfalls, FITS I/O issues, and optional dependency notes.

Required Safety And Validation

at runtime; use only the public installed Astropy package and bundled skill

references.

overwrite user data unless the user explicitly requested it.

but a successful lint does not replace a numeric round-trip check for the

user’s specific coordinate convention.

warning was inspected and why ignoring it is safe for the task.

world/pixel/world round-trip inside the relevant image domain.

shape, unit, and WCS metadata survived the read/write/slice/cutout step.

Native-Backed Validation Ideas

to world and back, and check agreement within a small tolerance.

all_pix2world against wcs_pix2world only to explain the difference, not to

demand equality.

that the CLI runs and reports WCS diagnostics without mutating the file.

StdDevUncertainty, and WCS; then slice or FITS round-trip and assert the

critical attributes remain present.

Known Boundaries

obtain a header or read/write a CCDData image.

WCS inputs or outputs.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.