Coverage for core / src / sensorkit / std / optics.py: 100%

25 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-09-02 00:03 +0000

1# SPDX-License-Identifier: Apache-2.0 

2from pydantic import BaseModel, Field 

3 

4import sensorkit.api as sk 

5 

6 

7@sk.declare_keyword 

8class Filter(BaseModel): 

9 """Represents an optical filter with its properties.""" 

10 

11 name: str 

12 position: int | None = None 

13 wavelength: float | None = None 

14 

15 

16@sk.declare_keyword 

17class Filters(BaseModel): 

18 """Collection of optical filters available in a filter changer.""" 

19 

20 filters: list[Filter] = Field(default_factory=list) 

21 

22 

23class SetFilter(sk.DeviceCommand): 

24 """Set the active optical filter by name or position.""" 

25 

26 filter: str | int 

27 

28 

29StandardFilterChanger = sk.declare_archetype( 

30 "filter_changer", 

31 required_commands=(SetFilter,), 

32) 

33"""A device that can change optical filters by name or position.""" 

34 

35 

36@sk.declare_keyword 

37class FocusPosition(BaseModel): 

38 """Current position of the focuser.""" 

39 

40 position: float 

41 

42 

43class ChangeFocusPosition(sk.DeviceCommand): 

44 """Command to change the focus position to a specified value.""" 

45 

46 position: float 

47 

48 

49StandardFocuser = sk.declare_archetype( 

50 "focuser", 

51 required_commands=(ChangeFocusPosition,), 

52) 

53"""A device that can adjust a focus position.""" 

54 

55 

56class OpenMirrorCover(sk.DeviceCommand): 

57 """Command to open the mirror cover.""" 

58 

59 

60class CloseMirrorCover(sk.DeviceCommand): 

61 """Command to close the mirror cover.""" 

62 

63 

64StandardMirrorCover = sk.declare_archetype( 

65 "mirror_cover", 

66 required_commands=(OpenMirrorCover,CloseMirrorCover,), 

67) 

68"""A device representing a mirror cover that can be opened and closed."""