Skip to content

Commit

Permalink
Process the alignment images.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Nov 12, 2023
1 parent 82208af commit f0a53ee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/panoptes/pocs/utils/cli/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from itertools import product
from multiprocessing import Process
from typing import List

import typer
Expand Down Expand Up @@ -106,6 +107,7 @@ def get_altaz_observation(coords, seq_time) -> Observation:
# Shared sequence time for all alignment observations.
sequence_time = current_time(flatten=True)

procs = list()
for i, altaz_coord in enumerate(altaz_coords):
print(f'{field_name} #{i:02d}/{len(altaz_coords):02d} {altaz_coord=}')

Expand All @@ -123,7 +125,13 @@ def get_altaz_observation(coords, seq_time) -> Observation:
print(f'\tStarting {exptime}s exposure #{j + 1:02d}/{num_exposures:02d}')
pocs.observatory.take_observation(blocking=True)

# Do processing in background.
process_proc = Process(target=pocs.observatory.process_observation)
process_proc.start()
procs.append(process_proc)

mount.query('stop_tracking')

except KeyboardInterrupt:
print('[red]POCS alignment interrupted by user, shutting down.[/red]')
except Exception as e:
Expand All @@ -133,4 +141,11 @@ def get_altaz_observation(coords, seq_time) -> Observation:
print('[green]POCS alignment finished, shutting down.[/green]')
finally:
print(f'[bold yellow]Please be patient, this may take a moment while the mount parks itself.[/bold yellow]')
pocs.observatory.mount.park()

# Wait for all the processing to finish.
print('Waiting for image processing to finish.')
for proc in procs:
proc.join()

pocs.power_down()

0 comments on commit f0a53ee

Please sign in to comment.