コード例 #1
0
def analyserpathscan_v1(scannables, path, *args):
    '''
    perform a single region analyser data collection at each point on the specified path,
    and produce a single scan data files recording scannables' poistions and metadata, and 
    analyser data for the active region defined in your sequence definition file under ew4001 node.
    
    implementation details:
    This function pre-process sequence file to set up Region Position Provider for scannable 
    'regions' ready for data collection using analyser 'ew4001', then delegate the scan 
    process to 'pathscan'.
    '''
    newargs = []
    i = 0
    while i < len(args):
        arg = args[i]
        newargs.append(arg)
        i = i + 1
        if isinstance(arg, RegionScannable):
            controller = Finder.find("SequenceFileObserver")
            xmldir = InterfaceProvider.getPathConstructor(
            ).createFromDefaultProperty() + "xml" + os.sep
            filename = xmldir + args[i]
            if (OsUtil.isWindows()):
                FilenameUtil.setPrefix("D:")
                filename = FilenameUtil.convertSeparator(filename)
            controller.update(controller, SequenceFileChangeEvent(filename))
            sleep(1.0)
            while (InterfaceProvider.getScanStatusHolder().getScanStatus() ==
                   JythonStatus.PAUSED):
                sleep(1.0)
            newargs.append(RegionPositionProvider(filename))
            #newargs.append( arg ) # to read the actual position
            i = i + 1
    pathscan(scannables, path, newargs)
コード例 #2
0
def analyserscan_v1(*args):
    starttime = time.ctime()
    if PRINTTIME: print "=== Scan started: " + starttime
    newargs = []
    i = 0
    while i < len(args):
        arg = args[i]
        newargs.append(arg)
        i = i + 1
        if isinstance(arg, RegionScannable):
            controller = Finder.find("SequenceFileObserver")
            xmldir = InterfaceProvider.getPathConstructor(
            ).createFromDefaultProperty() + "xml" + os.sep
            filename = xmldir + args[i]
            if (OsUtil.isWindows()):
                FilenameUtil.setPrefix("D:")
                filename = FilenameUtil.convertSeparator(filename)
            controller.update(controller, SequenceFileChangeEvent(filename))
            sleep(1.0)
            while (InterfaceProvider.getScanStatusHolder().getScanStatus() ==
                   JythonStatus.PAUSED):
                sleep(1.0)
            newargs.append(RegionPositionProvider(filename))
            #newargs.append( arg ) # to read the actual position
            i = i + 1
    scan(newargs)
    if PRINTTIME:
        print("=== Scan ended: " + time.ctime() +
              ". Elapsed time: %.0f seconds" % (time.time() - starttime))
コード例 #3
0
def cwd(subdir=None):
	if subdir==None:
		metadata.setMetadataValue("subdirectory","")
	else:
		sane=re.compile("[^a-zA-Z0-9-_:]")
		subdir=sane.sub("",subdir)
		metadata.setMetadataValue("subdirectory",subdir)
        print InterfaceProvider.getPathConstructor().createFromDefaultProperty()
コード例 #4
0
def zacstop():
    try:
        fastEnergy.stop()
        beamlineutil.restoreArchiving()
        InterfaceProvider.getCommandAborter().abortCommands()
    except:
        errortype, exception, traceback = sys.exc_info()
        logger.fullLog(None, "Error in stopping the zacscan ", errortype,
                       exception, traceback, False)
コード例 #5
0
 def setUp(self):
     InterfaceProvider.setTerminalPrinterForTesting(
         MockJythonServerFacade())
     self.abspath = os.path.abspath(TestFileFolder + "/1.nxs")
     parentPath = os.path.split(self.abspath)[0]
     if not os.path.isdir(parentPath):
         os.makedirs(parentPath)
     if os.path.isfile(self.abspath):
         os.remove(self.abspath)
コード例 #6
0
	def configureFileWriterPlugin(self, areadet,numImages):
		if not isinstance(areadet, NXDetector):
			raise Exception("'%s' detector is not a NXDetector! " % (areadet.getName()))
		additional_plugin_list = areadet.getAdditionalPluginList()
		datawriter=None
		scanNumber=nfn()
		for each in additional_plugin_list:
			if isinstance(each, MultipleImagesPerHDF5FileWriter):
				datawriter=each
				datawriter.getNdFile().getPluginBase().disableCallbacks()
				datawriter.getNdFile().getPluginBase().setBlockingCallbacks(0)
				filePathUsed = InterfaceProvider.getPathConstructor().createFromDefaultProperty() + "/"
				f=File(filePathUsed)
				if not f.exists():
					if not f.mkdirs():
						raise Exception("Folder does not exist and cannot be made: " + str(filePathUsed))
				datawriter.getNdFile().setFilePath(filePathUsed)
				if not datawriter.getNdFile().filePathExists():
					raise Exception("Path does not exist on IOC '" + filePathUsed + "'")
				datawriter.getNdFile().setFileName("pco")
				datawriter.getNdFile().setFileNumber(scanNumber)
				datawriter.getNdFile().setAutoIncrement(0)
				datawriter.getNdFile().setAutoSave(0)
				datawriter.getNdFile().setFileWriteMode(2);
				datawriter.getNdFileHDF5().setStoreAttr(0)
				datawriter.getNdFileHDF5().setStorePerform(0)
				datawriter.getNdFileHDF5().setLazyOpen(True);
				datawriter.getNdFileHDF5().setBoundaryAlign(0);
				datawriter.getNdFileHDF5().setNumCapture(numImages);
				datawriter.getNdFileHDF5().setNumRowChunks(0);
				datawriter.getNdFileHDF5().setNumColChunks(0);
				datawriter.getNdFileHDF5().setNumFramesChunks(0);
				datawriter.getNdFileHDF5().setNumFramesFlush(0);
				datawriter.getNdFileHDF5().startCapture();
				datawriter.getNdFile().getPluginBase().enableCallbacks()

			elif isinstance(each, SingleImagePerFileWriter):
				datawriter=each
				datawriter.getNdFile().getPluginBase().disableCallbacks()
				filePathUsed = InterfaceProvider.getPathConstructor().createFromDefaultProperty() + "/" + str(scanNumber) + "_PCOImage/"
				f=File(filePathUsed)
				if not f.exists():
					if not f.mkdirs():
						raise Exception("Folder does not exist and cannot be made: " + str(filePathUsed))
				datawriter.getNdFile().setFilePath(filePathUsed)
				if not datawriter.getNdFile().filePathExists():
					raise Exception("Path does not exist on IOC '" + filePathUsed + "'")
				datawriter.getNdFile().setFileName("pco")
				datawriter.getNdFile().setFileNumber(1)
				datawriter.getNdFile().setAutoIncrement(1)
				datawriter.getNdFile().setAutoSave(1)
				datawriter.getNdFile().setFileWriteMode(0)
				datawriter.getNdFile().getPluginBase().enableCallbacks()
		if datawriter is None:
			raise Exception("Cannot find EPICS File Writer Plugin for detector %s" % (areadet.getName()))	
