#!/usr/bin/python

# * ccd_process 

# Copyright (c) 2011-2014 John Kielkopf and Karen Collins        
# kielkopf@louisville.edu                                                  
#                                                                          
#                                                                          
# Date: September 18, 2014                                                   
# Version: 1.1                                                             
#                                                                          
# This file is part of XmCCD                                              

import sys
from subprocess import Popen, PIPE
import string
import time

# Wait for ds9 to load the latest image

time.sleep(5)

# Make guiding corrections 

Popen('/usr/local/bin/guide.py', shell=True, stdout=PIPE).wait()

# Wait for telescope to respond to guide commands

time.sleep(5)

# Adjust the dome

Popen('/usr/local/bin/dome_track.py', shell=True, stdout=PIPE).wait()

# Wait for dome to adjust

time.sleep(5)

# Start the next exposure

Popen('/usr/local/bin/ccd_expose.py', shell=True, stdout=PIPE).wait()

exit()
