regen_catalogue#

niriss_tools.pipeline.regen_catalogue(new_seg_map, root='', sci=None, wht=None, threshold=2.0, get_background=True, bkg_only=False, bkg_params={'bh': 64, 'bw': 64, 'fh': 3, 'fw': 3, 'pixel_scale': 0.06}, verbose=True, phot_apertures=[<Quantity 0.36 arcsec>, <Quantity 0.500001 arcsec>, <Quantity 0.7000002 arcsec>, <Quantity 1.0000002 arcsec>, <Quantity 1.2 arcsec>, <Quantity 1.5 arcsec>, <Quantity 3. arcsec>], aper_segmask=False, prefer_var_image=True, rescale_weight=False, err_scale=-inf, use_bkg_err=False, column_case=<method 'upper' of 'str' objects>, save_to_fits=True, include_wcs_extension=True, source_xy=None, compute_auto_quantities=True, autoparams=[2.5, <Quantity 0.35 arcsec>, 2.4, 3.8], flux_radii=[0.2, 0.5, 0.9], subpix=0, mask_kron=False, max_total_corr=2, detection_params={'clean': True, 'clean_param': 1, 'deblend_cont': 0.001, 'deblend_nthresh': 32, 'filter_kernel': array([[0.0049, 0.0213, 0.0513, 0.0687, 0.0513, 0.0213, 0.0049],        [0.0213, 0.0921, 0.2211, 0.296 , 0.2211, 0.0921, 0.0213],        [0.0513, 0.2211, 0.5307, 0.7105, 0.5307, 0.2211, 0.0513],        [0.0687, 0.296 , 0.7105, 0.9511, 0.7105, 0.296 , 0.0687],        [0.0513, 0.2211, 0.5307, 0.7105, 0.5307, 0.2211, 0.0513],        [0.0213, 0.0921, 0.2211, 0.296 , 0.2211, 0.0921, 0.0213],        [0.0049, 0.0213, 0.0513, 0.0687, 0.0513, 0.0213, 0.0049]]), 'filter_type': 'conv', 'minarea': 9}, bkg_mask=None, pixel_scale=0.06, log=False, gain=2000.0, extract_pixstack=30000000, sub_object_limit=4096, exposure_footprints=None, suffix='', full_mask=None, **kwargs)[source]#

Make a catalog from drizzle products using SEP.

Parameters:
new_seg_mapArrayLike

The segmentation map from which the catalogue will be regenerated.

rootstr

Rootname of the FITS images to use for source extraction. This function is designed to work with the single-image products from drizzlepac, so the default data/science image is searched by

>>> drz_file = glob.glob(f'{root}_dr[zc]_sci.fits*')[0]

Note that this will find and use gzipped versions of the images, if necessary.

The associated weight image filename is then assumed to be

>>> weight_file = drz_file.replace('_sci.fits', '_wht.fits')
>>> weight_file = weight_file.replace('_drz.fits', '_wht.fits')
.
sci, whtstr

Filenames to override drz_file and weight_file derived from the root parameter.

thresholdfloat

Detection threshold for sep.extract.

get_backgroundbool

Compute the background with sep.Background.

bkg_onlybool

If True, then just return the background data array and don’t run the source detection.

bkg_paramsdict

Keyword arguments for sep.Background. Note that this can include a separate optional keyword pixel_scale that indicates that the background sizes bw, bh are set for a paraticular pixel size. They will be scaled to the pixel dimensions of the target images using the pixel scale derived from the image WCS.

verbosebool

Print status messages.

phot_aperturesstr or array_like

Photometric aperture diameters. If given as a string then assume units of pixels. If an array or list, can have units, e.g., astropy.units.arcsec.

aper_segmaskbool

If true, then run SEP photometry with segmentation masking. This requires the sep fork at gbrammer/sep.git, or sep >= 1.10.0.

prefer_var_imagebool

Use a variance image _wht.fits > _var.fits if found.

rescale_weightbool

If true, then a scale factor is calculated from the ratio of the weight image to the variance estimated by sep.Background.

err_scalefloat

Explicit value to use for the weight scaling, rather than calculating with rescale_weight. Only used if err_scale > 0.

use_bkg_errbool

If true, then use the full error array derived by sep.Background. This is turned off by default in order to preserve the pixel-to-pixel variation in the drizzled weight maps.

column_casefunc

Function to apply to the catalog column names. E.g., the default str.upper results in uppercase column names.

save_to_fitsbool

Save catalog FITS file {root}.cat.fits.

include_wcs_extensionbool

An extension will be added to the FITS catalog with the detection image WCS.

source_xy(x, y) or (ra, dec) arrays

Force extraction positions. If the arrays have units, then pass them through the header WCS. If no units, positions are zero indexed array coordinates.

To run with segmentation masking (1sep > 1.10`), also provide aseg and aseg_id arrays with source_xy, like

>>> source_xy = ra, dec, aseg, aseg_id

.

compute_auto_quantitiesbool

Compute Kron/auto-like quantities with compute_SEP_auto_params.

autoparamslist

Parameters of Kron/AUTO calculations with compute_SEP_auto_params.

flux_radiilist

Light fraction radii to compute with compute_SEP_auto_params, e.g., [0.5] will calculate the half-light radius (FLUX_RADIUS).

subpixint

Pixel oversampling.

mask_kronbool

Not used.

max_total_corrfloat

Not used.

detection_paramsdict

Parameters passed to sep.extract.

bkg_maskarray

Additional mask to apply to sep.Background calculation.

pixel_scalefloat

Not used.

logbool

Send log message to grizli.utils.LOGFILE.

gainfloat

Gain value passed to sep.sum_circle.

extract_pixstackint

See sep.set_extract_pixstack.

sub_object_limitint

See sep.set_sub_object_limit.

exposure_footprintslist, None

An optional list of objects that can be parsed with sregion.SRegion. If specified, add a column nexp to the catalog corresponding to the number of entries in the list that overlap with a particular source position.

suffixstr

Additional suffix to add to the catalogue name.

full_maskArrayLike

Parts of the image to mask out.

**kwargsdict, optional

Any additional keyword arguments.

Returns:
Table

Source catalogue.