コード例 #7
0
def analyserpathscan(*args):
    '''
    perform single/multiple regions analyser data collection at each point on the specified path,
    and produce a single scan file recording all scannables' poistions and metadata, along with
    analyser scan data under region's name as NXdetector node.
    
    implementation details:
    This function pre-process sequence file to set up analyser 'ew4000' ready for data collection.
    It creates scannable group to support point-to-point concurrent scan.
    '''
    starttime = time.ctime()
    if PRINTTIME: print "=== Scan started: " + starttime
    newargs = []
    i = 0
    while i < len(args):
        arg = args[i]
        if type(arg) == TupleType:
            if allElementsAreScannable(arg):
                scannableGroup = ScannableGroup("pathgroup")
                for each in arg:
                    scannableGroup.addGroupMember(each)
                newargs.append(scannableGroup)
            elif allElementsAreListOfNumber(arg):
                newargs.append(arg)
            else:
                raise TypeError, "Only tuple of scannables and tuple of list of numbers are supported."
        else:
            newargs.append(arg)
        i = i + 1
        if isinstance(arg, EW4000):
            controller = Finder.find("SequenceFileObserver")
            xmldir = InterfaceProvider.getPathConstructor(
            ).createFromDefaultProperty() + "xml" + os.sep
            filename = xmldir + args[i]
            if (OsUtil.isWindows()):
                FilenameUtil.setPrefix("D:")
                filename = FilenameUtil.convertSeparator(filename)
            controller.update(controller, SequenceFileChangeEvent(filename))
            sleep(2.0)
            jythonServerStatus = InterfaceProvider.getJythonServerStatusProvider(
            ).getJythonServerStatus()
            while (jythonServerStatus.isScriptOrScanPaused()):
                sleep(1.0)
            arg.setSequenceFilename(filename)
            sequence = arg.loadSequenceData(filename)
            if isinstance(arg.getCollectionStrategy(),
                          EW4000CollectionStrategy):
                arg.getCollectionStrategy().setSequence(sequence)
            i = i + 1
    scan(newargs)
    if PRINTTIME:
        print("=== Scan ended: " + time.ctime() +
              ". Elapsed time: %.0f seconds" % (time.time() - starttime))
コード例 #8
0
	def fullLog(self, controller, msg, exceptionType=None, exception=None, traceback=None, Raise=False):
		msg = self.createMessage(msg, exceptionType, exception, traceback);
		if controller != None:
			controller.update(None, msg);
		if exception != None:
			self.logger.error(msg);
		else:
			self.logger.info(msg);
			
		InterfaceProvider.getTerminalPrinter().print(msg);
		if Raise:
			if isinstance(msg, Exception):
				raise msg;
			raise Exception(msg);
コード例 #9
0
ファイル: handle_messages.py プロジェクト: openGDA/gda-core
def log(controller, msg, exceptionType=None, exception=None, traceback=None, Raise=False, logger=logger):
    msg = str(msg)
    msg = constructMessage(msg, exceptionType, exception, None)
    if controller:
        controller.update(None, msg);
    if logger:
        if exception:
            logger.error(constructMessage(msg, exceptionType, exception, traceback))
        else:
            logger.info(msg)
    InterfaceProvider.getTerminalPrinter().print(msg)
    if Raise:
        if isinstance(msg, Exception):
            raise msg
        raise Exception(msg)
コード例 #10
0
def createPVScannable( name, pv, addToNameSpace=True, hasUnits=True, getAsString=False):
    """
    utility function to create a scannable from a PV
    arguments:
    name - of scannable
    pv - pv 
    addToNameSpace = if True the scannable is accessible from the commandline after the call
    hasUnits - default True. The value is a number  and support is given for setUserUnits
    getAsString - default False. Useful if the PV is an enum as it returns the string representation. 
                 If true also set hasUnits to False 
    
    e.g.
    createPVScannable("acoll_average_size", "BL13J-OP-ACOLL-01:AVERAGESIZE", True)
    """
    sc = EpicsScannable()
    sc.setName(name)
    sc.setPvName(pv)
    sc.setUseNameAsInputName(True)
    sc.setHasUnits(hasUnits)
    sc.setGetAsString(getAsString)
    sc.afterPropertiesSet()
    sc.configure()
    if addToNameSpace:
        commandServer = InterfaceProvider.getJythonNamespace()    
        commandServer.placeInJythonNamespace(name,sc)
    return sc
コード例 #11
0
 def doCalibration(self, calibrant='Si', calibrant_x=0, calibrant_y=0, calibrant_exposure=1.0):
     if self.calibration_required:
         mycalibrant=Finder.getInstance().find("calibrant_name")
         mycalibrant.moveTo(calibrant)
         
         dummyScannable=DummyScannable("dummyScannable")
         
         #additional_plugin_list = pixium.getAdditionalPluginList()[0]
         #Detector calibration
         if self.calibration_required:
             self.stage_x.moveTo(calibrant_x)
             self.stage_y.moveTo(calibrant_y)
             scan([dummyScannable, 1, 1, 1, self.pixium, calibrant_exposure])
             #TODO GDA .nxs file, not EPICS h5 file
             scan_data_point_provider = InterfaceProvider.getScanDataPointProvider()
             self.calibrant_file_name = scan_data_point_provider.getLastScanDataPoint().getCurrentFilename()
             #calibrant_file_name = additional_plugin_list.getFullFileName()
             #do detector calibration on cluster serevrs
             builder = OSCommandRunnerBuilder.defaults()
             builder=builder.command([LocalProperties.get("org.opengda.lde.pixium.data.reduction.script","/dls_sw/apps/i11-scripts/bin/LDE-RunFromGDAAtEndOfScan.sh")])
             builder=builder.keepOutput(True)
             builder = builder.inputFilename(self.calibrant_file_name)
             builder = builder.outputFilename(os.path.splitext(self.calibrant_file_name)[0]+"_output.log")
             builder=builder.noTimeout()
             builder.build()
             self.calibration_required=False
コード例 #12
0
def lastscan(extension="tmp"):
    nt = NumTracker(extension)
    lastSRSFileName = InterfaceProvider.getPathConstructor(
    ).createFromDefaultProperty() + File.separator + str(
        nt.getCurrentFileNumber()) + ".dat"
    del nt
    return lastSRSFileName
