Beispiel #1
0
	def testProcessScanFile1(self):
		self.concurrentScan = createMockConcurrentScanForRealNexusFile()
		rootNamespaceDict = {}
		min_processor = MinPositionAndValue()
		max_processor = MaxPositionAndValue()
		min_processor.raise_process_exceptions = True
		max_processor.raise_process_exceptions = True

		sdp = ScanDataProcessor([min_processor, max_processor], rootNamespaceDict, raiseProcessorExceptions=True)
		sdp.raiseProcessorExceptions = True
		result = sdp.processScan(self.concurrentScan)
		self.assertAlmostEqual(result['maxval'].result.maxpos, -50)
Beispiel #2
0
class TestMax(Test):

	def setUp(self):
		Test.setUp(self)
		self.p = MaxPositionAndValue()

	def test_process(self):
		self.assertEqual(self.p._process(self.x, self.peak), (15., 5.0))
Beispiel #3
0
	def testPrepareForScan(self):
		dataSetResult = Mock()
		dataSetResult.resultsDict = {'key':None}
		dataSetResult.keyxlabel = 'key'
		sdpr = ScanDataProcessorResult(dataSetResult, None, None, None, None, scanDataPointCache=self.sdpc)
		namespace = {'myobject': 1, 'minval': 'Non SDPR should be left alone at this stage', 'maxval': sdpr}
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], namespace, raiseProcessorExceptions=True, scanDataPointCache=self.sdpc)
		sdp.prepareForScan()
		self.assertEquals(namespace, {'myobject': 1, 'minval': 'Non SDPR should be left alone at this stage'})
Beispiel #4
0
	def testProcessScanWithMultiInputXScannable(self):
		concurrentScan = MockConcurrentScan()

		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], {})
		report = sdp.processScan(concurrentScan)
		print "report:"
		print "***"
		print report
		print "***"
Beispiel #5
0
	def testProcessScanWithMultiInputXScannable(self):
		concurrentScan = MockConcurrentScan()
		concurrentScan.getUserListedScannables.return_value = [self.w, self.x, self.y, self.z]
		concurrentScan.getScanPlotSettings.return_value.getXAxisName.return_value = 'wi1'
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], {}, raiseProcessorExceptions=True)
		report = sdp.processScan(concurrentScan)
		print "report:"
		print "***"
		print report
		print "***"
Beispiel #6
0
	def testProcessScan(self):
		rootNamespaceDict = {}
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], rootNamespaceDict, raiseProcessorExceptions=True)
		report = sdp.processScan(self.concurrentScan)
		print "report:"
		print "***"
		print report
		print "***"
		self.assertEquals(report['minval'].name, 'minval')
		self.assertEquals(report['maxval'].name, 'maxval')
		self.assertEquals(self.x.name, sdp.last_scannable_scanned.name)
		print rootNamespaceDict
Beispiel #7
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.process.ScanDataProcessorResult import go
from gdascripts.scan import specscans
from gdascripts.scan import gdascans

from gda.jython.commands.GeneralCommands import alias

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

print "Creating scan 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])
scan = gdascans.Scan([scan_processor])
rscan = gdascans.Rscan([scan_processor])
alias('ascan')
Beispiel #8
0
	def testProcessScanNamespaceWritingWorksTwice(self):
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], {}, raiseProcessorExceptions=True)
		sdp.processScan(self.concurrentScan)
		sdp.processScan(self.concurrentScan)
Beispiel #9
0
	def testPrepareForScanDisablesGo(self):
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], {}, raiseProcessorExceptions=True, scanDataPointCache=self.sdpc)
		sdp.last_scannable_scanned = self.x
		sdp.prepareForScan()
		self.assertRaises(Exception, sdp.go, 3)
Beispiel #10
0
	def testProcessScan(self):
		rootNamespaceDict = {}
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue(), SimpleXYDataSetProcessorWithError()], rootNamespaceDict, raiseProcessorExceptions=True)
		report = sdp.processScan(self.concurrentScan)
		print report
		print rootNamespaceDict
Beispiel #11
0
	def testProcessScan(self):
		rootNamespaceDict = {}
		sdp = ScanDataProcessor([MaxPositionAndValue(), MinPositionAndValue()], rootNamespaceDict, raiseProcessorExceptions=True)
		report = sdp.processScan(self.concurrentScan)
		self.assertEquals(report, 'Scan too short to process sensibly')
Beispiel #12
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.process.ScanDataProcessorResult import go
from gdascripts.scan import specscans
from gdascripts.scan import gdascans

from gda.jython.commands.GeneralCommands import alias

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

print "Creating scan 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])
scan=gdascans.Scan([scan_processor])
rscan=gdascans.Rscan([scan_processor])
alias('ascan');    print ascan.__doc__.split('\nUSAGE:\n\t\n  ')[1]
alias('a2scan');print a2scan.__doc__.split('\nUSAGE:\n\t\n  ')[1]
alias('a3scan');print a3scan.__doc__.split('\nUSAGE:\n\t\n  ')[1]
alias('mesh');print mesh.__doc__.split('\nUSAGE:\n\t\n  ')[1]
alias('dscan');print dscan.__doc__.split('\nUSAGE:\n\t\n  ')[1]
alias('d2scan');print d2scan.__doc__.split('\nUSAGE:\n\t\n  ')[1]
Beispiel #13
0
from gdascripts.analysis.datasetprocessor.oned.MaxPositionAndValue import MaxPositionAndValue
from gdascripts.analysis.datasetprocessor.oned.MinPositionAndValue import MinPositionAndValue
from gdascripts.scan.process.ScanDataProcessor import ScanDataProcessor

scanprocessor = ScanDataProcessor(
    [MaxPositionAndValue(), MinPositionAndValue()], globals())
exec("scanp = Scan([scanprocessor])")
alias("scanp")  #@UndefinedVariable
alias("go")  #@UndefinedVariable
Beispiel #14
0
	def setUp(self):
		Test.setUp(self)
		self.p = MaxPositionAndValue()