def __init__(self): self.boardAddress = "192.168.0.175" self.program = SimpleGlibProgram( os.path.join( INSTALLATION_PATH, "runcontrol", "GlibSuper.xml" ) ) # Need to specify the environment variables required to run XDAQ. To get them use the system # settings in runcontrol/environmentVariables.py. I can't get them from the current environment # because they might not be set for the current user (apache won't have any of them set). environmentVariables=getEnvironmentVariables() self.program.setEnvironmentVariables( environmentVariables ) self.program.initialiseCBCs() # Do the necessary initialisation to get information about the CBCs # Need to provide the full executable path because this might not be in the path for different users # When the analyser is spawned it takes on the environment of this script, so I'll modify that directly self.analysisControl = AnalyserControl( "127.0.0.1", "50000", True, environmentVariables ) self.analysisControl.reset() # Directory where the user can save their I2C files self.userI2cDirectory=INSTALLATION_PATH+"/runcontrol/user_i2c/" # The members below are for handling the thread that takes data self.dataTakingThread=None self.dataTakingFractionComplete=1 self.dataTakingStatusString="Not taking data"
self.targets.remove( item ) if __name__ == '__main__': try : from environmentVariables import getEnvironmentVariables except ImportError : print "No runcontrol/environmentVariables.py file found. Using the defaults from runcontrol/environmentVariables_default.py" from environmentVariables_default import getEnvironmentVariables # Create an object to print the current status to the screen. This will # be passed to the SCurveRun instance which will call these methods. class PrintStatus(object) : def currentStatus( self, fractionComplete, statusString ) : print "%3d%% - %s"%(int(fractionComplete*100+0.5),statusString) def finished( self ) : print "Finished" daqProgram = SimpleGlibProgram( "GlibSuper.xml" ) environmentVariables=getEnvironmentVariables() daqProgram.setEnvironmentVariables( environmentVariables ) analysisControl = AnalyserControl( "127.0.0.1", "50000", True, environmentVariables ) cbc2CalibrateChannelTrims=CalibrateChannelTrims( PrintStatus(), daqProgram, analysisControl, range(100,150), 127, "/tmp/calibrateChannelTrims" ) # I have no interest in running this in a separate thread (that's mostly for gui # stuff) so I'll just call the run method directly. If I wanted to start it in a # separate thread I'd call "start" instead. cbc2CalibrateChannelTrims.run() print "Saving calibrated trims to '/tmp/calibratedTrims'" daqProgram.supervisor.saveI2c( "/tmp/calibratedTrims" )