コード例 #13
0
    def setFile(self, subDir=None, newFilePrefix=None):
        """Set file path and name"""
        if subDir is not None:
            self.subDir = str(subDir)
        if newFilePrefix is not None:
            self.filePrefix = str(newFilePrefix)

        pilatusDataDir = InterfaceProvider.getPathConstructor(
        ).createFromDefaultProperty()

        fullPath = os.path.join(pilatusDataDir, self.subDir)

        if not os.path.exists(fullPath):
            print "Warning: Pilatus image path does not exist. Create new"
            print "OS Command: " + "umask 0002; mkdir -p " + fullPath
            os.system("umask 0002; mkdir -p " + fullPath)

#		Check the new path created.
        if not os.path.exists(fullPath):
            print "Error: Pilatus image path does not exist and can not be created"
            return

        print "Note: Current Pilatus image path: " + fullPath
        self.detector.getNdFile().setFilePath(fullPath)
        self.detector.getNdFile().setFileName(self.filePrefix)
コード例 #14
0
def createPVScannable(name,
                      pv,
                      addToNameSpace=True,
                      hasUnits=True,
                      getAsString=False):
    """
    utility function to create a scannable from a PV
    arguments:
    name - of scannable
    pv - pv 
    addToNameSpace = if True the scannable is accessible from the commandline after the call
    hasUnits - default True. The value is a number  and support is given for setUserUnits
    getAsString - default False. Useful if the PV is an enum as it returns the string representation. 
                 If true also set hasUnits to False 
    
    e.g.
    createPVScannable("acoll_average_size", "BL13J-OP-ACOLL-01:AVERAGESIZE", True)
    """
    sc = EpicsScannable()
    sc.setName(name)
    sc.setPvName(pv)
    sc.setUseNameAsInputName(True)
    sc.setHasUnits(hasUnits)
    sc.setGetAsString(getAsString)
    sc.afterPropertiesSet()
    sc.configure()
    if addToNameSpace:
        commandServer = InterfaceProvider.getJythonNamespace()
        commandServer.placeInJythonNamespace(name, sc)
    return sc
コード例 #15
0
    def setTerminalLogger(self, newLoggerName="gda_terminal.log"):
        tlPath = InterfaceProvider.getPathConstructor(
        ).createFromDefaultProperty()

        tlFile = os.path.join(tlPath, newLoggerName)
        tlpp = Finder.find("terminallog_path_provider")
        tlpp.setTemplate(str(tlFile))
コード例 #16
0
    def saveSRSData(self, energy, pol, fileList):
        srsHeader=[" &SRS\n", " SRSRUN=null,SRSDAT=null,SRSTIM=null,\n", " SRSSTN='null',SRSPRJ='null    ',SRSEXP='null    ',\n", " SRSTLE='                                                            ',\n", " SRSCN1='        ',SRSCN2='        ',SRSCN3='        ',\n", " &END\n"];

        try:
            runs=NumTracker("tmp")
            currentNum = runs.getCurrentFileNumber()
            #currentNum = runs.incrementNumber()
            path = InterfaceProvider.getPathConstructor().createFromProperty("gda.data.scan.datawriter.datadir")
            fileName = path + "/" + str(currentNum) + ".dat"
#            print fileName
            fh=open(fileName, 'w');

            #SRS Header
            for i in range(len(srsHeader)):
                fh.write(srsHeader[i]);

            titleLine='%(v1)s \t %(v2)s \t %(v3)s \n' %{'v1': self.energyDevice.getName(), 'v2': self.polarisationDevice.getName(), 'v3': self.detector.getName()};
            fh.write(titleLine);
            
            nf=len(fileList);
            for n in range(nf):
                #print i, arrayEnergyPGM[i], arrayEnergyIDGAP[i], arrayChannel01[i], arrayChannel02[i], arrayChannel03[i], arrayChannel04[i];
                newLine='%(v1).8f \t %(v2)s \t %(v3)s \n' %{'v1': energy[n], 'v2': pol[n], 'v3': fileList[n]};
                fh.write(newLine);
            fh.close();
            print "Scan complete. File saved in " + fileName;
        except:
            print "ERROR: Could not save data into file."
コード例 #17
0
    def setNewImagePath(self):
        """Set file path and name based on current scan run number"""
        next_num = NumTracker("tmp").getCurrentFileNumber()

        base_path = InterfaceProvider.getPathConstructor(
        ).createFromDefaultProperty() + File.separator
        sub_dir = "%d_%s" % (next_num, self.pathPostfix)
        new_image_path = os.path.join(base_path, sub_dir)

        if not os.path.exists(new_image_path):
            #print("Path does not exist. Create new one.")
            os.makedirs(new_image_path)
            self.resetImageNumber()

        if not os.path.isdir(new_image_path):
            print("Invalid path")
            return

        self.filePath = new_image_path
        #print("Image file path set to " + self.filePath)

        nd_file = self.detector.getNdFile()
        nd_file.setFilePath(self.filePath)
        nd_file.setFileName(self.filePrefix)
        nd_file.setFileTemplate(self.fileFormat)

        nd_file.setAutoIncrement(True)
        nd_file.setAutoSave(True)
        nd_file.setFileFormat(0)
        #Magic file format depending on the file extension
        return self.filePath
コード例 #18
0
    def saveSRSData(self, numberOfPoints):
        srsHeader = [
            " &SRS\n", " SRSRUN=null,SRSDAT=null,SRSTIM=null,\n",
            " SRSSTN='null',SRSPRJ='null    ',SRSEXP='null    ',\n",
            " SRSTLE='                                                            ',\n",
            " SRSCN1='        ',SRSCN2='        ',SRSCN3='        ',\n",
            " &END\n"
        ]

        try:
            runs = NumTracker("tmp")
            nextNum = runs.getCurrentFileNumber()
            #nextNum = runs.incrementNumber()
            path = InterfaceProvider.getPathConstructor().createFromProperty(
                "gda.data.scan.datawriter.datadir")
            fileName = path + "/" + str(nextNum + 1) + ".dat"
            print fileName
            fh = open(fileName, 'w')

            #SRS Header
            for i in range(len(srsHeader)):
                fh.write(srsHeader[i])

            titleLine = '%(v1)s \t %(v2)s \t %(v3)s \t %(v4)s \t %(v5)s \t %(v6)s \n' % {
                'v1': 'PGM Energy',
                'v2': 'ID GAP Energy',
                'v3': 'Channel 1',
                'v4': 'Channel 2',
                'v5': 'Channel 3',
                'v6': 'Channel 4'
            }
            fh.write(titleLine)

            arrayEnergyPGM = self.energyPGM.cagetArrayDouble()
            arrayEnergyIDGAP = self.energyIDGAP.cagetArrayDouble()
            arrayChannel01 = self.channel01.cagetArrayDouble()
            arrayChannel02 = self.channel02.cagetArrayDouble()
            arrayChannel03 = self.channel03.cagetArrayDouble()
            arrayChannel04 = self.channel04.cagetArrayDouble()

            for i in range(numberOfPoints):
                if arrayEnergyPGM[i] < self.se:
                    continue
                if arrayEnergyPGM[i] > self.ee:
                    continue
                #print i, arrayEnergyPGM[i], arrayEnergyIDGAP[i], arrayChannel01[i], arrayChannel02[i], arrayChannel03[i], arrayChannel04[i];
                newLine = '%(v1).8f \t %(v2).8f \t %(v3).8f \t %(v4).8f \t %(v5).8f \t %(v6).8f \n' % {
                    'v1': arrayEnergyPGM[i],
                    'v2': arrayEnergyIDGAP[i],
                    'v3': arrayChannel01[i],
                    'v4': arrayChannel02[i],
                    'v5': arrayChannel03[i],
                    'v6': arrayChannel04[i]
                }
                fh.write(newLine)
            fh.close()
            runs.incrementNumber()
        except:
            print "ERROR: Could not save data into file."
