A package to produce produce FITS cubes.
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) 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, install from this git repo (latest):
pip install git+https://github.com/AlecThomson/fitscube.git
To install and use the uvloop Async runner do:
pip install fitscube[uvloop]
Usage
Command line:
❯ fitscube -h
usage: fitscube [-h] {combine,extract} ...
Tooling to create fitscubes
positional arguments:
{combine,extract}
combine Combine FITS images together into a cube
extract Extract a plane from an existing cube
options:
-h, --help show this help message and exit
❯ fitscube combine -h
usage: fitscube combine [-h] [-o] [--create-blanks] [--time-domain] [--spec-file SPEC_FILE | --specs SPECS [SPECS ...] | --ignore-spec] [-v] [--max-workers MAX_WORKERS]
file_list [file_list ...] out_cube
positional arguments:
file_list List of FITS files to combine (in frequency or time 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
--time-domain Flag for constructing a time-domain cube
--spec-file SPEC_FILE
File containing frequencies in Hz or times in MJD s (if --time-domain == True)
--specs SPECS [SPECS ...]
List of frequencies or times in Hz or MJD s respectively
--ignore-spec Ignore frequency or time information and just stack (probably not what you want)
-v, --verbosity Increase output verbosity
--max-workers MAX_WORKERS
Maximum number of workers to use for concurrent processing
❯ fitscube extract -h
usage: fitscube extract [-h] [--channel-index CHANNEL_INDEX] [--hdu-index HDU_INDEX] [-v] [--overwrite] [--output-path OUTPUT_PATH] fits_cube
positional arguments:
fits_cube The cube to extract a plane from
options:
-h, --help show this help message and exit
--channel-index CHANNEL_INDEX
The channel to extract
--hdu-index HDU_INDEX
The HDU index of the data card containing the cube data
-v, --verbosity Increase output verbosity
--overwrite overwrite the output file, if it exists.
--output-path OUTPUT_PATH
The name of the new output file. If not specified it is generated from the fits cube name
Python:
from pathlib import Path
from fitscube import combine_fits
file_list = list(Path().glob("*.fits"))
frequencies = combine_fits(
file_list
)
Convolving to a common resolution
See RACS-Tools.
License
MIT
Contributing
Contributions are welcome. Please open an issue or pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fitscube-2.3.0.tar.gz.
File metadata
- Download URL: fitscube-2.3.0.tar.gz
- Upload date:
- Size: 686.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab19d69d4f41724be52d36cc130482fabad115fca146f3c910151c5587bf4c39
|
|
| MD5 |
ab98d1c389922a9cf55b73993bd64c52
|
|
| BLAKE2b-256 |
4a408b19700852f14cdb1e740b69abcf9ff3c75e947c63c6d0492b3e994f0406
|
Provenance
The following attestation bundles were made for fitscube-2.3.0.tar.gz:
Publisher:
cd.yml on AlecThomson/fitscube
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitscube-2.3.0.tar.gz -
Subject digest:
ab19d69d4f41724be52d36cc130482fabad115fca146f3c910151c5587bf4c39 - Sigstore transparency entry: 483448559
- Sigstore integration time:
-
Permalink:
AlecThomson/fitscube@d9b535046ac8a179923b5e137358ad08b7bb2286 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@d9b535046ac8a179923b5e137358ad08b7bb2286 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fitscube-2.3.0-py3-none-any.whl.
File metadata
- Download URL: fitscube-2.3.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9f9b842eb787c6832696d74163409b703ed9b8c211b68cc91a4ec81ddee1553
|
|
| MD5 |
717a2d840df2a86fdb76cc4fb8ac1b9f
|
|
| BLAKE2b-256 |
abaf3a9c32e5c8d9c783fc7fcc659a0ec76234abaebe4503f36012d9a5f742d0
|
Provenance
The following attestation bundles were made for fitscube-2.3.0-py3-none-any.whl:
Publisher:
cd.yml on AlecThomson/fitscube
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitscube-2.3.0-py3-none-any.whl -
Subject digest:
e9f9b842eb787c6832696d74163409b703ed9b8c211b68cc91a4ec81ddee1553 - Sigstore transparency entry: 483448562
- Sigstore integration time:
-
Permalink:
AlecThomson/fitscube@d9b535046ac8a179923b5e137358ad08b7bb2286 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/AlecThomson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@d9b535046ac8a179923b5e137358ad08b7bb2286 -
Trigger Event:
release
-
Statement type: