Focus (pyobs.modules.focus)
Modules for focus-related tasks. TODO: write doc
AutoFocusSeries
- class AutoFocusSeries(focuser: Union[str, IFocuser], camera: Union[str, IData], series: Union[Dict[str, Any], FocusSeries], offset: bool = False, filters: Optional[Union[str, IFilters]] = None, filter_name: Optional[str] = None, binning: Optional[int] = None, **kwargs: Any)
Bases:
Module
,CameraSettingsMixin
,IAutoFocus
Module for auto-focusing a telescope.
Initialize a new auto focus system.
- Parameters:
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
- Parameters:
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.
- Returns:
Tuple of obtained best focus value and its uncertainty. Or Nones, if focus series failed.
- Raises:
FileNotFoundException – If image could not be downloaded.
FocusModel
- class FocusModel(focuser: Optional[str] = None, weather: Optional[str] = None, interval: int = 300, temperatures: Optional[Dict[str, Dict[str, float]]] = None, model: Optional[str] = None, coefficients: Optional[Dict[str, float]] = None, update: bool = False, log_file: Optional[str] = None, min_measurements: int = 10, enabled: bool = True, temp_sensor: str = 'average.temp', default_filter: Optional[str] = None, filter_offsets: Optional[Dict[str, float]] = None, filter_wheel: Optional[str] = None, **kwargs: Any)
Bases:
Module
,IFocusModel
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:
- temperatures:
- T1:
module: telescope sensor: T1
- T2:
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:
- coefficients:
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.
- Parameters:
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.