コード例 #19
0
 def checkPath(self):
     #			self.subDir=str(subDir);
     #			self.filePrefix = str(newFilePrefix);
     imagePath = InterfaceProvider.getPathConstructor(
     ).createFromDefaultProperty()
     fullPath = os.path.join(imagePath, self.subDir)
     if fullPath != self.getFilePath():
         self.setFile()
     return
コード例 #20
0
 def writeDataToFile(self, data=[]):
     filenumber = NumTracker("i10").getCurrentFileNumber();
     waveformfilename=str(InterfaceProvider.getPathConstructor().createFromDefaultProperty())+"/"+ str("i10-")+str(filenumber)+"-"+str(self.getName())+"_"+str(self.pointNumber)+".dat"
     print waveformfilename
     datafile=open(waveformfilename, 'w')
     for value in data:
         datafile.write(str(value)+'\n')
     datafile.flush()
     datafile.close()
     return waveformfilename
コード例 #21
0
def analyserpathscan(scannables, path, *args):
    '''
    perform single/multiple regions analyser data collection at each point on the specified path,
    and produce a single scan file recording all scannables' poistions and metadata, along with
    analyser scann data under region's name as NXdetector node.
    
    implementation details:
    This function pre-process sequence file to set up analyser 'ew4000' ready for data collection, 
    then delegate the scan process to 'pathscan'.    
    '''
    starttime = time.ctime()
    if PRINTTIME: print "=== Scan started: " + starttime
    newargs = []
    i = 0
    while i < len(args):
        arg = args[i]
        newargs.append(arg)
        i = i + 1
        if isinstance(arg, EW4000):
            controller = Finder.find("SequenceFileObserver")
            xmldir = InterfaceProvider.getPathConstructor(
            ).createFromDefaultProperty() + "xml" + os.sep
            filename = xmldir + args[i]
            if (OsUtil.isWindows()):
                FilenameUtil.setPrefix("D:")
                filename = FilenameUtil.convertSeparator(filename)
            controller.update(controller, SequenceFileChangeEvent(filename))
            sleep(2.0)
            jythonServerStatus = InterfaceProvider.getJythonServerStatusProvider(
            ).getJythonServerStatus()
            while (jythonServerStatus.isScriptOrScanPaused()):
                sleep(1.0)
            arg.setSequenceFilename(filename)
            sequence = arg.loadSequenceData(filename)
            if isinstance(arg.getCollectionStrategy(),
                          EW4000CollectionStrategy):
                arg.getCollectionStrategy().setSequence(sequence)
            i = i + 1
    pathscan(scannables, path, newargs)
    if PRINTTIME:
        print("=== Scan ended: " + time.ctime() +
              ". Elapsed time: %.0f seconds" % (time.time() - starttime))
コード例 #22
0
def getSrsFileName(scanNumber=None):
    if scanNumber is None:
        sn = getScanNumber()
    else:
        sn = scanNumber
    srsPath = InterfaceProvider.getPathConstructor().createFromProperty(
        "gda.data.scan.datawriter.datadir")
    srsFileName = srsPath + File.separator + str(sn) + ".dat"

    print "srs file name is: " + srsFileName
    return srsFileName
コード例 #23
0
 def _write_saveinfo_file(self):
     if DEBUG:
         print "writing saveinfo file for directory:", self._get_target_directory(
         )
     saveinfofilepath = os.path.join(PARAMETER_FILES_PATH, "saveinfo.txt")
     saveinfofile = open(saveinfofilepath, mode='w')
     paths = "Z:" + InterfaceProvider.getPathConstructor(
     ).createFromDefaultProperty()[10:]
     savepath = os.path.join(paths,
                             "%05i-%s-files" % (self.scannumber, self.name))
     saveinfofile.write(savepath + "/\r\n%05d" % self._next_image_number)
     saveinfofile.close()
コード例 #24
0
 def incrementFilename(self):
     self.fileno = self.runs.getCurrentFileNumber() + 1
     self.runs.incrementNumber()
     self.datadir = InterfaceProvider.getPathConstructor(
     ).createFromProperty("gda.data.scan.datawriter.datadir")
     self.datafilename = self.datadir + '/' + str(self.fileno) + self.runext
     self.mcadir = self.datadir + '/mca/' + str(self.fileno) + '/'
     self.mcarootname = self.mcadir + str(self.fileno)
     if not os.path.isdir(self.mcadir):
         os.mkdir(self.mcadir)
     self.tag = 1
     self.interrupted = Boolean(0)
コード例 #25
0
def log(controller,
        msg,
        exceptionType=None,
        exception=None,
        traceback=None,
        Raise=False,
        logger=logger):
    msg = str(msg)
    msg = constructMessage(msg, exceptionType, exception, None)
    if controller:
        controller.update(None, msg)
    if logger:
        if exception:
            logger.error(
                constructMessage(msg, exceptionType, exception, traceback))
        else:
            logger.info(msg)
    InterfaceProvider.getTerminalPrinter().print(msg)
    if Raise:
        if isinstance(msg, Exception):
            raise msg
        raise Exception(msg)
コード例 #26
0
def getDir(proposal=None, visit=1):

    if proposal is None:  # the default commissioning proposal
        userDir = InterfaceProvider.getPathConstructor(
        ).createFromDefaultProperty() + File.separator
        print "Current User Data Directory: " + userDir
    else:
        #	get current Year
        currentTime = localtime()
        currentYear = currentTime[0]
        userDir = +proposal + "-" + str(visit)
        userDir = "/dls/" + beamlineName + "/data/" + str(
            currentYear) + "/" + proposal + "-" + str(visit)
        print userDir + " should the user data directory for this proposal and visit."
コード例 #27
0
    def prepareForCollection(self):
        self._next_image_number = 1
        self.scannumber = InterfaceProvider.getCurrentScanInformationHolder(
        ).getCurrentScanInformation().getScanNumber()

        # Create folder for scannumber '12345-' + name + '-files'
        self._write_commands_file(self.getCollectionTime())
        self._write_background_file(self.background)
        self._write_saveinfo_file()

        target_dir = self._get_target_directory()
        if not os.path.exists(target_dir):
            os.makedirs(target_dir)
        time.sleep(5)
コード例 #28
0
ファイル: BSSC.py プロジェクト: openGDA/gda-scm
    def exportFinalBeans(self):
        """The samples are updated to include the datafile paths

        export readonly version of .biosaxs file to keep record of experiment"""
        fname = self.beanFile.split(os.path.sep)[-1].rsplit('.', 1)[0]
        now = datetime.datetime.now().strftime('_%Y%m%d_%H%M%S')

        user_visit = InterfaceProvider.getBatonStateProvider().getBatonHolder().getVisitID()
        prop = PathConstructor.getDefaultPropertyName()
        path = PathConstructor.createFromProperty(prop, HashMap({'visit': user_visit}))

        full_path = os.path.join(path, fname + now + '.biosaxs')
        BSSCSessionBean.writeToXML(self.bean, full_path)
        os.chmod(full_path, 0444)
コード例 #29
0
    def getSrsFileName(self, scanNumber=None, srsPath=None):
        if scanNumber is None:
            nt = NumTracker("tmp")
            sn = nt.getCurrentFileNumber()
        else:
            sn = scanNumber

        if srsPath is None:
            srsPath = InterfaceProvider.getPathConstructor(
            ).createFromProperty("gda.data.scan.datawriter.datadir")

        srsFileName = srsPath + File.separator + str(sn) + ".dat"

        #		print "srs file name is: " + srsFileName;
        return srsFileName
コード例 #30
0
    def exportFinalBeans(self):
        """The samples are updated to include the datafile paths

        export readonly version of .biosaxs file to keep record of experiment"""
        fname = self.beanFile.split(os.path.sep)[-1].rsplit('.', 1)[0]
        now = datetime.datetime.now().strftime('_%Y%m%d_%H%M%S')

        user_visit = InterfaceProvider.getBatonStateProvider().getBatonHolder(
        ).getVisitID()
        prop = PathConstructor.getDefaultPropertyName()
        path = PathConstructor.createFromProperty(
            prop, HashMap({'visit': user_visit}))

        full_path = os.path.join(path, fname + now + '.biosaxs')
        BSSCSessionBean.writeToXML(self.bean, full_path)
        os.chmod(full_path, 0444)
コード例 #31
0
    def setFile(self, subDir=None, newFilePrefix=None):
        """Set file path and name"""
        if subDir is not None:
            self.subDir = str(subDir)
        if newFilePrefix is not None:
            self.filePrefix = str(newFilePrefix)

#		imagePath = InterfaceProvider.getPathConstructor().createFromProperty("gda.data.scan.datawriter.datadir");
#		imagePath=InterfaceProvider.getPathConstructor().createFromDefaultProperty() + File.separator;
        imagePath = InterfaceProvider.getPathConstructor(
        ).createFromDefaultProperty()

        fullPath = os.path.join(imagePath, self.subDir)
        print "Image path for %s is set to %s." % (self.getName(), fullPath)

        self.imageProducer.setFilePath(fullPath)
        self.imageProducer.setFilePrefix(self.filePrefix)
コード例 #32
0
def ls_pv_scannables(PV=""):
    """
    Function to list Scannables associated with EPICs PVs, the PV and the associated DESC field
    Usage:
        >ls_pv_scannables()
    
    or
    
        >ls_pv_scannables(<PV>)
    """
    from gda.device.scannable import ScannableMotor
    from gda.device.motor import EpicsMotor
    scannableConnectedToPV = None
    a = InterfaceProvider.getJythonNamespace().getNamesForAllObjectsOfType(
        Findable)
    l = filter(
        lambda x: isinstance(x, EpicsScannable) or
        (isinstance(x, ScannableMotor) and isinstance(x.motor, EpicsMotor)),
        a.values().toArray())
    for x in l:
        description = "unknown"
        pvName = "unknown"
        if isinstance(x, EpicsScannable):
            pvName = x.pvName
        if isinstance(x, ScannableMotor) and isinstance(x.motor, EpicsMotor):
            pvName = x.motor.pvName

        if PV != "":
            if PV.upper() == pvName.upper():
                scannableConnectedToPV = x
                break
        else:
            if x.configured:
                try:
                    description = caget(pvName + ".DESC")
                except:
                    description = "Unable to read description"
                    pass
            else:
                description = "Not configured!"
            print x.name, pvName, description

    if PV != "":
        if scannableConnectedToPV is None:
            print "No scannable found for PV " + PV
        print "Scannable " + x.name + " is connected to ", PV
コード例 #33
0
	def setFile(self, subDir, newFilePrefix):
		"""Set file path and name"""
#		imagePath = InterfaceProvider.getPathConstructor().createFromProperty("gda.data.scan.datawriter.datadir");
		imagePath=InterfaceProvider.getPathConstructor().createFromDefaultProperty() + File.separator;
		newFilePath = os.path.join(imagePath, subDir);

		if not os.path.exists(newFilePath):
			print "Path does not exist. Create new one."
			os.makedirs(newFilePath);
			
		if not os.path.isdir(newFilePath):
			print "Invalid path";
			return;
				
		self.filePath = newFilePath;
		self.filePrefix = newFilePrefix
		print "Image file path set to " + self.filePath;
