Mask stars in JWST NIRISS images
Project description
JWST NIRISS Star Masking Library
This Python library is designed to mask bright stars in JWST NIRISS imaging mosaics. Foreground stars are identified from the Gaia catalog using the astroquery library. The NIRISS stellar PSF is approximated using a toy model, represented by a circular region for the PSF's central componenets, and extended rectangles for the diffraction spikes. The library also includes helper functions to check if a given source is contaminated by a stellar PSF.
The PSF is scaled for each object according to its Gaia G-band magnitude. The details of this calibration are included in calibration.ipynb.
Functions
The library's key functions include:
get_footprint(mosaic, wcsdf, hdulistindex)
Generates a footprint for each exposure in the mosaic.
- Parameters:
mosaic(HDUList): The mosaic FITS file.wcsdf(pd.DataFrame): DataFrame containing WCS information.hdulistindex(int): Index of the HDU in the mosaic.
- Returns:
footprints(list): List of footprints for each exposure.
mask_mosaic(mosaic, wcspath, output_path=None, hdulistindex=0, spikewidth=30, ncores=None, inspect_final_mask=True, calibration_slope=-13.551, calibration_int=342.216)
Creates a mask for an entire NIRISS mosaic composed of different exposures.
Note this code also works for a single exposure; in this case, provide wcsdf as a one-row dataframe.
- Parameters:
mosaic(str or HDUList): Mosaic to mask.wcspath(str): Path to WCS info file.output_path(str): Path to save mosaic mask as FITS.hdulistindex(int): Index in HDUList where data and header are located.spikewidth(int): Width of diffraction spikes in NIRISS PSF mask.ncores(int): Number of cores for multiprocessing.inspect_final_mask(bool): If True, generates an image displaying the image and mask.calibration_slope(float): Slope of calibration between PSF mask size and Gaia G-band magnitude.calibration_int(float): Intercept of calibration between PSF mask size and Gaia G-band magnitude.
- Returns:
HDUList: Astropy HDUList object containing the star mask.
is_object_contaminated(starmaskhdu, objectdata)
Checks if a given source is contaminated by a stellar PSF.
- Parameters:
starmaskhdu(HDUList): Star mask to check against.objectdata(SkyCoord, PrimaryHDU, ImageHDU or iterable of those types): Objects to check if contaminated.
- Returns:
bool or iterable of bool: True/False indicating whether the object(s) is contaminated.
Dependencies
The code has been tested in Python 3.12.2 with the following dependencies:
numpypandasmatplotlibastropyastroquerygrizlipathoscv2tqdm
Installation
To install the required dependencies, you can use pip:
pip install numpy pandas matplotlib astropy astroquery grizli pathos opencv-python tqdm
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 mask_stars_niriss-2024.11.11.tar.gz.
File metadata
- Download URL: mask_stars_niriss-2024.11.11.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0c846edd3493d4f621ee06ea55cd7f61e218e4cd91d6a5639d997e14c7ba4f
|
|
| MD5 |
331cd99efa3f34908bd380a94ee74cb9
|
|
| BLAKE2b-256 |
87b03aeb4ab9de0b09d9235888139f8d09ed1eb8775435a191ddb0682468ae0c
|
File details
Details for the file mask_stars_NIRISS-2024.11.11-py3-none-any.whl.
File metadata
- Download URL: mask_stars_NIRISS-2024.11.11-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d49082c2f3cf51287f2e199ea890cb189ef1cbd98def5f89af79de8b301d7432
|
|
| MD5 |
dd9199caf70975979feb945ba94d7c75
|
|
| BLAKE2b-256 |
3609a7f039f6273adf3e1d2548895b6587302fde4035e47926ed6c1a49452a12
|