Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First push of modified take_stuttered code #100

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions python/lsst/ts/observatory/control/base_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ async def take_bias(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -236,6 +237,7 @@ async def take_darks(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -320,6 +322,7 @@ async def take_flats(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -423,6 +426,7 @@ async def take_object(
n_snaps=n_snaps,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -503,6 +507,7 @@ async def take_engtest(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -592,6 +597,7 @@ async def take_focus(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -677,6 +683,7 @@ async def take_cwfs(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand Down Expand Up @@ -765,6 +772,7 @@ async def take_acq(
n_snaps=1,
n_shift=None,
row_shift=None,
change_focus=None,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand All @@ -780,6 +788,7 @@ async def take_stuttered(
exptime: float,
n_shift: int,
row_shift: int,
change_focus: bool,
n: int = 1,
group_id: typing.Optional[str] = None,
test_type: typing.Optional[str] = None,
Expand Down Expand Up @@ -807,6 +816,8 @@ async def take_stuttered(
Number of shift-expose sequences.
row_shift : `int`
How many rows to shift at each sequence.
change_focus : 'bool'
Whether or not to shift focus on odd numbered shifts
n : `int`, optional
Number of frames to take.
group_id : `str`, optional
Expand All @@ -824,8 +835,8 @@ async def take_stuttered(
note : `str`
Optional observer note to be added to the image header.
checkpoint : `coro`
A optional awaitable callback that accepts one string argument
that is called before each bias is taken.
An awaitable callback that accepts one string argument
that is called to shift the focus.
**kwargs
Arbitrary keyword arguments.

Expand Down Expand Up @@ -862,6 +873,7 @@ async def take_stuttered(
n_snaps=1,
n_shift=n_shift,
row_shift=row_shift,
change_focus=change_focus,
group_id=group_id,
test_type=test_type,
reason=reason,
Expand All @@ -880,6 +892,7 @@ async def take_imgtype(
n_snaps: int = 1,
n_shift: typing.Optional[int] = None,
row_shift: typing.Optional[int] = None,
change_focus=None,
group_id: typing.Optional[str] = None,
test_type: typing.Optional[str] = None,
reason: typing.Optional[str] = None,
Expand All @@ -906,6 +919,9 @@ async def take_imgtype(
row_shift : `int`, optional
How many rows to shift at each sequence. Only used for stuttered
images.
change_focus : `bool`, optional
Whether or not to shift focus during stuttered images.
Only used for stuttered images.
reason : `str`, optional
Reason for the data being taken. This must be a short tag-like
string that can be used to disambiguate a set of observations.
Expand Down Expand Up @@ -979,7 +995,10 @@ async def take_imgtype(
self.log.debug(f"imagetype: {imgtype}, skip TCS synchronization.")

if checkpoint is not None:
await checkpoint(f"Expose {n} {imgtype}")
if change_focus:
self.checkpoint=checkpoint
else:
await checkpoint(f"Expose {n} {imgtype}")

camera_exposure = CameraExposure(
exp_time=exptime if imgtype != "BIAS" else 0.0,
Expand All @@ -990,6 +1009,7 @@ async def take_imgtype(
n_snaps=n_snaps,
n_shift=n_shift,
row_shift=row_shift,
change_focus=change_focus,
test_type=test_type,
reason=reason,
program=program,
Expand Down Expand Up @@ -1283,6 +1303,10 @@ async def _handle_expose_shift(self, camera_exposure: CameraExposure) -> None:
assert type(camera_exposure.n_shift) is int

for i in range(camera_exposure.n_shift - 1):
if camera_exposure.change_focus and (i % 2 == 1):
# shift focus on odd numbered shifts
self.checkpoint("Shifting hexapod z")

self.log.debug(
f"Exposing {i+1} of {camera_exposure.n_shift} for {camera_exposure.exp_time} seconds."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CameraExposure:
n_snaps: int
n_shift: typing.Union[int, None]
row_shift: typing.Union[int, None]
change_focus: typing.Union[bool, None]
test_type: typing.Union[str, None]
reason: typing.Union[str, None]
program: typing.Union[str, None]
Expand Down