コード例 #34
0
def createScannableFromPV( name, pv, addToNameSpace=True, getAsString=True, hasUnits=False):
    """
    Description:
        utility function to create a scannable from a given PV
    Arguments:
        name - user-specified name of a scannable to be created, e.g. pixium10_DataType
        pv - EPICS identifier of pv to be used by the scannable, e.g. BL12I-EA-DET-10:CAM:DataType
        addToNameSpace = if True, the scannable is accessible from the commandline after the call
        getAsString - If True, output value is a string (useful for enum pv, in which case set getAsString=True, and set hasUnits=False)
        hasUnits - If False, output value is not converted to units - useful for enum pv with getAsString=True
    
    For example,
        createScannableFromPV("pixium10_DataType", "BL12I-EA-DET-10:CAM:DataType", True, True, False)
    creates a scannable for pv with the following enums:
    caget -d 31 BL12I-EA-DET-10:CAM:DataType
        BL12I-EA-DET-10:CAM:DataType
        Native data type: DBF_ENUM
        Request type:     DBR_CTRL_ENUM
        Element count:    1
        Value:            UInt32
        Status:           NO_ALARM
        Severity:         NO_ALARM
        Enums:            ( 8)
                          [ 0] Int8
                          [ 1] UInt8
                          [ 2] Int16
                          [ 3] UInt16
                          [ 4] Int32
                          [ 5] UInt32
                          [ 6] Float32
                          [ 7] Float64
    """
    sc = EpicsScannable()
    sc.setName(name)
    sc.setPvName(pv)
    sc.setUseNameAsInputName(True)
    sc.setGetAsString(getAsString)
    sc.setHasUnits(hasUnits)
    sc.afterPropertiesSet()
    sc.configure()
    if addToNameSpace:
        commandServer = InterfaceProvider.getJythonNamespace()
        commandServer.placeInJythonNamespace(name,sc)
    return sc
コード例 #35
0
    def __init__(self, detectorList=None):
        # EXAFS PANEL CODE
        self.scannableNamesVector = Vector()
        self.scannableNamesVector.add("dcm_mono")
        self.detectorNamesVector = Vector()
        self.detectorNamesVector.add("counterTimer01")
        self.detectorNamesVector.add("counterTimer02")
        self.controller = Finder.find("ExafsController")
        self.mcontroller = Finder.find("MicroFocusController")
        self.title = "TITLE"
        self.condition1 = "CONDITION1"
        self.condition2 = "CONDITION2"
        self.condition3 = "CONDITION3"
        # Script code
        self.das = Finder.find("daserver")
        self.ionchambers = SlaveCounterTimer()
        self.converter = Finder.find("auto_mDeg_idGap_mm_converter")
        self.windowValues = [[0, 4095]] * 9
        self.windowName = 'ALL'
        self.ionchamberData = []
        self.mcaList = []
        self.scalarList = []
        self.runs = NumTracker("tmp")
        self.runprefix = 'i18exafs'
        self.runext = '.dat'
        self.fileno = self.runs.getCurrentFileNumber() + 1
        self.runs.incrementNumber()
        self.datadir = InterfaceProvider.getPathConstructor(
        ).createFromProperty("gda.data.scan.datawriter.datadir")
        self.datafilename = self.datadir + '/' + str(self.fileno) + self.runext
        if (detectorList != None):
            self.detectorMask = detectorList
        else:
            self.detectorMask = [1, 1, 1, 1, 1, 1, 1, 1, 1]

        self.mcadir = self.datadir + '/mca/' + str(self.fileno) + '/'
        self.mcarootname = self.mcadir + str(self.fileno)
        if not os.path.isdir(self.mcadir):
            os.mkdir(self.mcadir)
        self.tag = 1
        self.facade = JythonServerFacade.getInstance()
        self.scanList = []
        self.noOfRepeats = 1
        self.noOfPoints = 0
コード例 #36
0
def ls_pv_scannables( PV=""):
    """
    Function to list Scannables associated with EPICs PVs, the PV and the associated DESC field
    Usage:
        >ls_pv_scannables()
    
    or
    
        >ls_pv_scannables(<PV>)
    """
    from gda.device.scannable import ScannableMotor
    from gda.device.motor import EpicsMotor
    scannableConnectedToPV=None
    a=InterfaceProvider.getJythonNamespace().getAllFromJythonNamespace()
    l=filter(lambda x: isinstance(x, EpicsScannable) or (isinstance(x, ScannableMotor) and isinstance(x.motor, EpicsMotor)), a.values().toArray())
    for x in l:
        description="unknown"
        pvName ="unknown"
        if isinstance(x, EpicsScannable):
            pvName=x.pvName
        if isinstance(x, ScannableMotor) and isinstance(x.motor, EpicsMotor):
            pvName=x.motor.pvName
            
        if PV != "":
            if PV.upper() == pvName.upper():
                scannableConnectedToPV=x
                break
        else:
            if x.configured:
                try:
                    description = caget(pvName + ".DESC")
                except:
                    description = "Unable to read description"
                    pass
            else:
                description = "Not configured!"
            print x.name, pvName, description

    if PV != "":
        if scannableConnectedToPV is None:
            print "No scannable found for PV " + PV
        print "Scannable " + x.name  + " is connected to ", PV
コード例 #37
0
 def doSampleDataCollection(self, sample_x_start=None, sample_x_stop=None, sample_x_step=None, sample_y_start=None, sample_y_stop=None, sample_y_step=None, sample_exposure=1.0):
     # sample diffraction data
     args=[]
     
     if sample_x_start is not None or sample_x_stop is not None or sample_x_step is not None:
         args.append(self.stage_x)
     if sample_y_start is not None:
         args.append(sample_x_start)
     if sample_y_stop is not None:
         args.append(sample_x_stop)
     if sample_y_step is not None:
         args.append(sample_x_step)
     
     if sample_y_start is not None or sample_y_stop is not None or sample_y_step is not None:
         args.append(self.stage_y)
     if sample_y_start is not None:
         args.append(sample_y_start)
     if sample_y_stop is not None:
         args.append(sample_y_stop)
     if sample_y_step is not None:
         args.append(sample_y_step)
     if args.count!=0:
         args.append(self.pixium)
         args.append(sample_exposure)
     scan(args)
     #sample_file_name = additional_plugin_list.getFullFileName()
     scan_data_point_provider = InterfaceProvider.getScanDataPointProvider()
     sample_file_name = scan_data_point_provider.getLastScanDataPoint().getCurrentFilename()
     #builder = OSCommandRunnerBuilder.defaults()
     builder = OSCommandRunnerBuilder.defaults()
     builder=builder.command([LocalProperties.get("org.opengda.lde.pixium.data.reduction.script","/dls_sw/apps/i11-scripts/bin/LDE-RunFromGDAAtEndOfScan.sh"),self.calibrant_file_name])
     builder=builder.keepOutput(True)
     builder = builder.inputFilename(sample_file_name)
     builder = builder.outputFilename(os.path.splitext(sample_file_name)[0]+"_output.log")
     builder=builder.noTimeout()
     builder.build()
