#!/usr/bin/env python
from PythonBinding import *
import os
#import lsst.eotest.sensor as sensorTest
import sys
import hdrtools as ht

fitsfile = "ArchonImageFile_1423709683459.fits"

ht.addPDvals(fitsfile,"pd-values-for-seq-1-exp-1","PhotoDiode1Readings",1)
ht.addPDvals(fitsfile,"bias-values-for-seq-1-exp-1","PhotoDiode2Readings",1)
print ht.fitsAverage(fitsfile)

#from lcatr.harness.helpers import dependency_glob
print "reading file %s" % sys.argv[1]
fileName = sys.argv[1]
fo = open(fileName, "r");
content = fo.read();
fo.close();
print "sending to Jython"
try:
#Create an instance of the python binding
    ccs1 = CcsJythonInterpreter("ccsscript");
 
    ccs1.syncExecution("tsCWD = '%s'" % os.getcwd());
    ccs1.syncExecution("lab = 'BNL'");
    ccs1.syncExecution("acffile = '%s/archon641-merged2-singleshot.acf'" % os.getcwd());
    ccs1.syncExecution("acqcfgfile = '%s/BNL-short.cfg'" % os.getcwd());
    ccs1.syncExecution("calfile = '%s/fluxcal_20140529150721.txt'" % os.getcwd());
    print 'starting synch execution'
    result1 = ccs1.syncExecution(content);
    print result1.getOutput();    
 
 
except CcsException as ex:
    print 'Failure', ex

