ufig package
Subpackages
- ufig.config package
- ufig.plugins package
- Submodules
- ufig.plugins.add_generic_stamp_flags module
- ufig.plugins.add_generic_stamp_flags_ucat module
- ufig.plugins.add_lensing module
- ufig.plugins.add_psf module
Plugin
apply_psf_parameter_scalings()
ensure_valid_psf_beta()
ensure_valid_psf_ellip()
ensure_valid_psf_flux_ratio()
ensure_valid_psf_fwhm()
get_moffat_coadd_psf_cnn()
get_moffat_coadd_psf_cnn_from_file()
get_moffat_maps_psf()
load_psf_skymaps()
moffat_alpha2fwhm()
moffat_alpha2r50()
moffat_fwhm2alpha()
moffat_fwhm2r50()
moffat_profile_integrated()
moffat_r502alpha()
moffat_r502fwhm()
multiple_moffat_fwhm()
multiple_moffat_r50()
numba_min_dist()
psf_from_sky_maps()
sample_psf_moffat_constant()
update_psf_for_current_filter()
- ufig.plugins.background_noise module
- ufig.plugins.background_subtract module
- ufig.plugins.cleanup_catalogs module
- ufig.plugins.cleanup_memory module
- ufig.plugins.compression_noise module
- ufig.plugins.convert_photons_to_adu module
- ufig.plugins.draw_stars_besancon_map module
- ufig.plugins.estimate_psf module
- ufig.plugins.gamma_interpolation_table module
- ufig.plugins.match_sextractor_catalog_multiband_read module
- ufig.plugins.match_sextractor_seg_catalog_multiband_read module
- ufig.plugins.multi_band_setup module
- ufig.plugins.read_in_catalog module
- ufig.plugins.render_galaxies_flexion module
- ufig.plugins.render_stars_photon module
- ufig.plugins.resample module
- ufig.plugins.run_detection_classifier module
- ufig.plugins.run_emulator module
- ufig.plugins.run_nflow module
- ufig.plugins.run_sextractor module
- ufig.plugins.run_sextractor_forced_photometry module
- ufig.plugins.saturate_pixels module
- ufig.plugins.saturate_pixels_x module
- ufig.plugins.single_band_setup module
- ufig.plugins.single_band_setup_intrinsic_only module
- ufig.plugins.write_catalog module
- ufig.plugins.write_catalog_for_emu module
Plugin
add_blending_binned_integrated()
add_blending_full_image()
add_blending_integrated()
add_blending_ngal()
add_blending_points()
add_no_blending()
enrich_catalog()
enrich_star_catalog()
ensure_valid_cats()
estimate_flux_full_image()
estimate_flux_of_points()
get_elliptical_indices()
sersic_b()
sersic_brightness()
- ufig.plugins.write_image module
- Module contents
- ufig.psf_estimation package
- Submodules
- ufig.psf_estimation.cnn_predictions module
- ufig.psf_estimation.cnn_util module
- ufig.psf_estimation.core module
- ufig.psf_estimation.correct_brighter_fatter module
- ufig.psf_estimation.cutouts_utils module
- ufig.psf_estimation.data_preparation module
- ufig.psf_estimation.polynomial_fitting module
- ufig.psf_estimation.psf_predictions module
- ufig.psf_estimation.psf_utils module
- ufig.psf_estimation.save_model module
- ufig.psf_estimation.star_sample_selection_cnn module
beta_cut()
cut_boundaries()
cut_magnitude()
cut_moments()
cut_n_exp()
cut_nearby_bright_star()
cut_position_weights()
cut_sextractor_flag()
cut_sysmaps_delta_weight()
cut_sysmaps_survey_mask()
ellipticity_cut()
flexion_cut()
fwhm_cut()
get_gaia_image_coords()
get_gaia_match()
get_match_vector()
get_stars_for_cnn()
inlims()
kurtosis_cut()
remove_outliers()
select_cnn_predictions()
set_flag_bit_and_log()
- ufig.psf_estimation.tiled_regressor module
- Module contents
Submodules
ufig.array_util module
Created on Dec 5, 2016
author: tomaszk
ufig.coordinate_util module
Created on Jul 5, 2016 @author: Claudio Bruderer
- ufig.coordinate_util.get_healpix_pixels(nside, w, size_x, size_y, margin=50, npoints=300, nest=False)[source]
For a given wcs-information of a tile find overlapping HEALPix pixels. These pixels are found, by setting up a grid of npoints x npoints points, finding the corresponding HEALPix pixels of these gridpoints and computing the unique pixel IDs.
Note: Pixels are in RING-ordering
- Parameters:
nside – NSIDE of the HEALPix map
w – wcs-object containing all the relevant wcs-information
size_x – size of image in x-direction (pixel)
size_y – size of image in x-direction (pixel)
margin – Number of pixels margin to ensure that the whole tile is covered
npoints – Number of points in one dimension sampled
nest – whether the HEALPix map is ordered in the NESTED-format or not; default = False
- Return pixels:
HEALPix pixels overlapping a given tile
- ufig.coordinate_util.get_healpix_pixels_from_map(par)[source]
Returns the pixels of a boolean HEALPix map that are True. Also adapts the nside_sampling parameter if it is not set to the same value as the nside of the map.
- ufig.coordinate_util.radec2pix(ra, dec, nside, **kwargs)[source]
Convert (RA, DEC) to HEALPix pixel number.
- Parameters:
ra – RA coordinate (in degrees)
dec – DEC coordinate (in degrees)
nside – nside of HEALPix map
kwargs – additional keyword arguments for healpy.ang2pix-function; e.g. nest
- Returns:
pixel number position lies in
- ufig.coordinate_util.radec2thetaphi(ra, dec)[source]
Convert (RA, DEC) to (theta, phi).
- Parameters:
ra – RA coordinate (in degrees)
dec – DEC coordinate (in degrees)
- Returns:
Theta angle on the sphere following the HEALPix convention (in radians)
- Returns:
Phi angle on the sphere following the HEALPix convention (in radians)
- ufig.coordinate_util.radec2xy(w, ra, dec)[source]
Convert (RA, DEC) to (x, y).
- Parameters:
w – wcs-object containing all the relevant wcs-information
ra – RA coordinate (in degrees)
dec – DEC coordinate (in degrees)
- Returns:
x coordinate (in pixels)
- Returns:
y coordinate (in pixels)
- ufig.coordinate_util.thetaphi2pix(theta, phi, nside, **kwargs)[source]
Convert (RA, DEC) to HEALPix pixel number.
- Parameters:
theta – Theta angle on the sphere following the HEALPix convention (in radians)
phi – Phi angle on the sphere following the HEALPix convention (in radians)
nside – nside of HEALPix map
kwargs – additional keyword arguments for healpy.ang2pix-function; e.g. nest
- Returns:
pixel number position lies in
- ufig.coordinate_util.thetaphi2radec(theta, phi)[source]
Convert (theta, phi) to (RA, DEC).
- Parameters:
theta – Theta angle on the sphere following the HEALPix convention (in radians)
phi – Phi angle on the sphere following the HEALPix convention (in radians)
- Returns:
RA coordinate (in degrees)
- Returns:
DEC coordinate (in degrees)
- ufig.coordinate_util.thetaphi2xy(w, theta, phi)[source]
Convert (theta, phi) to (x, y).
- Parameters:
w – wcs-object containing all the relevant wcs-information
theta – Theta angle on the sphere following the HEALPix convention (in radians)
phi – Phi angle on the sphere following the HEALPix convention (in radians)
- Returns:
x coordinate (in pixels)
- Returns:
y coordinate (in pixels)
- ufig.coordinate_util.tile_in_skycoords(pixscale, ra0, dec0, crpix_ra, crpix_dec)[source]
Maps a pixel tile onto the sky. The tile, which has pixels with width pixscale, is defined around a center point (ra0, dec0). The projection employed is a tangent plane gnonomic projection.
- Parameters:
pixscale – Pixelscale of the image
size_x – size of image in x-direction (pixel)
size_y – size of image in x-direction (pixel)
ra0 – Right ascension of the center of the tile
dec0 – Declination of the center of the tile
crpix_ra – RA axis reference pixel (x-axis)
crpix_dec – DEC axis reference pixel (y-axis)
- Return wcs_trans:
wcs-object containing all the relevant wcs-transformation information
- ufig.coordinate_util.wcs_from_parameters(par)[source]
Creates an astropy WCS objects from the parameters in stored in the context. This is a wrapper for tile_in_skycoords to avoid code duplicates when getting crpix_ra and crpix_dec. :param par: parameters, type: ivy.utils.struct.Struct :return: wcs object created by tile_in_skycoords
- ufig.coordinate_util.xy2pix(w, x, y, nside, **kwargs)[source]
Convert (RA, DEC) to HEALPix pixel number.
- Parameters:
w – wcs-object containing all the relevant wcs-information
x – x coordinate (in pixels)
y – y coordinate (in pixels)
nside – nside of HEALPix map
kwargs – additional keyword arguments for healpy.ang2pix-function; e.g. nest
- Returns:
pixel number position lies in
- ufig.coordinate_util.xy2radec(w, x, y)[source]
Convert (x, y) to (RA, DEC).
- Parameters:
w – wcs-object containing all the relevant wcs-information
x – x coordinate (in pixels)
y – y coordinate (in pixels)
- Returns:
RA coordinate (in degrees)
- Returns:
DEC coordinate (in degrees)
- ufig.coordinate_util.xy2thetaphi(w, x, y)[source]
Convert (x, y) to (theta, phi).
- Parameters:
w – wcs-object containing all the relevant wcs-information
x – x coordinate (in pixels)
y – y coordinate (in pixels)
- Returns:
Theta angle on the sphere following the HEALPix convention (in radians)
- Returns:
Phi angle on the sphere following the HEALPix convention (in radians)
ufig.io_util module
Created on Nov 3, 2015
author: jakeret
- ufig.io_util.get_abs_path(file_name, root_path='res/maps/', is_file=True, package_name='ufig')[source]
Resolves the absolute path for a file or a directory.
In case the input is treated as a file (is_file=True), the function tries the following steps: 1) if file_name is already an absolute path, then just return it 2) if root_path is an absolute path the path is simply concatenated 3) checking in the ufig package structure 4) using DarkSkySync
In case the input should be treated as a directory (is_file=False), the function tries the following steps: 1) if file_name is already an absolute path, then just return it 2) if root_path is an absolute path the path is simply concatenated 3) checking in the ufig package structure
- Returns path:
local absolute path to the file or directory if possible
- ufig.io_util.load_from_hdf5(file_name, hdf5_keys, hdf5_path='', root_path='res/maps/')[source]
Load data stored in a HDF5-file.
- Parameters:
file_name – Name of the file.
hdf5_keys – Keys of arrays to be loaded.
hdf5_path – Path within HDF5-file appended to all keys.
root_path – Relative or absolute root path.
- Returns:
Loaded arrays.
- ufig.io_util.load_hpmap(file_name, root_path, ext=1)[source]
Loads a healpix map and returns it in the ring-scheme
- Parameters:
file_name – name of the file
root_path – relative root path
ext – Extension of Healpix-maps (by default = 1)
- ufig.io_util.load_image(file_name, size_x, size_y, root_path='res/maps/', ext=0, **kwargs)[source]
Loads an image from stored in a fits file
- Parameters:
file_name – name of the file
size_x – max x size
size_y – max y size
root_path – relative root path
ext – fits extention
ufig.mask_utils module
Created on Feb 5, 2019 author: Joerg Herbel
- ufig.mask_utils.decimal_integer_to_binary(n_bits, arr_decimal, dtype_out)[source]
Transform a one-dimensional array of decimal integers into its binary representation. Returns an array with the shape (len(arr_decimal), n_bits). To reconstruct arr_decimal[i], one would perform the operation
arr_decimal[i] = np.sum(2**np.arange(n_bits) * arr_binary[i])
This means that this binary representation is reversed with respect to what is normally used. For example, normally,
1100 = 1 * 2**3 + 1 * 2**2 + 0 * 2**1 + 0 * 2**0.
However, here we have
1100 = 1 * 2**0 + 1 * 2**1 + 0 * 2**2 + 0 * 2**3.
ATTENTION: THIS FUNCTION MODIFIES ARR_DECIMAL IN PLACE!
- ufig.mask_utils.pixel_mask_to_ucat_catalog_mask(pixel_mask, cat, off_mask_radius, r50_offset=5)[source]
- ufig.mask_utils.set_masked_pixels(pixel_mask, maskbits_keep, n_bits)[source]
Set pixels which are masked according to input bits. This function modifies pixel_mask in-place.
- Parameters:
pixel_mask – mask
maskbits_keep – mask bits to keep
n_bits –
…
- Returns:
mask with only bits to keep switched on (same shape as input mask)
ufig.rendering_util module
Created on Jul 31, 2017 @author: Joerg Herbel
- ufig.rendering_util.add_photon(image, x, y, dx, dy)[source]
Add one photon to image.
- Parameters:
image – image
x – centroid x-position
y – centroid y-position
dx – x-coordinate sampled from light profile
dy – y-coordinate sampled from light profile
- Returns:
- ufig.rendering_util.compute_ellip_matrices(size, e1, e2)[source]
size can either be the PSF fwhm or the intrinsic galaxy r50
- ufig.rendering_util.draw_photon_gal(rng_buffer, sin_table, cos_table, gammaprecision, gammaprecisionhigh, intrinsic_sersic_l, intrinsic_sersic_b, intrinsic_table, rng, ellip_matrix)[source]
- ufig.rendering_util.draw_photon_psf(rng_buffer, sin_table, cos_table, alpha_by_fwhm, beta_power, rng, ellip_matrix, flexion_tensor, kurtosis, flexion_suppression, kurtosis_suppression, dx_offset, dy_offset)[source]
- ufig.rendering_util.draw_photon_psf_radial(rng_buffer, sin_table, cos_table, rng, alpha_by_fwhm, beta_power)[source]
ufig.run_util module
Created on Sep 30, 2016 @author: Joerg Herbel
ufig.sampling_util module
Created on Mar 6, 2018 author: Joerg Herbel
- ufig.sampling_util.sample_position_uniform(numobj, w, pixel_index, nside)[source]
Sample a Healpix pixel uniformly
- Parameters:
numobj – Number of uniform samples
w – wcs-object containing all the relevant wcs-information
pixel_index – Index of the Healpix pixels sampled
nside – NSIDE of the Healpix map
- Returns:
Uniformly drawn x-coordinate (in pixels)
- Returns:
Uniformly drawn y-coordinate (in pixels)
ufig.se_moment_util module
- ufig.se_moment_util.moments_to_distortion(x2, y2, xy)[source]
Convert SExtractor second moments to ellipticity parameters.
- Parameters:
x2 – Second moments in x-direction (X2WIN_IMAGE from SExtractor)
y2 – Second moments in y-direction (Y2WIN_IMAGE from SExtractor
xy – Cross moments (XYWIN_IMAGE from SExtractor)
- Returns:
e1, e2, r50: Ellipticity components and effective radius
ufig.sysmaps_util module
Created on Nov 16, 2016 author: Tomasz Kacprzak
- ufig.sysmaps_util.chi_mean_combination_lowmem(par)[source]
This creates a CHI-MEAN detection image, as is done by the DES pipeline, see https://iopscience.iop.org/article/10.3847/1538-4365/aab4f5/pdf (DOI: 10.3847/1538-4365/aab4f5), appendix B.
Copy of chi_mean_combination made to run with low memory
- Parameters:
images_and_weights – iterable yielding images with weights to be combined
- Returns:
chi-mean detection image
- ufig.sysmaps_util.get_detection_image(par)[source]
Constructs the detection image for SExtractor. In case of a single-band detection image, simply writes the weight map of the detection band to a fits file. For multi-band detection, the function computes the CHI-MEAN combination of the detection band images and their weights. :param par: ctx.parameters :return: path to detection image (fits), path to detection weights (fits or ‘NONE’),
weight type of detection image for SExtractor, either according to input parameters (single-band) or ‘NONE’ (multi-band detection image)
- ufig.sysmaps_util.get_hdf_location_bgrms(par, band=None)[source]
Get the filename and dataset for the background noise map
- Parameters:
par – ctx().parameters structure
band – which band to use (if None, use the single-band parameter values)
- Returns:
filepath, dataset: path and dataset index in hdf file
- ufig.sysmaps_util.get_hdf_location_exptime(par, band=None)[source]
Get the filename and dataset for the exposure time map
- Parameters:
par – ctx().parameters structure
band – which band to use (if None, use the single-band parameter values)
- Returns:
filepath, dataset: path and dataset index in hdf file
- ufig.sysmaps_util.get_hdf_location_gain(par, band=None)[source]
Get the filename and dataset for the background noise map
- Parameters:
par – ctx().parameters structure
band – which band to use (if None, use the single-band parameter values)
- Returns:
filepath, dataset: path and dataset index in hdf file
- ufig.sysmaps_util.get_hdf_location_invvar(par, band=None)[source]
Get the filename and dataset for the inverse variance map
- Parameters:
par – ctx().parameters structure
band – which band to use (if None, use the single-band parameter values)
- Returns:
filepath, dataset: path and dataset index in hdf file
- ufig.sysmaps_util.get_path_temp_sextractor_weight(par, band)[source]
Constructs the path to the temporary fits-file with the weights for SExtractor
- Parameters:
par – ctx.parameters
band – filter band
- Returns:
path
- ufig.sysmaps_util.write_temp_sextractor_weight(par, path_out, band=None, dtype=<class 'numpy.float32'>)[source]
Reads out the weight map (inverse variance) from hdf5 and writes it to fits, s.t. it can be used by SExtractor
- Parameters:
par – ctx.parameters
path_out – path where weight map will be stored
band – filter band
- ufig.sysmaps_util.write_temp_sextractor_weights(par, dirpath_temp, overwrite_photo=True, overwrite_det=True, dtype=<class 'numpy.float32'>)[source]
Write fits weight maps for SExtractor in the temp folder.
- Parameters:
par – ctx().parameters structure
dirpath_temp – temp dir where to write files
overwrite_photo – if to overwrite photometry weight if exists
overwrite_det – if to overwrite detection weight if exists
- Returns:
filepath_fits_photometry, filepath_fits_detection: paths to decompressed weights
ufig.workflow_util module
Created on Jun 15, 2016 author: Joerg Herbel