create_masks¶
-
muse_origin.
create_masks
(line_table, source_table, profile_fwhm, cube_correl, threshold_correl, cube_std, threshold_std, segmap, fwhm, out_dir, *, mask_size=25, min_sky_npixels=100, seg_thres_factor=0.5, fwhm_factor=2, plot_problems=True)[source]¶ Create the mask of each source.
This function creates the masks and sky masks of the sources in the line table using the
origin.source_masks.gen_source_mask
function on each source. The primary source masks are created using the cube_correl while the complementary source masks are created using the cube_std.The cube_correl and cube_std are expected to have the same WCS.
TODO: Implement parallel processing.
- Parameters
- line_table: astropy.table.Table
ORIGIN table of lines, this table must contain the columns: ID, x0, y0, z0, comp, and profile.
- source_table: astropy.table.Table
ORIGIN table containing the source list. This table is used to get the position of the source.
- profile_fwhm: list
List of the profile FWHMs. The index in the list is the profile number.
- cube_correl: mpdaf.obj.Cube
Correlation cube where primary sources where detected.
- threshold_correl: float
Threshold used for detection of sources in the cube_correl.
- cube_std: mpdaf.obj.Cube
STD cube where complementary sources where detected.
- threshold_std: float
Threshold used for detection of sources in the STD cube.
- segmap: mpdaf.obj.Image
Segmentation map. Must have the same spatial WCS as the cube. The sky must be in segment 0.
- fwhm: numpy array of floats
Value of the spatial FWHM in pixels at each wavelength of the detection cube.
- out_dir: str
Directory into which the masks will be created.
- mask_size: int
Width in pixel for the square masks.
- min_sky_npixels: int
Minimum number of sky pixels in the mask.
- seg_thres_factor: float
Factor applied to the detection thresholds to get the threshold used for segmentation. The default is to take half of it.
- fwhm_factor: float
When creating a source, for each line a disk with a diameter of the FWMH multiplied by this factor is added to the source mask.
- plot_problems: bool
If true, the problematic sources will be reprocessed by gen_source_mask in verbose mode to produce various plots of the mask creation process.