예제 #1
0
                msg = "Parameters (keys):\t\t"
                for key in zscores.keys():
                    msg += "%s,\t\t" % (key)
                print msg

	# ENDFOR Each Peak
		    
        return

    def parseZscoreFilter(self, zscorefilterstr):
	""" Parse Zscore filter string
	Return: zscore filter dictionary Parameter Name: Maximum Allowed
	"""
	zscorefilter = {}

	terms = zscorefilterstr.split(',')
	if len(terms) % 2 == 1:
	    raise NotImplementedError("Zscore filter is not defined correct.  It must have string and float in pair.")
	
	for i in xrange(len(terms)/2):
	    parname = terms[2*i].strip()
	    maxzscore = float(terms[2*i+1])
	    zscorefilter[parname] = maxzscore

	return zscorefilter


# Register algorithm with Mantid
registerAlgorithm(SelectPowderDiffPeaks)

예제 #2
0
        mo.initialize()
        mo.setAlwaysStoreInADS(True)
        mo.setProperty("Workspace",'__app')
        mo.setProperty("DetectorID",dID)
        mo.setProperty("Z",detDist)
        mo.setProperty("RelativePosition",'0')
        mo.execute()
        #mantid.simpleapi.MoveInstrumentComponent(Workspace='__app',DetectorID=dID,Z=detDist,RelativePosition='0')      
        
        #fix spectrum numbers
        for i in range(__w_mon.getNumberHistograms()):
            __app.getSpectrum(i).setSpectrumNo(__w_mon.getSpectrum(i).getSpectrumNo())
        __app.getSpectrum(mon2spec).setSpectrumNo(0)
        
        #get Ei
        results=mantid.simpleapi.GetEi(InputWorkspace='__app',Monitor1Spec=mon1spec,Monitor2Spec=0,EnergyEstimate=Eguess)
        
        #cleanup
        mantid.mtd.remove('__sum') 
        mantid.mtd.remove('__app') 
        
        #return the results from GetEi
        self.setProperty("IncidentEnergy",results[0])
        self.setProperty("FirstMonitorPeak",results[1])
        self.setProperty("FirstMonitorIndex",results[2])
        self.setProperty("Tzero",results[3])
        return 
    
    
registerAlgorithm(GetEiMonDet)
예제 #3
0
"""*WIKI* 

This algorithm creates an empty table workspace and puts it in the data service to make it available to python.

*WIKI*"""

from mantid.api import PythonAlgorithm, registerAlgorithm, ITableWorkspaceProperty, WorkspaceFactory
from mantid.kernel import Direction

# Create an empty table workspace to be populated by a python script.
class CreateEmptyTableWorkspace(PythonAlgorithm):
 
    def PyInit(self):
        # Declare properties
        self.setWikiSummary("""Creates an empty table workspace that can be populated by python code.""")
        self.declareProperty(ITableWorkspaceProperty("OutputWorkspace", "", Direction.Output), "The name of the table workspace that will be created.")
 
    def PyExec(self):
        tableWS = WorkspaceFactory.createTable()

        self.setProperty("OutputWorkspace", tableWS)
 
# Register algorithm with Mantid
registerAlgorithm(CreateEmptyTableWorkspace)

예제 #4
0
 def setUp(self):
     if self.__class__._registered is None:
         self.__class__._registered = True
         registerAlgorithm(TestPyAlgDefaultAttrs)
         registerAlgorithm(TestPyAlgOverriddenAttrs)
예제 #5
0
            tablews.addRow([parname, paramdict[bank][parname], "f", -1.0E100, 1.0E100, 1.0])
        # ENDFOR

        # 3. Add lattice constant
        latticeconstant = self.getProperty("LatticeConstant").value
        tablews.addRow(["LatticeConstant", latticeconstant, "t", 0.1, 1.0E5, 0.1])

        return tablews

    def createReflectionWorkspace(self, hkldict, tablews):
        """ Create TableWorkspace containing reflections and etc. 
        """
        # 1. Set up columns
        tablews.addColumn("int", "H");
        tablews.addColumn("int", "K");
        tablews.addColumn("int", "L"); 
        tablews.addColumn("double", "PeakHeight"); 
        tablews.addColumn("str", "Include/Exclude")

        # 2. Add rows
        for hkl in sorted(hkldict.keys()):
            tablews.addRow([hkl[0], hkl[1], hkl[2], 1.0, "i"])
        # ENDFOR

        return tablews


# Register algorithm with Mantid
registerAlgorithm(CreateLeBailFitInput)