bin_and_save#
- niriss_tools.sed.bin_and_save(obj_id, out_dir, seg_map, info_dict, sn_filter, target_sn=100, bin_scheme='hexbin', bin_diameter=4, seg_hdu_index=0, padding=50, overwrite=False, binned_name=None, **bin_kwargs)[source]#
Rebin and save one object in a segmentation map.
This is a thin wrapper around other functions in this module, with a slightly opinionated default set of parameters. If the user is familiar with the lower-level functions, those will provide an equivalent output.
- Parameters:
- obj_id
int The unique identifier of an object in the full segmentation map.
- out_dir
PathLike The directory to which the output will be written, consisting of a segmentation image for the binning scheme, and a photometric catalogue.
- seg_map
ArrayLike|PathLike The segmentation map identifying the location of objects in the individual images, where pixels with a given unique integer correspond to the extent of a single object. This should have the same alignment and shape as images in
info_dict.- info_dict
dict A dictionary containing all information on the images to be used when binning and generating the photometric catalogue. The keys of the dictionary should correspond to the names of the filters (or any desired column name in the output catalogue), and each entry should itself contain a
dict, with the keyssciandvardescribing the locations of the PSF-matched science and variance images.- sn_filter
str The
info_dictkey to use when calculating the S/N for binning.- target_sn
float, optional The desired S/N in each output bin, by default 100. This is only guaranteed to be achieved for the hexagonal bins (if using this binning scheme), as there is some scatter on the S/N achieved through Voronoi binning.
- bin_scheme
str, optional Which binning scheme to use, by default
"hexbin". In this case, the first stage of the binning procedure will be performed. If"vorbin", then this will be skipped, and only the Voronoi binning procedure will be attempted. If"colour", then pixels will be aggregated based on their colour.- bin_diameter
float, optional The minimum diameter of each bin (subject to pixel discretisation effects), by default 4.
- seg_hdu_index
int|str, optional The index or name of the HDU containing the segmentation map, by default
0.- padding
int, optional The extra padding to add to the object boundaries, by default 50.
- overwritebool, optional
If a catalogue already exists in
out_dir, this determines if it should be written over. By defaultFalse.- binned_name
str|None, optional Specify the exact name used for writing the output file. If
None(default), this will be automatically generated from the chosen binning parameters.- **bin_kwargs
dict, optional Any additional parameters to be passed through to
constrained_adaptive.
- obj_id
- Returns:
PathLikeThe path to the binned data, saved as a multi-extension FITS file.