Modules for focus-related tasks. TODO: write doc
- class AutoFocusSeries(focuser: str | IFocuser, camera: str | IData, series: Dict[str, Any] | FocusSeries, offset: bool = False, filters: str | IFilters | None = None, filter_name: str | None = None, binning: int | None = None, **kwargs: Any)
Module for auto-focusing a telescope.
Initialize a new auto focus system.
focuser – Name of IFocuser.
camera – Name of ICamera.
filters – Name of IFilters, if any.
filter_name – Name of filter to set.
offset – If True, offsets are used instead of absolute focus values.
- async auto_focus(count: int, step: float, exposure_time: float, **kwargs: Any) Tuple[float, float] [source]
Perform an auto-focus series.
This method performs an auto-focus series with “count” images on each side of the initial guess and the given step size. With count=3, step=1 and guess=10, this takes images at the following focus values: 7, 8, 9, 10, 11, 12, 13
count – Number of images to take on each side of the initial guess. Should be an odd number.
step – Step size.
exposure_time – Exposure time for images.
Tuple of obtained best focus value and its uncertainty. Or Nones, if focus series failed.
FileNotFoundException – If image could not be downloaded.
- async auto_focus_status(**kwargs: Any) Dict[str, Any] [source]
Returns current status of auto focus.
Returned dictionary contains a list of focus/fwhm pairs in X and Y direction.
Dictionary with current status.
- class FocusModel(focuser: str | None = None, weather: str | None = None, interval: int = 300, temperatures: Dict[str, Dict[str, float]] | None = None, model: str | None = None, coefficients: Dict[str, float] | None = None, update: bool = False, log_file: str | None = None, min_measurements: int = 10, enabled: bool = True, temp_sensor: str = 'average.temp', default_filter: str | None = None, filter_offsets: Dict[str, float] | None = None, filter_wheel: str | None = None, **kwargs: Any)
A focus model that is automatically applied to an IFocuser.
If, e.g., the model is defined as:
model: -0.043807*T1 - 0.031798*T2 + 0.062042*temp + 41.694895
Then “temp” is taken from the weather module automatically. The other temperatures must be defined, e.g., as:
module: telescope sensor: T1
module: telescope sensor: T2
In this case, the method get_temperatures() is called on the module “telescope” and the values T1 and T2 are taken for the model.
Alternatively, the coefficients can be defined as symbols:
model: a*T1 + b*T2 + c*temp + d
For this to work, initial values must be specified separately:
a: -0.043807 b: -0.031798 c: 0.062042 d: 41.694895
Only this way it is possible to automatically re-calculate the model.
Initialize a focus model.
focuser – Name of focuser.
weather – Name of weather station.
interval – Interval for setting focus or None, if no regular setting of focus is required.
model – Focus model to use.
coefficients – Coefficients in model, mainly used when updating it.
update – Whether to update the model on new focus values.
log_file – Path to file containing all focus measurements.
min_measurements – Minimum number of measurements to update model.
enabled – If False, no focus is set.
temp_sensor – Name of sensor at weather station to provide ambient temperature.
default_filter – Name of default filter. If None, filters are ignored.
filter_offsets – Offsets for different filters. If None, they are not modeled.
filter_wheel – Name of filter wheel module to use for fetching filter before setting focus.
- async get_optimal_focus(**kwargs: Any) float [source]
Returns the optimal focus.
Optimum focus calculated from model.
ValueError – If anything went wrong.