You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(13) |
Nov
(50) |
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(49) |
Feb
(72) |
Mar
(18) |
Apr
(27) |
May
(40) |
Jun
(52) |
Jul
(26) |
Aug
(8) |
Sep
(12) |
Oct
(26) |
Nov
(13) |
Dec
(14) |
2009 |
Jan
(13) |
Feb
(7) |
Mar
(8) |
Apr
(11) |
May
(4) |
Jun
(2) |
Jul
(7) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
(1) |
Dec
(1) |
2010 |
Jan
(1) |
Feb
(8) |
Mar
(3) |
Apr
(9) |
May
(16) |
Jun
(8) |
Jul
(7) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
(12) |
From: <zk...@us...> - 2007-11-04 23:41:00
|
Revision: 146 http://pyphant.svn.sourceforge.net/pyphant/?rev=146&view=rev Author: zklaus Date: 2007-11-04 15:41:03 -0800 (Sun, 04 Nov 2007) Log Message: ----------- r1304@zaphodb: ford | 2007-11-05 00:38:36 +0100 - Fixed NoneObject bug in __imod__ of Connectors. - Fixed typo in Param.py - Made ListSelect return unicode instead of string, thus correcting selection handling. - Split OscLoader and other osc workers. - Refactored OscMapper into a general mapper. Will be separated from Osc toolbox after some polishing. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/Connectors.py trunk/src/pyphant/pyphant/core/Param.py trunk/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py trunk/src/workers/OSC/OSC/OscLoader.py trunk/src/workers/OSC/OSC/__init__.py Added Paths: ----------- trunk/src/workers/OSC/OSC/OscAbsorption.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1303 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1304 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/pyphant/core/Connectors.py =================================================================== --- trunk/src/pyphant/pyphant/core/Connectors.py 2007-11-04 23:40:42 UTC (rev 145) +++ trunk/src/pyphant/pyphant/core/Connectors.py 2007-11-04 23:41:03 UTC (rev 146) @@ -121,7 +121,8 @@ self.process = process def __imod__(self, percentage): - self.subscriber.updateProcess(self.process, percentage) + if self.subscriber: + self.subscriber.updateProcess(self.process, percentage) return self class CalculatingPlug(Plug): Modified: trunk/src/pyphant/pyphant/core/Param.py =================================================================== --- trunk/src/pyphant/pyphant/core/Param.py 2007-11-04 23:40:42 UTC (rev 145) +++ trunk/src/pyphant/pyphant/core/Param.py 2007-11-04 23:41:03 UTC (rev 146) @@ -95,7 +95,7 @@ return self.getPossibleValues() def setPossibleValues(self, values): - self._possibleValue=values + self._possibleValues=values def __setPossibleValues(self, values): oldValues=self.possibleValues Modified: trunk/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py =================================================================== --- trunk/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py 2007-11-04 23:40:42 UTC (rev 145) +++ trunk/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py 2007-11-04 23:41:03 UTC (rev 146) @@ -48,4 +48,4 @@ if self.GetSelection()==wx.NOT_FOUND: raise ValueError("Invalid value") else: - return str(self.GetStringSelection()) + return unicode(self.GetStringSelection()) Added: trunk/src/workers/OSC/OSC/OscAbsorption.py =================================================================== --- trunk/src/workers/OSC/OSC/OscAbsorption.py (rev 0) +++ trunk/src/workers/OSC/OSC/OscAbsorption.py 2007-11-04 23:41:03 UTC (rev 146) @@ -0,0 +1,199 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2006-2007, Rectorate of the University of Freiburg +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the Freiburg Materials Research Center, +# University of Freiburg nor the names of its contributors may be used to +# endorse or promote products derived from this software without specific +# prior written permission. +# +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +u""" +""" + +__id__ = "$Id$" +__author__ = "$Author$" +__version__ = "$Revision$" +# $Source$ + +import numpy +from pyphant.core import (Worker, Connectors, + Param, DataContainer) + +import scipy.interpolate +from Scientific.Physics import PhysicalQuantities + +class OscAbsorptionCalculator(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Osc Absorption Calculator" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("clipping", "Clipping", 1, None)] + + @Worker.plug(Connectors.TYPE_ARRAY) + def calcAbsorption(self, osc, subscriber=0): + cont = osc.recreateFieldContainers() + I = cont[u'ScopRaw[counts]'] + I_d = cont[u'DarkRef[counts]'] + I_0 = cont[u'WhiteRef[counts]'] + A = -((I.data-I_d.data)/(I_0.data-I_d.data)-1) + if self.paramClipping.value==1: + A[A>1] = 0 + A[A<0] = 0 + Abso = DataContainer.FieldContainer(A, longname=u'Absorption', shortname=u'A') + result = DataContainer.SampleContainer(cont.values()+[Abso], longname=osc.longname, shortname=osc.shortname) + result.seal() + return result + + +class OscAbsorptionExtractor(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Single Spectrum Viewer" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("index", "Index", 1, None)] + + @Worker.plug(Connectors.TYPE_ARRAY) + def extractSpec(self, osc, subscriber=0): + data = osc.recreateFieldContainers() + a = data[u'Absorption'] + l = data[u'Wellenlänge[nm]'] + lam = DataContainer.FieldContainer(l.data[self.paramIndex.value-1], l.unit, l.error, l.dimensions, l.longname, u"\lambda") + Abso = DataContainer.FieldContainer(a.data[self.paramIndex.value-1], a.unit, a.error, [lam], osc.longname+u", Abs Pixel %i"%self.paramIndex.value, u"A") + Abso.seal() + return Abso + + +class OscMinimumFinder(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Minimum finder" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("lower", "Lower Bound", 380, None), + ("upper", "Upper Bound", 500, None), + ("a", "a", 14000, None), + ("b", "b", -4270000, None), + ("s", "Fit smoothing (0 no smoothing, larger value more smoothing)", 150, None)] + + @Worker.plug(Connectors.TYPE_ARRAY) + def findMinimum(self, osc, subscriber=0): + data = osc.recreateFieldContainers() + Abso = data[u'Absorption'] + lam = data[u'Wellenlänge[nm]'] + as = [] + ls = [] + mins = [] + l = lam.data[0] + hs = [] + lower = numpy.argwhere(l>self.paramLower.value)[0][0] + upper = numpy.argwhere(l<self.paramUpper.value)[-1][0] + count = len(lam.data) + for i in xrange(count): + l = lam.data[i][lower:upper] + ls.append(l) + a = Abso.data[i][lower:upper] + tck = scipy.interpolate.splrep(l, a, s=self.paramS.value) + a = scipy.interpolate.splev(l, tck, 0) + as.append(a) + imin = a.argmin() + if imin>0 and imin<len(l)-1: + mins.append(l[imin]) + hs.append(l[imin]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) + else: + mins.append(0) + hs.append(0) + subscriber %= float(i)*100.0/float(count) + data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname=u'Absorption', shortname=u'A') + data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), unit=lam.unit, + longname=u'Wavelength', shortname=u'\lambda') + data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), unit=lam.unit, + longname=u'Minima', shortname='m') + data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=lam.unit, + longname=u'Höhe', shortname='h') + result = DataContainer.SampleContainer(data.values(), longname=osc.longname, shortname=osc.shortname) + result.seal() + return result + + +class OscMapper(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Osc Mapper" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("xAxis", u"x-Axis", [u"TISCH_POS_X", u"TISCH_POS_Y"], None), + ("yAxis", u"y-Axis", [u"TISCH_POS_Y", u"TISCH_POS_X"], None), + ("field", u"Field", [u"Höhe", u"Strom"], None)] + + def inithook(self): + self.isInvalidating=False + + def invalidate(self, event=None): + if self.isInvalidating: + return + self.isInvalidating=True + if self.socketOsc.isFull(): + templ = self.socketOsc.value + colNames = [ d[0][0] for d in templ.data.dtype.descr ] + self.paramXAxis.possibleValues=colNames + self.paramYAxis.possibleValues=colNames + self.paramField.possibleValues=colNames + super(OscMapper, self).invalidate(event) + self.isInvalidating=False + + @Worker.plug(Connectors.TYPE_IMAGE) + def mapHeights(self, osc, subscriber=0): + d = 9 + data = osc.recreateFieldContainers() + xCon = data[self.paramXAxis.value] + xCon.longname=xCon.longname.replace('_', ' ').title() + yCon = data[self.paramYAxis.value] + yCon.longname=yCon.longname.replace('_', ' ').title() + fCon = data[self.paramField.value] + fCon.longname=fCon.longname.replace('_', ' ').title() + xCon.data = xCon.data.astype('float') + xf = xCon.data + yCon.data = yCon.data.astype('float') + yf = yCon.data + x = (xf*10).astype('int') + y = (yf*10).astype('int') + x = x-x.min() + y = y-y.min() + fCon.data = fCon.data.astype('float') + h = fCon.data + m = h[h>0].min() + img = numpy.ones((y.max()+d, x.max()+d))*m + for i in xrange(len(x)): + img[y[i]:y[i]+d,x[i]:x[i]+d]=max(h[i], m) + result = DataContainer.FieldContainer(img, fCon.unit, dimensions=[xCon, yCon], + longname=u'Map of %s for %s'%(fCon.longname, osc.longname), shortname=fCon.shortname) + result.seal() + return result Property changes on: trunk/src/workers/OSC/OSC/OscAbsorption.py ___________________________________________________________________ Name: svn:keywords + Id Author Revision Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-11-04 23:40:42 UTC (rev 145) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-11-04 23:41:03 UTC (rev 146) @@ -37,11 +37,10 @@ __version__ = "$Revision$" # $Source$ -import zipfile, numpy, copy, re +import zipfile, numpy, re from pyphant.core import (Worker, Connectors, Param, DataContainer) -import scipy.interpolate from Scientific.Physics import PhysicalQuantities def makeRoot(pixelName, ll): @@ -138,130 +137,3 @@ result.seal() return result -class OscAbsorptionCalculator(Worker.Worker): - API = 2 - VERSION = 1 - REVISION = "$Revision$"[11:-1] - name = "Osc Absorption Calculator" - - _sockets = [("osc", Connectors.TYPE_ARRAY)] - _params = [("clipping", "Clipping", 1, None)] - - @Worker.plug(Connectors.TYPE_ARRAY) - def calcAbsorption(self, osc, subscriber=0): - cont = osc.recreateFieldContainers() - I = cont[u'ScopRaw[counts]'] - I_d = cont[u'DarkRef[counts]'] - I_0 = cont[u'WhiteRef[counts]'] - A = -((I.data-I_d.data)/(I_0.data-I_d.data)-1) - if self.paramClipping.value==1: - A[A>1] = 0 - A[A<0] = 0 - Abso = DataContainer.FieldContainer(A, longname='Absorption', shortname='A') - result = DataContainer.SampleContainer(cont.values()+[Abso], longname=osc.longname, shortname=osc.shortname) - result.seal() - return result - - -class OscAbsorptionExtractor(Worker.Worker): - API = 2 - VERSION = 1 - REVISION = "$Revision$"[11:-1] - name = "Single Spectrum Viewer" - - _sockets = [("osc", Connectors.TYPE_ARRAY)] - _params = [("index", "Index", 1, None)] - - @Worker.plug(Connectors.TYPE_ARRAY) - def extractSpec(self, osc, subscriber=0): - data = osc.recreateFieldContainers() - a = data[u'Absorption'] - l = data[u'Wellenlänge[nm]'] - lam = DataContainer.FieldContainer(l.data[self.paramIndex.value-1], l.unit, l.error, l.dimensions, l.longname, u"\lambda") - Abso = DataContainer.FieldContainer(a.data[self.paramIndex.value-1], a.unit, a.error, [lam], osc.longname+u", Abs Pixel %i"%self.paramIndex.value, u"A") - Abso.seal() - return Abso - - -class OscMinimumFinder(Worker.Worker): - API = 2 - VERSION = 1 - REVISION = "$Revision$"[11:-1] - name = "Minimum finder" - - _sockets = [("osc", Connectors.TYPE_ARRAY)] - _params = [("lower", "Lower Bound", 380, None), - ("upper", "Upper Bound", 500, None), - ("a", "a", 14000, None), - ("b", "b", -4270000, None), - ("s", "Fit smoothing (0 no smoothing, larger value more smoothing)", 150, None)] - - @Worker.plug(Connectors.TYPE_ARRAY) - def findMinimum(self, osc, subscriber=0): - data = osc.recreateFieldContainers() - Abso = data[u'Absorption'] - lam = data[u'Wellenlänge[nm]'] - as = [] - ls = [] - mins = [] - l = lam.data[0] - hs = [] - lower = numpy.argwhere(l>self.paramLower.value)[0][0] - upper = numpy.argwhere(l<self.paramUpper.value)[-1][0] - count = len(lam.data) - for i in xrange(count): - l = lam.data[i][lower:upper] - ls.append(l) - a = Abso.data[i][lower:upper] - tck = scipy.interpolate.splrep(l, a, s=self.paramS.value) - a = scipy.interpolate.splev(l, tck, 0) - as.append(a) - imin = a.argmin() - if imin>0 and imin<len(l)-1: - mins.append(l[imin]) - hs.append(l[imin]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) - else: - mins.append(0) - hs.append(0) - subscriber %= float(i)*100.0/float(count) - data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname=u'Absorption', shortname=u'A') - data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), unit=lam.unit, - longname=u'Wavelength', shortname=u'\lambda') - data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), unit=lam.unit, - longname=u'Minima', shortname='m') - data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=lam.unit, - longname=u'Höhe', shortname='h') - result = DataContainer.SampleContainer(data.values(), longname=osc.longname, shortname=osc.shortname) - result.seal() - return result - - -class OscMapper(Worker.Worker): - API = 2 - VERSION = 1 - REVISION = "$Revision$"[11:-1] - name = "Osc Mapper" - - _sockets = [("osc", Connectors.TYPE_ARRAY)] - - @Worker.plug(Connectors.TYPE_IMAGE) - def mapHeights(self, osc, subscriber=0): - d = 9 - data = osc.recreateFieldContainers() - xf = numpy.array(data[u'TISCH_POS_X'].data, dtype='float') - yf = numpy.array(data[u'TISCH_POS_Y'].data, dtype='float') - x = (xf*10).astype('int') - y = (yf*10).astype('int') - x = x-x.min() - y = y-y.min() - h = data[u'Höhe'].data - m = h[h>0].min() - img = numpy.ones((y.max()+d, x.max()+d))*m - for i in xrange(len(x)): - img[y[i]:y[i]+d,x[i]:x[i]+d]=max(h[i], m) - xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'x-Axis', shortname="x") - ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'y-Axis', shortname="y") - result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], - longname=u'Heightmap for '+osc.longname, shortname='h') - result.seal() - return result Modified: trunk/src/workers/OSC/OSC/__init__.py =================================================================== --- trunk/src/workers/OSC/OSC/__init__.py 2007-11-04 23:40:42 UTC (rev 145) +++ trunk/src/workers/OSC/OSC/__init__.py 2007-11-04 23:41:03 UTC (rev 146) @@ -37,5 +37,6 @@ __version__ = "$Revision$" # $Source$ -workers=[ "OscLoader" ] +workers=[ "OscLoader", + "OscAbsorption" ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-11-04 23:40:45
|
Revision: 145 http://pyphant.svn.sourceforge.net/pyphant/?rev=145&view=rev Author: zklaus Date: 2007-11-04 15:40:42 -0800 (Sun, 04 Nov 2007) Log Message: ----------- r1303@zaphodb: ford | 2007-11-04 16:03:58 +0100 - Made the loader data-agnostic. Modified Paths: -------------- trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1301 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1303 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-31 13:18:25 UTC (rev 144) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-11-04 23:40:42 UTC (rev 145) @@ -50,6 +50,8 @@ def startSection(root, l): if l == u'MESSDATEN': root[l] = [] + elif l == u'SPALTENBESCHRIFTUNG': + root[l] = [] else: root[l] = {} return root[l], l @@ -58,6 +60,10 @@ ff = l.split('=') section[ff[0]] = ff[1] +def addDataColumn(section, l): + ff = l.split('=') + section.append(ff[1]) + def addTableLine(section, l): ff = l.split('\t') section.append([float(f) for f in ff]) @@ -65,7 +71,7 @@ LINE_HANDLER = { u'Section': startSection, u'GLOBAL': addAttributeLine, u'MESSUNG': addAttributeLine, - u'SPALTENBESCHRIFTUNG': addAttributeLine, + u'SPALTENBESCHRIFTUNG': addDataColumn, u'MESSDATEN': addTableLine } def loadOscFromFile(filename, subscriber=0): @@ -88,10 +94,8 @@ for dicname in (u'GLOBAL',u'MESSUNG'): for k in d[dicname].keys(): container[k].append(d[dicname][k]) - for i in xrange(1,6): - col = "SPALTE%i" % i - container[d[u'SPALTENBESCHRIFTUNG'][col]].append(d[u'MESSDATEN'][:,i-1]) - #container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) + for i, col in enumerate(d[u'SPALTENBESCHRIFTUNG']): + container[col].append(d[u'MESSDATEN'][:,i]) cols = [DataContainer.FieldContainer(numpy.array(v), unit=longname2unit(k), longname=k) for k,v in container.iteritems()] return DataContainer.SampleContainer(cols, longname=container[u'KOMMENTAR'][0]) @@ -99,12 +103,8 @@ def constructTemplate(data): template = data[0] container = {} - for k in template[u'GLOBAL'].keys()+template[u'MESSUNG'].keys(): + for k in template[u'GLOBAL'].keys()+template[u'MESSUNG'].keys()+template[u'SPALTENBESCHRIFTUNG']: container[k] = [] - for i in xrange(1,5): - k = "SPALTE%i" % i - container[template[u'SPALTENBESCHRIFTUNG'][k]] = [] - container[u'WhiteRef[counts]'] = [] return container This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-31 13:18:22
|
Revision: 144 http://pyphant.svn.sourceforge.net/pyphant/?rev=144&view=rev Author: zklaus Date: 2007-10-31 06:18:25 -0700 (Wed, 31 Oct 2007) Log Message: ----------- r1301@zaphodb: ford | 2007-10-31 14:16:24 +0100 - Added shortlabel to DataContainer. - Simple charts now use shortlabel as ylabel, since the longname is in the title anyway. - Hacked Chart to accomodate for Osc changes. - Removed matplotlib ion. That slowed things horribly down. Further investigation needed. - Removed special treatment of WhiteRef in OscLoader. The format was changed to make this unnecessary. WARNING: This breaks compatibility with older data files. Use T14 or later. - Renamed Osc Absorption Spectrum to Single Spectrum Viewer. - Added more meaningful short- and longnames in Single Spectrum Viewer. - Added smoothing parameter to Minimum Finder. - Minimumfinder changes 'Wellenl?\195?\164nge[nm]' to Wavelength. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/pyphant/pyphant/visualizers/Chart.py trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1298 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1301 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-30 00:47:47 UTC (rev 143) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-31 13:18:25 UTC (rev 144) @@ -205,6 +205,13 @@ return u"%s $%s$ / %s" % (self.longname, self.shortname, self.unit) label=property(_getLabel) + def _getShortLabel(self): + if not isPhysicalQuantity(self.unit) and self.unit == 1: + return u"$%s$ / a.u." % self.shortname + else: + return u"$%s$ / %s" % (self.shortname, self.unit) + shortlabel=property(_getShortLabel) + def __deepcopy__(self, memo): self.lock.acquire() data=copy.deepcopy(self.data, memo) Modified: trunk/src/pyphant/pyphant/visualizers/Chart.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-30 00:47:47 UTC (rev 143) +++ trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-31 13:18:25 UTC (rev 144) @@ -64,23 +64,28 @@ if isinstance(self.dataContainer, DataContainer.FieldContainer): self.addFieldContainer(self.dataContainer) pylab.xlabel(self.dataContainer.dimensions[0].label) - pylab.ylabel(self.dataContainer.label) + pylab.ylabel(self.dataContainer.shortlabel) pylab.title(self.dataContainer.longname) else: data = self.dataContainer.recreateFieldContainers() - lam = data[u'Wellenlänge[nm]'] + if u'Wellenlänge[nm]' in data.keys(): + lam = data[u'Wellenlänge[nm]'] + else: + lam = data[u'Wavelength'] abso = data[u'Absorption'] - mins = data[u'Minima'] for i in xrange(len(lam.data)): self.ordinates.append(abso.data[i]) self.abscissae.append(lam.data[i]) - self.mins.append(mins.data[i]) + if u'Minima' in data.keys(): + mins = data[u'Minima'] + for i in xrange(len(lam.data)): + self.mins.append(mins.data[i]) pylab.xlabel(lam.label) pylab.ylabel(abso.label) pylab.title(self.dataContainer.longname) def finalize(self): - pylab.ion() + #pylab.ion() pylab.show() Modified: trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py 2007-10-30 00:47:47 UTC (rev 143) +++ trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py 2007-10-31 13:18:25 UTC (rev 144) @@ -69,7 +69,7 @@ return str(x) ax=pylab.gca() pylab.colorbar(format=F(self.fieldContainer)) - pylab.ion() + #pylab.ion() pylab.show() DataVisReg.getInstance().registerVisualizer(TYPE_IMAGE, ImageVisualizer) Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-30 00:47:47 UTC (rev 143) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-31 13:18:25 UTC (rev 144) @@ -88,10 +88,10 @@ for dicname in (u'GLOBAL',u'MESSUNG'): for k in d[dicname].keys(): container[k].append(d[dicname][k]) - for i in xrange(1,5): + for i in xrange(1,6): col = "SPALTE%i" % i container[d[u'SPALTENBESCHRIFTUNG'][col]].append(d[u'MESSDATEN'][:,i-1]) - container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) + #container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) cols = [DataContainer.FieldContainer(numpy.array(v), unit=longname2unit(k), longname=k) for k,v in container.iteritems()] return DataContainer.SampleContainer(cols, longname=container[u'KOMMENTAR'][0]) @@ -167,7 +167,7 @@ API = 2 VERSION = 1 REVISION = "$Revision$"[11:-1] - name = "Osc Absorption Spectrum" + name = "Single Spectrum Viewer" _sockets = [("osc", Connectors.TYPE_ARRAY)] _params = [("index", "Index", 1, None)] @@ -177,8 +177,8 @@ data = osc.recreateFieldContainers() a = data[u'Absorption'] l = data[u'Wellenlänge[nm]'] - lam = DataContainer.FieldContainer(l.data[self.paramIndex.value], l.unit, l.error, l.dimensions, l.longname, l.shortname) - Abso = DataContainer.FieldContainer(a.data[self.paramIndex.value], a.unit, a.error, [lam], a.longname, l.shortname) + lam = DataContainer.FieldContainer(l.data[self.paramIndex.value-1], l.unit, l.error, l.dimensions, l.longname, u"\lambda") + Abso = DataContainer.FieldContainer(a.data[self.paramIndex.value-1], a.unit, a.error, [lam], osc.longname+u", Abs Pixel %i"%self.paramIndex.value, u"A") Abso.seal() return Abso @@ -193,7 +193,8 @@ _params = [("lower", "Lower Bound", 380, None), ("upper", "Upper Bound", 500, None), ("a", "a", 14000, None), - ("b", "b", -4270000, None)] + ("b", "b", -4270000, None), + ("s", "Fit smoothing (0 no smoothing, larger value more smoothing)", 150, None)] @Worker.plug(Connectors.TYPE_ARRAY) def findMinimum(self, osc, subscriber=0): @@ -212,7 +213,7 @@ l = lam.data[i][lower:upper] ls.append(l) a = Abso.data[i][lower:upper] - tck = scipy.interpolate.splrep(l, a, s=len(l)-numpy.sqrt(2*len(l))) + tck = scipy.interpolate.splrep(l, a, s=self.paramS.value) a = scipy.interpolate.splev(l, tck, 0) as.append(a) imin = a.argmin() @@ -225,7 +226,7 @@ subscriber %= float(i)*100.0/float(count) data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname=u'Absorption', shortname=u'A') data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), unit=lam.unit, - longname=lam.longname, shortname=lam.shortname) + longname=u'Wavelength', shortname=u'\lambda') data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), unit=lam.unit, longname=u'Minima', shortname='m') data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=lam.unit, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-30 00:47:44
|
Revision: 143 http://pyphant.svn.sourceforge.net/pyphant/?rev=143&view=rev Author: zklaus Date: 2007-10-29 17:47:47 -0700 (Mon, 29 Oct 2007) Log Message: ----------- r1298@zaphodb: ford | 2007-10-30 01:45:37 +0100 - Latexified the handling of shortname. - Improved line chart labeling. - Improved longname handling of osc data. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/pyphant/pyphant/visualizers/Chart.py trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1296 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1298 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-29 23:53:15 UTC (rev 142) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-30 00:47:47 UTC (rev 143) @@ -200,9 +200,9 @@ def _getLabel(self): if not isPhysicalQuantity(self.unit) and self.unit == 1: - return u"%s %s / a.u." % (self.longname,self.shortname) + return u"%s $%s$ / a.u." % (self.longname,self.shortname) else: - return u"%s %s / %s" % (self.longname, self.shortname, self.unit) + return u"%s $%s$ / %s" % (self.longname, self.shortname, self.unit) label=property(_getLabel) def __deepcopy__(self, memo): @@ -291,7 +291,7 @@ for j in xrange(N): pos = listing.index(topic) if nameList: - listing[pos] += str(j) + listing[pos] += "_{"+str(j)+"}" else: listing[pos] += names[j].capitalize() nameList = False Modified: trunk/src/pyphant/pyphant/visualizers/Chart.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-29 23:53:15 UTC (rev 142) +++ trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-30 00:47:47 UTC (rev 143) @@ -65,6 +65,7 @@ self.addFieldContainer(self.dataContainer) pylab.xlabel(self.dataContainer.dimensions[0].label) pylab.ylabel(self.dataContainer.label) + pylab.title(self.dataContainer.longname) else: data = self.dataContainer.recreateFieldContainers() lam = data[u'Wellenlänge[nm]'] @@ -76,6 +77,7 @@ self.mins.append(mins.data[i]) pylab.xlabel(lam.label) pylab.ylabel(abso.label) + pylab.title(self.dataContainer.longname) def finalize(self): pylab.ion() Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-29 23:53:15 UTC (rev 142) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-30 00:47:47 UTC (rev 143) @@ -93,7 +93,7 @@ container[d[u'SPALTENBESCHRIFTUNG'][col]].append(d[u'MESSDATEN'][:,i-1]) container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) cols = [DataContainer.FieldContainer(numpy.array(v), unit=longname2unit(k), longname=k) for k,v in container.iteritems()] - return DataContainer.SampleContainer(cols) + return DataContainer.SampleContainer(cols, longname=container[u'KOMMENTAR'][0]) def constructTemplate(data): @@ -158,7 +158,7 @@ A[A>1] = 0 A[A<0] = 0 Abso = DataContainer.FieldContainer(A, longname='Absorption', shortname='A') - result = DataContainer.SampleContainer(cont.values()+[Abso], longname='Osc data', shortname='O') + result = DataContainer.SampleContainer(cont.values()+[Abso], longname=osc.longname, shortname=osc.shortname) result.seal() return result @@ -230,7 +230,7 @@ longname=u'Minima', shortname='m') data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=lam.unit, longname=u'Höhe', shortname='h') - result = DataContainer.SampleContainer(data.values(), longname='Osc data', shortname='O') + result = DataContainer.SampleContainer(data.values(), longname=osc.longname, shortname=osc.shortname) result.seal() return result @@ -257,10 +257,10 @@ m = h[h>0].min() img = numpy.ones((y.max()+d, x.max()+d))*m for i in xrange(len(x)): - #img[y[i]-d:y[i]+d,x[i]-d:x[i]+d]=max(h[i], m) img[y[i]:y[i]+d,x[i]:x[i]+d]=max(h[i], m) xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'x-Axis', shortname="x") ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'y-Axis', shortname="y") - result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], longname='Osc Heightmap', shortname='h') + result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], + longname=u'Heightmap for '+osc.longname, shortname='h') result.seal() return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-29 23:53:12
|
Revision: 142 http://pyphant.svn.sourceforge.net/pyphant/?rev=142&view=rev Author: zklaus Date: 2007-10-29 16:53:15 -0700 (Mon, 29 Oct 2007) Log Message: ----------- r1296@zaphodb: ford | 2007-10-30 00:51:10 +0100 - Added unit parsing to OscLoader (from Columntitles with [unit]-tags). - Sanitized minimum finder. - Improved height-map generation. Modified Paths: -------------- trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1294 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1296 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-27 20:50:39 UTC (rev 141) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-29 23:53:15 UTC (rev 142) @@ -37,7 +37,7 @@ __version__ = "$Revision$" # $Source$ -import zipfile, numpy, copy +import zipfile, numpy, copy, re from pyphant.core import (Worker, Connectors, Param, DataContainer) @@ -69,6 +69,13 @@ u'MESSDATEN': addTableLine } def loadOscFromFile(filename, subscriber=0): + def longname2unit(name): + reg = re.compile(r"\[([^]]*)\]") + m = reg.search(name) + if not m or m.group(1)=="counts": + return 1.0 + else: + return PhysicalQuantities.PhysicalQuantity('1 '+str(m.group(1))) z = zipfile.ZipFile(filename, 'r') data = [] names = z.namelist() @@ -85,7 +92,7 @@ col = "SPALTE%i" % i container[d[u'SPALTENBESCHRIFTUNG'][col]].append(d[u'MESSDATEN'][:,i-1]) container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) - cols = [DataContainer.FieldContainer(numpy.array(v), longname=k) for k,v in container.iteritems()] + cols = [DataContainer.FieldContainer(numpy.array(v), unit=longname2unit(k), longname=k) for k,v in container.iteritems()] return DataContainer.SampleContainer(cols) @@ -203,26 +210,26 @@ count = len(lam.data) for i in xrange(count): l = lam.data[i][lower:upper] + ls.append(l) a = Abso.data[i][lower:upper] tck = scipy.interpolate.splrep(l, a, s=len(l)-numpy.sqrt(2*len(l))) a = scipy.interpolate.splev(l, tck, 0) - #d1 = scipy.interpolate.splev(l, tck, 1) - d2 = scipy.interpolate.splev(l, tck, 2) - #j = numpy.abs(d1).argmin() - j = a.argmin() - if d2[j]>0: - mins.append(l[j]) - hs.append(l[j]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) + as.append(a) + imin = a.argmin() + if imin>0 and imin<len(l)-1: + mins.append(l[imin]) + hs.append(l[imin]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) else: mins.append(0) hs.append(0) - as.append(a) - ls.append(l) subscriber %= float(i)*100.0/float(count) - data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname='Absorption', shortname='A') - data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), longname=lam.longname, shortname=lam.shortname) - data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), longname=u'Minima', shortname='m') - data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=PhysicalQuantities.PhysicalQuantity('1 nm'), longname=u'Höhe', shortname='h') + data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname=u'Absorption', shortname=u'A') + data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), unit=lam.unit, + longname=lam.longname, shortname=lam.shortname) + data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), unit=lam.unit, + longname=u'Minima', shortname='m') + data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=lam.unit, + longname=u'Höhe', shortname='h') result = DataContainer.SampleContainer(data.values(), longname='Osc data', shortname='O') result.seal() return result @@ -238,7 +245,7 @@ @Worker.plug(Connectors.TYPE_IMAGE) def mapHeights(self, osc, subscriber=0): - d = 4 + d = 9 data = osc.recreateFieldContainers() xf = numpy.array(data[u'TISCH_POS_X'].data, dtype='float') yf = numpy.array(data[u'TISCH_POS_Y'].data, dtype='float') @@ -248,9 +255,10 @@ y = y-y.min() h = data[u'Höhe'].data m = h[h>0].min() - img = numpy.ones((y.max(), x.max()))*m + img = numpy.ones((y.max()+d, x.max()+d))*m for i in xrange(len(x)): - img[y[i]-d:y[i]+d,x[i]-d:x[i]+d]=max(h[i], m) + #img[y[i]-d:y[i]+d,x[i]-d:x[i]+d]=max(h[i], m) + img[y[i]:y[i]+d,x[i]:x[i]+d]=max(h[i], m) xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'x-Axis', shortname="x") ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'y-Axis', shortname="y") result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], longname='Osc Heightmap', shortname='h') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-27 20:50:40
|
Revision: 141 http://pyphant.svn.sourceforge.net/pyphant/?rev=141&view=rev Author: zklaus Date: 2007-10-27 13:50:39 -0700 (Sat, 27 Oct 2007) Log Message: ----------- r1294@zaphodb: ford | 2007-10-27 22:35:17 +0200 - Modified the minimum finder algorithm. Modified Paths: -------------- trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1291 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1294 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-24 23:48:42 UTC (rev 140) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-27 20:50:39 UTC (rev 141) @@ -206,9 +206,10 @@ a = Abso.data[i][lower:upper] tck = scipy.interpolate.splrep(l, a, s=len(l)-numpy.sqrt(2*len(l))) a = scipy.interpolate.splev(l, tck, 0) - d1 = scipy.interpolate.splev(l, tck, 1) + #d1 = scipy.interpolate.splev(l, tck, 1) d2 = scipy.interpolate.splev(l, tck, 2) - j = numpy.abs(d1).argmin() + #j = numpy.abs(d1).argmin() + j = a.argmin() if d2[j]>0: mins.append(l[j]) hs.append(l[j]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-24 23:48:38
|
Revision: 140 http://pyphant.svn.sourceforge.net/pyphant/?rev=140&view=rev Author: zklaus Date: 2007-10-24 16:48:42 -0700 (Wed, 24 Oct 2007) Log Message: ----------- r1291@zaphodb: ford | 2007-10-25 01:45:37 +0200 - Removed pysvn code completely from setup.py. This is another dependency with very little gain, especially in the light of setuptools subversion capabilities. Modified Paths: -------------- trunk/src/pyphant/setup.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1290 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1291 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/setup.py =================================================================== --- trunk/src/pyphant/setup.py 2007-10-24 23:48:29 UTC (rev 139) +++ trunk/src/pyphant/setup.py 2007-10-24 23:48:42 UTC (rev 140) @@ -8,13 +8,7 @@ from setuptools import setup, find_packages -try: - import pysvn - client = pysvn.Client() - head_rev = client.update('.') - version='%s-%s'%(VERSION, head_rev[0].number) -except: - version='%s-%s'%(VERSION, __revision__[11:-2]) +version='%s-%s'%(VERSION, __revision__[11:-2]) setup( name='Pyphant', version = version, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-24 23:48:26
|
Revision: 139 http://pyphant.svn.sourceforge.net/pyphant/?rev=139&view=rev Author: zklaus Date: 2007-10-24 16:48:29 -0700 (Wed, 24 Oct 2007) Log Message: ----------- r1290@zaphodb: ford | 2007-10-25 01:44:16 +0200 - Added proper titleing to ImageVisualizer. - Extended bounds of BoundedIntegerTextField. - Made pyphants setup.py independent of pysvn - Fixed various typos in OscLoader.py. Modified Paths: -------------- trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py trunk/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py trunk/src/pyphant/setup.py trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1286 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1290 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py 2007-10-24 23:33:16 UTC (rev 138) +++ trunk/src/pyphant/pyphant/visualizers/ImageVisualizer.py 2007-10-24 23:48:29 UTC (rev 139) @@ -57,6 +57,7 @@ pylab.imshow(self.fieldContainer.data, extent=(xmin, xmax, ymin, ymax)) pylab.xlabel(self.fieldContainer.dimensions[0].label) pylab.ylabel(self.fieldContainer.dimensions[1].label) + pylab.title(self.fieldContainer.longname) class F(pylab.Formatter): def __init__(self, container, *args, **kwargs): Modified: trunk/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py =================================================================== --- trunk/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py 2007-10-24 23:33:16 UTC (rev 138) +++ trunk/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py 2007-10-24 23:48:29 UTC (rev 139) @@ -41,8 +41,8 @@ class BoundedIntegerTextField(wx.lib.masked.NumCtrl): def __init__(self, parent, param): - min=0 - max=5000 + min = -50000000 + max = 50000000 if min and min>=0: allowNegative=False else: allowNegative=True if min or max: limited=True Modified: trunk/src/pyphant/setup.py =================================================================== --- trunk/src/pyphant/setup.py 2007-10-24 23:33:16 UTC (rev 138) +++ trunk/src/pyphant/setup.py 2007-10-24 23:48:29 UTC (rev 139) @@ -8,9 +8,9 @@ from setuptools import setup, find_packages -import pysvn -client = pysvn.Client() try: + import pysvn + client = pysvn.Client() head_rev = client.update('.') version='%s-%s'%(VERSION, head_rev[0].number) except: Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-24 23:33:16 UTC (rev 138) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-24 23:48:29 UTC (rev 139) @@ -184,7 +184,9 @@ _sockets = [("osc", Connectors.TYPE_ARRAY)] _params = [("lower", "Lower Bound", 380, None), - ("upper", "Upper Bound", 500, None)] + ("upper", "Upper Bound", 500, None), + ("a", "a", 14000, None), + ("b", "b", -4270000, None)] @Worker.plug(Connectors.TYPE_ARRAY) def findMinimum(self, osc, subscriber=0): @@ -209,7 +211,7 @@ j = numpy.abs(d1).argmin() if d2[j]>0: mins.append(l[j]) - hs.append(l[j]*1.4-427.0) + hs.append(l[j]*float(self.paramA.value)/10000.0+float(self.paramB.value)/10000.0) else: mins.append(0) hs.append(0) @@ -248,8 +250,8 @@ img = numpy.ones((y.max(), x.max()))*m for i in xrange(len(x)): img[y[i]-d:y[i]+d,x[i]-d:x[i]+d]=max(h[i], m) - xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 cm'), longname=u'x-Axis', shortname="x") - ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 cm'), longname=u'y-Axis', shortname="y") + xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'x-Axis', shortname="x") + ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 mm'), longname=u'y-Axis', shortname="y") result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], longname='Osc Heightmap', shortname='h') result.seal() return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-24 23:33:18
|
Revision: 138 http://pyphant.svn.sourceforge.net/pyphant/?rev=138&view=rev Author: zklaus Date: 2007-10-24 16:33:16 -0700 (Wed, 24 Oct 2007) Log Message: ----------- r1286@zaphodb: ford | 2007-10-25 01:31:12 +0200 - Added some unicode marker. Modified Paths: -------------- trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:1286 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-23 14:24:28 UTC (rev 137) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-24 23:33:16 UTC (rev 138) @@ -48,7 +48,7 @@ return {} def startSection(root, l): - if l == 'MESSDATEN': + if l == u'MESSDATEN': root[l] = [] else: root[l] = {} @@ -62,11 +62,11 @@ ff = l.split('\t') section.append([float(f) for f in ff]) -LINE_HANDLER = { 'Section': startSection, - 'GLOBAL': addAttributeLine, - 'MESSUNG': addAttributeLine, - 'SPALTENBESCHRIFTUNG': addAttributeLine, - 'MESSDATEN': addTableLine } +LINE_HANDLER = { u'Section': startSection, + u'GLOBAL': addAttributeLine, + u'MESSUNG': addAttributeLine, + u'SPALTENBESCHRIFTUNG': addAttributeLine, + u'MESSDATEN': addTableLine } def loadOscFromFile(filename, subscriber=0): z = zipfile.ZipFile(filename, 'r') @@ -78,13 +78,13 @@ subscriber %= float(i)/total*100.0 container = constructTemplate(data) for d in data: - for dicname in ('GLOBAL','MESSUNG'): + for dicname in (u'GLOBAL',u'MESSUNG'): for k in d[dicname].keys(): container[k].append(d[dicname][k]) for i in xrange(1,5): col = "SPALTE%i" % i - container[d['SPALTENBESCHRIFTUNG'][col]].append(d['MESSDATEN'][:,i-1]) - container['WhiteRef[counts]'].append(d['MESSDATEN'][:,4]) + container[d[u'SPALTENBESCHRIFTUNG'][col]].append(d[u'MESSDATEN'][:,i-1]) + container[u'WhiteRef[counts]'].append(d[u'MESSDATEN'][:,4]) cols = [DataContainer.FieldContainer(numpy.array(v), longname=k) for k,v in container.iteritems()] return DataContainer.SampleContainer(cols) @@ -92,12 +92,12 @@ def constructTemplate(data): template = data[0] container = {} - for k in template['GLOBAL'].keys()+template['MESSUNG'].keys(): + for k in template[u'GLOBAL'].keys()+template[u'MESSUNG'].keys(): container[k] = [] for i in xrange(1,5): k = "SPALTE%i" % i - container[template['SPALTENBESCHRIFTUNG'][k]] = [] - container['WhiteRef[counts]'] = [] + container[template[u'SPALTENBESCHRIFTUNG'][k]] = [] + container[u'WhiteRef[counts]'] = [] return container @@ -110,10 +110,10 @@ secId = 'root' for l in ll: if l.startswith('[') and l.endswith(']'): - section, secId = LINE_HANDLER['Section'](root, l[1:-1]) + section, secId = LINE_HANDLER[u'Section'](root, l[1:-1]) else: LINE_HANDLER[secId](section, l) - root['MESSDATEN'] = numpy.array(root['MESSDATEN']) + root[u'MESSDATEN'] = numpy.array(root[u'MESSDATEN']) return root This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-10-23 14:24:28
|
Revision: 137 http://pyphant.svn.sourceforge.net/pyphant/?rev=137&view=rev Author: liehr Date: 2007-10-23 07:24:28 -0700 (Tue, 23 Oct 2007) Log Message: ----------- r3267@orion: obi | 2007-10-23 16:14:00 +0200 - Added test checking the creation of SampleContainers with string elements (uncomplete). - Added test checking the creation of a SampleContainer from a single FieldContainer (fails). Modified Paths: -------------- trunk/src/pyphant/pyphant/tests/TestDataContainer.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:3267 Modified: trunk/src/pyphant/pyphant/tests/TestDataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestDataContainer.py 2007-10-23 14:23:45 UTC (rev 136) +++ trunk/src/pyphant/pyphant/tests/TestDataContainer.py 2007-10-23 14:24:28 UTC (rev 137) @@ -176,6 +176,21 @@ else: self.fail("Modification of sealed FieldContainer was not prohibited.") + def testSingleSample(self): + #string = numpy.rec.fromrecords([(s,) for s in [u'Hello',u'World!',u'Bäh!']]) +# strings = + uField = FieldContainer(scipy.array([u'Hello',u'World!',u'Bäh!']),longname=u'Text',shortname='\gamma') + table = SampleContainer(uField) + + def testStringSample(self): + #string = numpy.rec.fromrecords([(s,) for s in [u'Hello',u'World!',u'Bäh!']]) +# strings = + uField = FieldContainer(scipy.array([u'Hello',u'World!',u'Bäh!']),longname=u'Text',shortname='\gamma') + sample = SampleContainer([uField]) + sample.seal() + print sample,sample.data + + class TestCreateDType(unittest.TestCase): def setUp(self): self.dim = 11 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-10-23 14:23:42
|
Revision: 136 http://pyphant.svn.sourceforge.net/pyphant/?rev=136&view=rev Author: liehr Date: 2007-10-23 07:23:45 -0700 (Tue, 23 Oct 2007) Log Message: ----------- r3235@orion (orig r135): liehr | 2007-10-18 15:40:46 +0200 First attempts to fix the bug. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/PyTablesPersister.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 + 3321fe91-ea1f-0410-9b6b-81c2d13ccd49:/branches/PyTablesHack:135 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 Modified: trunk/src/pyphant/pyphant/core/PyTablesPersister.py =================================================================== --- trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2007-10-18 13:40:46 UTC (rev 135) +++ trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2007-10-23 14:23:45 UTC (rev 136) @@ -138,16 +138,23 @@ return resId def saveSample(h5, resultGroup, result): - desc=buildDescription(result.desc) + desc = result.desc + descDict = {} + for name in desc.names: + origDType = desc.fields[name][0] + if origDType.char == 'U': + strings = result.data[name].tolist() + utfLen = [len(string.encode('utf-8')) for string in strings] + maxLen = max(utfLen) + descDict["col_"+name.encode("utf-8")]=StringCol(maxLen) + + else: + descDict["col_"+name.encode("utf-8")]=Col.from_dtype(desc.fields[name][0])#Col(dtype=descStr.capitalize()) + desc = descDict dataTable = h5.createTable(resultGroup, "data", desc, result.longname.encode("utf-8")) keys = [key[4:] for key in desc.keys()] - data=scipy.transpose(scipy.array([result.data[key].tolist() for key in keys])) header=[key.encode("utf-8") for key in keys] - for line in data: - row=dataTable.row - for i, key in enumerate(header): - row["col_"+key]=line[i] - row.append() + dataTable.append(result.data) dataTable.flush() h5.setNodeAttr(resultGroup, "desc", result.desc) units = [repr(unit).encode("utf-8") for unit in result.units] @@ -165,14 +172,6 @@ u.append() unitsTable.flush() -def buildDescription(desc): - descDict = {} - for name in desc.names: - descStr = str(desc.fields[name][0]) - print desc.fields[name], ";",descStr - descDict["col_"+name.encode("utf-8")]=Col.from_dtype(desc.fields[name][0])#Col(dtype=descStr.capitalize()) - return descDict - def saveField(h5, resultGroup, result): h5.createArray(resultGroup, "data", result.data, result.longname.encode("utf-8")) if result.error: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-10-18 13:40:41
|
Revision: 135 http://pyphant.svn.sourceforge.net/pyphant/?rev=135&view=rev Author: liehr Date: 2007-10-18 06:40:46 -0700 (Thu, 18 Oct 2007) Log Message: ----------- First attempts to fix the bug. Modified Paths: -------------- branches/PyTablesHack/src/pyphant/pyphant/core/PyTablesPersister.py Modified: branches/PyTablesHack/src/pyphant/pyphant/core/PyTablesPersister.py =================================================================== --- branches/PyTablesHack/src/pyphant/pyphant/core/PyTablesPersister.py 2007-10-18 13:39:01 UTC (rev 134) +++ branches/PyTablesHack/src/pyphant/pyphant/core/PyTablesPersister.py 2007-10-18 13:40:46 UTC (rev 135) @@ -138,16 +138,23 @@ return resId def saveSample(h5, resultGroup, result): - desc=buildDescription(result.desc) + desc = result.desc + descDict = {} + for name in desc.names: + origDType = desc.fields[name][0] + if origDType.char == 'U': + strings = result.data[name].tolist() + utfLen = [len(string.encode('utf-8')) for string in strings] + maxLen = max(utfLen) + descDict["col_"+name.encode("utf-8")]=StringCol(maxLen) + + else: + descDict["col_"+name.encode("utf-8")]=Col.from_dtype(desc.fields[name][0])#Col(dtype=descStr.capitalize()) + desc = descDict dataTable = h5.createTable(resultGroup, "data", desc, result.longname.encode("utf-8")) keys = [key[4:] for key in desc.keys()] - data=scipy.transpose(scipy.array([result.data[key].tolist() for key in keys])) header=[key.encode("utf-8") for key in keys] - for line in data: - row=dataTable.row - for i, key in enumerate(header): - row["col_"+key]=line[i] - row.append() + dataTable.append(result.data) dataTable.flush() h5.setNodeAttr(resultGroup, "desc", result.desc) units = [repr(unit).encode("utf-8") for unit in result.units] @@ -165,14 +172,6 @@ u.append() unitsTable.flush() -def buildDescription(desc): - descDict = {} - for name in desc.names: - descStr = str(desc.fields[name][0]) - print desc.fields[name], ";",descStr - descDict["col_"+name.encode("utf-8")]=Col.from_dtype(desc.fields[name][0])#Col(dtype=descStr.capitalize()) - return descDict - def saveField(h5, resultGroup, result): h5.createArray(resultGroup, "data", result.data, result.longname.encode("utf-8")) if result.error: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <li...@us...> - 2007-10-18 13:38:57
|
Revision: 134 http://pyphant.svn.sourceforge.net/pyphant/?rev=134&view=rev Author: liehr Date: 2007-10-18 06:39:01 -0700 (Thu, 18 Oct 2007) Log Message: ----------- On-going bug fixes for saving of complex recarrays. Added Paths: ----------- branches/PyTablesHack/ Copied: branches/PyTablesHack (from rev 133, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-12 10:15:04
|
Revision: 133 http://pyphant.svn.sourceforge.net/pyphant/?rev=133&view=rev Author: zklaus Date: 2007-10-12 03:14:50 -0700 (Fri, 12 Oct 2007) Log Message: ----------- r429@localhost: ford | 2007-10-12 11:46:18 +0200 - Moved createDType in DataContainer.py to a more reasonable place. - Added various OscWorkers in OscLoader.py, all in all allowing for the creation of heightmaps from osc data. - Modified SampleContainer and ChartVisualiser to better cope with sample like data. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/pyphant/pyphant/visualizers/Chart.py trunk/src/workers/OSC/OSC/OscLoader.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:411 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 + 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:429 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-08 17:31:17 UTC (rev 132) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2007-10-12 10:14:50 UTC (rev 133) @@ -104,33 +104,6 @@ resUri = urlparse.urlsplit(id) return resUri[2].split('/')[-1].split('.') #(hash, uriType) -def createDType(columns): - """Returns numpy.dtype object describing the provided list of - FieldContainers.""" - names = [col.shortname for col in columns] - formats = [numpy.dtype(str(col.data.shape[1:])+col.data.dtype.str) for col in columns] - titles = [col.longname for col in columns] - - nameList = True - for listing in [names,titles]: - for topic in listing: - N = listing.count(topic) - if N > 1: - for j in xrange(N): - pos = listing.index(topic) - if nameList: - listing[pos] += str(j) - else: - listing[pos] += names[j].capitalize() - nameList = False - - #Workaround for numpy ticket 485 - if numpy.__version__ == '1.0.1': - result = scipy.dtype({'names':names, 'formats':formats}) - else: - result = scipy.dtype({'names':names, 'formats':formats, 'titles':titles}) - return result - class DataContainer(object): u"""DataContainer \t- A Pyphant base class for self-explanatory scientific data \nDataContainer presents the following attributes: @@ -303,6 +276,34 @@ return not self.__eq__(other) +def createDType(columns): + """Returns numpy.dtype object describing the provided list of + FieldContainers.""" + names = [col.shortname for col in columns] + formats = [numpy.dtype(str(col.data.shape[1:])+col.data.dtype.str) for col in columns] + titles = [col.longname for col in columns] + + nameList = True + for listing in [names,titles]: + for topic in listing: + N = listing.count(topic) + if N > 1: + for j in xrange(N): + pos = listing.index(topic) + if nameList: + listing[pos] += str(j) + else: + listing[pos] += names[j].capitalize() + nameList = False + + #Workaround for numpy ticket 485 + if numpy.__version__ == '1.0.1': + result = scipy.dtype({'names':names, 'formats':formats}) + else: + result = scipy.dtype({'names':names, 'formats':formats, 'titles':titles}) + return result + + class SampleContainer(DataContainer): u"""SampleContainer(columns, longname='Realizations of random variable', shortname='X') \t Class of tables storing realizations of random variables as recarray @@ -329,6 +330,9 @@ self.desc = createDType(columns) self.data = scipy.rec.fromarrays([col.data for col in columns], self.desc) self.units= [col.unit for col in columns] + self._units = {} + for i in xrange(len(self.units)): + self._units[self.data.dtype.descr[i][0][1]] = columns[i].unit def _getLabel(self): @@ -364,3 +368,13 @@ super(SampleContainer, self).seal(id) self.lock.release() + def recreateFieldContainers(self): + fields = [ d[0] for d in self.data.dtype.descr ] + containers = {} + for field in fields: + container = FieldContainer( self.data[field[1]], + unit = self._units[field[1]], + longname=field[0], + shortname=field[1]) + containers[field[0]]=container + return containers Modified: trunk/src/pyphant/pyphant/visualizers/Chart.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-08 17:31:17 UTC (rev 132) +++ trunk/src/pyphant/pyphant/visualizers/Chart.py 2007-10-12 10:14:50 UTC (rev 133) @@ -39,6 +39,7 @@ import pylab import pyphant.core.Connectors +from pyphant.core import DataContainer from pyphant.wxgui2.DataVisReg import DataVisReg from Scientific.Physics.PhysicalQuantities import isPhysicalQuantity @@ -46,16 +47,35 @@ name='General chart' def __init__(self, dataContainer): self.dataContainer = dataContainer + self.ordinates = [] + self.abscissae = [] + self.mins = [] + + def addFieldContainer(self, fieldContainer): + if not isPhysicalQuantity(fieldContainer.unit): + self.ordinates.append(fieldContainer.data*self.dataContainer.unit) + else: + self.ordinates.append(fieldContainer.data*fieldContainer.unit.value) + self.abscissae.append(fieldContainer.dimensions[0].data) + def prepare(self): pylab.figure() - if not isPhysicalQuantity(self.dataContainer.unit): - self.ordinate = self.dataContainer.data*self.dataContainer.unit + if isinstance(self.dataContainer, DataContainer.FieldContainer): + self.addFieldContainer(self.dataContainer) + pylab.xlabel(self.dataContainer.dimensions[0].label) + pylab.ylabel(self.dataContainer.label) else: - self.ordinate = self.dataContainer.data*self.dataContainer.unit.value - self.abscissa = self.dataContainer.dimensions[0] - pylab.xlabel(self.abscissa.label) - pylab.ylabel(self.dataContainer.label) + data = self.dataContainer.recreateFieldContainers() + lam = data[u'Wellenlänge[nm]'] + abso = data[u'Absorption'] + mins = data[u'Minima'] + for i in xrange(len(lam.data)): + self.ordinates.append(abso.data[i]) + self.abscissae.append(lam.data[i]) + self.mins.append(mins.data[i]) + pylab.xlabel(lam.label) + pylab.ylabel(abso.label) def finalize(self): pylab.ion() @@ -69,10 +89,11 @@ self.prepare() # xerr and yerr added due to error in matplotlib 0.87.4 self.error = pylab.zeros(len(self.abscissa.data)) - pylab.bar(self.abscissa.data,self.ordinate, - xerr = self.error,yerr = self.error, - capsize=0, - width=pylab.min(pylab.diff(self.abscissa.data))) + for i in xrange(len(self.ordinates)): + pylab.bar(self.abscissae[i],self.ordinates[i], + xerr = self.error,yerr = self.error, + capsize=0, + width=pylab.min(pylab.diff(self.abscissae[i]))) self.finalize() @@ -81,7 +102,10 @@ def __init__(self, dataContainer): Chart.__init__(self, dataContainer) self.prepare() - pylab.plot(self.abscissa.data,self.ordinate) + for i in xrange(len(self.ordinates)): + pylab.plot(self.abscissae[i],self.ordinates[i]) + for i in xrange(len(self.mins)): + pylab.axvline(self.mins[i]) self.finalize() Modified: trunk/src/workers/OSC/OSC/OscLoader.py =================================================================== --- trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-08 17:31:17 UTC (rev 132) +++ trunk/src/workers/OSC/OSC/OscLoader.py 2007-10-12 10:14:50 UTC (rev 133) @@ -41,6 +41,8 @@ from pyphant.core import (Worker, Connectors, Param, DataContainer) +import scipy.interpolate +from Scientific.Physics import PhysicalQuantities def makeRoot(pixelName, ll): return {} @@ -136,25 +138,118 @@ name = "Osc Absorption Calculator" _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("clipping", "Clipping", 1, None)] @Worker.plug(Connectors.TYPE_ARRAY) def calcAbsorption(self, osc, subscriber=0): - #resArr = copy.deepcopy(osc.data) - resArr = osc.data - I = resArr[u'ScopRaw[counts]'] - print I.shape - #del resArr[u'ScopRaw[counts]'][0] - I_d = resArr[u'DarkRef[counts]'] - #del resArr[u'DarkRef[counts]'][0] - I_0 = resArr[u'WhiteRef[counts]'] - #del resArr[u'WhiteRef[counts]'][0] - c = resArr[u'Unkorrigierte Reflexion[counts]'] - #del resArr[u'Unkorrigierte Reflexion[counts]'][0] - l = resArr[u'Wellenlänge[nm]'] - #del resArr[u'Wellenlänge[nm]'][0] - A = -((I-I_d)/(I_0-I_d)-1) - lam = DataContainer.FieldContainer(l, 'nm', longname=u'Wellenlänge', shortname=u'\\lambda') - result = DataContainer.FieldContainer(A[20], dimensions=[lam], longname='Absorption', shortname='A') + cont = osc.recreateFieldContainers() + I = cont[u'ScopRaw[counts]'] + I_d = cont[u'DarkRef[counts]'] + I_0 = cont[u'WhiteRef[counts]'] + A = -((I.data-I_d.data)/(I_0.data-I_d.data)-1) + if self.paramClipping.value==1: + A[A>1] = 0 + A[A<0] = 0 + Abso = DataContainer.FieldContainer(A, longname='Absorption', shortname='A') + result = DataContainer.SampleContainer(cont.values()+[Abso], longname='Osc data', shortname='O') result.seal() return result + +class OscAbsorptionExtractor(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Osc Absorption Spectrum" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("index", "Index", 1, None)] + + @Worker.plug(Connectors.TYPE_ARRAY) + def extractSpec(self, osc, subscriber=0): + data = osc.recreateFieldContainers() + a = data[u'Absorption'] + l = data[u'Wellenlänge[nm]'] + lam = DataContainer.FieldContainer(l.data[self.paramIndex.value], l.unit, l.error, l.dimensions, l.longname, l.shortname) + Abso = DataContainer.FieldContainer(a.data[self.paramIndex.value], a.unit, a.error, [lam], a.longname, l.shortname) + Abso.seal() + return Abso + + +class OscMinimumFinder(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Minimum finder" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + _params = [("lower", "Lower Bound", 380, None), + ("upper", "Upper Bound", 500, None)] + + @Worker.plug(Connectors.TYPE_ARRAY) + def findMinimum(self, osc, subscriber=0): + data = osc.recreateFieldContainers() + Abso = data[u'Absorption'] + lam = data[u'Wellenlänge[nm]'] + as = [] + ls = [] + mins = [] + l = lam.data[0] + hs = [] + lower = numpy.argwhere(l>self.paramLower.value)[0][0] + upper = numpy.argwhere(l<self.paramUpper.value)[-1][0] + count = len(lam.data) + for i in xrange(count): + l = lam.data[i][lower:upper] + a = Abso.data[i][lower:upper] + tck = scipy.interpolate.splrep(l, a, s=len(l)-numpy.sqrt(2*len(l))) + a = scipy.interpolate.splev(l, tck, 0) + d1 = scipy.interpolate.splev(l, tck, 1) + d2 = scipy.interpolate.splev(l, tck, 2) + j = numpy.abs(d1).argmin() + if d2[j]>0: + mins.append(l[j]) + hs.append(l[j]*1.4-427.0) + else: + mins.append(0) + hs.append(0) + as.append(a) + ls.append(l) + subscriber %= float(i)*100.0/float(count) + data[u'Absorption'] = DataContainer.FieldContainer(numpy.array(as), longname='Absorption', shortname='A') + data[u'Wellenlänge[nm]'] = DataContainer.FieldContainer(numpy.array(ls), longname=lam.longname, shortname=lam.shortname) + data[u'Minima'] = DataContainer.FieldContainer(numpy.array(mins), longname=u'Minima', shortname='m') + data[u'Höhe'] = DataContainer.FieldContainer(numpy.array(hs), unit=PhysicalQuantities.PhysicalQuantity('1 nm'), longname=u'Höhe', shortname='h') + result = DataContainer.SampleContainer(data.values(), longname='Osc data', shortname='O') + result.seal() + return result + + +class OscMapper(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Osc Mapper" + + _sockets = [("osc", Connectors.TYPE_ARRAY)] + + @Worker.plug(Connectors.TYPE_IMAGE) + def mapHeights(self, osc, subscriber=0): + d = 4 + data = osc.recreateFieldContainers() + xf = numpy.array(data[u'TISCH_POS_X'].data, dtype='float') + yf = numpy.array(data[u'TISCH_POS_Y'].data, dtype='float') + x = (xf*10).astype('int') + y = (yf*10).astype('int') + x = x-x.min() + y = y-y.min() + h = data[u'Höhe'].data + m = h[h>0].min() + img = numpy.ones((y.max(), x.max()))*m + for i in xrange(len(x)): + img[y[i]-d:y[i]+d,x[i]-d:x[i]+d]=max(h[i], m) + xdim = DataContainer.FieldContainer(xf, PhysicalQuantities.PhysicalQuantity('1 cm'), longname=u'x-Axis', shortname="x") + ydim = DataContainer.FieldContainer(yf, PhysicalQuantities.PhysicalQuantity('1 cm'), longname=u'y-Axis', shortname="y") + result = DataContainer.FieldContainer(img, PhysicalQuantities.PhysicalQuantity('1 nm'), dimensions=[xdim, ydim], longname='Osc Heightmap', shortname='h') + result.seal() + return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2007-10-08 17:31:13
|
Revision: 132 http://pyphant.svn.sourceforge.net/pyphant/?rev=132&view=rev Author: zklaus Date: 2007-10-08 10:31:17 -0700 (Mon, 08 Oct 2007) Log Message: ----------- r409@charon: zklaus | 2007-10-08 19:31:01 +0200 - Removed old debug code. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/CompositeWorker.py Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:411 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 + 6f7b97d4-f842-44fd-9373-9f8d51b2dfcf:/local/pyphant/sourceforge:2719 8bf637c1-38a7-4b57-b48d-fce0f21498c5:/local/pyphant:411 bece090c-e03b-4a9e-a238-bce0435dd73a:/local/pyphant:409 e121922d-4398-4060-8276-e26c71b599e4:/local/pyphant/sourceforge:367 ffafd7c2-a18e-42a0-a535-81fd4436fb1c:/local/pyphant/sourceforge/trunk:2958 Modified: trunk/src/pyphant/pyphant/core/CompositeWorker.py =================================================================== --- trunk/src/pyphant/pyphant/core/CompositeWorker.py 2007-10-01 08:01:50 UTC (rev 131) +++ trunk/src/pyphant/pyphant/core/CompositeWorker.py 2007-10-08 17:31:17 UTC (rev 132) @@ -40,9 +40,6 @@ from pyphant.core import EventDispatcher, Worker, Connectors import copy, pkg_resources -pkg_resources.require('Pyphant_ImageProcessing') -import ImageProcessing.ThresholdingWorker - class CompositeWorkerChangedEvent(object): def __init__(self, worker, message, data=None): self.worker = worker @@ -81,13 +78,6 @@ _params = [("noSockets", "Number of sockets", 1, None), ("noPlugs", "Number of plugs", 1, None)] -# def __init__(self, parent=None, annotations={}): -# Worker.Worker.__init__(self, parent, annotations) -# th = ImageProcessing.ThresholdingWorker.ThresholdingWorker() -# self.addWorker(th) -# (th.getSockets()[0]).insert(self.socketSocket0) -# self.plugPlug0.insert(th.getPlugs()[0]) - def inithook(self): self._workers = [] self._sources = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |