|
From: <li...@us...> - 2008-10-15 10:15:43
|
Revision: 547
http://pyphant.svn.sourceforge.net/pyphant/?rev=547&view=rev
Author: liehr
Date: 2008-10-15 10:15:34 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
viewOSC visualizes the thickness map
Setting parameter '-v thicknessMap' shows the thickness map of the
investigated sample. Furthermore the position of the absorption curve,
which is specified by parameter -n, is indicated by plotting a cross at the
respective position. For this purpose
the coordinate system of the thickness map is shifted by -(stepX,stepY),
such that the cross marks the center of the respective pixel.
Modified Paths:
--------------
trunk/doc/demo/viewOSC.py
trunk/src/workers/OSC/OSC/OscAbsorption.py
Modified: trunk/doc/demo/viewOSC.py
===================================================================
--- trunk/doc/demo/viewOSC.py 2008-10-14 15:23:47 UTC (rev 546)
+++ trunk/doc/demo/viewOSC.py 2008-10-15 10:15:34 UTC (rev 547)
@@ -81,8 +81,13 @@
import pyphant.core.PyTablesPersister
+visualizer = None
from optparse import OptionParser
+visualizationThemes = ("compareAbsorption",
+ "noisyAbsorption",
+ "thicknessMap")
+
parser = OptionParser(usage="usage: %prog [options] path2recipe")
parser.add_option("-n", "--number", dest="curvNo",type='long',
@@ -91,7 +96,7 @@
help="Frequency range to use for data slicing.", metavar="FREQRANGE", default=None)
parser.add_option("-s", "--scale", dest="scale", type="str",
help="Scale parameter", metavar="SCALE", default=None)
-visualizationThemes = ("compareAbsorption","noisyAbsorption")
+
parser.add_option("-v", "--visualize", dest="theme", type="choice",choices = visualizationThemes,
help="Choose visualization theme from %s" % str(visualizationThemes),
metavar="THEME", default=visualizationThemes[0])
@@ -114,9 +119,9 @@
#Get Absorption
worker = recipe.getWorkers("Slicing")[0]
if freqRange != None:
- print freqRange, worker.paramDim1.value
- worker.paramDim1.value=freqRange
-noisyAbsorption = worker.plugExtract.getResult()
+ print freqRange, worker.paramDim1.value
+ worker.paramDim1.value=freqRange
+ noisyAbsorption = worker.plugExtract.getResult()
#Get Simulation
worker = recipe.getWorkers("Coat Thickness Model")[0]
@@ -126,6 +131,11 @@
worker = recipe.getWorkers("Multi Resolution Analyser")[0]
worker.paramScale.value=scale
+if theme == visualizationThemes[2]:
+ worker = recipe.getWorkers("Osc Mapper")[0]
+ worker.plugMapHeights.invalidate()
+ oscMap = worker.plugMapHeights.getResult()
+
#Get EstimatedWidth
worker = recipe.getWorkers("Add Column")[0]
table = worker.plugCompute.getResult(subscriber=TextSubscriber("Add Column"))
@@ -181,8 +191,6 @@
pylab.axes([left,bottom,right-left,top-bottom])
if theme == visualizationThemes[0]:
-
-
pylab.plot(noisyAbsorption.dimensions[1].inUnitsOf(simulation.dimensions[1]).data,
noisyAbsorption.data[curvNo,:],label="$%s$"%noisyAbsorption.shortname)
pylab.plot(simulation.dimensions[1].data,
@@ -195,13 +203,25 @@
elif theme == visualizationThemes[1]:
pylab.plot(noisyAbsorption.dimensions[1].inUnitsOf(simulation.dimensions[1]).data,
noisyAbsorption.data[curvNo,:],label="$%s$"%noisyAbsorption.shortname)
+ pylab.vlines(minimaPos.data[:,curvNo],0.1,1.0,
+ label ="$%s$"%minimaPos.shortname)
pylab.title(result)
pylab.xlabel(simulation.dimensions[1].label)
pylab.ylabel(simulation.label)
-
+
+elif theme == visualizationThemes[2]:
+ from pyphant.visualizers.ImageVisualizer import ImageVisualizer
+ visualizer = ImageVisualizer(oscMap)
+ pylab.plot([xPos.data[curvNo]],[yPos.data[curvNo]],'xk',scalex=False,scaley=False)
+
+
if options.postscript:
from os.path import basename
- pylab.savefig('%s-%s-n%s.eps' % (basename(pathToRecipe)[:-3],theme,curvNo))
+ filename = '%s-%s-n%s.eps' % (basename(pathToRecipe)[:-3],theme,curvNo)
+ if visualizer:
+ visualizer.figure.savefig(filename)
+ else:
+ pylab.savefig(filename)
else:
pylab.show()
Modified: trunk/src/workers/OSC/OSC/OscAbsorption.py
===================================================================
--- trunk/src/workers/OSC/OSC/OscAbsorption.py 2008-10-14 15:23:47 UTC (rev 546)
+++ trunk/src/workers/OSC/OSC/OscAbsorption.py 2008-10-15 10:15:34 UTC (rev 547)
@@ -179,9 +179,9 @@
yOff, yStep, yInd = grid2Index(yf, self.paramExtentY.value)
xMax = xInd.maxV
yMax = yInd.maxV
- xDim = DataContainer.FieldContainer( numpy.linspace(xInd.minV,xInd.maxV,xInd.stepCount), xCon.unit,
+ xDim = DataContainer.FieldContainer( numpy.linspace(xInd.minV,xInd.maxV,xInd.stepCount)-0.5*xStep, xCon.unit,
longname = xCon.longname, shortname = xCon.shortname )
- yDim = DataContainer.FieldContainer( numpy.linspace(yInd.minV,yInd.maxV,yInd.stepCount), yCon.unit,
+ yDim = DataContainer.FieldContainer( numpy.linspace(yInd.minV,yInd.maxV,yInd.stepCount)-0.5*yStep, yCon.unit,
longname = yCon.longname, shortname = yCon.shortname )
img = numpy.ones((yInd.stepCount, xInd.stepCount), dtype='float')*numpy.NaN
mask = numpy.ones((yInd.stepCount, xInd.stepCount), dtype='bool')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|