sourcefinder.config#
Attributes#
Classes#
Selection of output, related to detected sources and/or intermediate |
|
Configuration that should cover all the specifications for processing the image. |
|
Functions#
|
Remove |
|
Assert value is of one of the types |
|
|
|
Validate nested types allowed in TOML |
|
Validate types, dispatch on generic or POD types |
Module Contents#
- class sourcefinder.config.ExportSettings[source]#
Bases:
_ValidateSelection of output, related to detected sources and/or intermediate image processing products
- class sourcefinder.config.ImgConf[source]#
Bases:
_ValidateConfiguration that should cover all the specifications for processing the image.
- alpha: float = 0.01[source]#
FDR alpha value (float, default 0.01) that sets an upper limit on the fraction of pixels erroneously detected as source pixels, relative to all source pixels. This requirement should be met when averaged over a large ensemble of images, but problems were encountered with alpha as low as 0.001, see paragraph 3.6 of Spreeuw’s thesis.
- alpha_brightness1: float = 1.5[source]#
First exponent for scaling errors in peak brightness, see equation 26 and paragraph 5.2.5 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- alpha_brightness2: float = 1.5[source]#
Second exponent for scaling errors in peak brightness, see equation 26 and paragraph 5.2.5 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- alpha_maj1: float = 2.5[source]#
First exponent for scaling errors along the fitted major axis, see equation 26 and paragraph 5.2.3 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- alpha_maj2: float = 0.5[source]#
Second exponent for scaling errors along the fitted major axis, see equation 26 and paragraph 5.2.3 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- alpha_min1: float = 0.5[source]#
First exponent for scaling errors along the fitted minor axis and for scaling errors in the position angle, see equation 26 and paragraph 5.2.3 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- alpha_min2: float = 2.5[source]#
Second exponent for scaling errors along the fitted minor axis and for scaling errors in the position angle, see equation 26 and paragraph 5.2.3 of the NVSS paper and equation 41 and paragraph 3 of Condon’s (1997) “Errors in Elliptical Gaussian Fits”.
- analysis_thr: float = 3.0[source]#
Analysis threshold as multiple of the background standard deviation (rms) map, after the background mean values have been subtracted from the image.
- back_size_x: int | None = None[source]#
Subimage size for estimation of background node values (X direction). The nodes are centred on the subimages.
- back_size_y: int | None = None[source]#
Subimage size for estimation of background node values (Y direction). The nodes are centred on the subimages.
- clean_bias: float = 0.0[source]#
Clean bias to subtract from the peak brightnesses (Jy/beam), see parapagraph 5.2.5 and equation 34 of the NVSS paper.
- clean_bias_error: float = 0.0[source]#
1-sigma uncertainty in clean bias (Jy/beam), see parapagraph 5.2.5 and equation 37 of the NVSS paper.
- deblend_mincont: float = 0.005[source]#
Minimum flux density fraction (relative to the original, i.e. unblended, island) required for a subisland to be considered a valid deblended component.
- detection_image: str | None = None[source]#
Path to detection map. PySE will identify sources and the positions of pixels which comprise them on the detection image, but then use the corresponding pixels on the target images to perform measurements. Of course, the detection image and the target image(s) must have the same pixel dimensions. Note that only a single detection image may be specified, and the same pixels are then used on all target images. Note further that this detection-image option is incompatible with –fdr
- detection_thr: float = 10.0[source]#
Detection threshold as multiple of the background standard deviation (rms) map, after the background mean values have been subtracted from the image.
- eps_dec: float = 0.0[source]#
Calibration uncertainty in declination (degrees), see equation 27b of the NVSS paper.
- eps_ra: float = 0.0[source]#
Calibration uncertainty in right ascension (degrees), see equation 27a of the NVSS paper.
- ew_sys_err: float = 0.0[source]#
Systematic error in east-west direction, see paragraph 5.2.3 of the NVSS paper. Note that this parameter is currently not applied in PySE, because it should be considered a final step before entering source parameters in a catalog, i.e. it is simply returned to allow for systematic positional offset cf. the NVSS. Therefore, its unit (degrees, arcseconds) is up to the user.
- fdr: bool = False[source]#
Use False Detection Rate (FDR) algorithm for determining detection threshold.
- ffbox: float = 3.0[source]#
When fitting to a fixed position, a square “box” of pixels is chosen around the requested position, and the optimization procedure allows the source position to vary within that box. The size of the box may be changed with this option. Note that this parameter is given in units of the major axis of the beam in pixels.
- fixed_posns: str | None = None[source]#
JSON __list__ of RA, Dec pairs of coordinates to measure sources at (disables blind extraction and vectorized source measurements).
- fixed_posns_file: str | None = None[source]#
Path to JSON file with RA, Dec pairs of coordinates to measure sources at (disables blind extraction and vectorized source measurements).
- force_beam: bool = False[source]#
Force source shape to align restoring beam shape (bmaj, bmin, bpa) for Gauss fits and vetorized source measurement, i.e. when vectorized=True (as of 2025-06-13: upcoming, issue #131).
- frac_flux_cal_error: float = 0.0[source]#
Intensity-proportional calibration uncertainty, see paragraph 5.2.5 and equation 37 of the NVSS paper.
- grid: int | None = 64[source]#
Background subimage size used as fallback for back_size_x and back_size_y. If both are not set, this implies back_size_x=backsize_y=grid, i.e. the subimages are squares.
- interpolate_order: int = 1[source]#
Order of interpolation to use for the background mean and background standard deviation (rms) maps (e.g. 1 for linear)
- margin: int = 0[source]#
Margin in pixels to ignore near the edge of the image, i.e. sources within this margin will not be detected.
- median_filter: int = 0[source]#
Size of the median filter to apply to background and RMS grids prior to interpolating. This is used to discard outliers. Use 0 to disable.
- mf_threshold: int = 0[source]#
Threshold (Jy/beam) used with the median filter if median_filter is non-zero. This is used to only discard outliers (i.e. extreme background mean or rms node values) beyond a certain threshold. Use 0 to disable.
- nr_threads: int | None = None[source]#
The number of threads used to parallelize Gaussian fits to detected sources. Note: this does not change numba’s ‘num threads’ for parallel numba operations.
- ns_sys_err: float = 0.0[source]#
Systematic error in north-south direction, see paragraph 5.2.3 of the NVSS paper. Note that this parameter is currently not applied in PySE, because it should be considered a final step before entering source parameters in a catalog, i.e. it is simply returned to allow for systematic positional offset cf. the NVSS. Therefore, its unit (degrees, arcseconds) is up to the user.
- radius: float = 0.0[source]#
Radius in pixels (from image center) considered valid, i.e. sources beyond this radius will not be detected.
- remove_edge_sources: bool = True[source]#
When source pixels - with values above the analysis threshold - connect with the edge of a map or with masked pixels, do not measure the source properties. Consequently, the parameters of this source will not be returned. The idea here is that, when source pixels are adjacent to edges or masked pixels, we’ll likely be missing some pixels and any source measurement will be compromised.
- rms_filter: float = 0.001[source]#
Any interpolated background standard deviation (rms) value should be above this threshold times the median of all background standard deviation (rms) node values. This is used to avoid picking up sources towards the edges of the image where the values of the background rms map may be the result of poor interpolation, i.e. are the result of extrapolation rather than interpolation. Use 0 to disable.
- structuring_element: list[list[int]] = [[1, 1, 1], [1, 1, 1], [1, 1, 1]][source]#
The “structuring element” defines island connectivity as in “4-connectivity” and “8-connectivity”. These two are the only reasonable choices, since the structuring element must be centrosymmetric. The structuring element is applied in scipy.ndimage.label, so check its documentation for some background on its use.
- sourcefinder.config._is_dataclass(_type: Type[T], /) bool[source]#
Remove
TypeGuardfrom is_dataclass.see: python/mypy#14941
- Parameters:
_type (Type[T])
- Return type:
bool
- sourcefinder.config.assert_t(key: str, value, *types: type)[source]#
Assert value is of one of the types
keyis the TOML configuration key the value is associated to. It is used to generate a meaningful error message.- Parameters:
key (str)
types (type)
- sourcefinder.config.read_conf(path: str | pathlib.Path)[source]#
- Parameters:
path (str | pathlib.Path)
- sourcefinder.config.validate_nested(key: str, value, origin_t, args)[source]#
Validate nested types allowed in TOML
keyis the TOML configuration key being validated.valueshould be of typeorigin_t[args]. It is passed to this function separately to avoid recomputing the type again.When the type is a
list, the value is tested recursively. On recursive calls, the list index is appended to the key. Fordict-s, iterate over all key-value pairs and validated.- Parameters:
key (str)