Skip to content

Commit

Permalink
Merge branch 'main' into troubleshooter
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Nov 7, 2024
2 parents 163ec02 + 5996f29 commit 6635a41
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## Next version

### 🔥 Breaking change

* `GortObserver.observe_tile` now default to `async_readout=False`. This will block until the exposure is done, which is a more natural behaviour for an external user that is not trying to over-optimise things. The code that uses `observe_tile` in GORT (`Gort.observe()` and `ObserverOverwatcher.observe_loop_task()`) have been updated to explicitly use `async_readout=True`.

### 🔧 Fixed

* Temporary fix in the cleanup recipe for a bug in `lvmscp` caused by a quick reset after reading out a pending exposure.


## 1.0.2 - November 6, 2024

### 🚀 New
Expand Down
3 changes: 2 additions & 1 deletion src/gort/gort.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,10 @@ async def observe(

for ipos, dpos in enumerate(tile.dither_positions):
is_last = ipos == len(tile.dither_positions) - 1
result, _ = await self.observe_tile(
result, _ = await self.observer.observe_tile(
tile=tile,
dither_position=dpos,
async_readout=True,
keep_guiding=not is_last,
skip_slew_when_acquired=True,
run_cleanup=False,
Expand Down
2 changes: 1 addition & 1 deletion src/gort/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async def observe_tile(
dither_position: int | None = None,
exposure_time: float = 900.0,
n_exposures: int = 1,
async_readout: bool = True,
async_readout: bool = False,
keep_guiding: bool = False,
skip_slew_when_acquired: bool = True,
guide_tolerance: float = 1.0,
Expand Down
1 change: 1 addition & 0 deletions src/gort/overwatcher/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ async def observe_loop_task(self):
result, _ = await observer.observe_tile(
tile=tile,
dither_position=dpos,
async_readout=True,
keep_guiding=True,
skip_slew_when_acquired=True,
run_cleanup=False,
Expand Down
10 changes: 10 additions & 0 deletions src/gort/recipes/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ async def recipe(self, readout: bool = True, turn_lamps_off: bool = True):
await self.gort.guiders.stop()

if not (await self.gort.specs.are_idle()):
extra_sleep: float = 0
cotasks = []

for spec in self.gort.specs.values():
Expand All @@ -227,6 +228,7 @@ async def recipe(self, readout: bool = True, turn_lamps_off: bool = True):
if await spec.is_reading():
self.gort.log.warning(f"{spec.name} is reading. Waiting.")
cotasks.append(self._wait_until_spec_is_idle(spec))
extra_sleep = 10
elif await spec.is_exposing():
self.gort.log.warning(f"{spec.name} is exposing. Aborting.")
cotasks.append(spec.abort())
Expand All @@ -239,9 +241,17 @@ async def recipe(self, readout: bool = True, turn_lamps_off: bool = True):
self.gort.log.warning(f"{msg} Reading it.")
cotasks.append(spec.actor.commands.read())
cotasks.append(self._wait_until_spec_is_idle(spec))
extra_sleep = 10

try:
await asyncio.gather(*cotasks)

# HACK: lvmscp says the controller is idle before it actually
# writes the image to disk. If we reset too fast (as we are going
# to do just after this) that will crash the exposures.
# I'll fix that in lvmscp (promise) but for now we add a sleep here
# to allows the images to post-process and write before resetting.
await asyncio.sleep(extra_sleep)
except Exception as ee:
self.gort.log.error(f"Error during cleanup: {ee}")
self.gort.log.warning("Resetting the spectrographs.")
Expand Down

0 comments on commit 6635a41

Please sign in to comment.