Beispiel #1
0
def go_initialize():
   DataReadWrite.initializeDatabase(dirname,fileName)
   DataReadWrite.openDatabase(dirname,fileName)
   numberOfSamples=int(NUMBEROFSAMPLES.get())
   duration=int(DURATION.get())
   startPosition=int(START_POSITION.get())
   #xyzRobot.resetValuesToZero()   
   setInitials=INITIALS.get()
   standardTemp=float(RHTEMP2000TEMP.get())
   standardRH = float(RHTEMP2000HUMIDITY.get())


   tempCorrection=standardTemp-float(xyzRobot.getTemperature())
   rhCorrection=standardRH-float(xyzRobot.getHumidity())
   logger.debug( "standardTemp: %f",standardTemp)
   logger.debug( "standardRH: %f",standardRH)
   logger.debug( "Temp: %f",xyzRobot.getTemperature())
   logger.debug( "RH: %f",xyzRobot.getHumidity())
   logger.debug( "tempCorrection: %f", tempCorrection)
   logger.debug( "rhCorrection: %f ",rhCorrection)
   
   runID = weighAllCrucibles(setInitials,numberOfSamples,LOGINT,duration,
   								startPosition,tempCorrection,rhCorrection,
          						robotStatus,POSITION,MCOUNT,CURRENTSTEP,
          						STATUS,DURATION,LOGGERINTERVAL,
          						RUNID,NUMBEROFSAMPLES,TIMEREMAINING)
   return True;
Beispiel #2
0
print "Close Database: closeDatabase()"
value = DataReadWrite.closeDatabase()
test += 1
if (value==True):
   print "Database closed. PASS"
   passed += 1
else:
   print "FAIL"

print "-------------------------------------------------------"
print "Open newly created Database: initializeDatabase()"
filename = "TEST"
dirname="c:/Users/Archy/Dropbox/Rehydroxylation/"
test += 1
value = DataReadWrite.openDatabase(dirname,filename)
if (value==True):
   print "Database opened. PASS"
   passed += 1
else:
   print "FAIL"

print "-------------------------------------------------------"
value=DataReadWrite.BDOpen()
print "BDOpen() result->",value
test += 1
if value==True:
   print "PASS"
   passed += 1
else:
   print "FAIL"