コード例 #38
0
from gdascripts.analysis.datasetprocessor.oned.MaxPositionAndValue import MaxPositionAndValue
from gdascripts.analysis.datasetprocessor.oned.MinPositionAndValue import MinPositionAndValue
from gdascripts.analysis.datasetprocessor.oned.CentreOfMass import CentreOfMass
from gdascripts.analysis.datasetprocessor.oned.GaussianPeakAndBackground import  GaussianPeakAndBackground
from gdascripts.scan.process.ScanDataProcessor import ScanDataProcessor
from gdascripts.scan import specscans
from gdascripts.scan import gdascans

from gda.jython.commands.GeneralCommands import alias
from gda.jython import InterfaceProvider
from gda.scan import ScanDataPointCache

print "Setting up scan data point cache"
scanDataPointCache = ScanDataPointCache()
# Attach to JSF
InterfaceProvider.getScanDataPointProvider().addIScanDataPointObserver(scanDataPointCache)

print "Setting up scan data processor, scan_processor"
scan_processor = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue(), CentreOfMass(), GaussianPeakAndBackground() ], globals(), scanDataPointCache=scanDataPointCache)
go = scan_processor.go
alias("go")

print "Creating spec-like commands:"
ascan  = specscans.Ascan([scan_processor])
a2scan = specscans.A2scan([scan_processor])
a3scan = specscans.A3scan([scan_processor])
mesh   = specscans.Mesh([scan_processor])
dscan  = specscans.Dscan([scan_processor])
d2scan = specscans.D2scan([scan_processor])
d3scan = specscans.D3scan([scan_processor])
alias('ascan');print ascan.__doc__.split('\n')[3]
コード例 #39
0
ファイル: loghandling.py プロジェクト: openGDA/gda-core
 def __init__(self, level=logging.NOTSET):
     logging.Handler.__init__(self, level)
     self._printer = InterfaceProvider.getTerminalPrinter()
コード例 #40
0
def isScanRunning():
	return InterfaceProvider.getScanStatusHolder().getScanStatus() != JythonStatus.IDLE
