Exposure Time estimators (pyobs.images.processors.exptime)
ExpTimeEstimator
- class ExpTimeEstimator(min_exp_time: float = 0.0, max_exp_time: float | None = None, **kwargs: Any)
Estimate exposure time.
StarExpTimeEstimator
- class StarExpTimeEstimator(edge: float = 0.0, bias: float = 0.0, saturated: float = 0.7, **kwargs: Any)
Estimate a new exposure time from the brightest unsaturated star in the image.
This processor inspects a source catalog attached to a
pyobs.images.Image, filters out saturated and edge-affected stars, selects the brightest remaining star, and scales the current exposure time so that the star would reach a configurable fraction of the detector saturation. The scaling uses a bias-corrected linear relation. The recommended exposure time is returned as a float; pixel data are not modified.- Parameters:
edge (float) – Fraction of the image to ignore at each border (on both sides of x and y). A value of 0.1 excludes the outer 10% of the image width and height. Default:
0.0.bias (float) – Bias level in ADU to subtract from measured peaks in the exposure-time scaling formula. Default:
0.0.saturated (float) – Target fraction of the detector saturation to aim for with the brightest star (e.g.,
0.7for 70% of saturation). Default:0.7.kwargs – Additional keyword arguments forwarded to
pyobs.images.processors.exptime.ExpTimeEstimator.
Behavior
Reads the current exposure time from
image.header["EXPTIME"].If the image has no source catalog (
image.safe_catalog is None), returns the current exposure time unchanged.Determines the detector saturation level in ADU:
If both
DET-SATU(saturation in electrons) andDET-GAIN(e⁻/ADU) are present in the header, usesDET-SATU / DET-GAIN.Otherwise, uses a default saturation of
50000ADU.
Removes saturated stars from the catalog by keeping entries with
peak <= saturation.Excludes stars near the image borders on both axes:
The axis lengths are read from
NAXIS0(x) andNAXIS1(y) in the header.Stars must satisfy
x >= 1 + edge_sizeandx <= axis_len - edge_size(analogously fory), whereedge_size = edge * axis_len.Coordinates are expected to use FITS 1-based convention.
Selects the brightest remaining star by the
peakcolumn and computes the target peak astarget = saturated * saturation.Computes the new exposure time with bias correction:
t_new = (target - bias) / (peak - bias) * t_old.
Input/Output
Input:
pyobs.images.Imagewith a source catalog containing at leastx,y, andpeakcolumns, and a FITS header withEXPTIME. OptionalDET-SATUandDET-GAINimprove saturation estimation.Output:
floatrecommended exposure time. Pixel data and headers are unchanged.
Configuration (YAML)
Aim for 70% of saturation and ignore 5% borders:
class: pyobs.images.processors.exptime.StarExpTimeEstimator edge: 0.05 saturated: 0.7 bias: 0.0
Notes
The formula assumes linear detector response in ADU after bias correction. If
peak <= bias, the scaling becomes ill-defined; ensure peaks are above the bias level.Accurate gain (
DET-GAIN) and saturation (DET-SATU) metadata yield more reliable targets; otherwise the default saturation of 50000 ADU is used.Edge filtering helps avoid truncated or aberrant stars near the borders that would bias the estimate.
If all stars are filtered out, the brightest-star selection may fail; ensure reasonable detection and filtering parameters or handle empty catalogs upstream.
- SATURATION = 50000