Beispiel #3
0
def go_postFire():
   dbName=DATABASENAME.get()
   dbDir=DBDIRECTORY.get()

   value=DataReadWrite.openDatabase(dbDir,dbName)
   if value is False:
      logger.error("There has been an error since openDatabase returned FALSE")
      alert.deiconify()
      Message(alert,text="There has been a problem. Cannot create database", bg='red', fg='ivory', relief=GROOVE)

   runID=int(RUNID.get())
   if (runID<1):
      alert.deiconify()
      alert.title("Alert: No RunID Number!")
      Message(alert,text="You must have a RunID to continue.", bg='red', fg='ivory', relief=GROOVE).grid(row=0, column=0, sticky=W+E+N+S)
      #Button(alert, text="Continue", command=backToMainWindow).grid(row=1,column=0)
      #Button(alert, text="Quit", command=KillProgram).grid(row=2,column=1)
      logger.debug("You must have a RunID entered in order to continue.")
      return False;
   
   setInitials=str(INITIALS.get())
   startPosition=int(START_POSITION.get())
   intervalsec=int(INTERVAL.get())
   numberOfSamples=int(NUMBEROFSAMPLES.get())
   repetitions=int(REPS.get())
   duration=int(DURATION.get())
   setTemperature=float(TEMP.get())
   setHumidity=float(HUMIDITY.get())
   standardTemp=float(RHTEMP2000TEMP.get())
   standardRH=float(RHTEMP2000HUMIDITY.get())

   temp=xyzRobot.getTemperature()
   humidity=xyzRobot.getHumidity()
   tempCorrection=standardTemp-temp
   rhCorrection=standardRH-humidity
   temperatureOfFiring=int(TEMPOFFIRING.get())
   durationOfFiring=DURATIONOFFIRING.get()*60
   preOrPost=2
   status="postfire"
 

   startPosition=START_POSITION.get()
   now = datetime.today()
   ## (locationCode,numberOfSamples,description,temperature,humidity,endOfFiring,durationOfFiring)=DataReadWrite.getRunInfo(runID)
   startdate=DATEOFFIRING.get()
   starttime=TIMEOFFIRING.get()
   sdate=startdate.split("-",3)
   stime=starttime.split(":",3)

   startOfFiring = datetime(int(sdate[2]), int(sdate[0]), int(sdate[1]), int(stime[0]), int(stime[1]), int(stime[2]))
   
   end = timedelta(minutes=durationOfFiring)
   endOfFiring = startOfFiring + end
   
   # minutes since firing ended
   diffTime = now - endOfFiring
  
   ## d_endOfFiring = endOfFiring.strftime("%m-%d-%y %H:%M:%S")
   intervalsec=int(INTERVAL.get())
   postMeasurementTimeInterval=int(DURATION.get()) 
   repetitions=int(REPS.get())
   #print runID,setInitials,status,durationOfFiring,temperatureOfFiring,postMeasurementTimeInterval,duration,repetitions,endOfFiring,startPosition,intervalsec
   logger.debug("updateRunPostFire( %d,%s,%s,%s,%d,%d,%d,%d,%d,%s,%d,%d )" % 
   							(runID,setInitials,status,startOfFiring,
       						durationOfFiring,temperatureOfFiring,intervalsec,
      						duration,repetitions,endOfFiring,startPosition,intervalsec))

   value=DataReadWrite.updateRunPostFire(runID,setInitials,
               status,startOfFiring,durationOfFiring,temperatureOfFiring,intervalsec,
               duration,repetitions,endOfFiring, startPosition,intervalsec)
   if (value is False):
      logger.error("There has been an error since updateRunPostFire returned FALSE")
      alert.deiconify()
      Message(alert,text="There has been a problem. The arm has returned to Home.", bg='red', fg='ivory', relief=GROOVE).pack(padx=1,pady=1)
     # Button(alert, text="Continue", command=backToMainWindow)
     # Button(alert, text="Quit", command=KillProgram)

   count=0
   repeat=1
   ## print runID,"-",duration,"-",intervalsec,"-",numberOfSamples,"-",startPosition,"-",endOfFiring,"-",tempCorrection,"-",rhCorrection,"-",repeat
 
   while repeat < (repetitions+1):
      CYCLE.set(repeat)
      weighAllSamplesPostFire(runID,duration,
               intervalsec,numberOfSamples,startPosition,
               endOfFiring,tempCorrection,rhCorrection,repeat,
               robotStatus,POSITION,MCOUNT,
               CURRENTSTEP,STATUS,DURATION,
               LOGGERINTERVAL,RUNID,NUMBEROFSAMPLES,
               TIMEREMAINING,TIMEELAPSED,REPS,CYCLE)
      repeat += 1
      #  update_windows()
   #postfire.update()
   #postfire.deiconify()
   #postfire.withdraw()
   return True;