コード例 #41
0
def tomoScan(
    description,
    inBeamPosition,
    outOfBeamPosition,
    exposureTime=1.0,
    start=0.0,
    stop=180.0,
    step=0.1,
    darkFieldInterval=0,
    flatFieldInterval=0,
    imagesPerDark=10,
    imagesPerFlat=10,
    optimizeBeamInterval=0,
    pattern="default",
    tomoRotationAxis=0,
    addNXEntry=True,
    autoAnalyse=True,
    additionalScannables=[],
):
    """
    Function to collect a tomography step scan
    Arguments:
    description - description of the scan or the sample that is being scanned. This is generally user-specific information that may be used to map to this scan later and is available in the NeXus file)
    inBeamPosition - position of X drive to move sample into the beam to take a projection
    outOfBeamPosition - position of X drive to move sample out of the beam to take a flat field image
    exposureTime - exposure time in seconds (default=1.0)
    start - first rotation angle (default=0.0)
    stop  - last rotation angle (default=180.0)
    step - rotation step size (default=0.1)
    darkFieldInterval - number of projections between each dark-field sub-sequence. 
        NOTE: at least 1 dark is ALWAYS taken both at the start and end of the scan provided imagesPerDark>0 
        (default=0: use this value if you DON'T want to take any darks between projections)
    flatFieldInterval - number of projections between each flat-field sub-sequence. 
        NOTE: at least 1 flat is ALWAYS taken both at the start and end the scan provided imagesPerFlat>0 
        (default=0: use this value if you DON'T want to take any flats between projections)
    imagesPerDark - number of images to be taken for each dark-field sub-sequence (default=10)
    imagesPerFlat - number of images to be taken for each flat-field sub-sequence (default=10)
    
    General scan sequence is: D, F, P,..., P, F, D
    where D stands for dark field, F - for flat field, and P - for projection.
    """
    dataFormat = LocalProperties.get("gda.data.scan.datawriter.dataFormat")
    try:
        darkFieldInterval = int(darkFieldInterval)
        flatFieldInterval = int(flatFieldInterval)
        optimizeBeamInterval = int(optimizeBeamInterval)

        jns = beamline_parameters.JythonNameSpaceMapping(InterfaceProvider.getJythonNamespace())
        tomography_theta = jns.tomography_theta
        if tomography_theta is None:
            raise "tomography_theta is not defined in Jython namespace"
        tomography_shutter = jns.tomography_shutter
        if tomography_shutter is None:
            raise "tomography_shutter is not defined in Jython namespace"
        tomography_translation = jns.tomography_translation
        if tomography_translation is None:
            raise "tomography_translation is not defined in Jython namespace"

        tomography_detector = jns.tomography_detector
        if tomography_detector is None:
            raise "tomography_detector is not defined in Jython namespace"

        tomography_optimizer = jns.tomography_optimizer
        if tomography_optimizer is None:
            raise "tomography_optimizer is not defined in Jython namespace"

        tomography_time = jns.tomography_time
        if tomography_time is None:
            raise "tomography_time is not defined in Jython namespace"

        tomography_beammonitor = jns.tomography_beammonitor
        if tomography_beammonitor is None:
            raise "tomography_beammonitor is not defined in Jython namespace"

        tomography_camera_stage = jns.tomography_camera_stage
        if tomography_camera_stage is None:
            raise "tomography_camera_stage is not defined in Jython namespace"

        tomography_sample_stage = jns.tomography_sample_stage
        if tomography_sample_stage is None:
            raise "tomography_sample_stage is not defined in Jython namespace"

        tomo_additional_scannables = jns.tomography_additional_scannables
        if tomo_additional_scannables is None:
            raise "tomo_additional_scannables is not defined in Jython namespace"

        index = SimpleScannable()
        index.setCurrentPosition(0.0)
        index.setInputNames(["imageNumber"])
        index.setName("imageNumber")
        index.configure()

        image_key = SimpleScannable()
        image_key.setCurrentPosition(0.0)
        image_key.setInputNames(["image_key"])
        image_key.setName("image_key")
        image_key.configure()

        tomoScanDevice = make_tomoScanDevice(
            tomography_theta, tomography_shutter, tomography_translation, tomography_optimizer, image_key, index
        )

        #        return tomoScanDevice
        # generate list of positions
        numberSteps = ScannableUtils.getNumberSteps(tomography_theta, start, stop, step)
        theta_points = []
        theta_points.append(start)
        previousPoint = start
        for i in range(numberSteps):
            nextPoint = ScannableUtils.calculateNextPoint(previousPoint, step)
            theta_points.append(nextPoint)
            previousPoint = nextPoint

        # generateScanPoints
        optimizeBeamNo = 0
        optimizeBeamYes = 1
        shutterOpen = 1
        shutterClosed = 0
        shutterNoChange = 2
        scan_points = []
        theta_pos = theta_points[0]
        index = 0
        # Added shutterNoChange state for the shutter. The scan points are added using the (pseudo) ternary operator,
        # if index is 0 then the shutterPosition is added to the scan point, else shutterNoChange is added to scan points.
        for i in range(imagesPerDark):
            scan_points.append(
                (
                    theta_pos,
                    [shutterClosed, shutterNoChange][i != 0],
                    inBeamPosition,
                    optimizeBeamNo,
                    image_key_dark,
                    index,
                )
            )  # dark
            index = index + 1

        for i in range(imagesPerFlat):
            scan_points.append(
                (
                    theta_pos,
                    [shutterOpen, shutterNoChange][i != 0],
                    outOfBeamPosition,
                    optimizeBeamNo,
                    image_key_flat,
                    index,
                )
            )  # flat
            index = index + 1
        scan_points.append((theta_pos, shutterOpen, inBeamPosition, optimizeBeamNo, image_key_project, index))  # first
        index = index + 1
        imageSinceDark = 1
        imageSinceFlat = 1
        optimizeBeam = 0
        for i in range(numberSteps):
            theta_pos = theta_points[i + 1]
            scan_points.append(
                (
                    theta_pos,
                    [shutterOpen, shutterNoChange][i != 0],
                    inBeamPosition,
                    optimizeBeamNo,
                    image_key_project,
                    index,
                )
            )  # main image
            index = index + 1

            imageSinceFlat = imageSinceFlat + 1
            if imageSinceFlat == flatFieldInterval and flatFieldInterval != 0:
                for i in range(imagesPerFlat):
                    scan_points.append(
                        (
                            theta_pos,
                            [shutterOpen, shutterNoChange][i != 0],
                            outOfBeamPosition,
                            optimizeBeamNo,
                            image_key_flat,
                            index,
                        )
                    )
                    index = index + 1
                    imageSinceFlat = 0

            imageSinceDark = imageSinceDark + 1
            if imageSinceDark == darkFieldInterval and darkFieldInterval != 0:
                for i in range(imagesPerDark):
                    scan_points.append(
                        (
                            theta_pos,
                            [shutterClosed, shutterNoChange][i != 0],
                            inBeamPosition,
                            optimizeBeamNo,
                            image_key_dark,
                            index,
                        )
                    )
                    index = index + 1
                    imageSinceDark = 0

            optimizeBeam = optimizeBeam + 1
            if optimizeBeam == optimizeBeamInterval and optimizeBeamInterval != 0:
                scan_points.append(
                    (
                        theta_pos,
                        [shutterOpen, shutterNoChange][i != 0],
                        inBeamPosition,
                        optimizeBeamYes,
                        image_key_project,
                        index,
                    )
                )
                index = index + 1
                optimizeBeam = 0

        # add dark and flat only if not done in last steps
        if imageSinceFlat != 0:
            for i in range(imagesPerFlat):
                scan_points.append(
                    (
                        theta_pos,
                        [shutterOpen, shutterNoChange][i != 0],
                        outOfBeamPosition,
                        optimizeBeamNo,
                        image_key_flat,
                        index,
                    )
                )  # flat
                index = index + 1
        if imageSinceDark != 0:
            for i in range(imagesPerDark):
                scan_points.append(
                    (
                        theta_pos,
                        [shutterClosed, shutterNoChange][i != 0],
                        inBeamPosition,
                        optimizeBeamNo,
                        image_key_dark,
                        index,
                    )
                )  # dark
                index = index + 1
        scan_points1 = generateScanPoints(
            inBeamPosition,
            outOfBeamPosition,
            theta_points,
            darkFieldInterval,
            flatFieldInterval,
            imagesPerDark,
            imagesPerFlat,
            optimizeBeamInterval,
            pattern=pattern,
        )
        if pattern == "default" or pattern == "DFPFD":
            i = 0
            for pt1 in scan_points1:
                pt = scan_points[i]
                if pt1 != pt:
                    print "Mismatch - please tell Kaz about your scan and its arguments!"
                    print "i = ", i
                    print "pt = ", pt
                    print "pt1 = ", pt1
                i += 1
        # return None
        positionProvider = tomoScan_positions(
            start,
            stop,
            step,
            darkFieldInterval,
            imagesPerDark,
            flatFieldInterval,
            imagesPerFlat,
            inBeamPosition,
            outOfBeamPosition,
            optimizeBeamInterval,
            scan_points,
        )
        scan_args = [
            tomoScanDevice,
            positionProvider,
            tomography_time,
            tomography_beammonitor,
            tomography_detector,
            exposureTime,
            tomography_camera_stage,
            tomography_sample_stage,
        ]
        # scan_args.append(RotationAxisScannable("approxCOR", tomoRotationAxis))
        # meta_add(RotationAxisScannable("approxCOR", tomoRotationAxis))
        # meta_add("RotationCoord_as_list", [tomoRotationAxis])
        meta_add("approxCOR", tomoRotationAxis)
        for scannable in additionalScannables:
            scan_args.append(scannable)
        for scannable in tomo_additional_scannables:
            scan_args.append(scannable)
        """ setting the description provided as the title"""
        if not description == None:
            setTitle(description)
        else:
            setTitle("undefined")

        dataFormat = LocalProperties.get("gda.data.scan.datawriter.dataFormat")
        if not dataFormat == "NexusDataWriter":
            handle_messages.simpleLog(
                "Data format inconsistent. Setting 'gda.data.scan.datawriter.dataFormat' to 'NexusDataWriter'"
            )
            LocalProperties.set("gda.data.scan.datawriter.dataFormat", "NexusDataWriter")
        scanObject = createConcurrentScan(scan_args)
        if addNXEntry:
            addNXTomoSubentry(scanObject, tomography_detector.name, tomography_theta.name)
        scanObject.runScan()
        if autoAnalyse:
            lsdp = jns.lastScanDataPoint()
            OSCommandRunner.runNoWait(
                ["/dls_sw/apps/tomopy/tomopy/bin/gda/tomo_at_scan_end", lsdp.currentFilename],
                OSCommandRunner.LOGOPTION.ALWAYS,
                None,
            )
        return scanObject
    except InterruptedException:
        exceptionType, exception, traceback = sys.exc_info()
        handle_messages.log(None, "User interrupted the scan", exceptionType, exception, traceback, False)
        raise InterruptedException("User interrupted the scan")
    except:
        exceptionType, exception, traceback = sys.exc_info()
        handle_messages.log(None, "Error during tomography scan", exceptionType, exception, traceback, False)
        raise Exception("Error during tomography scan", exception)
    finally:
        handle_messages.simpleLog("Data Format reset to the original setting: " + dataFormat)
        LocalProperties.set("gda.data.scan.datawriter.dataFormat", dataFormat)