Skip to main content

A framework for galaxy morphology and non-parametric decomposition.

Project description

AsTrovello Logo

AsTrovello

AsTrovello is a Python library for multi-wavelength galaxy data analysis. It integrates high-resolution photometry from PHANGS (HST) with mid-infrared data from S4G (Spitzer/IRAC), providing tools for image alignment, PSF homogenization, unit conversion, and 3D hypercube creation.


Main Features

  • Image Alignment: Reprojects S4G images onto the HST pixel grid (conserving surface brightness).
  • PSF Homogenization: Calculates FWHM and generates convolution kernels via PyPHER to match the resolution of different filters to a common Master PSF.
  • Unit Standardization: Converts ELECTRONS/S (HST) and MJy/sr (Spitzer) to Jy/pixel.
  • Hypercube Creation: Builds a 3D FITS hypercube (RA, Dec, Filter) with automated sky masking and spatial bounding box cropping.

Data Sources

The pipeline is designed to work with the following public datasets:

S4G (Spitzer): https://irsa.ipac.caltech.edu/data/SPITZER/S4G/

└── <target>.phot.1.fits and <target>.phot.2.fits

PHANGS (HST): https://archive.stsci.edu/hlsp/phangs

└── hlsp_phangs-hst_hst_wfc3-uvis_<target>_<filter>_v1_exp-drc-sci.fits

Installation

AsTrovello requires Python >= 3.10 and is recommended to run inside a Conda environment on Linux.

From PyPI:

pip install astrovello

From GitHub (latest development version):

pip install git+https://github.com/your-username/AsTrovello.git

Setting up a dedicated environment:

conda create -n <env_name> python=3.10
conda activate <env_name>
pip install astrovello

How to Run the Command Line Interface (CLI)

AsTrovello can be executed as a CLI using

astrovello --galaxy [GALAXY_NAME] --mode [MODE] [FLAGS]

Execution Modes

The pipeline can be executed in different stages depending on your needs. Use the --mode argument to select one of the following:

Mode Description
full Complete Pipeline: Executes alignment, PSF homogenization, convolution, and hypercube creation in a single run.
alignment_only Spatial Alignment: Only reprojects S4G images to the PHANGS pixel grid. Use this to check coordinate consistency.
conv_only Resolution Matching: Performs PSF cleaning, kernel generation via PyPHER, and image convolution.
cube_only Data Integration: Skips processing and builds the final 3D hypercube using existing convolved files.

Note: When using conv_only or full, remember to include the --create_kernel flag if you need to generate new homogenization kernels for the current galaxy.

The command must be executed inside the same directory where galaxy data and survey PSFs are located. These inputs need to be organized as follows:

BASE_DIRECTORY/
├── Input/
│   ├── PHANGS/             # HST images and PSF models
│   |    ├── galaxies/
|   |    |    ├── galaxies/
|   |    |        ├── phangs_hst/
|   |    |            ├── ngc.../
|   |    ├── PSF/
│   └── S4G/                # Spitzer/IRAC images and PSFs
│        ├── galaxies/
|        |    ├── galaxies/
|        |        ├── ngc.../
|        ├── PSF/

Usage Examples

Here are the most common ways to run the AsTrovello pipeline:

1. Full Processing (Standard)

Runs everything from alignment to the final hypercube. Ideal for a first-time run on a new galaxy.

python Codes/AsTrovello_run.py --galaxy ngc1566 --mode full --create_kernel --apply_mask --sigma 1.5

Quick Start

from astrovello import S4G2PHANGS_reproject, create_data_cube, convert2Jansky

# Reproject a Spitzer image onto the PHANGS pixel grid
S4G2PHANGS_reproject(s4g_file, phangs_ref_file, output_path)

# Convert image units to Jy/pixel
data, header = convert2Jansky(fits_file)

# Build a 3D hypercube from aligned images
cube, cube_header = create_data_cube(aligned_images, filter_names, ref_file, header, "output.fits")

Project Structure

AsTrovello/
├── src/
│   └── astrovello/
│       ├── __init__.py
│       ├── alignment.py     # Image reprojection (S4G → PHANGS grid)
│       ├── convolution.py   # PSF/FWHM estimation and kernel convolution
│       ├── units.py         # Flux unit conversion to Jy/pixel
│       ├── masking.py       # Sky background subtraction and signal masking
│       ├── cube.py          # 3D FITS hypercube creation and cutouts
│       └── utils.py         # Utility functions
├── examples/
│   ├── AsTrovello_run.py    # Main execution script
│   └── galaxy_loop.py       # Batch processing for multiple galaxies
├── pyproject.toml
└── README.md

API Reference

alignment

S4G2PHANGS_reproject(s4g_file_path, phangs_ref_file_path, output_path) — Aligns a Spitzer/IRAC image to the HST pixel grid using WCS reprojection.

convolution

calculaFWHM_radial_profile(files_path) — Estimates FWHM from PSF files using radial profiles.
final_clean_psf(input_file, output_file) — Standardizes PSF headers for PyPHER compatibility.
pypher_kernel_creation(todos_fwhm, psf_master_path, input_dir, output_dir) — Generates PyPHER shell commands to create homogenization kernels.
create_convolvedFITS(original_fits, kernel_fits, output_dir) — Applies a convolution kernel to an image via FFT.

units

convert2Jansky(fits_file) — Converts HST (ELECTRONS/S) and Spitzer (MJy/sr) images to Jy/pixel.

masking

mask(data, N_SIGMA=3) — Sky subtraction and signal mask generation using MAD-based sigma clipping.

cube

create_data_cube(aligned_images, filter_names, ref_file, ref_header, output_filename) — Builds a 3D FITS hypercube with masking and bounding box cutout.
create_cutouts(cube, cube_header, regions) — Extracts spatial sub-cubes from the main hypercube.


Requirements

All dependencies are installed automatically via pip. Main dependencies:

numpy astropy scipy matplotlib reproject photutils pypher tqdm psutil

Full list available in pyproject.toml.


License

MIT License. See LICENSE for details.

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

astrovello-0.1.2.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

astrovello-0.1.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file astrovello-0.1.2.tar.gz.

File metadata

  • Download URL: astrovello-0.1.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for astrovello-0.1.2.tar.gz
Algorithm Hash digest
SHA256 98e7c29f31e3d660716761b8388942f83f809c6ca016d42aa273116ba660b735
MD5 50a6760ce4415a1088a538f899de8688
BLAKE2b-256 d57b77184b2f1d4bb8ca6a62fec95344c2cbd5b364f08f10c66e11c23bc12953

See more details on using hashes here.

File details

Details for the file astrovello-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: astrovello-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for astrovello-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21bff163c011342351b7c464d4f239cb0f76e1643d785859c576c6c609b1450a
MD5 24204640cff189ab5125cb57972d4488
BLAKE2b-256 794e2bce1015032dcb9f7ca20cc5919e68f5cb3016031c2fd68825e106670644

See more details on using hashes here.

Supported by

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