Beispiel #4
0
def go_preFire():
   dbName=DATABASENAME.get()
   dbDir=DBDIRECTORY.get()

   value=DataReadWrite.openDatabase(dbDir,dbName)
   if value is False:
      logger.error("There has been an error since openDatabase returned FALSE")
      alert.deiconify()
      Message(alert,text="There has been a problem. Cannot create database", bg='red', fg='ivory', relief=GROOVE)

   runID=int(RUNID.get())
   if (runID<1):
      alert.deiconify()
      alert.title("Alert: No RunID Number!")
      Message(alert,text="You must have a RunID to continue.", bg='red', fg='ivory', relief=GROOVE).grid(row=0,column=0,sticky=E+W+N+S)
      ##Button(alert, text="Continue", command=backToMainWindow).grid(row=1,column=0)
      ##Button(alert, text="Quit", command=KillProgram).grid(row=1,column=1)
      logger.debug("You must have a RunID entered in order to continue.")
      return False;
   preOrPost=1
   status="prefire"
   setInitials=str(INITIALS.get())
   startPosition=int(START_POSITION.get())
   setName=str(NAME.get())
   setLocation=str(LOCATION.get())
   intervalsec=int(INTERVAL.get())
   numberOfSamples=int(NUMBEROFSAMPLES.get())
   repetitions=int(REPS.get())
   duration=int(DURATION.get())
   setTemperature=float(TEMP.get())
   setHumidity=float(HUMIDITY.get())
   standardTemp=float(RHTEMP2000TEMP.get())
   standardRH=float(RHTEMP2000HUMIDITY.get())

   temp=xyzRobot.getTemperature()
   humidity=xyzRobot.getHumidity()
   tempCorrection=standardTemp-temp
   rhCorrection=standardRH-humidity

   now = datetime.today()
   today = now.strftime("%m-%d-%y %H:%M:%S")

   if (startPosition==""):
      startPosition=1
      
   runID=DataReadWrite.updateRunPreFire(runID,setInitials,setName,today,
   setLocation,preOrPost,intervalsec,setTemperature,setHumidity,
   status,duration,numberOfSamples,repetitions,startPosition)
   
   if (runID == False):
      logger.error("There has been an error since updateRunPreFire returned FALSE")
      alert.deiconify()
      Message(alert,text="There has been a problem. The arm has returned to Home.", bg='red', fg='ivory', relief=GROOVE).grid(row=0,column=0,sticky=W+E+N+S)
      ##Button(alert, text="Continue", command=backToMainWindow).grid(column=1,row=0)
      ##Button(alert, text="Quit", command=KillProgram).grid(row=1,column=1)
   count=1
   repeat=0

   while (count < (numberOfSamples+1)):

      (meanWeight, stdevWeight) = DataReadWrite.getCrucibleWeightStats(runID,count)
      # Now do an insert for tblSample for each sample include--- from here on we can then just update the record.
      sampleID = DataReadWrite.insertNewSample(runID,count,setName,now,setLocation,preOrPost,intervalsec,setTemperature,setHumidity,status,duration,repetitions,meanWeight,stdevWeight)

    
      if (sampleID is False):
         logger.error("There has been an error since insertNewSample returned FALSE")
         alert.deiconify()
         Message(alert,text="There has been a problem. The arm has returned to Home.", bg='red', fg='ivory', relief=GROOVE).grid(row=0,column=0,sticky=W+E+N+S)
         ##Button(alert, text="Continue", command=backToMainWindow).grid(column=1,row=0)
         ##Button(alert, text="Quit", command=KillProgram).grid(row=1,column=1)
         break
      count += 1

   repeat=0      
   ## repeat as many times as asked (all of the crucibles)
   while repeat < repetitions:
      weighAllSamplesPreFire(runID,duration,intervalsec,
            numberOfSamples,startPosition,standardTemp,
            standardRH,repeat,
            robotStatus,POSITION,MCOUNT,CURRENTSTEP,
            STATUS,DURATION,LOGGERINTERVAL,RUNID,
            NUMBEROFSAMPLES,TIMEREMAINING,CYCLE,MEAN,STDEV,VARIANCE)
      repeat += 1
      #prefire.update_windows()
   

   prefire.withdraw()
   return True
Beispiel #5
0
__author__ = 'clipo'
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
matplotlib.rc('axes',grid=True)
rcParams['axes.formatter.limits']=(0,0)
import DataReadWrite

#print rcParams.keys()
dbName="TEST"
dbDir="c:/Users/Archy/Dropbox/Rehydroxylation/"

data= np.array([])
value=DataReadWrite.openDatabase(dbDir,dbName)
runID=1
sampleLocation=1
count =0

data=DataReadWrite.getPreFireWeightOverTime(runID,sampleLocation)

print data
if data is False:
   print "no data"
   exit(1)

x=[]
y=[]
weight=0.0
maximumVal=0
minimumVal=100000