Spectrum Analysis¶
grizli.grismconf Module¶
Demonstrate aXe trace polynomials.
Initial code taken from (Brammer, Pirzkal, & Ryan 2014), which contains a detailed explanation how the grism configuration parameters and coefficients are defined and evaluated.
Functions¶
Get field-dependent coefficients in aXe format from an |
|
|
Get WFSS reffiles from CRDS |
|
Run |
|
Generate a config filename based on the instrument, filter & grism combination. |
|
Load parameters from an aXe configuration file |
|
Show all available versions of the NIRCAM Grism config files |
Classes¶
|
Helper object to replicate |
|
Rotate NIRISS and NIRCam coordinates such that slitless dispersion has wavelength increasing towards +x. |
|
Dictionary that remembers insertion order |
|
Transform GRISMCONF-format configuration files to grizli convention of wavelength increasing towards +x |
|
Read an aXe-compatible configuration file |
grizli.model Module¶
Model grism spectra in individual FLTs
Classes¶
|
Cutout spectral object from the full frame. |
|
Object for computing dispersed model spectra |
|
Scripts for modeling of individual grism FLT images |
|
Container for image data with WCS, etc. |
grizli.multifit Module¶
Functionality for manipulating multiple grism exposures simultaneously
Functions¶
|
Drizzle 2D spectrum from a list of beams |
|
Drizzle 2D spectrum from a list of beams |
|
Drizzle a cutout at a specific wavelength from a list of |
Default parameters for redshift fitting functions in |
|
|
Make a figure from the multiple extensions in the drizzled grism file. |
Classes¶
|
Main container for handling multiple grism exposures together |
|
Tools for dealing with multiple |
grizli.fitting Module¶
Tools for fitting spectra with templates.
Functions¶
|
Compute tabulated percentiles of the CDF for a (lossy) compressed version of the redshift PDF. |
|
Compute stellar population parameters from a |
|
Make a separate plot showing photometry and the spectrum |
|
Make a summary table of redshift and other parameters from a set of |
|
Regenerate a MultiBeam object selecting only certiain PAs |
|
Run the full template-fitting procedure |
|
Wrapper function for |
|
Make a figure with the drizzled line maps |
Classes¶
Base class for |
Utilities¶
grizli.utils Module¶
Dumping ground for general utilities
Functions¶
|
Converts RGB values in a variety of formats to Hex values. |
|
Read and apply the compact exposure information file |
|
Convert a list of (simple) command-line arguments to a dictionary. |
|
Return an array version of the templates that have all been interpolated to the same grid. |
|
Own blot function for blotting exact pixels without rescaling for input and output pixel size |
|
B-spline basis functions, modeled after |
|
Determine AB zeropoint from image header |
|
Compute the surface area of a list of RA/DEC coordinates |
|
Compute a catalog mask for |
|
Chebyshev polynomial basis functions |
|
Analogous to |
|
Test if column elements "in" an iterable (e.g., a list of strings) |
|
Combine photmetry dictionaries |
|
Compute template-fit emission line equivalent widths |
|
Compute output WCS that contains the full list of input WCS |
|
Generate a convex hull from a list of points |
|
Convert |
|
Use |
|
Compute template sum analogous to |
|
Drizzle array data with associated wcs |
|
Make drizzle mosaic from exposures in a visit dictionary |
|
Dump FLT/FLC header & DQ extensions to a compact file |
Testing FSPS line templates |
|
|
Evaluate B-spline templates at given wavelengths. |
|
Fetch wcs files for a given beams.fits files |
|
Config files needed for Grizli |
|
Fetch a set of default HST calibration files |
|
Fetches the HST calibration file from the given FTP directory or local reference path. |
|
Fetch necessary calibration files needed for running calwf3 from STScI FTP |
|
Download skyflat files |
|
Download STScI wisp templates from s3 mirror |
|
Fetch file from an S3 bucket |
|
Fetch static WFPC2 calibration file and run |
|
Add a timestamp to a figure output |
|
Make |
|
Fill a covariance matrix in a larger array that had masked values |
|
Find peaks in a signal using |
|
Fix NaN values in FLT files |
|
Parse basic elements from a FLT/FLC header to a dictionary |
|
Make a WCS header for a 2D spectrum |
|
Generate a template grid for photometric redshift fitting. |
|
Fetch photometry from a Vizier catalog |
|
Get slices of overlaps between two rectangular grids |
|
Derive |
|
Get overlapping slices of FITS files |
|
Compute footprint of all SCI extensions of an HST exposure |
|
Extract header information from a list of FLT files |
|
Deprecated: use |
Get a dictionary of common emission line wavelengths and line ratios |
|
|
Get tabulated scale factor |
|
Integrate a |
|
Add |
|
Get correct pscale from a |
|
Generate a |
|
Create a new WCS with half the pixel scale of another that can be block-averaged 2x2 |
|
Dump header keywords to a |
|
Return the area of a convex hull of a list of points |
|
Compute geometrical edge mask for points within a convex hull |
|
Scale factors between different JWST CRDS_CONTEXT |
|
Update JWST DQ mask with |
|
Step-function templates with f_lambda ~ (wave/1216.)**beta |
|
Load Phoenix stellar templates |
|
Make templates suitable for fitting broad-line quasars |
|
Load SDSS eigen PCA templates |
|
Generate a list of templates for fitting to the grism spectra |
|
Log a message to a file, optionally including a date tag |
|
Log exception information to a file, or print to screen |
|
Log local variables, e.g., parameter arguements to a file |
|
Scale an array like ds9 log scaling |
|
Make a logarithmically spaced redshift grid |
Make Alf + FSPS template |
|
|
Make a footprint for image filtering |
|
Compute an ImageHDU with a footprint that covers all of |
|
Make a WCS header for a 2D spectrum |
|
Make a celestial WCS header |
|
Generate a MAST query on datasets in a list. |
|
Modify bit flags from a DQ array |
|
Get modal value of a distribution of data following Connor et al. 2017 https://arxiv.org/pdf/1709.01925.pdf. |
|
Cut up a large array and send slices to |
|
Make a mask for NIRISS imaging ghosts |
|
Normalized NMAD = 1.4826022 * |
|
Wrapper for |
|
Set of 3.3 micron PAH lines from Li et al. 2020. |
|
Make a template for a broad PAH line with a Drude profile |
|
Get simple filter name out of an HST/JWST image header. |
|
Read header information from a list of exposures and parse out groups |
|
Get associated lists of grism and direct exposures |
|
Parse s3 path string |
|
Find overlapping visits/filters to make combined mosaics |
|
Generate the Path object from |
Patch to fix inconsistency with drizzlepac=3.2.1 and photutils>1.0, where The latter is needed for jwst=1.3.2 |
|
|
Compute PHOTFNU from PHOTFLAM and PHOTPLAM, e.g., for ACS/WFC |
|
Make a mask points in a 2D array inside a polygon |
|
Generate polynomial templates based on the input parameters. |
|
Turn decimal degree coordinates into a string with rounding. |
|
Wrapper around |
|
Read primary header from a (potentially large) zipped FITS file |
|
Remove all Text annotations from |
|
Speed up |
|
Version-safe matrix inversion using |
|
Run nanmedian filter on |
|
Set global numpy and astropy warnings |
|
Simple LambdaCDM cosmology |
|
Rotate a SIP WCS by increments of 90 degrees using direct transformations between x / y coordinates |
|
Multiply a single template by polynomial bases to effectively generate a polynomial multiplicative correction that can be fit with linear least squares. |
|
Multiply a single template by spline bases to effectively generate a spline multiplicative correction that can be fit with linear least squares. |
|
Check if files in a visit have large shifts and split them otherwise |
|
Step-function templates for easy binning |
|
Strip header keywords |
|
Symlink templates from module to $GRIZLI/templates as part of the initial setup |
|
Compute encircled energy curves with pysynphot |
|
Compute synphot for a specific aperture. |
|
Tabulated encircled energy for different aperture radii and normalization radius. |
|
Modify |
|
Update WCS with shift, rotation, & scale |
|
Return trapezoid rule coefficients, useful for numerical integration using a dot product |
|
Classes¶
Tools for handling WFC3/IR Effective PSF |
|
|
Extend |
|
Initialize the class instance. |
|
Wrapper around the |
|
Helper class for parsing an S_REGION strings and general polygon tools |
|
Container for template spectra. |
|
Helper for unique items in an array |
|
Helper functions for dealing with WCS footprints |
|
Sample class to demonstrate how to define a coordinate transformation |
grizli.utils_numba.interp Module¶
Functions¶
|
Fast pixel mapping from one image to another |
|
Fast linear interpolation: |
|
Cumulative trapz integration |
|
Interpolate spectrum conserving flux |
|
Rebin |
|
Simple midpoints of array |
grizli.utils_numba.disperse Module¶
Functions¶
|
Compute a dispersed 2D spectrum |
|
Find pixel limits of a segmentation region |
Catalog tools¶
grizli.catalog Module¶
Catalog table tools
Functions¶
|
Make a "radec" ascii file with ra, dec columns from a table object |
|
Make a DS9 region file from a table object |
|
Randomize labels on a segmentation image for easier visualization |
|
Query for objects in the UKIDSS catalogs |
|
Query for objects in the SDSS photometric catalog |
|
Query for objects in the IRSA 2MASS catalog |
|
Query for objects in the AllWISE source catalog |
|
Use |
Get translation of Vizier GAIA DR2 columns. |
|
|
Query GAIA catalogs from Vizier TAP |
|
Query GAIA catalog from Vizier |
|
Generate a query string for the TAP servers |
|
Query GAIA DR2 astrometric catalog |
|
Generate a query string for the NOAO Legacy Survey TAP server |
|
Query NOAO Catalog holdings |
|
Query NOAO Source Catalog, which is aligned to GAIA DR1. |
|
Query NOAO Source Catalog, which is aligned to GAIA DR1. |
|
Query DES DR1 Catalog from Vizier |
|
Get Skymapper DR1 from Vizier |
|
VEXAS DR2 from vizier |
|
VISTA Hemisphere Survey (VHS) DR4.1 from vizier |
|
Get PS1 from Vizier |
|
Decide what reference astrometric catalog to use |
Pipeline tools¶
grizli.pipeline.default_params Module¶
Parameter handling with YAML
Functions¶
|
Read default parameters from the YAML file in |
|
Try different YAML loaders |
Test if aws s3 is available |
|
|
Write grizli parameters to a file |
grizli.pipeline.auto_script Module¶
Automatic processing scripts for grizli
Functions¶
|
Clean unneeded files after the field preparation |
|
Convert a |
|
Count number of grism exposures that contain objects in a catalog |
|
Generate path dict. |
|
Drizzle filter groups based on precomputed image associations |
|
Save exposure info to webpage & json file |
|
|
|
Fully automatic script for fetching exposure files |
|
Generate PSFs for the available filters in a given field |
|
RGB image of the field mosaics |
|
Fill field mosaics with the average value taken from other filters so that all images have the same coverage |
|
Find the yaml or npy visits file, return None if neither found |
|
Try fine alignment from visit-based SourceExtractor catalogs |
|
Generate a parameter dictionary for passing to the fitting script |
|
Not used [2023] |
|
MIRI flats computed by date |
|
Compute which filters to use to make an RGB cutout |
|
Add exposure-level footprints to the visit dictionary |
|
Run the full pipeline for a given target |
|
Contamination model pipeline for grism exposures |
|
Initialize a GroupFLT object from exposures in a working directory. |
|
Load fine_alignment result |
|
Load visit info from a visits.npy or visits.yaml file |
|
Load a {root}_visits.yaml file |
|
Drizzle combined mosaics |
|
Make RAW, Prep, Persistence, Extractions directories |
|
Combine ir/opt mosaics manually scaling a specific zeropoint |
|
Make region files where wht images nonzero |
|
Make a reference image WCS based on the grism exposures |
|
Make HTML report of the imaging and grism data products |
|
Make RGB thumbnails in working directory |
|
Manual visit alignment |
|
Mask 45-degree diffraction spikes around bright stars for WFC3/IR |
|
Make a detection catalog and run aperture photometry on all available filter images with the SourceExtractor clone |
|
Organize exposures into "visits" by filter / position / PA / epoch |
|
Make a detection catalog with SourceExtractor and then measure photometry with |
|
Preprocessing script |
|
Refine the full-field grism models with the best fit spectra from individual extractions. |
|
Remove FLT files in RAW directory with bad EXPFLAG values, which usually corresponds to failed guide stars. |
|
Save results from fine_alignment |
|
|
|
Update grism headers with the fine shifts |
Parse footprint objects from YAML visit dictionary |
|
Make visit dictionary cleaner for writing to YAML |
|
|
Write visit association files |
grizli.pipeline.photoz Module¶
Helpers for working with eazy-py
.
Functions¶
|
Aperture and background corrections to photometric catalog |
|
|
|
June 2020: Reapply total corrections using fixed bug for the kron total corrections where the necessary pixel scale wasn't used. |
|
Fetch photometry from vizier |
|
Show individual filter and RGB thumbnails |
|
Classes¶
|
|
Simulations¶
Some basic tools for simulating HST/JWST/Roman grism data. See multimission_simulaation.ipynb for some examples.
grizli.fake_image Module¶
Tools for generating very basic fake images for HST/JWST/Roman simulations
Functions¶
|
Use the header from NIRISS, WFC3/IR or WFIRST/Roman and make an |
|
Use |
|
Make JWST/NIRCAM image header |
|
Make JWST/NIRISS image header |
|
Make WFIRST/Roman WFI header |
|
Make a simple FITS file for a Roman High Latitude Survey Image |
|
Rotate CD matrix |
|
Make HST/WFC3-IR image header |
|
Alias to |