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
Metadata
Release files for mask-stars-NIRISS 2024.11.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mask_stars_niriss-2024.11.11.tar.gz | 8.5 kB | Without provenance | Details for mask_stars_niriss-2024.11.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mask_stars_NIRISS-2024.11.11-py3-none-any.whl | Python 3 | none | any | Details for mask_stars_NIRISS-2024.11.11-py3-none-any.whl |
Total release size: 17.7 kB
Release files / mask_stars_niriss-2024.11.11.tar.gz
| Download URL | mask_stars_niriss-2024.11.11.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc0c846edd3493d4f621ee06ea55cd7f61e218e4cd91d6a5639d997e14c7ba4f
|
|
BLAKE2b-256 checksum How to use checksums |
87b03aeb4ab9de0b09d9235888139f8d09ed1eb8775435a191ddb0682468ae0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / mask_stars_NIRISS-2024.11.11-py3-none-any.whl
| Download URL | mask_stars_NIRISS-2024.11.11-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d49082c2f3cf51287f2e199ea890cb189ef1cbd98def5f89af79de8b301d7432
|
|
BLAKE2b-256 checksum How to use checksums |
3609a7f039f6273adf3e1d2548895b6587302fde4035e47926ed6c1a49452a12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Security for mask-stars-NIRISS 2024.11.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.