From: <zk...@us...> - 2009-04-03 12:48:47
|
Revision: 632 http://pyphant.svn.sourceforge.net/pyphant/?rev=632&view=rev Author: zklaus Date: 2009-04-03 12:48:38 +0000 (Fri, 03 Apr 2009) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Enh: Attributes of FieldContainers are printed to the Full Metdata Format viewer BugFix: Correct handling of attributes Longname and symbol of MRA worker can be set by the user. Corrected syntax error in setup.py of fmfile module. Corrected typo in FMFWriter module. Modified Paths: -------------- trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/workers/OSC/OSC/MRA.py trunk/src/workers/OSC/OSC/OscAbsorption.py trunk/src/workers/fmfile/fmfile/FMFLoader.py trunk/src/workers/fmfile/fmfile/FMFWriter.py trunk/src/workers/fmfile/setup.py Property Changed: ---------------- trunk/src/workers/fmfile/fmfile/FMFWriter.py Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2009-04-03 12:48:38 UTC (rev 632) @@ -120,7 +120,7 @@ def __init__(self, longname, shortname, attributes=None): self.longname = longname self.shortname = shortname - if attributes: + if type(attributes) == type({}): self.attributes = attributes else: self.attributes = {} Modified: trunk/src/workers/OSC/OSC/MRA.py =================================================================== --- trunk/src/workers/OSC/OSC/MRA.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/workers/OSC/OSC/MRA.py 2009-04-03 12:48:38 UTC (rev 632) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2008, Rectorate of the University of Freiburg +# Copyright (c) 2008-2009, Rectorate of the University of Freiburg # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -111,12 +111,14 @@ class MRA(Worker.Worker): API = 2 - VERSION = 1 + VERSION = 2 REVISION = "$Revision$"[11:-1] name = "Multi Resolution Analyser" _sockets = [("field", Connectors.TYPE_IMAGE)] - _params = [("scale", u"Scale", "200 nm", None)] + _params = [("scale", u"Scale", "200 nm", None), + ("longname",u"Name of result",'default',None), + ("symbol",u"Symbol of result",'default',None)] @Worker.plug(Connectors.TYPE_IMAGE) def mra(self, field, subscriber=0): @@ -160,6 +162,10 @@ mask = numpy.isnan(pos).transpose(), longname="%s of the local %s of %s" % (dim.longname,"minima",field.longname), shortname="%s_0" % dim.shortname) + if self.paramLongname.value != 'default': + roots.longname = self.paramLongname.value + if self.paramSymbol.value != 'default': + roots.shortname = self.paramSymbol.value roots.seal() return roots Modified: trunk/src/workers/OSC/OSC/OscAbsorption.py =================================================================== --- trunk/src/workers/OSC/OSC/OscAbsorption.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/workers/OSC/OSC/OscAbsorption.py 2009-04-03 12:48:38 UTC (rev 632) @@ -120,7 +120,7 @@ def extract(self, osc, subscriber=0): col = osc[self.paramColumn.value] if self.paramIndex.value=='All': - result = col + result = copy.deepcopy(col) else: index = int(self.paramIndex.value) if len(col.dimensions)>1: @@ -137,6 +137,7 @@ dimensions = [dim], longname=col.longname, shortname=col.shortname) + result.attributes = osc.attributes result.seal() return result Modified: trunk/src/workers/fmfile/fmfile/FMFLoader.py =================================================================== --- trunk/src/workers/fmfile/fmfile/FMFLoader.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/workers/fmfile/fmfile/FMFLoader.py 2009-04-03 12:48:38 UTC (rev 632) @@ -236,7 +236,9 @@ newField.dimensions[dim]=independentFields[indepField] assert newField.isValid() containers.append(newField) - return DataContainer.SampleContainer(containers,attributes=commonAttr) + result = DataContainer.SampleContainer(containers,attributes=commonAttr) + print "FMFLoader",result.attributes + return result def reshapeField(field): if field.isIndependent(): Modified: trunk/src/workers/fmfile/fmfile/FMFWriter.py =================================================================== --- trunk/src/workers/fmfile/fmfile/FMFWriter.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/workers/fmfile/fmfile/FMFWriter.py 2009-04-03 12:48:38 UTC (rev 632) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2008, Rectorate of the University of Freiburg +# Copyright (c) 2008-2009, Rectorate of the University of Freiburg # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -39,7 +39,7 @@ enc=lambda s: unicode(s, "utf-8") -import platform,os +import platform,os,socket,datetime pltform=platform.system() if pltform=='Linux' or pltform=='Darwin': USER=enc(os.environ['LOGNAME']) @@ -66,6 +66,17 @@ factory = fmfgen.gen_factory(out_coding='utf-8', eol='\n') fc = factory.gen_fmf() fc.add_reference_item('author', USER) + fc.add_reference_item('title',fieldContainer.longname) + fc.add_reference_item('place',socket.getfqdn()) + fc.add_reference_item('created',datetime.datetime.utcnow().isoformat()) + sec = factory.gen_section("parameters") + for key,value in fieldContainer.attributes.iteritems(): + if type(value)==type([]): + output = ' '.join(value) + else: + output = str(value) + sec.add_item(key,output) + fc.add_section(sec) if len(fieldContainer.data.shape)==1: dim = fieldContainer.dimensions[0] if fieldContainer.error == None: @@ -84,7 +95,7 @@ dependencies = [dim.shortname], error = errorSymbol) if fieldContainer.error != None: - tab.add_column_def(u"encertainty of %s" % fieldContainer.longname, + tab.add_column_def(u"uncertainty of %s" % fieldContainer.longname, errorSymbol, str(fieldContainer.unit)) elif fieldContainer.dimensions[0].isIndex(): @@ -111,13 +122,45 @@ return str(fc) import wx +ID_EXIT = 102 +class FMFframe(wx.Frame): + def __init__(self,parent, ID, title): + wx.Frame.__init__(self,parent,ID, title, + wx.DefaultPosition,wx.Size(300,300)) + self.CreateStatusBar() + self.SetStatusText("Full-Metadata Format") + p = wx.Panel(self) + menuBar = wx.MenuBar() + menu = wx.Menu() + menu.Append(101, "&About", + "Full-Metadata Format Viewer") + menu.AppendSeparator() + menu.Append(ID_EXIT,"E&xit","Terminate the program") + menuBar.Append(menu,"&File") + self.SetMenuBar(menuBar) + + wx.EVT_MENU(self,ID_EXIT, self.timeToQuit) + + def timeToQuit(self,event): + self.Close(True) + class TextFrame(wx.Frame): def __init__(self,fmf): wx.Frame.__init__(self,None,-1,'FMFWriter', size=(300,200)) multiText = wx.TextCtrl(self,-1,fmf,size=(200,200),style=wx.TE_MULTILINE) multiText.SetInsertionPoint(0) +class MyApp(wx.App): + def OnInit(self): + frame = FMFframe(None,-1,"Pyphant Full-Metadata Format Viewer") + frame.Show(True) + return True + + def OnExit(self): + self.ExitMainLoop() + wx.Exit() + class FMFWriter(object): name='FMF Writer' def __init__(self, fieldContainer,show=True): Property changes on: trunk/src/workers/fmfile/fmfile/FMFWriter.py ___________________________________________________________________ Added: svn:executable + * Modified: trunk/src/workers/fmfile/setup.py =================================================================== --- trunk/src/workers/fmfile/setup.py 2009-04-03 12:48:08 UTC (rev 631) +++ trunk/src/workers/fmfile/setup.py 2009-04-03 12:48:38 UTC (rev 632) @@ -22,7 +22,7 @@ description = __doc__, install_requires=['pyphant>=0.4alpha3', 'ConfigObj' - ] + ], packages = ['fmfile'], entry_points = """ [pyphant.workers] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |