#! /usr/local/python

# do_flat_acq.py : collect electro-optical test data from the
#                   flat exposure of a CCD
#
# created 6/3/2014 by H.Neal from P.Doeherty's scripts

from org.lsst.ccs.subsystem.ts import TS3SubSys

import org.lsst.ccs.framework.Configurable
import org.lsst.ccs.framework.annotations.ConfigChanger

import sys
import time
import os
import glob
import time

def do_flat_acq

    Configurable.Environment env = getEnvironment();
    flat_lolim = env.getCheckedValueFromConfiguration(?FLAT_LOLIM?, flat_lolim)
    flat_hilim = env.getCheckedValueFromConfiguration(?FLAT_HILIM?, flat_hilim)
    flat_bcount = env.getCheckedValueFromConfiguration(?FLAT_BCOUNT?, flat_bcount)
    flat_wl = env.getCheckedValueFromConfiguration(?FLAT_WL?, flat_wl)



    mono.setWavelength(flat_wl);

# go through config file looking for 'flat' instructions, take the flats
    seq = 0  # image pair number in sequence
    with open(?CCDconfig?) as fp:
        for line in fp:
            tokens = str.split(line);
            if ((len(tokens) > 0) and (tokens[0] == 'flat')):
                target = float(tokens[1])
                CCD.exp_acq(fname, exptime, path=datadir, test='FLAT', img='FLAT')
    seq = seq + 1

    return

