Skip to main content

No project description provided

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] [--freq-file FREQ_FILE | --freqs FREQS [FREQS ...] | --ignore-freq] 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

# optional arguments:
#   -h, --help            show this help message and exit
#   -o, --overwrite       Overwrite output file if it exists
#   --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)

stokescube -h
# usage: stokescube [-h] [-v STOKES_V_FILE] [--overwrite] 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

# optional arguments:
#   -h, --help            show this help message and exit
#   -v STOKES_V_FILE, --stokes_V_file STOKES_V_FILE
#                         Stokes V file
#   --overwrite           Overwrite output file if it exists

Python:

from fitscube import combine_fits, combine_stokes

hdu_list, frequencies = combine_fits(
    ['file1.fits', 'file2.fits', 'file3.fits'],
)
hdus_list = combine_stokes(
    'stokes_I.fits',
    'stokes_Q.fits',
    '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 tracking of the PSF in header / beamtable
  • 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.2.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

fitscube-0.2.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fitscube-0.2.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.13 Darwin/20.6.0

File hashes

Hashes for fitscube-0.2.2.tar.gz
Algorithm Hash digest
SHA256 874a59e9578f59ade9b68c48a959289bea2dff90016eeac5cee3d0107db55166
MD5 219c10ff3b88dfe662b34b004b92a378
BLAKE2b-256 eb11e1429b23f4a2bf8fb348cb8407a257b778c76ed18a5fd9bc566240a5e7c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fitscube-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.13 Darwin/20.6.0

File hashes

Hashes for fitscube-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da6366490b62352ae34c653c577d688cea0f147d35e27087ea68f62dde6d75de
MD5 a4bdd9da5d62f6d6b8796597918f7624
BLAKE2b-256 50a060bc48d452d14b5626e8a41e4f227b5cdc54cdd0a0bdaab10077efa7644f

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