Skip to main content

A package to produce produce FITS cubes.

Reason this release was yanked:

Incorrect CLI configuration

Project description

FITSCUBE

From the wsclean docs:

WSClean does not output these images in a normal “imaging cube” like CASA does, i.e., a single fits file with several images in it. For now I’ve decided not to implement this (one of the reasons for this is that information about the synthesized beam is not properly stored in a multi-frequency fits file). One has of course the option to combine the output manually, e.g. with a simple Python script.

This is a simple Python script to combine (single-frequency or single-Stokes) FITS images manually.

Current assumptions:

  • All files have the same WCS
  • All files have the same shape / pixel grid
  • Frequency is either a WCS axis or in the REFFREQ header keyword
  • All the relevant information is in the first header of the first image

Installation

Install from PyPI (stable):

pip install fitscube

Or, onstall from this git repo (latest):

pip install git+https://github.com/AlecThomson/fitscube.git

Usage

Command line:

fitscube -h
# usage: fitscube [-h] [-o] [--create-blanks] [--freq-file FREQ_FILE | --freqs FREQS [FREQS ...] | --ignore-freq] [-v] file_list [file_list ...] out_cube
#
# Fitscube: Combine single-frequency FITS files into a cube. Assumes: - All files have the same WCS - All files have the same shape / pixel grid - Frequency is either a WCS axis or  in the REFFREQ header
# keyword - All the relevant information is in the first header of the first image
#
# positional arguments:
#   file_list             List of FITS files to combine (in frequency order)
#   out_cube              Output FITS file
#
# options:
#   -h, --help            show this help message and exit
#   -o, --overwrite       Overwrite output file if it exists
#   --create-blanks       Try to create a blank cube with evenly spaced frequencies
#   --freq-file FREQ_FILE
#                         File containing frequencies in Hz
#   --freqs FREQS [FREQS ...]
#                         List of frequencies in Hz
#   --ignore-freq         Ignore frequency information and just stack (probably not what you want)
#   -v, --verbosity       Increase output verbosity

stokescube -h
# usage: stokescube [-h] [-V STOKES_V_FILE] [-o] [-v] stokes_I_file stokes_Q_file stokes_U_file output_file
#
# Fitscube: Combine single-Stokes FITS files into a Stokes cube. Assumes: - All files have the same WCS - All files have the same shape / pixel grid - All the relevant information # is in the first header of
# the first image
#
# positional arguments:
#   stokes_I_file         Stokes I file
#   stokes_Q_file         Stokes Q file
#   stokes_U_file         Stokes U file
#   output_file           Output file
#
# options:
#   -h, --help            show this help message and exit
#   -V STOKES_V_FILE, --stokes_V_file STOKES_V_FILE
#                         Stokes V file
#   -o, --overwrite       Overwrite output file if it exists
#   -v, --verbosity       Increase output verbosity

Python:

from pathlib import Path

from fitscube import combine_fits, combine_stokes

file_list = list(Path().glob("*.fits"))

hdu_list, frequencies = combine_fits(
    file_list
)
hdu_stokes_list = combine_stokes(
    Path("stokes_I.fits"),
    Path("stokes_Q.fits"),
    Path("stokes_U.fits"),
)

Convolving to a common resolution

See RACS-Tools.

License

MIT

Contributing

Contributions are welcome. Please open an issue or pull request.

TODO

  • Add support for non-frequency axes
  • Add convolution to a common resolution via RACS-Tools

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitscube-0.4.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

fitscube-0.4.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file fitscube-0.4.1.tar.gz.

File metadata

  • Download URL: fitscube-0.4.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for fitscube-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d18041db65243d4e79fd38a619a944b29127aa14a8483da63597d090cf6f71fc
MD5 8f963306835ec61c81d3d4f660b57f84
BLAKE2b-256 5ce6b8bd3e33f64cf6e991b09995e68208701e9501e35797fb63c7070dbe9fa3

See more details on using hashes here.

File details

Details for the file fitscube-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: fitscube-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for fitscube-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb9854ab9e56987625c672ba556ab796bbe1d23f44f2a61791c4e293db3c2a6f
MD5 4a23892b8647d5a099bb6587738f8a82
BLAKE2b-256 05c60ec9beced42e0c3913f4d79edcff2367a18ef63d8dec9aaca962c88a9ee0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page