mpdaf.sdetect.create_masks_from_segmap(segmap, catalog, ref_image, n_jobs=1, skip_existing=True, masksky_name='mask-sky.fits', maskobj_name='mask-source-%05d.fits', idname='ID', raname='RA', decname='DEC', margin=0, mask_size=(20, 20), convolve_fwhm=0, psf_threshold=0.5, verbose=0)[source]

Create binary masks from a segmentation map.

For each source from the catalog, extract the segmap region, align with ref_image and regrid to the resolution of ref_image.

segmapstr or mpdaf.obj.Image

The segmentation map.

catalogstr or mpdaf.sdetect.Catalog or astropy.table.Table

The catalog with sources id and position.

ref_imagestr or mpdaf.obj.Image

The reference image, with which the segmap is aligned.


Number of parallel processes (for joblib).


If True, skip sources for which the mask file exists.

masksky_namestr or callable()

The filename for the sky mask.

maskobj_namestr or callable()

The filename for the source masks, with a format string that will be substituted with the ID, e.g. %05d.

idname, raname, decnamestr

Name of the ‘id’, ‘ra’ and ‘dec’ columns.


Margin used for the segmap alignment (pixels).


Size of the source masks (arcsec).


FWHM for the PSF convolution (arcsec).


Threshold applied to the PSF to get a binary image.

verbose: int

Verbosity level for joblib.Parallel.