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: <ah...@us...> - 2011-12-09 09:45:36
|
Revision: 718 http://pyphant.svn.sourceforge.net/pyphant/?rev=718&view=rev Author: aheld84 Date: 2011-12-09 09:45:30 +0000 (Fri, 09 Dec 2011) Log Message: ----------- cloned pyphant-1.0b1 Added Paths: ----------- branches/pyphant-1.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-09 09:42:39
|
Revision: 717 http://pyphant.svn.sourceforge.net/pyphant/?rev=717&view=rev Author: aheld84 Date: 2011-12-09 09:42:33 +0000 (Fri, 09 Dec 2011) Log Message: ----------- cloned pyphant-0.8a2 Added Paths: ----------- branches/pyphant-0.8/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-08 17:18:01
|
Revision: 716 http://pyphant.svn.sourceforge.net/pyphant/?rev=716&view=rev Author: aheld84 Date: 2011-12-08 17:17:55 +0000 (Thu, 08 Dec 2011) Log Message: ----------- Merge commit '38194039bb04c97cb0a7962c8b0427e7f54f6b85' into svn-tag-pyphant-0.8a1 * commit '38194039bb04c97cb0a7962c8b0427e7f54f6b85': Configured release (version numbering, no .dev tagging). Modified Paths: -------------- tags/pyphant-0.8a1/src/pyphant/setup.cfg tags/pyphant-0.8a1/src/pyphant/setup.py tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py tags/pyphant-0.8a1/src/workers/OSC/setup.cfg tags/pyphant-0.8a1/src/workers/OSC/setup.py tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg tags/pyphant-0.8a1/src/workers/Statistics/setup.py tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg tags/pyphant-0.8a1/src/workers/fmfile/setup.py tags/pyphant-0.8a1/src/workers/tools/setup.cfg tags/pyphant-0.8a1/src/workers/tools/setup.py Modified: tags/pyphant-0.8a1/src/pyphant/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/pyphant/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/pyphant/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/pyphant/setup.py =================================================================== --- tags/pyphant-0.8a1/src/pyphant/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/pyphant/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -4,7 +4,7 @@ __id__ = '$Id: $' __revision__ = '$Revision: 25 $' -VERSION = '0.5' +VERSION = '0.8a1' from setuptools import setup, find_packages Modified: tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py =================================================================== --- tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -14,7 +14,7 @@ __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a1' import setuptools Modified: tags/pyphant-0.8a1/src/workers/OSC/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/workers/OSC/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/OSC/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/workers/OSC/setup.py =================================================================== --- tags/pyphant-0.8a1/src/workers/OSC/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/OSC/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -11,7 +11,7 @@ __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a1' import setuptools Modified: tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/workers/Statistics/setup.py =================================================================== --- tags/pyphant-0.8a1/src/workers/Statistics/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/Statistics/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -14,7 +14,7 @@ __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a1' import setuptools Modified: tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/workers/fmfile/setup.py =================================================================== --- tags/pyphant-0.8a1/src/workers/fmfile/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/fmfile/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -11,7 +11,7 @@ __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a1' import setuptools Modified: tags/pyphant-0.8a1/src/workers/tools/setup.cfg =================================================================== --- tags/pyphant-0.8a1/src/workers/tools/setup.cfg 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/tools/setup.cfg 2011-12-08 17:17:55 UTC (rev 716) @@ -1,4 +1 @@ # -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a1/src/workers/tools/setup.py =================================================================== --- tags/pyphant-0.8a1/src/workers/tools/setup.py 2011-12-08 17:15:44 UTC (rev 715) +++ tags/pyphant-0.8a1/src/workers/tools/setup.py 2011-12-08 17:17:55 UTC (rev 716) @@ -11,7 +11,7 @@ __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a1' import setuptools @@ -20,7 +20,7 @@ version = VERSION, author = __author__, description = __doc__, - install_requires=['pyphant>=0.4alpha3'], + install_requires=['pyphant>=0.8a1'], packages = ['tools'], entry_points = """ [pyphant.workers] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-08 17:15:53
|
Revision: 715 http://pyphant.svn.sourceforge.net/pyphant/?rev=715&view=rev Author: aheld84 Date: 2011-12-08 17:15:44 +0000 (Thu, 08 Dec 2011) Log Message: ----------- cloned r699 Revision Links: -------------- http://pyphant.svn.sourceforge.net/pyphant/?rev=699&view=rev Added Paths: ----------- tags/pyphant-0.8a1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-08 17:12:44
|
Revision: 714 http://pyphant.svn.sourceforge.net/pyphant/?rev=714&view=rev Author: aheld84 Date: 2011-12-08 17:12:37 +0000 (Thu, 08 Dec 2011) Log Message: ----------- Merge branch 'v0.8' into svn-tag-pyphant-0.8a2 * v0.8: Configured release for v0.8a2 Fix: Bin centers of Histogram worker Fix: wxPyphant hangs upon exiting Configured release (version numbering, no .dev tagging). Modified Paths: -------------- tags/pyphant-0.8a2/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py tags/pyphant-0.8a2/src/pyphant/setup.py tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.py tags/pyphant-0.8a2/src/workers/OSC/setup.py tags/pyphant-0.8a2/src/workers/Statistics/Statistics/Histogram.py tags/pyphant-0.8a2/src/workers/Statistics/setup.py tags/pyphant-0.8a2/src/workers/fmfile/setup.py tags/pyphant-0.8a2/src/workers/tools/setup.py Removed Paths: ------------- tags/pyphant-0.8a2/src/pyphant/setup.cfg tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.cfg tags/pyphant-0.8a2/src/workers/OSC/setup.cfg tags/pyphant-0.8a2/src/workers/Statistics/setup.cfg tags/pyphant-0.8a2/src/workers/fmfile/setup.cfg tags/pyphant-0.8a2/src/workers/tools/setup.cfg Modified: tags/pyphant-0.8a2/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py =================================================================== --- tags/pyphant-0.8a2/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-12-08 17:12:37 UTC (rev 714) @@ -35,7 +35,7 @@ __id__ = "$Id$" __author__ = "$Author$" -__version__ = "Sprint" +__version__ = "0.8a2" # $Source$ import os, os.path, pkg_resources @@ -614,9 +614,10 @@ # wxPyphantFrame is the main frame. self.parent._frame = wxPyphantFrame(self.parent) self.parent._frame.Show() - + # The program will freeze without this line. evt.Skip() # Make sure the default handler runs too... + self.Destroy() import optparse Deleted: tags/pyphant-0.8a2/src/pyphant/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/pyphant/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/pyphant/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/pyphant/setup.py =================================================================== --- tags/pyphant-0.8a2/src/pyphant/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/pyphant/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -4,33 +4,38 @@ __id__ = '$Id: $' __revision__ = '$Revision: 25 $' -VERSION = '0.5' +VERSION = '0.8a2' from setuptools import setup, find_packages -setup( name='pyphant', - version = VERSION, - description='Workflow modelling app', - author='Klaus Zimmermann, Andreas W. Liehr', - author_email='kla...@fm...', - maintainer='Klaus Zimmermann', - maintainer_email='zk...@so...', - license = "BSD", - url='http://pyphant.sourceforge.net/', - install_requires=['sogl>=0.2.0', - 'egenix-mx-base', - 'paste', - 'simplejson', - ## The following are required, but currently not setuptools enabled. - #'ScientificPython>=2.6', - #'matplotlib>=0.90.1', - #'scipy>=0.5.2', - #'tables>=1.4', - #'wxPython>=2.6.3.2', - ], - packages = find_packages(), - entry_points={'gui_scripts':['wxPyphant = pyphant.wxgui2.wxPyphantApplication:startWxPyphant']}, - include_package_data = True, - test_suite = 'pyphant.tests' - ) +setup( + name='pyphant', + version=VERSION, + description='Workflow modelling app', + author='Alexander Held, Andreas W. Liehr, Klaus Zimmermann', + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + url='http://pyphant.sourceforge.net/', + install_requires=[ + 'sogl>=0.2.0', + 'paste', + 'simplejson', + ## The following are required, + ## but currently not setuptools enabled. + #'ScientificPython', + #'matplotlib', + #'scipy', + #'tables', + #'wxPython', + #'egenix-mx-base', + ], + packages=find_packages(), + entry_points={'gui_scripts':[ + 'wxPyphant = pyphant.wxgui2.wxPyphantApplication:startWxPyphant' + ]}, + include_package_data=True, + test_suite='pyphant.tests' + ) Deleted: tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.py =================================================================== --- tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/ImageProcessing/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -9,25 +9,29 @@ http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a2' import setuptools setuptools.setup( - name = "pyphant.imageprocessing", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['ImageProcessing'], - entry_points = """ + name="pyphant.imageprocessing", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=0.8a2'], + packages=['ImageProcessing'], + entry_points=""" [pyphant.workers] myeentry = ImageProcessing """, - test_suite = 'ImageProcessing.tests') - + test_suite='ImageProcessing.tests' + ) Deleted: tags/pyphant-0.8a2/src/workers/OSC/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/workers/OSC/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/OSC/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/workers/OSC/setup.py =================================================================== --- tags/pyphant-0.8a2/src/workers/OSC/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/OSC/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -6,24 +6,29 @@ Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a2' import setuptools setuptools.setup( - name = "pyphant.osc", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['OSC'], - entry_points = """ + name="pyphant.osc", + version=VERSION, + author=__author__, + author_email='kla...@fm...', + maintainer='Klaus Zimmermann', + maintainer_email='kla...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=0.8a2'], + packages=['OSC'], + entry_points=""" [pyphant.workers] myeentry = OSC """, - test_suite='OSC.tests') + test_suite='OSC.tests' + ) Modified: tags/pyphant-0.8a2/src/workers/Statistics/Statistics/Histogram.py =================================================================== --- tags/pyphant-0.8a2/src/workers/Statistics/Statistics/Histogram.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/Statistics/Statistics/Histogram.py 2011-12-08 17:12:37 UTC (rev 714) @@ -42,31 +42,33 @@ # $Source$ from pyphant.core import (Connectors, DataContainer, - Param, Worker) -import scipy, scipy.stats + Worker) import numpy class Histogram(Worker.Worker): API = 2 VERSION = 1 REVISION = "$Revision$"[11:-1] - name = u"Histogram" + name = "Histogram" _sockets=[("vector", Connectors.TYPE_IMAGE)] _params = [("bins", "Bins", 10, None)] @Worker.plug(Connectors.TYPE_IMAGE) def calculateHistogram(self, vector, subscriber=0): bins = self.paramBins.value + assert bins >= 2 + # numpy 1.3 try: histo = numpy.histogram(vector.data.flat, bins, new=True, range=(numpy.floor(vector.data.min()), numpy.ceil(vector.data.max()))) - binCenters = histo[1][:-1]+(numpy.diff(histo[1])/2.0) + # newer numpy versions except TypeError: histo = numpy.histogram(vector.data.flat, bins, range=(numpy.floor(vector.data.min()), numpy.ceil(vector.data.max()))) - binCenters = histo[1]+((histo[1][1]-histo[1][0])/2.0) + binCenters = histo[1][:-1] + (numpy.diff(histo[1]) / 2.0) + assert len(binCenters) == bins == len(histo[0]) xdim = DataContainer.FieldContainer(binCenters, vector.unit, longname=vector.longname, shortname=vector.shortname) Deleted: tags/pyphant-0.8a2/src/workers/Statistics/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/workers/Statistics/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/Statistics/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/workers/Statistics/setup.py =================================================================== --- tags/pyphant-0.8a2/src/workers/Statistics/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/Statistics/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -2,32 +2,36 @@ # -*- coding: utf-8 -*- """ -Pyphant ImageProcessing toolbox -This is the ImageProcessing toolbox, that serves as an example off a -toolbox for the Pyphant framework. In order to use it you must have +Pyphant Statistics toolbox +This is the Statistics toolbox, that provides workers +for the Pyphant framework. In order to use it you must have the Pyphant framework installed first. Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a2' import setuptools setuptools.setup( - name = "pyphant.statistics", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['Statistics'], - entry_points = """ + name="pyphant.statistics", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=0.8a2'], + packages=['Statistics'], + entry_points=""" [pyphant.workers] myeentry = Statistics """, - test_suite = 'Statistics.tests') - + test_suite='Statistics.tests' + ) Deleted: tags/pyphant-0.8a2/src/workers/fmfile/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/workers/fmfile/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/fmfile/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/workers/fmfile/setup.py =================================================================== --- tags/pyphant-0.8a2/src/workers/fmfile/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/fmfile/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -6,28 +6,35 @@ Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Rolf Wuerdemann, " +\ + "Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a2' import setuptools setuptools.setup( - name = "pyphant.fmf", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3', - 'ConfigObj' - ], - packages = ['fmfile'], - entry_points = """ + name="pyphant.fmf", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=[ + 'pyphant>=0.8a2', + 'ConfigObj' + ], + packages=['fmfile'], + entry_points=""" [pyphant.workers] myeentry = fmfile [pyphant.visualizers] pil.image = fmfile.FMFWriter:FMFWriter """, - test_suite='fmfile.tests') + test_suite='fmfile.tests' + ) Deleted: tags/pyphant-0.8a2/src/workers/tools/setup.cfg =================================================================== --- tags/pyphant-0.8a2/src/workers/tools/setup.cfg 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/tools/setup.cfg 2011-12-08 17:12:37 UTC (rev 714) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-0.8a2/src/workers/tools/setup.py =================================================================== --- tags/pyphant-0.8a2/src/workers/tools/setup.py 2011-12-08 17:05:59 UTC (rev 713) +++ tags/pyphant-0.8a2/src/workers/tools/setup.py 2011-12-08 17:12:37 UTC (rev 714) @@ -2,28 +2,33 @@ # -*- coding: utf-8 -*- """ -Pyphant Organic Solar Cells toolbox +Pyphant Tools toolbox Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Kai Kaminski" +__author__ = "Alexander Held, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '0.8a2' import setuptools setuptools.setup( - name = "pyphant.tools", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['tools'], - entry_points = """ + name="pyphant.tools", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=0.8a2'], + packages=['tools'], + entry_points=""" [pyphant.workers] myeentry = tools """, - test_suite='tools.tests') + test_suite='tools.tests' + ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-08 17:06:10
|
Revision: 713 http://pyphant.svn.sourceforge.net/pyphant/?rev=713&view=rev Author: aheld84 Date: 2011-12-08 17:05:59 +0000 (Thu, 08 Dec 2011) Log Message: ----------- cloned r699 Revision Links: -------------- http://pyphant.svn.sourceforge.net/pyphant/?rev=699&view=rev Added Paths: ----------- tags/pyphant-0.8a2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-02 16:19:59
|
Revision: 712 http://pyphant.svn.sourceforge.net/pyphant/?rev=712&view=rev Author: aheld84 Date: 2011-12-02 16:19:53 +0000 (Fri, 02 Dec 2011) Log Message: ----------- Remove pyphant-0.8a1 tag created by git git does not allow to branch from anything else than trunk, so pyphant-0.8a1 is a copy and no link, which is bad. pyphant-0.8a1 should be tagged using pure svn Removed Paths: ------------- tags/pyphant-0.8a1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-02 16:10:10
|
Revision: 711 http://pyphant.svn.sourceforge.net/pyphant/?rev=711&view=rev Author: aheld84 Date: 2011-12-02 16:09:56 +0000 (Fri, 02 Dec 2011) Log Message: ----------- Hack: Recreated pyphant 0.8a1 Added Paths: ----------- tags/pyphant-0.8a1/.gitignore tags/pyphant-0.8a1/.project tags/pyphant-0.8a1/.pydevproject tags/pyphant-0.8a1/doc/demo/README tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf tags/pyphant-0.8a1/doc/demo/demo.h5 tags/pyphant-0.8a1/doc/demo/demo.png tags/pyphant-0.8a1/doc/demo/demoFMF.py tags/pyphant-0.8a1/doc/demo/example.fmf tags/pyphant-0.8a1/doc/demo/example_delimiter.fmf tags/pyphant-0.8a1/doc/demo/example_delimiter2.fmf tags/pyphant-0.8a1/doc/demo/features.png tags/pyphant-0.8a1/doc/demo/fmf2h5.h5 tags/pyphant-0.8a1/doc/demo/fmf2h5.py tags/pyphant-0.8a1/doc/demo/plotter.py tags/pyphant-0.8a1/doc/demo/pyphant-shade-Information-Analysis-Framework.png tags/pyphant-0.8a1/doc/demo/readfmf.py tags/pyphant-0.8a1/doc/demo/simpleScripting.py tags/pyphant-0.8a1/doc/demo/viewOSC.py tags/pyphant-0.8a1/doc/demo/visualizeImage.py tags/pyphant-0.8a1/doc/grammarDoc.py tags/pyphant-0.8a1/doc/grammarDoc.txt tags/pyphant-0.8a1/doc/knowledge-ideas.org tags/pyphant-0.8a1/doc/logo/mklogo.py tags/pyphant-0.8a1/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png tags/pyphant-0.8a1/doc/logo/pyphantLogo.py tags/pyphant-0.8a1/doc/test_numpy1.0.1Bug.py tags/pyphant-0.8a1/src/pyphant/pyphant/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/createExecutionOrder.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/demo.h5 tags/pyphant-0.8a1/src/pyphant/pyphant/cli/demo.png tags/pyphant-0.8a1/src/pyphant/pyphant/cli/pyphant_exec.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/simpleCLI.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/CompositeWorker.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Connectors.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/DataContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/EventDispatcher.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/FieldContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/H5FileHandler.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Helpers.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/KnowledgeManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/KnowledgeNode.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Param.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/PyTablesPersister.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/RoutingHTTPServer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/SQLiteWrapper.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/UpdateManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/WebInterface.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Worker.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/WorkerRegistry.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/XMLHandler.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/ZStackManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/bottle.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/singletonmixin.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/ParseQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/PhysicalQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestChart.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestCompositeWorker.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestDataContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestEventDispatcher.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestH5FileHandler.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestImageVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestKnowledgeManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestKnowledgeNode.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestParam.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestParseQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestPyTablesPersister.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestSQLiteWrapper.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestZStacks.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z00.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z01.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z02.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z03.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z04.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z05.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z06.tif tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/_meta.xml tags/pyphant-0.8a1/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/Chart.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ConfigurablePlot.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/External.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ImageVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/KMVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/NonUniformImage.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/PrimitiveVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/SingleValueVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ZStackVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/disabled.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/favicon.ico tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/offline.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/online.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/pyphant.png tags/pyphant-0.8a1/src/pyphant/pyphant/web/script/LaTeXMathML.js tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/back.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/disabled.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/fieldcontainer.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/frontpage.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/htmlhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/log.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/mathhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/message.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/ordermathhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/remotes.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/samplecontainer.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/search.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/ConfigureFrame.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/DataVisReg.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/PyphantCanvas.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/PyphantDiagram.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/WorkerFactoryPool.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/WorkerRepository.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/CheckBox.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/FileButton.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/OneLineStringField.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/ParamVisReg.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/pyphantLogo.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py tags/pyphant-0.8a1/src/pyphant/setup.cfg tags/pyphant-0.8a1/src/pyphant/setup.py tags/pyphant-0.8a1/src/support/xmlrunner.py tags/pyphant-0.8a1/src/test-all.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ApplyMask.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/AutoFocus.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/BiThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ConetworkSeparator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ConetworkThresholdingPOC.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/CoverageWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/DiffWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/DistanceMapper.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EdgeFillWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EdgeTouchingFeatureRemover.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FeatureRatio.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FilterWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FindLocalExtrema.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FitBackground.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Gradient.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ImageLoaderWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/MarkAF.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Medianiser.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/OptimalContrastWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Reduce.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/SkeletonizeFeature.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/SliceSelector.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/SlopeCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/UltimatePointsCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Watershed.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/__init__.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestApplyMask.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestDistanceMapper.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestImageLoader.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestMedianiser.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestSkeletonizeFeature.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestSlopeCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/__init__.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/demo.png tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py tags/pyphant-0.8a1/src/workers/OSC/OSC/AddColumn.py tags/pyphant-0.8a1/src/workers/OSC/OSC/CompareFields.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ComputeFunctional.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ErrorEstimator.py tags/pyphant-0.8a1/src/workers/OSC/OSC/EstimateParameter.py tags/pyphant-0.8a1/src/workers/OSC/OSC/EstimateParameterFromValues.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ExtremumFinder.py tags/pyphant-0.8a1/src/workers/OSC/OSC/MRA.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscAbsorption.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscCurrent.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscLoader.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscThicknessCorrection.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscVisualisers.py tags/pyphant-0.8a1/src/workers/OSC/OSC/Slicing.py tags/pyphant-0.8a1/src/workers/OSC/OSC/Smoother.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ThicknessModeller.py tags/pyphant-0.8a1/src/workers/OSC/OSC/__init__.py tags/pyphant-0.8a1/src/workers/OSC/OSC/convert2FMF.py tags/pyphant-0.8a1/src/workers/OSC/OSC/data.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestErrorEstimator.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestExtremumFinder.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestMRA.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestOscAbsorption.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/__init__.py tags/pyphant-0.8a1/src/workers/OSC/setup.cfg tags/pyphant-0.8a1/src/workers/OSC/setup.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/Histogram.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/__init__.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/tests/TestHistogram.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/tests/__init__.py tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg tags/pyphant-0.8a1/src/workers/Statistics/setup.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/FMFLoader.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/FMFWriter.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/__init__.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/fmfgen.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/TestFMFLoader.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/__init__.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/dep.fmf tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg tags/pyphant-0.8a1/src/workers/fmfile/setup.py tags/pyphant-0.8a1/src/workers/tools/setup.cfg tags/pyphant-0.8a1/src/workers/tools/setup.py tags/pyphant-0.8a1/src/workers/tools/tools/DCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/Emd5Src.py tags/pyphant-0.8a1/src/workers/tools/tools/FCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/SCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/__init__.py tags/pyphant-0.8a1/src/workers/tools/tools/tests/TestEmd5Source.py tags/pyphant-0.8a1/src/workers/tools/tools/tests/__init__.py Added: tags/pyphant-0.8a1/.gitignore =================================================================== --- tags/pyphant-0.8a1/.gitignore (rev 0) +++ tags/pyphant-0.8a1/.gitignore 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,20 @@ +*.py[co] +*~ +DEBUG +PKG-INFO +SOURCES.txt +dependency_links.txt +entry_points.txt +requires.txt +top_level.txt +.svn +build +dist +*.egg-info +\#*\# +*.aux +*.log +*.out +*.bst +*.bbl +.ropeproject/ Added: tags/pyphant-0.8a1/.project =================================================================== --- tags/pyphant-0.8a1/.project (rev 0) +++ tags/pyphant-0.8a1/.project 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>pyphant</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.python.pydev.PyDevBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.python.pydev.pythonNature</nature> + </natures> +</projectDescription> Added: tags/pyphant-0.8a1/.pydevproject =================================================================== --- tags/pyphant-0.8a1/.pydevproject (rev 0) +++ tags/pyphant-0.8a1/.pydevproject 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?> + +<pydev_project> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property> +<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> +<path>/pyphant/src/pyphant</path> +<path>/pyphant/src/workers/fmfile</path> +<path>/pyphant/src/workers/ImageProcessing</path> +<path>/pyphant/src/workers/OSC</path> +</pydev_pathproperty> +</pydev_project> Added: tags/pyphant-0.8a1/doc/demo/README =================================================================== --- tags/pyphant-0.8a1/doc/demo/README (rev 0) +++ tags/pyphant-0.8a1/doc/demo/README 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,6 @@ +#Start GUI with +wxPythant demo.h5 + +#Start scripting example with +./simpleScripting.py + Added: tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf =================================================================== --- tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf (rev 0) +++ tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,261 @@ +; -*- coding: utf-8 -*- +[*reference] +author: Kristian O. Sylvester-Hvid and Andreas W. Liehr +date: 2007-12-07 +width: h = 210 nm +title: Simulated abs spectrum for P3HT:PCBM solar cell - 210nm blend layer +[*data definitions] +wavelength: \lambda [nm] +absorption: A(\lambda) +[*data] +300 0.94001276 +302 0.94052832 +304 0.94100929 +306 0.94144604 +308 0.94180794 +310 0.94206936 +312 0.9422048 +314 0.94226886 +316 0.94232466 +318 0.94250446 +320 0.94286269 +322 0.94339843 +324 0.94398425 +326 0.94434446 +328 0.94427402 +330 0.94353182 +332 0.94200658 +334 0.93963851 +336 0.93632749 +338 0.9321587 +340 0.92667119 +342 0.91986756 +344 0.91172259 +346 0.90177058 +348 0.89041845 +350 0.8775073 +352 0.86356483 +354 0.84936335 +356 0.83456895 +358 0.82062459 +360 0.8076951 +362 0.79614205 +364 0.78564803 +366 0.77755195 +368 0.77085322 +370 0.76677966 +372 0.76425721 +374 0.76322039 +376 0.76481169 +378 0.76822021 +380 0.77352729 +382 0.77995359 +384 0.78875682 +386 0.79887878 +388 0.81032685 +390 0.82164329 +392 0.83405087 +394 0.84724906 +396 0.86076354 +398 0.87312447 +400 0.88556675 +402 0.8975478 +404 0.90855741 +406 0.918659 +408 0.92730708 +410 0.9342962 +412 0.93988822 +414 0.94414255 +416 0.94665541 +418 0.9482054 +420 0.94895653 +422 0.94856192 +424 0.94709676 +426 0.94477955 +428 0.94172813 +430 0.93847747 +432 0.93522811 +434 0.93179879 +436 0.92875434 +438 0.9254059 +440 0.92240329 +442 0.91961551 +444 0.91700092 +446 0.91509408 +448 0.91307083 +450 0.91157556 +452 0.9100461 +454 0.90922433 +456 0.90849702 +458 0.90873161 +460 0.90918283 +462 0.90961624 +464 0.9103671 +466 0.91096396 +468 0.91174446 +470 0.91324641 +472 0.91475231 +474 0.9166557 +476 0.9184305 +478 0.92016726 +480 0.92199446 +482 0.92325293 +484 0.92476136 +486 0.92637909 +488 0.92800125 +490 0.92996184 +492 0.93139366 +494 0.9327197 +496 0.93383375 +498 0.93467089 +500 0.93529753 +502 0.93601335 +504 0.93691212 +506 0.93781723 +508 0.93874206 +510 0.93939636 +512 0.94003719 +514 0.94025198 +516 0.94035136 +518 0.94047114 +520 0.94073254 +522 0.94103714 +524 0.94130091 +526 0.94144813 +528 0.9415573 +530 0.94156843 +532 0.94138793 +534 0.94122204 +536 0.94099705 +538 0.94070117 +540 0.94035489 +542 0.9398703 +544 0.93954695 +546 0.93907971 +548 0.93853096 +550 0.93828818 +552 0.93770268 +554 0.93729021 +556 0.93682153 +558 0.93665619 +560 0.93660652 +562 0.9368939 +564 0.93710224 +566 0.93784482 +568 0.93866566 +570 0.93971 +572 0.94093727 +574 0.94231377 +576 0.94372178 +578 0.94516736 +580 0.94656231 +582 0.94775016 +584 0.94883467 +586 0.94980323 +588 0.95039466 +590 0.95043141 +592 0.95019453 +594 0.94949293 +596 0.94863656 +598 0.94729984 +600 0.9451777 +602 0.94231776 +604 0.93889644 +606 0.93402475 +608 0.9273553 +610 0.91887018 +612 0.90780796 +614 0.89401947 +616 0.87904645 +618 0.85919763 +620 0.83898752 +622 0.81322756 +624 0.7848802 +626 0.75385085 +628 0.71965866 +630 0.68307008 +632 0.64559891 +634 0.60841687 +636 0.57242972 +638 0.53468059 +640 0.50251968 +642 0.46947399 +644 0.44484263 +646 0.42004295 +648 0.39939842 +650 0.37870989 +652 0.36264726 +654 0.35232717 +656 0.33934159 +658 0.32502465 +660 0.31542268 +662 0.30824157 +664 0.2990077 +666 0.2947837 +668 0.28922591 +670 0.28658894 +672 0.28614721 +674 0.28202046 +676 0.28149016 +678 0.28040605 +680 0.27845176 +682 0.27654909 +684 0.27634083 +686 0.27617549 +688 0.27632291 +690 0.27384696 +692 0.27280758 +694 0.27443572 +696 0.27510338 +698 0.27512684 +700 0.27583487 +702 0.2729722 +704 0.27366256 +706 0.27463568 +708 0.27448946 +710 0.2767401 +712 0.27715502 +714 0.27797834 +716 0.27954103 +718 0.27946012 +720 0.28130034 +722 0.28056736 +724 0.28254809 +726 0.28456215 +728 0.28409837 +730 0.28531638 +732 0.2877751 +734 0.28996248 +736 0.2926061 +738 0.29527246 +740 0.29744612 +742 0.29808286 +744 0.29999903 +746 0.30224372 +748 0.30390019 +750 0.30599832 +752 0.30891292 +754 0.31095523 +756 0.31187227 +758 0.31412822 +760 0.315058 +762 0.31755964 +764 0.31919832 +766 0.32225542 +768 0.32428429 +770 0.32687193 +772 0.3273539 +774 0.32961995 +776 0.33199819 +778 0.33408599 +780 0.3366742 +782 0.33664265 +784 0.33911601 +786 0.3409073 +788 0.34362441 +790 0.34421251 +792 0.34616219 +794 0.34814186 +796 0.34946026 +798 0.35092394 +800 0.35234574 Added: tags/pyphant-0.8a1/doc/demo/demo.h5 =================================================================== --- tags/pyphant-0.8a1/doc/demo/demo.h5 (rev 0) +++ tags/pyphant-0.8a1/doc/demo/demo.h5 2011-12-02 16:09:56 UTC (rev 711) @@ -0,0 +1,68 @@ +\x89HDF + + |
From: <ah...@us...> - 2011-12-02 15:59:44
|
Revision: 710 http://pyphant.svn.sourceforge.net/pyphant/?rev=710&view=rev Author: aheld84 Date: 2011-12-02 15:59:33 +0000 (Fri, 02 Dec 2011) Log Message: ----------- Hack: cleared all files this is necessary to recreate pyphant 0.8a1 in svn since branches always branch from trunk Removed Paths: ------------- tags/pyphant-0.8a1/.gitignore tags/pyphant-0.8a1/.project tags/pyphant-0.8a1/.pydevproject tags/pyphant-0.8a1/doc/demo/README tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf tags/pyphant-0.8a1/doc/demo/demo.h5 tags/pyphant-0.8a1/doc/demo/demo.png tags/pyphant-0.8a1/doc/demo/demoFMF.py tags/pyphant-0.8a1/doc/demo/example.fmf tags/pyphant-0.8a1/doc/demo/example_delimiter.fmf tags/pyphant-0.8a1/doc/demo/example_delimiter2.fmf tags/pyphant-0.8a1/doc/demo/features.png tags/pyphant-0.8a1/doc/demo/fmf2h5.h5 tags/pyphant-0.8a1/doc/demo/fmf2h5.py tags/pyphant-0.8a1/doc/demo/plotter.py tags/pyphant-0.8a1/doc/demo/pyphant-shade-Information-Analysis-Framework.png tags/pyphant-0.8a1/doc/demo/readfmf.py tags/pyphant-0.8a1/doc/demo/simpleScripting.py tags/pyphant-0.8a1/doc/demo/viewOSC.py tags/pyphant-0.8a1/doc/demo/visualizeImage.py tags/pyphant-0.8a1/doc/grammarDoc.py tags/pyphant-0.8a1/doc/grammarDoc.txt tags/pyphant-0.8a1/doc/knowledge-ideas.org tags/pyphant-0.8a1/doc/logo/mklogo.py tags/pyphant-0.8a1/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png tags/pyphant-0.8a1/doc/logo/pyphantLogo.py tags/pyphant-0.8a1/doc/test_numpy1.0.1Bug.py tags/pyphant-0.8a1/src/pyphant/pyphant/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/createExecutionOrder.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/demo.h5 tags/pyphant-0.8a1/src/pyphant/pyphant/cli/demo.png tags/pyphant-0.8a1/src/pyphant/pyphant/cli/pyphant_exec.py tags/pyphant-0.8a1/src/pyphant/pyphant/cli/simpleCLI.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/AstTransformers.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/CompositeWorker.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Connectors.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/DataContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/EventDispatcher.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/FieldContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/H5FileHandler.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Helpers.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/KnowledgeManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/KnowledgeNode.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Param.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/PyTablesPersister.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/RoutingHTTPServer.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/SQLiteWrapper.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/UpdateManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/WebInterface.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/Worker.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/WorkerRegistry.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/bottle.py tags/pyphant-0.8a1/src/pyphant/pyphant/core/singletonmixin.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/ParseQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/PhysicalQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/quantities/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestChart.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestCompositeWorker.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestDataContainer.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestEventDispatcher.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestH5FileHandler.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestImageVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestKnowledgeManager.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestKnowledgeNode.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestParam.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestParseQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestPyTablesPersister.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestQuantities.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestSQLiteWrapper.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/TestTimestamp.py tags/pyphant-0.8a1/src/pyphant/pyphant/tests/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/Chart.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ConfigurablePlot.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/External.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ImageVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/KMVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/NonUniformImage.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/PrimitiveVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/ZStackVisualizer.py tags/pyphant-0.8a1/src/pyphant/pyphant/visualizers/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/disabled.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/favicon.ico tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/offline.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/online.gif tags/pyphant-0.8a1/src/pyphant/pyphant/web/images/pyphant.png tags/pyphant-0.8a1/src/pyphant/pyphant/web/script/LaTeXMathML.js tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/back.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/disabled.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/fieldcontainer.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/frontpage.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/htmlhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/log.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/mathhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/message.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/ordermathhead.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/remotes.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/samplecontainer.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/web/templates/search.tpl tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/ConfigureFrame.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/DataVisReg.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/PyphantCanvas.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/PyphantDiagram.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/WorkerFactoryPool.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/WorkerRepository.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/BoundedIntegerTextField.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/CheckBox.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/FileButton.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/ListSelect.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/OneLineStringField.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/ParamVisReg.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/paramvisualization/__init__.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/pyphantLogo.py tags/pyphant-0.8a1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py tags/pyphant-0.8a1/src/pyphant/setup.cfg tags/pyphant-0.8a1/src/pyphant/setup.py tags/pyphant-0.8a1/src/support/xmlrunner.py tags/pyphant-0.8a1/src/test-all.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ApplyMask.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/AutoFocus.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/BiThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ConetworkSeparator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ConetworkThresholdingPOC.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/CoverageWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/DiffWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/DistanceMapper.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EdgeFillWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EdgeTouchingFeatureRemover.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FindLocalExtrema.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/FitBackground.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Gradient.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ImageLoaderWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/LoadZStack.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/MarkInclusions.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Medianiser.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/OptimalContrastWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/SkeletonizeFeature.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/SlopeCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/UltimatePointsCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/Watershed.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/__init__.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestApplyMask.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestDiffWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestDistanceMapper.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestETFR.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestEdgeFill.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestEnhanceContrast.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestFitBackground.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestGradient.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestImageLoader.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestInvert.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestLocalExtrema.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestMedianiser.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestSkeletonizeFeature.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestSlopeCalculator.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestThresholdingWorker.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestUltimatePoints.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/TestWatershed.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/__init__.py tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/demo.png tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z00.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z01.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z02.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z03.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z04.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z05.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z06.tif tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.cfg tags/pyphant-0.8a1/src/workers/ImageProcessing/setup.py tags/pyphant-0.8a1/src/workers/OSC/OSC/CompareFields.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ComputeFunctional.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ErrorEstimator.py tags/pyphant-0.8a1/src/workers/OSC/OSC/EstimateParameter.py tags/pyphant-0.8a1/src/workers/OSC/OSC/EstimateParameterFromValues.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ExtremumFinder.py tags/pyphant-0.8a1/src/workers/OSC/OSC/MRA.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscAbsorption.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscCurrent.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscLoader.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscMapper.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscThicknessCorrection.py tags/pyphant-0.8a1/src/workers/OSC/OSC/OscVisualisers.py tags/pyphant-0.8a1/src/workers/OSC/OSC/Smoother.py tags/pyphant-0.8a1/src/workers/OSC/OSC/ThicknessModeller.py tags/pyphant-0.8a1/src/workers/OSC/OSC/__init__.py tags/pyphant-0.8a1/src/workers/OSC/OSC/convert2FMF.py tags/pyphant-0.8a1/src/workers/OSC/OSC/data.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestErrorEstimator.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestExtremumFinder.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestInstantiation.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestMRA.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/TestOscAbsorption.py tags/pyphant-0.8a1/src/workers/OSC/OSC/tests/__init__.py tags/pyphant-0.8a1/src/workers/OSC/setup.cfg tags/pyphant-0.8a1/src/workers/OSC/setup.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/Histogram.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/__init__.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/tests/TestHistogram.py tags/pyphant-0.8a1/src/workers/Statistics/Statistics/tests/__init__.py tags/pyphant-0.8a1/src/workers/Statistics/setup.cfg tags/pyphant-0.8a1/src/workers/Statistics/setup.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/FMFLoader.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/FMFWriter.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/__init__.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/fmfgen.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/TestFMFLoader.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/__init__.py tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/dep.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/hash_test.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/multitable.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/onecolumn.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/onerow.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/onerow_dep.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/onevalue.fmf tags/pyphant-0.8a1/src/workers/fmfile/fmfile/tests/resources/fmf/semi_test.fmf tags/pyphant-0.8a1/src/workers/fmfile/setup.cfg tags/pyphant-0.8a1/src/workers/fmfile/setup.py tags/pyphant-0.8a1/src/workers/tools/setup.cfg tags/pyphant-0.8a1/src/workers/tools/setup.py tags/pyphant-0.8a1/src/workers/tools/tools/AddColumn.py tags/pyphant-0.8a1/src/workers/tools/tools/AlgebraWorker.py tags/pyphant-0.8a1/src/workers/tools/tools/ColumnExtractor.py tags/pyphant-0.8a1/src/workers/tools/tools/DCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/Emd5Src.py tags/pyphant-0.8a1/src/workers/tools/tools/ExtractRows.py tags/pyphant-0.8a1/src/workers/tools/tools/FCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/SCSource.py tags/pyphant-0.8a1/src/workers/tools/tools/Slicing.py tags/pyphant-0.8a1/src/workers/tools/tools/__init__.py tags/pyphant-0.8a1/src/workers/tools/tools/tests/TestEmd5Source.py tags/pyphant-0.8a1/src/workers/tools/tools/tests/TestInstantiation.py tags/pyphant-0.8a1/src/workers/tools/tools/tests/__init__.py Deleted: tags/pyphant-0.8a1/.gitignore =================================================================== --- tags/pyphant-0.8a1/.gitignore 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/.gitignore 2011-12-02 15:59:33 UTC (rev 710) @@ -1,20 +0,0 @@ -*.py[co] -*~ -DEBUG -PKG-INFO -SOURCES.txt -dependency_links.txt -entry_points.txt -requires.txt -top_level.txt -.svn -build -dist -*.egg-info -\#*\# -*.aux -*.log -*.out -*.bst -*.bbl -.ropeproject/ Deleted: tags/pyphant-0.8a1/.project =================================================================== --- tags/pyphant-0.8a1/.project 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/.project 2011-12-02 15:59:33 UTC (rev 710) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>pyphant</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.python.pydev.PyDevBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.python.pydev.pythonNature</nature> - </natures> -</projectDescription> Deleted: tags/pyphant-0.8a1/.pydevproject =================================================================== --- tags/pyphant-0.8a1/.pydevproject 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/.pydevproject 2011-12-02 15:59:33 UTC (rev 710) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?eclipse-pydev version="1.0"?> - -<pydev_project> -<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property> -<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> -<path>/pyphant/src/pyphant</path> -<path>/pyphant/src/workers/fmfile</path> -<path>/pyphant/src/workers/ImageProcessing</path> -<path>/pyphant/src/workers/OSC</path> -</pydev_pathproperty> -</pydev_project> Deleted: tags/pyphant-0.8a1/doc/demo/README =================================================================== --- tags/pyphant-0.8a1/doc/demo/README 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/README 2011-12-02 15:59:33 UTC (rev 710) @@ -1,6 +0,0 @@ -#Start GUI with -wxPythant demo.h5 - -#Start scripting example with -./simpleScripting.py - Deleted: tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf =================================================================== --- tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/Sim_abs_210nm.fmf 2011-12-02 15:59:33 UTC (rev 710) @@ -1,261 +0,0 @@ -; -*- coding: utf-8 -*- -[*reference] -author: Kristian O. Sylvester-Hvid and Andreas W. Liehr -date: 2007-12-07 -width: h = 210 nm -title: Simulated abs spectrum for P3HT:PCBM solar cell - 210nm blend layer -[*data definitions] -wavelength: \lambda [nm] -absorption: A(\lambda) -[*data] -300 0.94001276 -302 0.94052832 -304 0.94100929 -306 0.94144604 -308 0.94180794 -310 0.94206936 -312 0.9422048 -314 0.94226886 -316 0.94232466 -318 0.94250446 -320 0.94286269 -322 0.94339843 -324 0.94398425 -326 0.94434446 -328 0.94427402 -330 0.94353182 -332 0.94200658 -334 0.93963851 -336 0.93632749 -338 0.9321587 -340 0.92667119 -342 0.91986756 -344 0.91172259 -346 0.90177058 -348 0.89041845 -350 0.8775073 -352 0.86356483 -354 0.84936335 -356 0.83456895 -358 0.82062459 -360 0.8076951 -362 0.79614205 -364 0.78564803 -366 0.77755195 -368 0.77085322 -370 0.76677966 -372 0.76425721 -374 0.76322039 -376 0.76481169 -378 0.76822021 -380 0.77352729 -382 0.77995359 -384 0.78875682 -386 0.79887878 -388 0.81032685 -390 0.82164329 -392 0.83405087 -394 0.84724906 -396 0.86076354 -398 0.87312447 -400 0.88556675 -402 0.8975478 -404 0.90855741 -406 0.918659 -408 0.92730708 -410 0.9342962 -412 0.93988822 -414 0.94414255 -416 0.94665541 -418 0.9482054 -420 0.94895653 -422 0.94856192 -424 0.94709676 -426 0.94477955 -428 0.94172813 -430 0.93847747 -432 0.93522811 -434 0.93179879 -436 0.92875434 -438 0.9254059 -440 0.92240329 -442 0.91961551 -444 0.91700092 -446 0.91509408 -448 0.91307083 -450 0.91157556 -452 0.9100461 -454 0.90922433 -456 0.90849702 -458 0.90873161 -460 0.90918283 -462 0.90961624 -464 0.9103671 -466 0.91096396 -468 0.91174446 -470 0.91324641 -472 0.91475231 -474 0.9166557 -476 0.9184305 -478 0.92016726 -480 0.92199446 -482 0.92325293 -484 0.92476136 -486 0.92637909 -488 0.92800125 -490 0.92996184 -492 0.93139366 -494 0.9327197 -496 0.93383375 -498 0.93467089 -500 0.93529753 -502 0.93601335 -504 0.93691212 -506 0.93781723 -508 0.93874206 -510 0.93939636 -512 0.94003719 -514 0.94025198 -516 0.94035136 -518 0.94047114 -520 0.94073254 -522 0.94103714 -524 0.94130091 -526 0.94144813 -528 0.9415573 -530 0.94156843 -532 0.94138793 -534 0.94122204 -536 0.94099705 -538 0.94070117 -540 0.94035489 -542 0.9398703 -544 0.93954695 -546 0.93907971 -548 0.93853096 -550 0.93828818 -552 0.93770268 -554 0.93729021 -556 0.93682153 -558 0.93665619 -560 0.93660652 -562 0.9368939 -564 0.93710224 -566 0.93784482 -568 0.93866566 -570 0.93971 -572 0.94093727 -574 0.94231377 -576 0.94372178 -578 0.94516736 -580 0.94656231 -582 0.94775016 -584 0.94883467 -586 0.94980323 -588 0.95039466 -590 0.95043141 -592 0.95019453 -594 0.94949293 -596 0.94863656 -598 0.94729984 -600 0.9451777 -602 0.94231776 -604 0.93889644 -606 0.93402475 -608 0.9273553 -610 0.91887018 -612 0.90780796 -614 0.89401947 -616 0.87904645 -618 0.85919763 -620 0.83898752 -622 0.81322756 -624 0.7848802 -626 0.75385085 -628 0.71965866 -630 0.68307008 -632 0.64559891 -634 0.60841687 -636 0.57242972 -638 0.53468059 -640 0.50251968 -642 0.46947399 -644 0.44484263 -646 0.42004295 -648 0.39939842 -650 0.37870989 -652 0.36264726 -654 0.35232717 -656 0.33934159 -658 0.32502465 -660 0.31542268 -662 0.30824157 -664 0.2990077 -666 0.2947837 -668 0.28922591 -670 0.28658894 -672 0.28614721 -674 0.28202046 -676 0.28149016 -678 0.28040605 -680 0.27845176 -682 0.27654909 -684 0.27634083 -686 0.27617549 -688 0.27632291 -690 0.27384696 -692 0.27280758 -694 0.27443572 -696 0.27510338 -698 0.27512684 -700 0.27583487 -702 0.2729722 -704 0.27366256 -706 0.27463568 -708 0.27448946 -710 0.2767401 -712 0.27715502 -714 0.27797834 -716 0.27954103 -718 0.27946012 -720 0.28130034 -722 0.28056736 -724 0.28254809 -726 0.28456215 -728 0.28409837 -730 0.28531638 -732 0.2877751 -734 0.28996248 -736 0.2926061 -738 0.29527246 -740 0.29744612 -742 0.29808286 -744 0.29999903 -746 0.30224372 -748 0.30390019 -750 0.30599832 -752 0.30891292 -754 0.31095523 -756 0.31187227 -758 0.31412822 -760 0.315058 -762 0.31755964 -764 0.31919832 -766 0.32225542 -768 0.32428429 -770 0.32687193 -772 0.3273539 -774 0.32961995 -776 0.33199819 -778 0.33408599 -780 0.3366742 -782 0.33664265 -784 0.33911601 -786 0.3409073 -788 0.34362441 -790 0.34421251 -792 0.34616219 -794 0.34814186 -796 0.34946026 -798 0.35092394 -800 0.35234574 Deleted: tags/pyphant-0.8a1/doc/demo/demo.h5 =================================================================== (Binary files differ) Deleted: tags/pyphant-0.8a1/doc/demo/demo.png =================================================================== (Binary files differ) Deleted: tags/pyphant-0.8a1/doc/demo/demoFMF.py =================================================================== --- tags/pyphant-0.8a1/doc/demo/demoFMF.py 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/demoFMF.py 2011-12-02 15:59:33 UTC (rev 710) @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2006-2008, 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 sys -import unittest -sys.path.append("..") - -import pkg_resources - -pkg_resources.require("Pyphant") - -from fmfile import FMFLoader -import pyphant.visualizers.Chart as cv - -loader = FMFLoader.FMFLoader() -loader.paramFilename.value = 'Sim_abs_210nm.fmf' -data = loader.loadFMF() - -v = cv.LineChart(data['absorption']) -v.figure.savefig('demoFMF.png') Deleted: tags/pyphant-0.8a1/doc/demo/example.fmf =================================================================== --- tags/pyphant-0.8a1/doc/demo/example.fmf 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/example.fmf 2011-12-02 15:59:33 UTC (rev 710) @@ -1,111 +0,0 @@ -# -*- fmf-version: 1.0; coding: utf-8 -*- -[*reference] -title: Demonstrating the flexibility of the Full-Metadata-Format -creator: Andreas W. Liehr -created: 2008-10-29 -place: Freiburger Materialforschungszentrum, Universität Freiburg, Deutschland -[Textual values] -word: Hello! -sentence: Hello World! -timestamp: 2008-10-31 12:00:59.438151 -comma separated list: world, die Welt, el mundo, monde -inside quotation: Arthur C. Clarke's "The Sentinel" -single quote: 'Freiburger Materialforschungszentrum, Universität Freiburg, Deutschland' -double quotation mark: "Freiburger Materialforschungszentrum, Universität Freiburg, Deutschland" -multiline: '''A multiline value, -that spans more than one line :-) -The line breaks are included in the value.''' -Another multiline: """A multiline value, -that spans more than one line :-)""" -Enclosed quotation marks: """ Andreas says: "Hello World!" """ -[Numerical values] -#Note, that the 'key' is arbitrary, but has to be unique within a section -integer: 1 -list of integers: 1, 2, 3, 4, 5 -float: 1.0 -float with leading dot: .1 -float with exponential: 1e-10 -float with Exponential: -1.1E10 -list of floats: 1.0, .1, 1e-10, -1.1E10 -complex: 1+2j -Complex: 1.1+2j -Complex number with zero real part : 2j -Complex number with zero imaginary part: 1+0j -list of complex: 1+2j, 1.1+2j -[Boolean values] -true1: True -true2: true -true3: TRUE -false1: False -false2: false -false3: FALSE -list of booleans: True, true, TRUE, False, false, FALSE -[Quantities] -voltage: 1V -temperature in Celsius: 22 degC -resistance: 2.0 kg*m^2*A^-2*s^-3 -arbitrary units: 10 a.u. -distance from Earth to Sun: 1 AU -[Quantities with error] -voltage: 1 V +- 1 mV -current: 1 A +/- 0.001 A -energy: 1 J \pm 1 mJ -work: 1 W +- 0.1% -voltage in brackets: (1 +- 0.001) V -current in brackets: (1 +- 0.1%) A -trailing amplitude: (1 +- 0.01) 2 ohm -trailing amplitude, relative error: (1 +- 1%) 2 ohm -estimated parameter: 1 \pm 0.1 -another estimated parameter: 1 \pm 1% -list of quantities: 1V, 22 degC,(1 +- 1%) 2 ohm -[Variables] -number: N = 2 -voltage: U = 1V -temperature in Celsius: T_C = 22 degC -temperature in Fahrenheit: T = 22 degF -resistance: \omega = 2.0 kg*m^2*A^-2*s^-3 -resistance 2: \omega = 2.0 kg*m**2*A**-2*s**-3 -normed variable: n = 10 a.u. -[Physical Quantities with error] -voltage: U = 1 V +- 1 mV -current: I = 1 A +/- 0.001 A -energy: E = 1 J \pm 1 mJ -work: A = 1 W +- 0.1% -voltage in brackets: U = (1 +- 0.001) V -current in brackets: I = (1 +- 0.1%) A -trailing amplitude: \omega = (1 +- 0.01) 2 ohm -trailing amplitude, relative error: \omega = (1 +- 1%) 2 ohm -estimated parameter: p = 1 \pm 0.1 -another estimated parameter: p = 1 \pm 1% -list of quantities: number: N = 2, U = 1V, T_C = 22 degC -[Datetime stamps] -date: 2008-12-16 -week date: 2008-W47-1 -list of dates: 2008-11-17,2008-1-3,2006-2-17,2008-W47-1 -datetime: 2008-12-16T16:51 -another datetime: 2008-12-16 16:51 -datetime with second: 2008-12-16T16:51:05 -datetime UTC: 2008-12-16T16:51Z -datetime+2h: 2006-04-23 14:25:51+02:00 -[*table definitions] -table: T -mixed: M -[*data definitions: T] -String: S -Integer: I -Float with dot: Fd -Float with exponent: Fe -Complex: C -Missing Value: V_m -Infinite Value: V_i -[*data: T] -H_2 1 1. 1e1 1+0j nan inf -O_2 2 .2 2E1 2+.1j NaN INF -O 2 2 .2 2E1 2.+2j NAN Inf -[*data definitions: M] -String: S -Complex: C -Float: F -[*data: M] -N_2 1 2 -2 1+1j 2.1 Deleted: tags/pyphant-0.8a1/doc/demo/example_delimiter.fmf =================================================================== --- tags/pyphant-0.8a1/doc/demo/example_delimiter.fmf 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/example_delimiter.fmf 2011-12-02 15:59:33 UTC (rev 710) @@ -1,56 +0,0 @@ -# -*- fmf-version: 1.0; coding: utf-8; delimiter: whitespace -*- -[*reference] -title: Demonstrating the flexibility of the Full-Metadata-Format -creator: Andreas W. Liehr -created: 2008-10-29 -place: Freiburger Materialforschungszentrum, Universität Freiburg, Deutschland -[String Examples] -word: Hello! -sentence: Hello World! -comma separated list: world, die Welt, el mundo, monde -multiline: '''A multiline value, -that spans more than one line :-) -The line breaks are included in the value.''' -[Numbers] -#Note, that the 'key' is arbitrary, but has to be unique within a section -integer: 1 -float: 1.0 -float with leading dot: .1 -float with exponential: 1e-10 -float with Exponential: -1.1E10 -complex: 1+2j -[Physical Quantities] -number: N = 2 -voltage: U = 1V -temperature in Celsius: T_C = 22 degC -temperature in Fahrenheit: T = 22 degF -[Physical Quantities with error] -voltage: U = 1 V +- 1 mV -current: I = 1 A +/- 0.001 A -energy: E = 1 J \pm 1 mJ -work: A = 1 W +- 0.1% -voltage in brackets: U = (1 +- 0.001) V -current in brackets: I = (1 +- 0.1%) A -estimated parameter: p = 1 \pm 0.1 -another estimated parameter: p = 1 \pm 1% -[*table definitions] -table: T -mixed: M -[*data definitions: T] -String: S -Integer: I -Float with dot: Fd -Float with exponent: Fe -Complex: C -Missing Value: V_m -Infinite Value: V_i -[*data: T] -H_2 1 1. 1e1 1+0j nan inf -O_2 2 .2 2E1 2+.1j NaN INF -[*data definitions: M] -String: S -Complex: C -Float: F -[*data: M] -N_2 1 2 -2 1+1j 2.1 Deleted: tags/pyphant-0.8a1/doc/demo/example_delimiter2.fmf =================================================================== --- tags/pyphant-0.8a1/doc/demo/example_delimiter2.fmf 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/example_delimiter2.fmf 2011-12-02 15:59:33 UTC (rev 710) @@ -1,57 +0,0 @@ -# -*- fmf-version: 1.0; coding: utf-8; delimiter:, -*- -[*reference] -title: Demonstrating the flexibility of the Full-Metadata-Format -creator: Andreas W. Liehr -created: 2008-10-29 -place: Freiburger Materialforschungszentrum, Universität Freiburg, Deutschland -[String Examples] -word: Hello! -sentence: Hello World! -comma separated list: world, die Welt, el mundo, monde -multiline: '''A multiline value, -that spans more than one line :-) -The line breaks are included in the value.''' -[Numbers] -#Note, that the 'key' is arbitrary, but has to be unique within a section -integer: 1 -float: 1.0 -float with leading dot: .1 -float with exponential: 1e-10 -float with Exponential: -1.1E10 -complex: 1+2j -[Physical Quantities] -number: N = 2 -voltage: U = 1V -temperature in Celsius: T_C = 22 degC -temperature in Fahrenheit: T = 22 degF -[Physical Quantities with error] -voltage: U = 1 V +- 1 mV -current: I = 1 A +/- 0.001 A -energy: E = 1 J \pm 1 mJ -work: A = 1 W +- 0.1% -voltage in brackets: U = (1 +- 0.001) V -current in brackets: I = (1 +- 0.1%) A -estimated parameter: p = 1 \pm 0.1 -another estimated parameter: p = 1 \pm 1% -[*table definitions] -table: T -mixed: M -[*data definitions: T] -String: S -Integer: I -Float with dot: Fd -Float with exponent: Fe -Complex: C -Missing Value: V_m -Infinite Value: V_i -[*data: T] -H_2,1,1.,1e1,1+0j,nan,inf -O_2,2,.2,2E1,2+.1j,NaN,INF -O 2,2,.2,2E1,2+.1j,NAN,Inf -[*data definitions: M] -String: S -Complex: C -Float: F -[*data: M] -N_2,1,2 -2,1+1j,2.1 Deleted: tags/pyphant-0.8a1/doc/demo/features.png =================================================================== --- tags/pyphant-0.8a1/doc/demo/features.png 2011-12-02 15:25:53 UTC (rev 709) +++ tags/pyphant-0.8a1/doc/demo/features.png 2011-12-02 15:59:33 UTC (rev 710) @@ -1,14 +0,0 @@ -\x89PNG - - |
From: <ah...@us...> - 2011-12-02 15:26:03
|
Revision: 709 http://pyphant.svn.sourceforge.net/pyphant/?rev=709&view=rev Author: aheld84 Date: 2011-12-02 15:25:53 +0000 (Fri, 02 Dec 2011) Log Message: ----------- cloned trunk Added Paths: ----------- tags/pyphant-0.8a1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-02 13:42:20
|
Revision: 708 http://pyphant.svn.sourceforge.net/pyphant/?rev=708&view=rev Author: aheld84 Date: 2011-12-02 13:42:09 +0000 (Fri, 02 Dec 2011) Log Message: ----------- Merge branch 'v1.0' into svn-tag-pyphant-1.0b1 * v1.0: Configured release for v1.0b1 Modified Paths: -------------- tags/pyphant-1.0b1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py tags/pyphant-1.0b1/src/pyphant/setup.py tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.py tags/pyphant-1.0b1/src/workers/OSC/setup.py tags/pyphant-1.0b1/src/workers/Statistics/setup.py tags/pyphant-1.0b1/src/workers/fmfile/setup.py tags/pyphant-1.0b1/src/workers/tools/setup.py Removed Paths: ------------- tags/pyphant-1.0b1/src/pyphant/setup.cfg tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.cfg tags/pyphant-1.0b1/src/workers/OSC/setup.cfg tags/pyphant-1.0b1/src/workers/Statistics/setup.cfg tags/pyphant-1.0b1/src/workers/fmfile/setup.cfg tags/pyphant-1.0b1/src/workers/tools/setup.cfg Modified: tags/pyphant-1.0b1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py =================================================================== --- tags/pyphant-1.0b1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-12-02 13:42:09 UTC (rev 708) @@ -35,7 +35,7 @@ __id__ = "$Id$" __author__ = "$Author$" -__version__ = "Sprint" +__version__ = "1.0b1" # $Source$ import os, os.path, pkg_resources Deleted: tags/pyphant-1.0b1/src/pyphant/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/pyphant/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/pyphant/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/pyphant/setup.py =================================================================== --- tags/pyphant-1.0b1/src/pyphant/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/pyphant/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -4,33 +4,38 @@ __id__ = '$Id: $' __revision__ = '$Revision: 25 $' -VERSION = '0.5' +VERSION = '1.0b1' from setuptools import setup, find_packages -setup( name='pyphant', - version = VERSION, - description='Workflow modelling app', - author='Klaus Zimmermann, Andreas W. Liehr', - author_email='kla...@fm...', - maintainer='Klaus Zimmermann', - maintainer_email='zk...@so...', - license = "BSD", - url='http://pyphant.sourceforge.net/', - install_requires=['sogl>=0.2.0', - 'egenix-mx-base', - 'paste', - 'simplejson', - ## The following are required, but currently not setuptools enabled. - #'ScientificPython>=2.6', - #'matplotlib>=0.90.1', - #'scipy>=0.5.2', - #'tables>=1.4', - #'wxPython>=2.6.3.2', - ], - packages = find_packages(), - entry_points={'gui_scripts':['wxPyphant = pyphant.wxgui2.wxPyphantApplication:startWxPyphant']}, - include_package_data = True, - test_suite = 'pyphant.tests' - ) +setup( + name='pyphant', + version=VERSION, + description='Workflow modelling app', + author='Alexander Held, Andreas W. Liehr, Klaus Zimmermann', + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + url='http://pyphant.sourceforge.net/', + install_requires=[ + 'sogl>=0.2.0', + 'paste', + 'simplejson', + ## The following are required, + ## but currently not setuptools enabled. + #'ScientificPython', + #'matplotlib', + #'scipy', + #'tables', + #'wxPython', + #'egenix-mx-base', + ], + packages=find_packages(), + entry_points={'gui_scripts':[ + 'wxPyphant = pyphant.wxgui2.wxPyphantApplication:startWxPyphant' + ]}, + include_package_data=True, + test_suite='pyphant.tests' + ) Deleted: tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.py =================================================================== --- tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/ImageProcessing/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -9,24 +9,29 @@ http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '1.0b1' import setuptools setuptools.setup( - name = "pyphant.imageprocessing", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['ImageProcessing'], - entry_points = """ + name="pyphant.imageprocessing", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=1.0b1'], + packages=['ImageProcessing'], + entry_points=""" [pyphant.workers] myeentry = ImageProcessing """, - test_suite = 'ImageProcessing.tests') + test_suite='ImageProcessing.tests' + ) Deleted: tags/pyphant-1.0b1/src/workers/OSC/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/workers/OSC/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/OSC/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/workers/OSC/setup.py =================================================================== --- tags/pyphant-1.0b1/src/workers/OSC/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/OSC/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -6,24 +6,29 @@ Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '1.0b1' import setuptools setuptools.setup( - name = "pyphant.osc", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['OSC'], - entry_points = """ + name="pyphant.osc", + version=VERSION, + author=__author__, + author_email='kla...@fm...', + maintainer='Klaus Zimmermann', + maintainer_email='kla...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=1.0b1'], + packages=['OSC'], + entry_points=""" [pyphant.workers] myeentry = OSC """, - test_suite='OSC.tests') + test_suite='OSC.tests' + ) Deleted: tags/pyphant-1.0b1/src/workers/Statistics/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/workers/Statistics/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/Statistics/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/workers/Statistics/setup.py =================================================================== --- tags/pyphant-1.0b1/src/workers/Statistics/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/Statistics/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -9,24 +9,29 @@ http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '1.0b1' import setuptools setuptools.setup( - name = "pyphant.statistics", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['Statistics'], - entry_points = """ + name="pyphant.statistics", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=1.0b1'], + packages=['Statistics'], + entry_points=""" [pyphant.workers] myeentry = Statistics """, - test_suite = 'Statistics.tests') + test_suite='Statistics.tests' + ) Deleted: tags/pyphant-1.0b1/src/workers/fmfile/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/workers/fmfile/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/fmfile/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/workers/fmfile/setup.py =================================================================== --- tags/pyphant-1.0b1/src/workers/fmfile/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/fmfile/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -6,28 +6,35 @@ Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Andreas W. Liehr" +__author__ = "Alexander Held, Andreas W. Liehr, Rolf Wuerdemann, " +\ + "Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '1.0b1' import setuptools setuptools.setup( - name = "pyphant.fmf", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3', - 'ConfigObj' - ], - packages = ['fmfile'], - entry_points = """ + name="pyphant.fmf", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=[ + 'pyphant>=1.0b1', + 'ConfigObj' + ], + packages=['fmfile'], + entry_points=""" [pyphant.workers] myeentry = fmfile [pyphant.visualizers] pil.image = fmfile.FMFWriter:FMFWriter """, - test_suite='fmfile.tests') + test_suite='fmfile.tests' + ) Deleted: tags/pyphant-1.0b1/src/workers/tools/setup.cfg =================================================================== --- tags/pyphant-1.0b1/src/workers/tools/setup.cfg 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/tools/setup.cfg 2011-12-02 13:42:09 UTC (rev 708) @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -[egg_info] -tag_build = .dev -tag_svn_revision = 1 Modified: tags/pyphant-1.0b1/src/workers/tools/setup.py =================================================================== --- tags/pyphant-1.0b1/src/workers/tools/setup.py 2011-12-02 13:21:01 UTC (rev 707) +++ tags/pyphant-1.0b1/src/workers/tools/setup.py 2011-12-02 13:42:09 UTC (rev 708) @@ -6,24 +6,29 @@ Visit http://pyphant.sourceforge.net for more information. """ -__author__ = "Klaus Zimmermann, Kai Kaminski" +__author__ = "Alexander Held, Klaus Zimmermann" __id__ = '$Id$' __revision__ = '$Revision: 25 $' -VERSION = '0.1' +VERSION = '1.0b1' import setuptools setuptools.setup( - name = "pyphant.tools", - version = VERSION, - author = __author__, - description = __doc__, - install_requires=['pyphant>=0.4alpha3'], - packages = ['tools'], - entry_points = """ + name="pyphant.tools", + version=VERSION, + author=__author__, + author_email='ale...@fm...', + maintainer='Alexander Held', + maintainer_email='ale...@fm...', + license="BSD", + description=__doc__, + install_requires=['pyphant>=1.0b1'], + packages=['tools'], + entry_points=""" [pyphant.workers] myeentry = tools """, - test_suite='tools.tests') + test_suite='tools.tests' + ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-12-02 13:21:07
|
Revision: 707 http://pyphant.svn.sourceforge.net/pyphant/?rev=707&view=rev Author: aheld84 Date: 2011-12-02 13:21:01 +0000 (Fri, 02 Dec 2011) Log Message: ----------- cloned svn-trunk Added Paths: ----------- tags/pyphant-1.0b1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-30 16:16:16
|
Revision: 706 http://pyphant.svn.sourceforge.net/pyphant/?rev=706&view=rev Author: aheld84 Date: 2011-11-30 16:16:10 +0000 (Wed, 30 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: simpleCLI.py Fix: Removed broken cli/demo.h5 Modified Paths: -------------- trunk/src/pyphant/pyphant/cli/demo.h5 trunk/src/pyphant/pyphant/cli/simpleCLI.py Modified: trunk/src/pyphant/pyphant/cli/demo.h5 =================================================================== (Binary files differ) Modified: trunk/src/pyphant/pyphant/cli/simpleCLI.py =================================================================== --- trunk/src/pyphant/pyphant/cli/simpleCLI.py 2011-11-29 09:19:11 UTC (rev 705) +++ trunk/src/pyphant/pyphant/cli/simpleCLI.py 2011-11-30 16:16:10 UTC (rev 706) @@ -42,14 +42,14 @@ recipe = handler.loadRecipe() #Configure ImageLoaderWorker -inputWorker = recipe.getWorkers('Image Loader')[0] +inputWorker = recipe.getWorker('Load Image') imageName = 'demo.png' inputWorker.getParam('filename').value=imageName #Fetch Result -worker = recipe.getWorkers('Apply Mask')[0] -result = worker.plugCreateMaskedImage.getResult() +worker = recipe.getWorker('Invert') +result = worker.plugInvert.getResult() #Visualise result visualizer = ImageVisualizer(result) -visualizer.figure.savefig('result-'+imageName) +visualizer.figure.savefig('result-' + imageName) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-29 09:19:18
|
Revision: 705 http://pyphant.svn.sourceforge.net/pyphant/?rev=705&view=rev Author: aheld84 Date: 2011-11-29 09:19:11 +0000 (Tue, 29 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Cosm: Cleaned up code Bugfix: Gravitational constant 'Grav' of FMFversion 1.0 is correctly interpreted. Refactoring ParseQuantities: Explicitely checking for changed units has the disadvantage to fail on combined units. Refactoring str2unit: The function has been refactured in order to fix some bugs, but this is just a work around, because other bugs keep crawling out of their holes. ParseQuantities: Bugfix, reading FMF 1.0 does not accidentially convert some values to base units due to floating point accuracy. ParseQuantity: Refactored str2unit Modified Paths: -------------- trunk/src/pyphant/pyphant/quantities/ParseQuantities.py trunk/src/pyphant/pyphant/tests/TestParseQuantities.py trunk/src/workers/fmfile/fmfile/tests/TestFMFLoader.py Modified: trunk/src/pyphant/pyphant/quantities/ParseQuantities.py =================================================================== --- trunk/src/pyphant/pyphant/quantities/ParseQuantities.py 2011-11-18 15:34:32 UTC (rev 704) +++ trunk/src/pyphant/pyphant/quantities/ParseQuantities.py 2011-11-29 09:19:11 UTC (rev 705) @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (c) 2008-2009, Rectorate of the University of Freiburg -# Copyright (c) 2009-2010, Andreas W. Liehr (li...@us...) +# Copyright (c) 2009-2011, Andreas W. Liehr (li...@us...) # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,52 +45,70 @@ import logging _logger = logging.getLogger("pyphant") -def str2unit(unit,FMFversion='1.1'): - """The function str2unit returns either a quantity or a float from a given string.""" +def str2unit(unitStr, FMFversion='1.1'): + """return float or Quantity instance + + The function str2unit is a factory, which either returns a float + or a Quantity instance from a given string. + Because the definition of units and physical constants is not unique for + FMFversion 1.0 (http://arxiv.org/abs/0904.1299) and + FMFversion 1.1 (http://dx.doi.org/10.1016/j.cpc.2009.11.014), + the result of str2unit() depends on FMFversion. + """ + if FMFversion not in ['1.0', '1.1']: + raise ValueError('FMFversion %s not supported.' % (FMFversion, )) + # Deal with exceptional units like '%' or 'a.u.' + if unitStr.endswith('%'): + if len(unitStr.strip()) == 1: + return 0.01 + else: + return float(unitStr[:-1]) / 100.0 + elif unitStr.endswith('a.u.'): + if len(unitStr.strip()) == 4: + return 1.0 + else: + return float(unitStr[:-4]) # Prepare conversion to quantity - if unit.startswith('.'): - unit = '0'+unit - elif unit.endswith('%'): + if unitStr.startswith('.'): + unitStr = '0' + unitStr + elif not (unitStr[0].isdigit() or unitStr[0] == '-'): + unitStr = '1' + unitStr + # Convert input to quantity or float + unitStr = unitStr.replace('^', '**') + try: #FMFversion == '1.1' + unit = Quantity(unitStr.encode('utf-8')) + except: + unit = None + if FMFversion == '1.0': try: - unit = float(unit[:-1])/100.0 - except: - unit = 0.01 - elif unit.endswith('a.u.'): + unit1_0 = PhysicalQuantity(unitStr.encode('utf-8')) + unit1_1 = Quantity(str(unit1_0.inBaseUnits())) + except: + unit1_1 = None + if isinstance(unit1_1, Quantity): # Unit exists in 1.0 + if isinstance(unit, Quantity): # Unit also exists in 1.1 + if unit.isCompatible(unit1_1.unit): + # Interpretation of unit has not changed + unit = unit1_1.inUnitsOf(unit.unit) + else: + unit = unit1_1 + _logger.warn('Usage of old unit "%s" required ' + 'conversion to base units.' % (unitStr, )) + else: + unit = unit1_1 + _logger.warn('Usage of old unit "%s" required ' + 'conversion to base units.' % (unitStr, )) + if unit is None: try: - unit = float(unit[:-4]) + if 'j' in unitStr: + unit = complex(unitStr) + else: + unit = float(unitStr) except: - unit = 1.0 - elif not (unit[0].isdigit() or unit[0]=='-'): - unit = '1'+unit - # Convert input to quantity or float - if FMFversion not in ['1.0','1.1']: - raise ValueError, 'FMFversion %s not supported.' % FMFversion - else: - try: - unit = unit.replace('^', '**') - if FMFversion=='1.1': - unit = Quantity(unit.encode('utf-8')) - elif FMFversion=='1.0': - unit1_0 = PhysicalQuantity(unit.encode('utf-8')) - unit = Quantity(str(unit1_0.inBaseUnits())) - try: - unit_new = Quantity(str(unit1_0)) - if unit_new == unit: - unit = unit_new - else: - _logger.warn('Usage of old unit "%s" required ' - 'conversion to base units.' % unit1_0) - except: - _logger.warn('Usage of old unit "%s" required ' - 'conversion to base units.' % unit1_0) - except Exception, e: - try: - unit = float(unit) - except: - raise e + raise ValueError("Unit %s cannot be interpreted." % (unitStr, )) return unit -def parseQuantity(value,FMFversion='1.1'): +def parseQuantity(value, FMFversion='1.1'): import re pm = re.compile(ur"(?:\\pm|\+-|\+/-)") try: @@ -106,36 +124,39 @@ value = str2unit(value,FMFversion) if error != None: if error.endswith('%'): - error = value*float(error[:-1])/100.0 + error = value * float(error[:-1]) / 100.0 else: try: - error = float(error)*unit + error = float(error) * unit except: - error = str2unit(error,FMFversion) + error = str2unit(error, FMFversion) return value, error -def parseVariable(oldVal,FMFversion='1.1'): +def parseVariable(oldVal, FMFversion='1.1'): shortname, value = tuple([s.strip() for s in oldVal.split('=')]) - value, error = parseQuantity(value,FMFversion) + value, error = parseQuantity(value, FMFversion) return (shortname, value, error) -def parseDateTime(value,FMFversion='1.1'): +def parseDateTime(value, FMFversion='1.1'): """ >>>parseDateTime('2004-08-21 12:00:00+-12hr') - (Quantity(731814.5,'d'), Quantity(0.5,'d')) + (Quantity(731814.5, 'd'), Quantity(0.5, 'd')) >>>parseDateTime('2004-08-21 12:00:00') - (Quantity(731814.5,'d'), None) + (Quantity(731814.5, 'd'), None) """ datetimeWithError = value.split('+-') - if len(datetimeWithError)==2: + if len(datetimeWithError) == 2: datetime = mx.DateTime.ISO.ParseAny(datetimeWithError[0]) - uncertainty = parseQuantity(datetimeWithError[1],FMFversion)[0] + uncertainty = parseQuantity(datetimeWithError[1], FMFversion)[0] if uncertainty.isCompatible('h'): - _logger.warning("The uncertainty of timestamp %s has the unit 'h', which is deprecated. The correct abbreviation for hour is 'hr'." % value) - uncertainty = uncertainty*Quantity('1hr/h') + _logger.warning( + "The uncertainty of timestamp %s has the unit 'h', " + "which is deprecated. " + "The correct abbreviation for hour is 'hr'." % (value, )) + uncertainty = uncertainty * Quantity('1hr/h') error = uncertainty.inUnitsOf('d') else: datetime = mx.DateTime.ISO.ParseAny(value) error = None - days,seconds = datetime.absvalues() - return (Quantity(days,'d')+Quantity(seconds,'s'),error) + days, seconds = datetime.absvalues() + return (Quantity(days, 'd') + Quantity(seconds, 's'), error) Modified: trunk/src/pyphant/pyphant/tests/TestParseQuantities.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestParseQuantities.py 2011-11-18 15:34:32 UTC (rev 704) +++ trunk/src/pyphant/pyphant/tests/TestParseQuantities.py 2011-11-29 09:19:11 UTC (rev 705) @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright (c) 2009, Rectorate of the University of Freiburg -# Copyright (c) 2009-2010, Andreas W. Liehr (li...@us...) +# Copyright (c) 2009-2011, Andreas W. Liehr (li...@us...) # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -35,54 +35,86 @@ import pkg_resources pkg_resources.require('pyphant') - -import unittest, numpy +import unittest from pyphant.quantities.ParseQuantities import parseDateTime,str2unit from pyphant.quantities import Quantity -""" + + +class TestParseDateTime(unittest.TestCase): + """ >>>parseDateTime('2004-08-21 12:00:00+-12hr') - (Quantity(731814.5,'d'), Quantity(0.5,'d')) + (Quantity(731814.5, 'd'), Quantity(0.5, 'd')) >>>parseDateTime('2004-08-21 12:00:00') - (Quantity(731814.5,'d'), None) -""" -class TestParseDateTime(unittest.TestCase): + (Quantity(731814.5, 'd'), None) + """ + def testWithError(self): self.assertEqual(parseDateTime('2004-08-21 12:00:00+-12hr'), - (Quantity(731814.5,'d'), Quantity(0.5,'d')) + (Quantity(731814.5, 'd'), Quantity(0.5, 'd')) ) def testWithErrorOldDeprecatedAbbreviation(self): self.assertEqual(parseDateTime('2004-08-21 12:00:00+-12h'), - (Quantity(731814.5,'d'), Quantity(0.5,'d')) + (Quantity(731814.5, 'd'), Quantity(0.5, 'd')) ) + class TestStr2unit(unittest.TestCase): """Test the correct conversion of strings to quantities or floats.""" + + def setUp(self): + self.inputDict = {'complexJ':'1.0j', 'Joule':'1.0J'} + def testSimpleQuantity(self): - """The the conversion of a simple textual quantity specification to a quantity object.""" + """ + The the conversion of a simple textual quantity specification + to a quantity object. + """ expected = Quantity('1V') result = str2unit('1V') - self.assertEqual(expected,result) + self.assertEqual(expected, result) - def setUp(self): - self.inputDict = {'complexJ':'1.0j','Joule':'1.0J'} + def testComplexNumber(self): + """ + Complex numbers have to be denoted by small 'j', + in oder to discriminate them from Joule. + """ + result = str2unit(self.inputDict['complexJ']) + self.assertEqual(result, complex(self.inputDict['complexJ'])) def testJouleValue(self): """Physical quantities with unit Joule are indicated by 'J'.""" result = str2unit(self.inputDict['Joule']) - self.assertEqual(result,Quantity(self.inputDict['Joule'])) + self.assertEqual(result, Quantity(self.inputDict['Joule'])) def testHourPlanck(self): - """In FMF 1.0 unit 'h' denotes hours, while in FMF 1.1 'h' denotes the Planck constant.""" + """ + In FMF 1.0 unit 'h' denotes hours, + while in FMF 1.1 'h' denotes the Planck constant. + """ result = str2unit('1h') - self.assertEqual(result,Quantity('6.62606896e-34 J*s')) - result = str2unit('1h',FMFversion='1.0') - self.assertEqual(result,Quantity('3600s')) + self.assertEqual(result, Quantity('6.62606896e-34 J*s')) + result = str2unit('1h', FMFversion='1.0') + self.assertEqual(result, Quantity('3600s')) + def testFloatAccuracy(self): + result = str2unit('16.8 mm', FMFversion='1.0') + diff = result - Quantity('16.8 mm') + self.assertEqual(abs(diff.value) < 2e-14,True) + result = str2unit('16.8 mm', FMFversion='1.0') + diff = Quantity('16.8 mm') + self.assertEqual(result, diff) + + def testGravitationalConstant(self): + result = str2unit("1 Grav", FMFversion="1.0") + self.assertEqual(result, str2unit('6.67259e-11 m**3/kg/s**2')) + + if __name__ == "__main__": import sys if len(sys.argv) == 1: unittest.main() else: - suite = unittest.TestLoader().loadTestsFromTestCase(eval(sys.argv[1:][0])) + suite = unittest.TestLoader().loadTestsFromTestCase( + eval(sys.argv[1:][0])) unittest.TextTestRunner().run(suite) Modified: trunk/src/workers/fmfile/fmfile/tests/TestFMFLoader.py =================================================================== --- trunk/src/workers/fmfile/fmfile/tests/TestFMFLoader.py 2011-11-18 15:34:32 UTC (rev 704) +++ trunk/src/workers/fmfile/fmfile/tests/TestFMFLoader.py 2011-11-29 09:19:11 UTC (rev 705) @@ -1,8 +1,8 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python2.6 # -*- coding: utf-8 -*- # Copyright (c) 2008-2009, Rectorate of the University of Freiburg -# Copyright (c) 2009-2010, Andreas W. Liehr (li...@us...) +# Copyright (c) 2009-2011, Andreas W. Liehr (li...@us...) # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,15 +45,22 @@ from pyphant.quantities.ParseQuantities import str2unit from copy import deepcopy +#Estimate floating point accuracy +ACCURACY = 1.0 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0. + class FieldContainerCondenseDim(unittest.TestCase): def setUp(self): self.x = numpy.linspace(0,0.9,10) m = numpy.meshgrid(self.x, self.x*5) self.valid = numpy.tile(self.x, (10,1)) - self.invalid = [ a.squeeze() for a in numpy.vsplit(m[0]+m[1], len(m[0])) ] + self.invalid = [ + a.squeeze() for a in numpy.vsplit(m[0] + m[1], len(m[0])) + ] def testInvalid(self): - self.assertRaises(AssertionError, FMFLoader.checkAndCondense, self.invalid) + self.assertRaises( + AssertionError, FMFLoader.checkAndCondense, self.invalid + ) def testValid(self): result = FMFLoader.checkAndCondense(self.valid) @@ -61,75 +68,100 @@ class TestColumn2FieldContainer(unittest.TestCase): def testStrings(self): - column = ['Hello','World'] - result = FMFLoader.column2FieldContainer('simple string',column) - expectedResult = FieldContainer(numpy.array(column),longname='simple string') - assertEqual(result,expectedResult) + column = ['Hello', 'World'] + result = FMFLoader.column2FieldContainer('simple string', column) + expectedResult = FieldContainer( + numpy.array(column), longname='simple string' + ) + assertEqual(result, expectedResult) def testListofStrings(self): - column = ['World',['Hello', 'World'],'World'] - result = FMFLoader.column2FieldContainer('simple string',column) - expectedResult = FieldContainer(numpy.array(['World','Hello, World','World']),longname='simple string') - assertEqual(result,expectedResult) + column = ['World', ['Hello', 'World'], 'World'] + result = FMFLoader.column2FieldContainer('simple string', column) + expectedResult = FieldContainer( + numpy.array(['World', 'Hello, World', 'World']), + longname='simple string' + ) + assertEqual(result, expectedResult) def testListofStrings2(self): - column = [['Hello', 'World'],'World'] - result = FMFLoader.column2FieldContainer('simple string',column) - expectedResult = FieldContainer(numpy.array(['Hello, World','World']),longname='simple string') - assertEqual(result,expectedResult) + column = [['Hello', 'World'], 'World'] + result = FMFLoader.column2FieldContainer('simple string', column) + expectedResult = FieldContainer( + numpy.array(['Hello, World', 'World']), longname='simple string' + ) + assertEqual(result, expectedResult) def testVariable(self): - column = [('T',Quantity('22.4 degC'),Quantity('0.5 degC')), - ('T',Quantity('11.2 degC'),Quantity('0.5 degC')) - ] - result = FMFLoader.column2FieldContainer('temperature',column) - expectedResult = FieldContainer(numpy.array([22.4,11.2]),error=numpy.array([0.5,0.5]), - mask = numpy.array([False,False]), - unit='1 degC',longname='temperature',shortname='T') - assertEqual(result,expectedResult) + column = [ + ('T', Quantity('22.4 degC'), Quantity('0.5 degC')), + ('T', Quantity('11.2 degC'), Quantity('0.5 degC')) + ] + result = FMFLoader.column2FieldContainer('temperature', column) + expectedResult = FieldContainer( + numpy.array([22.4, 11.2]) ,error=numpy.array([0.5, 0.5]), + mask=numpy.array([False, False]), + unit='1 degC', longname='temperature', shortname='T' + ) + assertEqual(result, expectedResult) def testVariableWithNaN(self): - column = [('T',Quantity('22.4 degC'),Quantity('0.5 degC')), - ('T',Quantity('11.2 degC'),None) - ] - result = FMFLoader.column2FieldContainer('temperature',column) - expectedResult = FieldContainer(numpy.array([22.4,11.2]),error=numpy.array([0.5,0.0]), - mask = numpy.array([False,False]), - unit='1 degC',longname='temperature',shortname='T') - assertEqual(result,expectedResult) + column = [ + ('T', Quantity('22.4 degC'), Quantity('0.5 degC')), + ('T', Quantity('11.2 degC'), None) + ] + result = FMFLoader.column2FieldContainer('temperature', column) + expectedResult = FieldContainer( + numpy.array([22.4, 11.2]), error=numpy.array([0.5, 0.0]), + mask = numpy.array([False, False]), + unit='1 degC', longname='temperature', shortname='T' + ) + assertEqual(result, expectedResult) def testVariableFirstNaN(self): - column = [('T','NaN',Quantity('0.5 degC')), - ('T',Quantity('11.2 degC'),None) - ] - result = FMFLoader.column2FieldContainer('temperature',column) - expectedResult = FieldContainer(numpy.array([numpy.NaN,11.2]),error=numpy.array([0.5,0.0]), - mask = numpy.array([True,False]), - unit='1 degC',longname='temperature',shortname='T') - assertEqual(result,expectedResult) + column = [ + ('T', 'NaN', Quantity('0.5 degC')), + ('T', Quantity('11.2 degC'), None) + ] + result = FMFLoader.column2FieldContainer('temperature', column) + expectedResult = FieldContainer( + numpy.array([numpy.NaN, 11.2]), error=numpy.array([0.5, 0.0]), + mask = numpy.array([True, False]), + unit='1 degC', longname='temperature', shortname='T') + assertEqual(result, expectedResult) class TestDiscriminatingJouleAndImaginary(unittest.TestCase): - """In order to discriminate between an imaginary number and unit Joule, imaginary numbers have to be indicated only by a minor capital 'j', while a major capital 'J' indicates the unit Joule. """ + In order to discriminate between an imaginary number and unit Joule, + imaginary numbers have to be indicated only by a minor capital 'j', + while a major capital 'J' indicates the unit Joule. + """ def setUp(self): - self.inputDict = {'complexJ':'1.0j','Joule':'1.0J'} + self.inputDict = {'complexJ':'1.0j', 'Joule':'1.0J'} - def testComplexVale(self): + def testComplexValue(self): """Imaginary numbers are indicated by 'j'.""" result = FMFLoader.item2value(self.inputDict['complexJ']) - self.assertEqual(result,complex(self.inputDict['complexJ'])) + self.assertEqual(result, (complex(self.inputDict['complexJ']), None)) def testJouleValue1_1(self): """Physical quantities with unit Joule are indicated by 'J'.""" result = FMFLoader.item2value(self.inputDict['Joule']) - self.assertEqual(result,(Quantity(self.inputDict['Joule']),None)) + self.assertEqual(result, (Quantity(self.inputDict['Joule']), None)) def testJouleValue1_0(self): """Physical quantities with unit Joule are indicated by 'J'.""" - result = FMFLoader.item2value(self.inputDict['Joule'],FMFversion='1.0') - self.assertEqual(result,(Quantity(self.inputDict['Joule']),None)) + result = FMFLoader.item2value( + self.inputDict['Joule'], FMFversion='1.0' + ) + self.assertEqual(result, (Quantity(self.inputDict['Joule']), None)) class TestFMFversion1_0(unittest.TestCase): + def almostEqual(self, a, b): + diff = a - b + mean = 0.5 * (a + b) + self.assertTrue(abs(diff / mean) < ACCURACY) + def setUp(self): self.FMFinput = """# -*- fmf-version: 1.0; coding: utf-8 -*- [*reference] @@ -178,31 +210,84 @@ 2 1+1j 2. """ def testReadSingleFile(self): - """Test the correct interpretation of physical constants as definied in FMF version 1.0.""" - consts = FMFLoader.readSingleFile(self.FMFinput,"testReadSingleFile")[0].attributes['Mathematical and Physical Constants'] - self.assertEqual(consts[u'Speed of light'][1],str2unit("1 c",FMFversion="1.0")) - self.assertEqual(consts[u'Speed of light'][1],str2unit("1 c")) - self.assertEqual(consts[u'Permeability of vacuum'][1],str2unit("1 mu0",FMFversion="1.0")) - self.assertEqual(consts[u'Permittivity of vacuum'][1],str2unit("1 eps0",FMFversion="1.0")) - self.assertEqual(consts[u'Gravitational constant'][1],str2unit("1 Grav",FMFversion="1.0")) - self.assertEqual(consts[u'Planck constant'][1],str2unit("1 hplanck",FMFversion="1.0")) - self.assertEqual(consts[u'Planck constant / 2pi'][1],str2unit("1 hbar",FMFversion="1.0")) - self.assertEqual(consts[u'Elementary charge'][1],str2unit("1 e",FMFversion="1.0")) - self.assertNotEqual(consts[u'Elementary charge'][1],str2unit("1 e"), - "Elementary charge has been adapted to new CODATA recommendations.") - self.assertEqual(consts[u'Electron mass'][1],str2unit("1 me",FMFversion="1.0")) - self.assertNotEqual(consts[u'Electron mass'][1],str2unit("1 me"), - "Electron mass has been adapted to new CODATA recommendations.") - self.assertEqual(consts[u'Proton mass'][1],str2unit("1 mp",FMFversion="1.0")) - self.assertNotEqual(consts[u'Proton mass'][1],str2unit("1 mp"), - "Proton mass has been adapted to new CODATA recommendations.") - self.assertEqual(consts[u'Avogadro number'][1],str2unit("1 Nav",FMFversion="1.0")) - self.assertEqual(consts[u'Boltzmann constant'][1],str2unit("1 k",FMFversion="1.0")) - consts = FMFLoader.readSingleFile(self.FMFinput,"testReadSingleFile")[0].attributes['Additional constants changed from FMF version 1.0 to 1.1'] - self.assertEqual(consts[u'Parsec'][1],str2unit("1 pc",FMFversion="1.0")) - self.assertEqual(consts[u'US gallon'][1],str2unit("1 galUS",FMFversion="1.0")) - self.assertEqual(consts[u'Atomic mass units'][1],str2unit("1 amu",FMFversion="1.0")) + """ + Test the correct interpretation of physical constants + as definied in FMF version 1.0. + """ + consts = FMFLoader.readSingleFile( + self.FMFinput, + "testReadSingleFile")[0].attributes[ + 'Mathematical and Physical Constants' + ] + self.assertEqual( + consts[u'Speed of light'][1], str2unit("1 c", FMFversion="1.0") + ) + self.assertEqual(consts[u'Speed of light'][1], str2unit("1 c")) + self.assertEqual( + consts[u'Permeability of vacuum'][1], + str2unit("1 mu0", FMFversion="1.0") + ) + self.assertEqual( + consts[u'Permittivity of vacuum'][1], + str2unit("1 eps0", FMFversion="1.0") + ) + self.assertEqual( + consts[u'Gravitational constant'][1], + str2unit("1 Grav", FMFversion="1.0") + ) + self.assertTrue( + consts[u'Planck constant'][1], + str2unit("1 hplanck", FMFversion="1.0") + ) + self.almostEqual( + consts[u'Planck constant / 2pi'][1], + str2unit("1 hbar", FMFversion="1.0") + ) + self.almostEqual( + consts[u'Elementary charge'][1], + str2unit("1 e", FMFversion="1.0") + ) + self.assertNotEqual( + consts[u'Elementary charge'][1], str2unit("1 e"), + "Elementary charge has been adapted to new CODATA recommendations." + ) + self.assertEqual( + consts[u'Electron mass'][1], str2unit("1 me", FMFversion="1.0") + ) + self.assertNotEqual( + consts[u'Electron mass'][1], str2unit("1 me"), + "Electron mass has been adapted to new CODATA recommendations." + ) + self.assertEqual( + consts[u'Proton mass'][1], str2unit("1 mp", FMFversion="1.0") + ) + self.assertNotEqual( + consts[u'Proton mass'][1], str2unit("1 mp"), + "Proton mass has been adapted to new CODATA recommendations." + ) + self.assertEqual( + consts[u'Avogadro number'][1], str2unit("1 Nav", FMFversion="1.0") + ) + self.assertEqual( + consts[u'Boltzmann constant'][1], str2unit("1 k", FMFversion="1.0") + ) + consts = FMFLoader.readSingleFile( + self.FMFinput, + "testReadSingleFile")[0].attributes[ + 'Additional constants changed from FMF version 1.0 to 1.1' + ] + self.almostEqual( + consts[u'Parsec'][1], str2unit("1 pc", FMFversion="1.0") + ) + self.almostEqual( + consts[u'US gallon'][1], str2unit("1 galUS", FMFversion="1.0") + ) + self.assertEqual( + consts[u'Atomic mass units'][1], + str2unit("1 amu", FMFversion="1.0") + ) + class TestFMFversion1_1(unittest.TestCase): def setUp(self): self.FMFinput = """# -*- fmf-version: 1.1; coding: utf-8 -*- @@ -255,26 +340,76 @@ 2 1+1j 2. """ def testReadSingleFile(self): - """Test the correct interpretation of physical constants as definied in FMF version 1.1.""" - consts = FMFLoader.readSingleFile(self.FMFinput,"testReadSingleFile")[0].attributes['Mathematical and Physical Constants'] - self.assertEqual(consts[u'Speed of light'][1],str2unit("1 c",FMFversion="1.1")) - self.assertEqual(consts[u'Permeability of vacuum'][1],str2unit("1 mu0",FMFversion="1.1"), - 'The values differ by %s.' % (consts[u'Permeability of vacuum'][1]-str2unit("1 mu0",FMFversion="1.1"),)) - self.assertEqual(consts[u'Permittivity of vacuum'][1],str2unit("1 eps0",FMFversion="1.1")) - self.assertEqual(consts[u'Gravitational constant'][1],str2unit("1 G",FMFversion="1.1")) - self.assertEqual(consts[u'Planck constant'][1],str2unit("1 h",FMFversion="1.1")) - self.assertEqual(consts[u'Planck constant / 2pi'][1],str2unit("1 hbar",FMFversion="1.1")) - self.assertEqual(consts[u'Elementary charge'][1],str2unit("1 e",FMFversion="1.1"), - 'The elements %s and %s do not match.' % (consts[u'Elementary charge'][1],str2unit("1 e",FMFversion="1.1"))) - self.assertEqual(consts[u'Electron mass'][1],str2unit("1 me",FMFversion="1.1")) - self.assertEqual(consts[u'Proton mass'][1],str2unit("1 mp",FMFversion="1.1")) - self.assertEqual(consts[u'Avogadro number'][1],str2unit("1 NA",FMFversion="1.1")) - self.assertEqual(consts[u'Boltzmann constant'][1],str2unit("1 k",FMFversion="1.1")) - self.assertEqual(consts[u'Rydberg constant'][1],str2unit("1 Ryd",FMFversion="1.1")) - consts = FMFLoader.readSingleFile(self.FMFinput,"testReadSingleFile")[0].attributes['Additional constants changed from FMF version 1.0 to 1.1'] - self.assertEqual(consts[u'Parsec'][1],str2unit("1 pc",FMFversion="1.1")) - self.assertEqual(consts[u'US gallon'][1],str2unit("1 galUS",FMFversion="1.1")) - self.assertEqual(consts[u'Atomic mass units'][1],str2unit("1 u",FMFversion="1.1")) + """ + Test the correct interpretation of physical constants + as definied in FMF version 1.1. + """ + consts = FMFLoader.readSingleFile( + self.FMFinput, "testReadSingleFile")[0].attributes[ + 'Mathematical and Physical Constants' + ] + self.assertEqual( + consts[u'Speed of light'][1], str2unit("1 c", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Permeability of vacuum'][1], + str2unit("1 mu0", FMFversion="1.1"), + 'The values differ by %s.' % ( + consts[u'Permeability of vacuum'][1] -\ + str2unit("1 mu0", FMFversion="1.1"), + ) + ) + self.assertEqual( + consts[u'Permittivity of vacuum'][1], + str2unit("1 eps0", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Gravitational constant'][1], + str2unit("1 G", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Planck constant'][1], + str2unit("1 h", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Planck constant / 2pi'][1], + str2unit("1 hbar", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Elementary charge'][1], str2unit("1 e",FMFversion="1.1"), + 'The elements %s and %s do not match.' % ( + consts[u'Elementary charge'][1], + str2unit("1 e", FMFversion="1.1") + ) + ) + self.assertEqual( + consts[u'Electron mass'][1], str2unit("1 me", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Proton mass'][1], str2unit("1 mp", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Avogadro number'][1], str2unit("1 NA", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Boltzmann constant'][1], str2unit("1 k",FMFversion="1.1") + ) + self.assertEqual( + consts[u'Rydberg constant'][1], str2unit("1 Ryd", FMFversion="1.1") + ) + consts = FMFLoader.readSingleFile( + self.FMFinput, "testReadSingleFile")[0].attributes[ + 'Additional constants changed from FMF version 1.0 to 1.1' + ] + self.assertEqual( + consts[u'Parsec'][1], str2unit("1 pc", FMFversion="1.1") + ) + self.assertEqual( + consts[u'US gallon'][1], str2unit("1 galUS", FMFversion="1.1") + ) + self.assertEqual( + consts[u'Atomic mass units'][1], str2unit("1 u", FMFversion="1.1") + ) class Emd5ConsistencyTestCase(unittest.TestCase): @@ -379,7 +514,6 @@ self.assertEqual(result.attributes['*reference']['title'], title) - if __name__ == "__main__": import sys import logging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-18 15:34:44
|
Revision: 704 http://pyphant.svn.sourceforge.net/pyphant/?rev=704&view=rev Author: aheld84 Date: 2011-11-18 15:34:32 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: PyTablesPersister: Annotations of Recipes Modified Paths: -------------- trunk/src/pyphant/pyphant/core/PyTablesPersister.py trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py Modified: trunk/src/pyphant/pyphant/core/PyTablesPersister.py =================================================================== --- trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-18 15:01:02 UTC (rev 703) +++ trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-18 15:34:32 UTC (rev 704) @@ -109,6 +109,7 @@ def saveRecipe(h5, recipe, saveResults=True): recipeGroup = h5.createGroup("/", "recipe") h5.createGroup("/", "results") + h5.setNodeAttr(recipeGroup, "Annotations", recipe._annotations) workers = recipe.getWorkers() for worker in workers: saveWorker(h5, recipeGroup, worker, saveResults) @@ -257,7 +258,11 @@ def loadRecipe(h5): recipeGroup = h5.root.recipe - recipe = CompositeWorker.CompositeWorker() + try: + annotations = recipeGroup._v_attrs.Annotations + except AttributeError: + annotations = {} + recipe = CompositeWorker.CompositeWorker(annotations=annotations) workers = {} createWorkerGraph(recipeGroup, workers, recipe) restoreResultsToWorkers(recipeGroup, workers, h5) Modified: trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-18 15:01:02 UTC (rev 703) +++ trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-18 15:34:32 UTC (rev 704) @@ -244,7 +244,7 @@ from pyphant.core.CompositeWorker import CompositeWorker from pyphant.core.WorkerRegistry import WorkerRegistry from itertools import chain - recipe = CompositeWorker() + recipe = CompositeWorker(annotations={'foo':42.0, 'bar':u'Hääh?'}) wreg = WorkerRegistry.getInstance() workerInfos = [t.workerInfos for t in wreg.getToolBoxInfoList()] for wInfo in chain(*workerInfos): @@ -261,6 +261,7 @@ loadedWorkerNames = [w.name for w in loadedWorkers] for name in loadedWorkerNames: self.assertTrue(name in workerNames) + self.assertEqual(recipe._annotations, loadedRecipe._annotations) if __name__ == "__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-18 15:01:16
|
Revision: 703 http://pyphant.svn.sourceforge.net/pyphant/?rev=703&view=rev Author: aheld84 Date: 2011-11-18 15:01:02 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: Removed direct usage of PyTablesPersister Modified Paths: -------------- trunk/src/pyphant/pyphant/cli/createExecutionOrder.py trunk/src/pyphant/pyphant/cli/simpleCLI.py trunk/src/pyphant/pyphant/core/H5FileHandler.py trunk/src/pyphant/pyphant/core/PyTablesPersister.py trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py trunk/src/pyphant/pyphant/tests/TestPyTablesPersister.py trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py Modified: trunk/src/pyphant/pyphant/cli/createExecutionOrder.py =================================================================== --- trunk/src/pyphant/pyphant/cli/createExecutionOrder.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/cli/createExecutionOrder.py 2011-11-18 15:01:02 UTC (rev 703) @@ -1,6 +1,7 @@ import pkg_resources pkg_resources.require('pyphant') from pyphant.core import PyTablesPersister +from pyphant.core.H5FileHandler import H5FileHandler import optparse import sys @@ -105,7 +106,8 @@ orderLists.append(orders[i:]) for i, orderList in enumerate(orderLists): filename = os.path.basename(sourcefile)[:-3]+'_%i.h5'%i - PyTablesPersister.saveRecipeToHDF5File(recipe, filename) + with H5FileHandler(filename, 'w') as handler: + handler.saveRecipe(recipe) h5 = tables.openFile(filename, 'r+') for o in orderList: PyTablesPersister.saveExecutionOrder(h5, o) Modified: trunk/src/pyphant/pyphant/cli/simpleCLI.py =================================================================== --- trunk/src/pyphant/pyphant/cli/simpleCLI.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/cli/simpleCLI.py 2011-11-18 15:01:02 UTC (rev 703) @@ -34,11 +34,12 @@ __author__ = "$Author: liehr $" __version__ = "$Revision: 29 $" -import pyphant.core.PyTablesPersister +from pyphant.core.H5FileHandler import H5FileHandler from pyphant.visualizers.ImageVisualizer import ImageVisualizer #Load recipe from hdf file -recipe = pyphant.core.PyTablesPersister.loadRecipeFromHDF5File('demo.h5') +with H5FileHandler('demo.h5', 'r') as handler: + recipe = handler.loadRecipe() #Configure ImageLoaderWorker inputWorker = recipe.getWorkers('Image Loader')[0] @@ -52,7 +53,3 @@ #Visualise result visualizer = ImageVisualizer(result) visualizer.figure.savefig('result-'+imageName) - - - - Modified: trunk/src/pyphant/pyphant/core/H5FileHandler.py =================================================================== --- trunk/src/pyphant/pyphant/core/H5FileHandler.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/core/H5FileHandler.py 2011-11-18 15:01:02 UTC (rev 703) @@ -39,10 +39,8 @@ # $Source$: import tables from pyphant.core import DataContainer -from tables import StringCol from pyphant.quantities import Quantity PhysicalQuantity = Quantity -import scipy import logging import os from pyphant.core import PyTablesPersister @@ -261,7 +259,7 @@ in the file. result -- SampleContainer instance to be saved """ - PyTablesPersister.saveSample(self.handle, resultGroup, result) + return PyTablesPersister.saveSample(self.handle, resultGroup, result) def saveField(self, resultGroup, result): """ @@ -271,4 +269,13 @@ in the file. result -- FieldContainer instance to be saved """ - PyTablesPersister.saveField(self.handle, resultGroup, result) + return PyTablesPersister.saveField(self.handle, resultGroup, result) + + def saveRecipe(self, recipe, saveResults=True): + """ + Saves a recipe + + recipe -- CompositeWorker to be saved + saveResults -- Whether to save results of the workers + """ + return PyTablesPersister.saveRecipe(self.handle, recipe, saveResults) Modified: trunk/src/pyphant/pyphant/core/PyTablesPersister.py =================================================================== --- trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/core/PyTablesPersister.py 2011-11-18 15:01:02 UTC (rev 703) @@ -106,15 +106,12 @@ input.flush() orderGroup._v_attrs.resultPlug = order[1] -def saveRecipeToHDF5File(recipe, filename, saveResults=True): - _logger.info( "Saving to %s" % filename ) - h5 = tables.openFile(filename, 'w') +def saveRecipe(h5, recipe, saveResults=True): recipeGroup = h5.createGroup("/", "recipe") - resultsGroup = h5.createGroup("/", "results") - workers=recipe.getWorkers() + h5.createGroup("/", "results") + workers = recipe.getWorkers() for worker in workers: saveWorker(h5, recipeGroup, worker, saveResults) - h5.close() def saveWorker(h5, recipeGroup, worker, saveResults=True): workerGroup = h5.createGroup(recipeGroup, "worker_"+str(hash(worker))) @@ -258,12 +255,6 @@ except KeyError: _logger.warning(u'Could not restore "%s" to parameter: "%s"'%(param,paramName)) -def loadRecipeFromHDF5File( filename ): - h5 = tables.openFile(filename, 'r') - recipe = loadRecipe(h5) - h5.close() - return recipe - def loadRecipe(h5): recipeGroup = h5.root.recipe recipe = CompositeWorker.CompositeWorker() Modified: trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/tests/TestH5FileHandler.py 2011-11-18 15:01:02 UTC (rev 703) @@ -45,8 +45,7 @@ import pkg_resources pkg_resources.require("pyphant") from pyphant.quantities import Quantity as PQ -from pyphant.core.DataContainer import FieldContainer, SampleContainer,\ - assertEqual +from pyphant.core.DataContainer import FieldContainer, SampleContainer from pyphant.core.H5FileHandler import H5FileHandler as H5FH from numpy import array as NPArray import os @@ -56,7 +55,7 @@ class BasicTestCase(unittest.TestCase): def testReadOnlyFileNotFound(self): try: - handler = H5FH('', 'r') + H5FH('', 'r') assert False except IOError: pass @@ -78,8 +77,8 @@ class FCSaveLoadTestCase(FieldContainerTestCase): def setUp(self): FieldContainerTestCase.setUp(self) - osHandle, self.fcFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.fcFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) def tearDown(self): @@ -96,8 +95,8 @@ class FCReadOnlyTestCase(FieldContainerTestCase): def setUp(self): FieldContainerTestCase.setUp(self) - osHandle, self.rofcFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.rofcFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) handler = H5FH(self.rofcFilename, 'w') with handler: @@ -137,11 +136,10 @@ class SCSaveLoadTestCase(SampleContainerTestCase): def setUp(self): SampleContainerTestCase.setUp(self) - osHandle, self.scFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.scFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) - def tearDown(self): os.remove(self.scFilename) @@ -156,8 +154,8 @@ class SCReadOnlyTestCase(SampleContainerTestCase): def setUp(self): SampleContainerTestCase.setUp(self) - osHandle, self.roscFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.roscFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) handler = H5FH(self.roscFilename, 'w') with handler: @@ -176,8 +174,8 @@ class MixedAppendTestCase(SampleContainerTestCase): def setUp(self): SampleContainerTestCase.setUp(self) - osHandle, self.appscFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.appscFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) handler = H5FH(self.appscFilename, 'w') with handler: @@ -199,8 +197,8 @@ class SummaryTestCase(SampleContainerTestCase): def setUp(self): SampleContainerTestCase.setUp(self) - osHandle, self.summFilename = mkstemp(suffix = '.h5', - prefix = 'pyphantH5FileHandlerTest') + osHandle, self.summFilename = mkstemp( + suffix = '.h5', prefix = 'pyphantH5FileHandlerTest') os.close(osHandle) handler = H5FH(self.summFilename, 'w') with handler: @@ -233,6 +231,38 @@ self.assertEqual(fcsummary['dimensions'], [im_id]) +class RecipeTestCase(unittest.TestCase): + def setUp(self): + osHandle, self.path = mkstemp( + suffix='.h5', prefix='pyphantH5RecipeTest') + os.close(osHandle) + + def tearDown(self): + os.remove(self.path) + + def testSaveLoadRecipe(self): + from pyphant.core.CompositeWorker import CompositeWorker + from pyphant.core.WorkerRegistry import WorkerRegistry + from itertools import chain + recipe = CompositeWorker() + wreg = WorkerRegistry.getInstance() + workerInfos = [t.workerInfos for t in wreg.getToolBoxInfoList()] + for wInfo in chain(*workerInfos): + worker = wInfo.createWorker() + recipe.addWorker(worker) + with H5FH(self.path, 'w') as handler: + handler.saveRecipe(recipe) + with H5FH(self.path, 'r') as handler: + loadedRecipe = handler.loadRecipe() + loadedWorkers = loadedRecipe.getWorkers() + workers = recipe.getWorkers() + self.assertEqual(len(loadedWorkers), len(workers)) + workerNames = [w.name for w in workers] + loadedWorkerNames = [w.name for w in loadedWorkers] + for name in loadedWorkerNames: + self.assertTrue(name in workerNames) + + if __name__ == "__main__": import sys if len(sys.argv) == 1: Modified: trunk/src/pyphant/pyphant/tests/TestPyTablesPersister.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestPyTablesPersister.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/tests/TestPyTablesPersister.py 2011-11-18 15:01:02 UTC (rev 703) @@ -46,11 +46,10 @@ import scipy import copy, datetime from pyphant.quantities import Quantity -from pyphant.core.DataContainer import FieldContainer, SampleContainer, assertEqual +from pyphant.core.DataContainer import FieldContainer, SampleContainer from pyphant.core.PyTablesPersister import (saveField, loadField, saveSample, loadSample, saveExecutionOrder, loadExecutionOrders) -import numpy.testing as nt import numpy import tables Modified: trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py =================================================================== --- trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-11-17 11:10:52 UTC (rev 702) +++ trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-11-18 15:01:02 UTC (rev 703) @@ -61,8 +61,7 @@ import wx.aui import sogl import pyphant.wxgui2.paramvisualization.ParamVisReg as ParamVisReg -from pyphant.core.PyTablesPersister import (loadRecipeFromHDF5File, - saveRecipeToHDF5File) +from pyphant.core.H5FileHandler import H5FileHandler import WorkerRepository import ConfigureFrame import platform @@ -226,8 +225,9 @@ if self._wxPyphantApp.pathToRecipe[-3:] == '.h5': if os.path.exists(self._wxPyphantApp.pathToRecipe): try: - recipe = loadRecipeFromHDF5File( - self._wxPyphantApp.pathToRecipe) + with H5FileHandler(self._wxPyphantApp.pathToRecipe, 'r') \ + as handler: + recipe = handler.loadRecipe() self._remainingSpace = PyphantCanvas.PyphantCanvas( self, recipe) except: @@ -259,9 +259,9 @@ self.recipeState = 'dirty' def onSaveCompositeWorker(self, event=None): - saveRecipeToHDF5File(self._remainingSpace.diagram.recipe, - self._wxPyphantApp.pathToRecipe, - self._fileMenu.IsChecked(wx.ID_FILE4)) + with H5FileHandler(self._wxPyphantApp.pathToRecipe, 'w') as handler: + handler.saveRecipe(self._remainingSpace.diagram.recipe, + self._fileMenu.IsChecked(wx.ID_FILE4)) self.recipeState = 'clean' def onSaveAsCompositeWorker(self, event=None): @@ -273,9 +273,10 @@ filename = dlg.GetPath() if not filename.endswith(".h5"): filename += ".h5" - saveRecipeToHDF5File( - self._remainingSpace.diagram.recipe, - filename, self._fileMenu.IsChecked(wx.ID_FILE4)) + with H5FileHandler(filename, 'w') as handler: + handler.saveRecipe( + self._remainingSpace.diagram.recipe, + self._fileMenu.IsChecked(wx.ID_FILE4)) self._wxPyphantApp.pathToRecipe = filename self.recipeState = 'clean' from pyphant.core.WebInterface import shorten This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-17 11:10:59
|
Revision: 702 http://pyphant.svn.sourceforge.net/pyphant/?rev=702&view=rev Author: aheld84 Date: 2011-11-17 11:10:52 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: removed python 2.7 specific unittest features Modified Paths: -------------- trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py Modified: trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py 2011-11-17 10:26:46 UTC (rev 701) +++ trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py 2011-11-17 11:10:52 UTC (rev 702) @@ -75,7 +75,7 @@ stuff1 = (stuff1 * rho1).inUnitsOf('C / m ** 3').value stuff2 = (stuff2 * rho2).inUnitsOf('C / m ** 3').value actualRatio = stuff1 / (stuff1 + stuff2) - self.assertAlmostEqual(ratio, actualRatio, delta=delta) + self.assertTrue(abs(ratio - actualRatio) <= delta) if __name__ == "__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ah...@us...> - 2011-11-17 10:26:56
|
Revision: 701 http://pyphant.svn.sourceforge.net/pyphant/?rev=701&view=rev Author: aheld84 Date: 2011-11-17 10:26:46 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: (24 commits) Fix: CommentChar in FMFLoader Fix for ;/# error in FMFLoader - see #52 Fix for #/; error in FMFLoader - see #52 Fix: Pathological fmf tables Fix: Unique timestamps Fix: Bin centers of Histogram worker Enh: Addes simple instantiation tests for tools and OSC Enh: Added tests for ImageProcessing toolbox Enh: Added / updated ImageProcessing tests Enh: Added test for thresholding with units Enh: Added simple LoadZStack worker Fix: Logical Operators for SampleContainers Enh: Adopted tests for intended logical operators Fix: Removed unnecessary imports from DataContainer Enh: Added optional unit support to ThresholdingWorker Enh: Changed deprecated interpretation of multi dim images Cosm: Changed display name of some workers Fix: Broken import in InvertWorker Cosm: Cleaned up OscMapper.py Fix: wxPyphant crash upon exit ... Modified Paths: -------------- trunk/src/pyphant/pyphant/core/CompositeWorker.py trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/pyphant/pyphant/core/Helpers.py trunk/src/pyphant/pyphant/tests/TestDataContainer.py trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py trunk/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py trunk/src/workers/ImageProcessing/ImageProcessing/FitBackground.py trunk/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/Medianiser.py trunk/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/Watershed.py trunk/src/workers/ImageProcessing/ImageProcessing/__init__.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestThresholdingWorker.py trunk/src/workers/OSC/OSC/OscMapper.py trunk/src/workers/OSC/OSC/__init__.py trunk/src/workers/OSC/OSC/tests/TestMRA.py trunk/src/workers/Statistics/Statistics/Histogram.py trunk/src/workers/Statistics/Statistics/tests/TestHistogram.py trunk/src/workers/fmfile/fmfile/FMFLoader.py trunk/src/workers/fmfile/fmfile/tests/TestFMFLoader.py trunk/src/workers/tools/tools/__init__.py Added Paths: ----------- trunk/src/pyphant/pyphant/core/AstTransformers.py trunk/src/pyphant/pyphant/tests/TestTimestamp.py trunk/src/workers/ImageProcessing/ImageProcessing/LoadZStack.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestDiffWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestETFR.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestEdgeFill.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestEnhanceContrast.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestFitBackground.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestGradient.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestInvert.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestLocalExtrema.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestUltimatePoints.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestWatershed.py trunk/src/workers/OSC/OSC/MRA.py trunk/src/workers/OSC/OSC/tests/TestInstantiation.py trunk/src/workers/fmfile/fmfile/tests/resources/fmf/hash_test.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/multitable.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/onecolumn.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/onerow.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/onerow_dep.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/onevalue.fmf trunk/src/workers/fmfile/fmfile/tests/resources/fmf/semi_test.fmf trunk/src/workers/tools/tools/tests/TestInstantiation.py Removed Paths: ------------- trunk/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py trunk/src/workers/tools/tools/MRA.py Added: trunk/src/pyphant/pyphant/core/AstTransformers.py =================================================================== --- trunk/src/pyphant/pyphant/core/AstTransformers.py (rev 0) +++ trunk/src/pyphant/pyphant/core/AstTransformers.py 2011-11-17 10:26:46 UTC (rev 701) @@ -0,0 +1,211 @@ +from pyphant.quantities import Quantity +from ast import (NodeTransformer, fix_missing_locations, Name, Load, + BinOp, Num, Mult, Compare, BoolOp, And, Add, Sub, Div, Or, + Call, Not, Expression) + + +class LocationFixingNodeTransformer(NodeTransformer): + def visit(self, *args, **kargs): + result = NodeTransformer.visit(self, *args, **kargs) + fix_missing_locations(result) + return result + + +class ReplaceName(LocationFixingNodeTransformer): + def __init__(self, sampleContainer): + self.localDict = {} + self.count = 0 + self.sc = sampleContainer + + def visit_Call(self, node): + if isinstance(node.func, Name) and node.func.id.lower() == 'col': + newName = self.getName(self.sc[node.args[0].s]) + return Name(newName, Load()) + + def visit_Str(self, node): + quantity = Quantity(node.s) + class QuantityDummy(object): + pass + dummy = QuantityDummy() + dummy.unit = Quantity(1.0, quantity.unit) + dummy.data = quantity.value + dummy.dimensions = None + newName = self.getName(dummy) + return Name(newName, Load()) + + def getName(self, ref): + newName = "N%s" % self.count + self.count += 1 + self.localDict[newName] = ref + return newName + + +def withFactor(factor, node): + if not isinstance(factor, float): + raise ValueError('Incompatible units!') + if factor == 1.0: + return node + return BinOp(Num(factor), Mult(), node) + + +class ReplaceCompare(LocationFixingNodeTransformer): + def __init__(self, localDict): + self.localDict = localDict + + def visit_Compare(self, node): + self.generic_visit(node) + unitcalc = UnitCalculator(self.localDict) + leftUD = unitcalc.getUnitAndDim(node.left) + listUD = [unitcalc.getUnitAndDim(comp) for comp in node.comparators] + nonNoneDims = [ud[1] for ud in listUD + [leftUD] if ud[1] is not None] + for dims in nonNoneDims: + checkDimensions(nonNoneDims[0], dims) + factorlist = [ud[0] / leftUD[0] for ud in listUD] + newComplist = [withFactor(*t) \ + for t in zip(factorlist, node.comparators)] + compOp = Compare(node.left, node.ops, newComplist) + compOpTrans = self.compBreaker(compOp) + return compOpTrans + + def compBreaker(self, node): + assert isinstance(node, Compare) + if len(node.comparators) == 1: + return node + else: + comp1 = Compare(node.left, node.ops[0:1], + node.comparators[0:1]) + comp2 = Compare(node.comparators[0], + node.ops[1:], node.comparators[1:]) + newNode = BoolOp(And(), [comp1, self.compBreaker(comp2)]) + return newNode + + +class ReplaceOperator(LocationFixingNodeTransformer): + def __init__(self, localDict): + self.localDict = localDict + + def visit_BinOp(self, node): + self.generic_visit(node) + unitcalc = UnitCalculator(self.localDict) + leftUD = unitcalc.getUnitAndDim(node.left) + rightUD = unitcalc.getUnitAndDim(node.right) + checkDimensions(leftUD[1], rightUD[1]) + if isinstance(node.op, (Add, Sub)): + factor = rightUD[0] / leftUD[0] + right = withFactor(factor, node.right) + binOp = BinOp(node.left, node.op, right) + return binOp + elif isinstance(node.op, (Mult, Div)): + return node + else: + raise NotImplementedError('%s not implemented' % (node.op, )) + + def visit_BoolOp(self, node): + self.generic_visit(node) + if isinstance(node.op, And): + func = 'logical_and' + elif isinstance(node.op, Or): + func = 'logical_or' + else: + raise NotImplementedError('%s not implemented' % (node.op, )) + return self.boolOpBreaker(node.values, func) + + def boolOpBreaker(self, values, func): + if len(values) == 1: + return values[0] + else: + return Call(Name(func, Load()), + [values[0], self.boolOpBreaker(values[1:], func)], + [], None, None) + + def visit_UnaryOp(self, node): + self.generic_visit(node) + if isinstance(node.op, Not): + return Call(Name('logical_not', Load()), [node.operand], + [], None, None) + else: + raise NotImplementedError('%s not implemented' % (node.op, )) + + +class UnitCalculator(object): + def __init__(self, localDict): + self.localDict = localDict + + def getUnitAndDim(self, node): + if isinstance(node, Expression): + return self.getUnitAndDim(node.body) + elif isinstance(node, Name): + if node.id in ['True', 'False']: + return (1.0, None) + else: + column = self.localDict[node.id] + return (column.unit, column.dimensions) + elif isinstance(node, Num): + return (1.0, None) + elif isinstance(node, Call): + if not isinstance(node.func, Name): + raise NotImplementedError( + 'Dynamic functions are not implemented!') + funcId = node.func.id + if funcId in ['logical_and', 'logical_or']: + left = self.getUnitAndDim(node.args[0]) + right = self.getUnitAndDim(node.args[1]) + dimensions = checkDimensions(left[1], right[1]) + if not isinstance(left[0], float): + raise ValueError( + "Type %s cannot be interpreted as a Boolean" % left) + if not isinstance(right[0], float): + raise ValueError( + "Type %s cannot be interpreted as a Boolean" % right) + return (1.0, dimensions) + elif funcId == 'logical_not': + return self.getUnitAndDim(node.args[0]) + else: + raise NotImplementedError("Function '%s' not implemented" \ + % (funcId, )) + elif isinstance(node, BinOp): + left = self.getUnitAndDim(node.left) + right = self.getUnitAndDim(node.right) + dimensions = checkDimensions(left[1], right[1]) + if isinstance(node.op, (Add, Sub)): + if not isinstance(left[0] / right[0], float): + raise ValueError("units %s, %s not compatible" \ + % (left, right)) + unit = left[0] + elif isinstance(node.op, Mult): + unit = left[0] * right[0] + elif isinstance(node.op, Div): + unit = left[0] / right[0] + else: + raise NotImplementedError() + return (unit, dimensions) + elif isinstance(node, Compare): + left = self.getUnitAndDim(node.left) + nonNoneDims = [] + if left[1] is not None: + nonNoneDims.append(left[1]) + for comparator in node.comparators: + right = self.getUnitAndDim(comparator) + if right[1] is not None: + nonNoneDims.append(right[1]) + if not isinstance(left[0] / right[0], float): + raise ValueError("units %s, %s not compatible" \ + % (left[0], right[0])) + if len(nonNoneDims) >= 1: + for dims in nonNoneDims: + checkDimensions(nonNoneDims[0], dims) + dimensions = nonNoneDims[0] + else: + dimensions = None + return (1.0, dimensions) + else: + raise NotImplementedError() + + +def checkDimensions(dimensions1, dimensions2): + if dimensions1 is not None and dimensions2 is not None and \ + dimensions1 != dimensions2: + msg = 'Dimensions "%s" and "%s" do not match!' \ + % (dimensions1, dimensions2) + raise ValueError(msg) + return dimensions1 or dimensions2 Modified: trunk/src/pyphant/pyphant/core/CompositeWorker.py =================================================================== --- trunk/src/pyphant/pyphant/core/CompositeWorker.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/pyphant/pyphant/core/CompositeWorker.py 2011-11-17 10:26:46 UTC (rev 701) @@ -84,7 +84,7 @@ API = 2 VERSION = 1 REVISION = "$Revision: $"[11:-1] - name = "CompositeWorker" + name = "Composite" _params = [("noSockets", "Number of sockets", 0, None), ("noPlugs", "Number of plugs", 0, None)] Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2011-11-17 10:26:46 UTC (rev 701) @@ -70,10 +70,11 @@ __version__ = "$Revision$" import copy, hashlib, threading, numpy, StringIO -import os, platform, datetime, socket, urlparse -from pyphant.quantities import (isQuantity, Quantity) +import urlparse +from pyphant.core.AstTransformers import ( + ReplaceName, ReplaceCompare, ReplaceOperator, UnitCalculator, + checkDimensions) import Helpers -from ast import (NodeTransformer, NodeVisitor) import logging _logger = logging.getLogger("pyphant") @@ -175,7 +176,7 @@ self.id = id else: self.hash = self.generateHash() - self.timestamp = datetime.datetime.utcnow() + self.timestamp = Helpers.getModuleUniqueTimestamp() self.id = u"emd5://%s/%s/%s/%s.%s" % (self.machine, self.creator, enc(self.timestamp.isoformat('_')), @@ -336,15 +337,15 @@ sorted by precedence from lowest precedence (least binding) to highest precedence (most binding): + or + and + not Comparisons: <, <=, >, >=, <>, !=, == - Bitwise OR: | - Bitwise XOR: ^ - Bitwise AND: & Addition and Subtraction: +, - Multiplication, Division: *, / - Positive, Negative, Bitwise NOT: +x, -x, ~x + Positive, Negative: +x, -x - Not implemented: and, or, not, **, //, %, if - else + Not implemented: ~, &, |, **, //, %, <<, >> Examples -------- @@ -362,7 +363,7 @@ exprStr = "col('Distance') / col('Time')" exprStr = "col('Distance') - '1 m'" exprStr = "col('t') >= '4 s'" - exprStr = "(col('s') > '1 m') & (COL('Time') == '3s')" + exprStr = "col('s') > '1 m' and COL('Time') == '3s'" """ exprStr = exprStr or 'True' @@ -370,10 +371,16 @@ rpn = ReplaceName(self) expr = compile(exprStr, "<calcColumn>", 'eval', ast.PyCF_ONLY_AST) replacedExpr = rpn.visit(expr) + rpc = ReplaceCompare(rpn.localDict) + factorExpr = rpc.visit(replacedExpr) rpo = ReplaceOperator(rpn.localDict) - factorExpr = rpo.visit(replacedExpr) + factorExpr = rpo.visit(factorExpr) localDict = dict([(key, value.data) \ for key, value in rpn.localDict.iteritems()]) + numpyDict = {'logical_and':numpy.logical_and, + 'logical_or':numpy.logical_or, + 'logical_not':numpy.logical_not} + localDict.update(numpyDict) data = eval(compile(factorExpr, '<calcColumn>', 'eval'), {}, localDict) unitcalc = UnitCalculator(rpn.localDict) unit, dims = unitcalc.getUnitAndDim(replacedExpr) @@ -465,179 +472,3 @@ return True else: raise AssertionError, diagnosis.getvalue() - - -class LocationFixingNodeTransformer(NodeTransformer): - def visit(self, *args, **kargs): - result = NodeTransformer.visit(self, *args, **kargs) - from ast import fix_missing_locations - fix_missing_locations(result) - return result - - -class ReplaceName(LocationFixingNodeTransformer): - def __init__(self, sampleContainer): - self.localDict = {} - self.count = 0 - self.sc = sampleContainer - - def visit_Call(self, node): - from ast import (Name, Load) - if isinstance(node.func, Name) and node.func.id.lower() == 'col': - newName = self.getName(self.sc[node.args[0].s]) - return Name(newName, Load()) - - def visit_Str(self, node): - from ast import (Name, Load) - quantity = Quantity(node.s) - class QuantityDummy(object): - pass - dummy = QuantityDummy() - dummy.unit = Quantity(1.0, quantity.unit) - dummy.data = quantity.value - dummy.dimensions = None - newName = self.getName(dummy) - return Name(newName, Load()) - - def getName(self, ref): - newName = "N%s" % self.count - self.count += 1 - self.localDict[newName] = ref - return newName - - -class ReplaceOperator(LocationFixingNodeTransformer): - def __init__(self, localDict): - self.localDict = localDict - - def visit_BinOp(self, node): - from ast import (Add, Sub, BinOp) - self.generic_visit(node) - unitcalc = UnitCalculator(self.localDict) - leftUD = unitcalc.getUnitAndDim(node.left) - rightUD = unitcalc.getUnitAndDim(node.right) - checkDimensions(leftUD[1], rightUD[1]) - if isinstance(node.op,(Add, Sub)): - factor = rightUD[0] / leftUD[0] - right = self.withFactor(factor, node.right) - binOp = BinOp(node.left, node.op, right) - return binOp - else: - return node - - def visit_Compare(self, node): - from ast import Compare - self.generic_visit(node) - unitcalc = UnitCalculator(self.localDict) - leftUD = unitcalc.getUnitAndDim(node.left) - listUD = [unitcalc.getUnitAndDim(comp) for comp in node.comparators] - nonNoneDims = [ud[1] for ud in listUD + [leftUD] if ud[1] is not None] - for dims in nonNoneDims: - checkDimensions(nonNoneDims[0], dims) - factorlist = [ud[0] / leftUD[0] for ud in listUD] - newComplist = [self.withFactor(*t) \ - for t in zip(factorlist, node.comparators)] - compOp = Compare(node.left, node.ops, newComplist) - compOpTrans = self.compBreaker(compOp) - return compOpTrans - - def withFactor(self, factor, node): - from ast import (BinOp, Num, Mult) - if not isinstance(factor, float): - raise ValueError('Incompatible units!') - if factor == 1.0: - return node - return BinOp(Num(factor), Mult(), node) - - def compBreaker(self, node): - from ast import (Compare, BinOp, BitAnd) - assert isinstance(node, Compare) - if len(node.comparators) == 1: - return node - else: - comp1 = Compare(node.left, node.ops[0:1], - node.comparators[0:1]) - comp2 = Compare(node.comparators[0], - node.ops[1:], node.comparators[1:]) - newNode = BinOp(comp1, BitAnd(), self.compBreaker(comp2)) - return newNode - - -class UnitCalculator(object): - def __init__(self, localDict): - self.localDict = localDict - - def getUnitAndDim(self, node): - from ast import (Expression, Name, Num, - BinOp, Add, Mult, Div, Sub, - Compare, BoolOp, UnaryOp, - BitOr, BitXor, BitAnd) - if isinstance(node, Expression): - return self.getUnitAndDim(node.body) - elif isinstance(node, Name): - if node.id in ['True', 'False']: - return (1.0, None) - else: - column = self.localDict[node.id] - return (column.unit, column.dimensions) - elif isinstance(node, Num): - return (1.0, None) - elif isinstance(node, BinOp): - left = self.getUnitAndDim(node.left) - right = self.getUnitAndDim(node.right) - dimensions = checkDimensions(left[1], right[1]) - if isinstance(node.op, (Add, Sub)): - if not isinstance(left[0] / right[0], float): - raise ValueError("units %s, %s not compatible" \ - % (left, right)) - unit = left[0] - elif isinstance(node.op, Mult): - unit = left[0] * right[0] - elif isinstance(node.op, Div): - unit = left[0] / right[0] - elif isinstance(node.op, (BitOr, BitXor, BitAnd)): - if not isinstance(left[0], float): - raise ValueError( - "Type %s cannot be interpreted as a Boolean" % left) - if not isinstance(right[0], float): - raise ValueError( - "Type %s cannot be interpreted as a Boolean" % right) - unit = 1.0 - else: - raise NotImplementedError() - return (unit, dimensions) - elif isinstance(node, Compare): - left = self.getUnitAndDim(node.left) - nonNoneDims = [] - if left[1] is not None: - nonNoneDims.append(left[1]) - for comparator in node.comparators: - right = self.getUnitAndDim(comparator) - if right[1] is not None: - nonNoneDims.append(right[1]) - if not isinstance(left[0] / right[0], float): - raise ValueError("units %s, %s not compatible" \ - % (left[0], right[0])) - if len(nonNoneDims) >= 1: - for dims in nonNoneDims: - checkDimensions(nonNoneDims[0], dims) - dimensions = nonNoneDims[0] - else: - dimensions = None - return (1.0, dimensions) - elif isinstance(node, BoolOp): - raise NotImplementedError( - 'BoolOps not supported. Use bitwise ops instead (&, |)!') - elif isinstance(node, UnaryOp): - return self.getUnitAndDim(node.operand) - else: - raise NotImplementedError() - - -def checkDimensions(dimensions1, dimensions2): - if dimensions1 is not None and dimensions2 is not None and \ - dimensions1 != dimensions2: - msg = 'Dimensions "%s" and "%s" do not match!' \ - % (dimensions1, dimensions2) - raise ValueError(msg) - return dimensions1 or dimensions2 Modified: trunk/src/pyphant/pyphant/core/Helpers.py =================================================================== --- trunk/src/pyphant/pyphant/core/Helpers.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/pyphant/pyphant/core/Helpers.py 2011-11-17 10:26:46 UTC (rev 701) @@ -183,3 +183,27 @@ attributes=attributes, columns=columns) sc.seal() return sc + +from threading import Lock +TIMESTAMP_LOCK = Lock() +LAST_TIMESTAMP = '' +del Lock + +def getModuleUniqueTimestamp(): + global TIMESTAMP_LOCK + global LAST_TIMESTAMP + TIMESTAMP_LOCK.acquire() + timestamp = None + try: + from datetime import datetime + while True: + timestamp = datetime.utcnow() + if timestamp != LAST_TIMESTAMP: + LAST_TIMESTAMP = timestamp + break + else: + from time import sleep + sleep(.001) + finally: + TIMESTAMP_LOCK.release() + return timestamp Modified: trunk/src/pyphant/pyphant/tests/TestDataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestDataContainer.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/pyphant/pyphant/tests/TestDataContainer.py 2011-11-17 10:26:46 UTC (rev 701) @@ -557,17 +557,20 @@ class AlgebraSampleContainerTests(SampleContainerTest): def testNodeTransformer(self): - from pyphant.core.DataContainer import (ReplaceName, ReplaceOperator) + from pyphant.core.AstTransformers import (ReplaceName, ReplaceOperator, + ReplaceCompare) rpn = ReplaceName(self.sampleContainer) import ast exprStr = 'col("i") / (col("t") + col("t"))' expr = compile(exprStr, "<TestCase>", 'eval', ast.PyCF_ONLY_AST) replacedExpr = rpn.visit(expr) - #print rpn.localDict - #print ast.dump(replacedExpr) - rpb = ReplaceOperator(rpn.localDict) - factorExpr = rpb.visit(replacedExpr) - #print ast.dump(factorExpr) + print rpn.localDict + print ast.dump(replacedExpr) + rpc = ReplaceCompare(rpn.localDict) + factorExpr = rpc.visit(replacedExpr) + rpo = ReplaceOperator(rpn.localDict) + factorExpr = rpo.visit(factorExpr) + print ast.dump(factorExpr) def testCalcColumn(self): exprStr = 'col("i") / (col("t") + col("t")) + "1km/s"' @@ -854,7 +857,7 @@ #purely one dimensional Tests: def testConsistancy(self): result1 = self.sampleContainer.filter( - '("20m" < col("i")) & ("80m" > col("i"))') + '"20m" < col("i") and "80m" > col("i")') result2 = self.sampleContainer.filter('"20m" < col("i") < "80m"') self.assertEqual(result1[0], result2[0]) self.assertEqual(result1[1], result2[1]) @@ -875,7 +878,7 @@ def testANDExpression(self): result = self.sampleContainer.filter( - '(col("i") >= "20m") & (col("t") <= "98.5s")') + 'col("i") >= "20m" and col("t") <= "98.5s"') expectedi = self.sampleContainer["i"][20:98] expectedt = self.sampleContainer["t"][20:98] expectedi.attributes = {} @@ -916,21 +919,32 @@ [True, True, False, True, True]) def testNot2dExpression(self): - self._compareExpected('~ (col("t") == "10s")', + self._compareExpected('not col("t") == "10s"', [True, True, True, False, True]) def testAnd2dExpression(self): self._compareExpected( - '(col("Zeit") == "60s") & ("20000m" == col("Strecke"))', + 'col("Zeit") == "60s" and "20000m" == col("Strecke")', [False, False, True, False, False]) + def testMultiAnd2dExpression(self): + self._compareExpected( + "col('l') >= '0 km' and col('l') < '20 km' and col('t') <= '60s'", + [False, True, False, True, False]) + def testOr2dExpression(self): self._compareExpected( - '(col("Zeit") < "60s") | (col("Strecke") == "5500m")', + 'col("Zeit") < "60s" or col("Strecke") == "5500m"', [True, True, False, True, True]) + def testMultiOr2dExpression(self): + self._compareExpected( + "col('t') == '20s' or col('l') == '0 km' or col('t') > '1000.2 s'", + [True, True, False, False, True] + ) + def testMultipleCompareOpPrecedence2dExpression(self): - self._compareExpected('~ ("0m" <= col("l") <= "10000m")', + self._compareExpected('not "0m" <= col("l") <= "10000m"', [True, False, True, False, False]) def testColumnToColumn2dExpression(self): Copied: trunk/src/pyphant/pyphant/tests/TestTimestamp.py (from rev 700, trunk/src/workers/OSC/OSC/__init__.py) =================================================================== --- trunk/src/pyphant/pyphant/tests/TestTimestamp.py (rev 0) +++ trunk/src/pyphant/pyphant/tests/TestTimestamp.py 2011-11-17 10:26:46 UTC (rev 701) @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2011, 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"""Provides test for unique timestamps +""" + +__id__ = "$Id$" +__author__ = "$Author$" +__version__ = "$Revision$" +# $Source$ + +import unittest +import pkg_resources + +pkg_resources.require("pyphant") + + +class TestModuleUniqueTimestamp(unittest.TestCase): + def testUnique(self): + from pyphant.core.Helpers import getModuleUniqueTimestamp + for x in xrange(100): + self.assertNotEqual( + getModuleUniqueTimestamp(), + getModuleUniqueTimestamp()) + + +if __name__ == '__main__': + unittest.main() Modified: trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py =================================================================== --- trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2011-11-17 10:26:46 UTC (rev 701) @@ -533,10 +533,10 @@ if isinstance(exep, socket_error): try: #Python 2.6 - eno = err.errno + eno = exep.errno except AttributeError: #Python 2.5 - eno = err.args[0] + eno = exep.args[0] from errno import EADDRINUSE if eno == EADDRINUSE: msg += "\nReason: Could not find a free port."\ @@ -620,6 +620,7 @@ # The program will freeze without this line. evt.Skip() # Make sure the default handler runs too... + self.Destroy() import optparse Modified: trunk/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py 2011-11-17 10:26:46 UTC (rev 701) @@ -38,8 +38,7 @@ __version__ = "$Revision$" # $Source$ -from pyphant.core import (Worker, Connectors) -from ImageProcessing.NDImageWorker import pile +from pyphant.core import (Worker, Connectors, DataContainer) import scipy, copy def normalizeHistogram(data): @@ -60,12 +59,12 @@ API = 2 VERSION = 1 REVISION = "$Revision$"[11:-1] - name = "EnhanceContrast" + name = "Enhance Contrast" _sockets = [("image", Connectors.TYPE_IMAGE)] @Worker.plug(Connectors.TYPE_IMAGE) def enhance(self, image, subscriber=0): - newdata = pile(normalizeLinear, image.data) + newdata = normalizeLinear(image.data) longname = "Normalize" result = DataContainer.FieldContainer( newdata, @@ -78,5 +77,4 @@ copy.deepcopy(image.attributes), False) result.seal() - #print newdata.shape return result Modified: trunk/src/workers/ImageProcessing/ImageProcessing/FitBackground.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/FitBackground.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/FitBackground.py 2011-11-17 10:26:46 UTC (rev 701) @@ -47,7 +47,7 @@ API = 2 VERSION = 1 REVISION = "$Revision$"[11:-1] - name = "FitBackground" + name = "Fit Background" _sockets = [("image", Connectors.TYPE_IMAGE)] _params = [("poldegree", "Polynomial degree (1 to 5)", 3, None), ("swidth", "sample width", 150, None), @@ -102,34 +102,22 @@ brightsize = int(self.paramBrightsize.value) brightruns = int(self.paramBrightruns.value) dopreview = self.paramDopreview.value - assert image.data.ndim in [2, 3] - if image.data.ndim == 2: - pile = [image.data] - else: - pile = image.data + data = image.data #Median: for run in xrange(medianruns): - pile = [ndimage.median_filter(data, - size=mediansize) for data in pile] + data = ndimage.median_filter(data, size=mediansize) #Suspend dark spots: for run in xrange(darkruns): - pile = [255 - ndimage.grey_erosion(255 - data, - size=darksize) for data in pile] + data = 255 - ndimage.grey_erosion(255 - data, size=darksize) #Suspend features: for run in xrange(brightruns): - pile = [ndimage.grey_erosion(data, - size=brightsize) for data in pile] + data = ndimage.grey_erosion(data, size=brightsize) #Fit background: if not dopreview: - pile = [self.fit(data, poldegree, swidth, sheight, - threshold) for data in pile] - if image.data.ndim == 2: - newdata = pile[0] - else: - newdata = numpy.array(pile) + data = self.fit(data, poldegree, swidth, sheight, threshold) longname = "FitBackground" result = DataContainer.FieldContainer( - newdata, + data, copy.deepcopy(image.unit), copy.deepcopy(image.error), copy.deepcopy(image.mask), @@ -139,4 +127,4 @@ copy.deepcopy(image.attributes), False) result.seal() - return result \ No newline at end of file + return result Modified: trunk/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py 2011-11-17 10:26:46 UTC (rev 701) @@ -56,7 +56,7 @@ max = scipy.amax(image.data) min = scipy.amin(image.data) data = max + min - image.data - from DataContainer import FieldContainer + from pyphant.core.DataContainer import FieldContainer result = FieldContainer(data, unit=image.unit, dimensions=copy.deepcopy(image.dimensions), mask=copy.deepcopy(image.mask), Added: trunk/src/workers/ImageProcessing/ImageProcessing/LoadZStack.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/LoadZStack.py (rev 0) +++ trunk/src/workers/ImageProcessing/ImageProcessing/LoadZStack.py 2011-11-17 10:26:46 UTC (rev 701) @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2006-2011, 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""" +The Load ZStack worker is a class of Pyphant's Image Processing +Toolbox. It simply loads a set of images from the location given in the +worker's configuration as a 3d image. +""" + +__id__ = "$Id$" +__author__ = "$Author$" +__version__ = "$Revision$" +# $Source$ + +from pyphant.core.Connectors import (SUBTYPE_FILE, TYPE_IMAGE) +from pyphant.core import Worker + + +class LoadZStack(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Load ZStack" + _params = [ + ("path", u"Path (select any file)", "", SUBTYPE_FILE), + ("regex", u"File Filter Regex", r'(?i)^.+\.tif$', None), + ("fieldUnit", u"Unit of the field", 1, None), + ("dz", u"z increment", '1 mum', None), + ("dy", u"y increment", '1 mum', None), + ("dx", u"x increment", '1 mum', None), + ("startz", u"z start", '0 mum', None), + ("starty", u"y start", '0 mum', None), + ("startx", u"x start", '0 mum', None), + ("zClip", u"Clipping of z-axis (pixels)", ':', None), + ("yClip", u"Clipping of y-axis (pixels)", ':', None), + ("xClip", u"Clipping of x-axis (pixels)", ':', None), + ("dtype", u"data type", 'uint8', None), + ("longname", u"Longname", 'ZStack', None), + ("shortname", u"Shortname", 'I', None) + ] + + @Worker.plug(TYPE_IMAGE) + def loadImageAsGreyScale(self, subscriber=0): + import os + import re + from scipy.misc import imread + import numpy + from pyphant.core.DataContainer import FieldContainer + from pyphant.quantities import Quantity + path = os.path.realpath(self.paramPath.value) + if os.path.isfile(path): + path = os.path.dirname(path) + pattern = re.compile(self.paramRegex.value) + filenames = filter( + lambda x: pattern.match(x) is not None, os.listdir(path) + ) + filenames.sort() + filenames = [os.path.join(path, fname) for fname in filenames] + print path + zClip = self.getClip(self.paramZClip.value) + filenames = filenames[zClip[0]:zClip[1]] + assert len(filenames) >= 1 + yClip = self.getClip(self.paramYClip.value) + xClip = self.getClip(self.paramXClip.value) + dtype = self.paramDtype.value + data = [] + for i, fn in enumerate(filenames): + subscriber %= 1 + 99 * i / len(filenames) + data.append(imread(fn, True)[yClip[0]:yClip[1], xClip[0]:xClip[1]]) + data = numpy.array(data, dtype=dtype) + axes = ['z', 'y', 'x'] + dimensions = [ + self.getDimension(a, data.shape[i]) for i, a in enumerate(axes) + ] + try: + unit = Quantity(self.paramFieldUnit.value) + except AttributeError: + unit = self.paramFieldUnit.value + longname = self.paramLongname.value + shortname = self.paramShortname.value + image = FieldContainer( + data=data, dimensions=dimensions, unit=unit, + longname=longname, shortname=shortname, + attributes={'yFactor':Quantity(self.paramDy.value), + 'xFactor':Quantity(self.paramDx.value)} + ) + image.seal() + subscriber %= 100 + return image + + def getClip(self, clipStr): + split = clipStr.split(':') + assert len(split) == 2 + return [int(x) if len(x) else None for x in split] + + def getDimension(self, axis, length): + from pyphant.quantities import Quantity + from pyphant.core.DataContainer import FieldContainer + import numpy + delta = Quantity(self.getParam('d' + axis).value) + start = Quantity(self.getParam('start' + axis).value) + + start = start.inUnitsOf(delta.unit) + data = start.value + numpy.arange(0, length, dtype=float) * delta.value + dim = FieldContainer( + data, unit=Quantity(1.0, delta.unit), + shortname=axis, + longname='%s-Axis' % (axis.upper(), ) + ) + return dim Modified: trunk/src/workers/ImageProcessing/ImageProcessing/Medianiser.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/Medianiser.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/Medianiser.py 2011-11-17 10:26:46 UTC (rev 701) @@ -50,7 +50,7 @@ API = 2 VERSION = 1 REVISION = "$Revision$"[11:-1] - name = "Medianiser" + name = "Median" _sockets = [("field", Connectors.TYPE_IMAGE)] _params = [("size", "Kernel Size", 5, None), ("runs", "Runs", 3, None)] @@ -63,4 +63,4 @@ for i in range(ru): im.data = scipy.ndimage.filters.median_filter(im.data, size=size) im.seal() - return im \ No newline at end of file + return im Deleted: trunk/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py 2011-11-17 10:26:46 UTC (rev 701) @@ -1,183 +0,0 @@ -# -*- 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""" -TODO: Check units, repair functionality -""" - -__id__ = "$Id$" -__author__ = "$Author$" -__version__ = "$Revision$" -# $Source$ - -from pyphant.core import Worker, Connectors,\ - Param, DataContainer -import ImageProcessing -import numpy, copy -from scipy import ndimage - -def pile(func, imagedata, runs=1, dopile=True): - assert imagedata.ndim in [2, 3] - assert runs >= 0 - if runs == 0: - return imagedata - if imagedata.ndim == 2 or not dopile: - pile = [imagedata] - else: - pile = imagedata - for run in xrange(runs): - pile = [func(data) for data in pile] - if imagedata.ndim == 2 or not dopile: - newdata = pile[0] - else: - newdata = numpy.array(pile) - return newdata - - -class NDImage(Worker.Worker): - API = 2 - VERSION = 1 - REVISION = "$Revision$"[11:-1] - name = "ndimage" - _sockets = [("image", Connectors.TYPE_IMAGE)] - _filters = {"binary_closing":("iterations", ), - "binary_opening":("iterations", ), - "binary_fill_holes":(), - "binary_erosion":("iterations", ), - "binary_dilation":("iterations", ), - "maximum_filter":("size", "mode", "cval"), - "median_filter":("size", "mode", "cval"), - "grey_closing":("size", "mode", "cval"), - "grey_erosion":("size", "mode", "cval"), - "grey_opening":("size", "mode", "cval"), - "distance_transform_bf":("metric", ), - "sobel":("axis", "mode", "cval"), - "grey_invert":(None, ), - "cut_histogram":(None, "tolerance"), - "label":(None, "connectivity"), - "threshold":(None, "threshold"), - "area_opening":(None, "size")} - _ndparams = {"iterations":1, - "size":5, - "mode":["reflect", - "nearest", - "wrap", - "constant"], - "cval":0, - "tolerance":1000, - "connectivity":2, - "metric":["euclidean", - "taxicab", - "chessboard"], - "threshold":"1 m", - "axis":-1} - _params = [("pile", "Treat 3d images as pile of 2d images", True, None), - ("ndfilter", "Filter", _filters.keys(), None)] - _params += [(pn, pn, dflt, None) for pn, dflt in _ndparams.iteritems()] - - def area_opening(self, data, size): - structure = ndimage.morphology.generate_binary_structure(data.ndim, - 2) - labels = ndimage.label(data, structure=structure)[0] - slices = ndimage.find_objects(labels) - areas = [numpy.where(labels[sli] == label + 1, True, False).sum() \ - for label, sli in enumerate(slices)] - print areas - output = numpy.zeros(data.shape, dtype=data.dtype) - for label, sli, area in zip(range(len(slices)), slices, areas): - if area >= size: - output[sli] |= numpy.where(labels[sli] == label + 1, data[sli], 0) - return output - - def threshold(self, data, threshold): - from pyphant.quantities import (Quantity, - isQuantity) - from pyphant.core.Helpers import uc2utf8 - try: - thp = Quantity(uc2utf8(threshold)) - except: - thp = float(threshold) - thp /= self._unit - assert not isQuantity(thp) - return numpy.where(data < thp, False, True) - - def grey_invert(self, data): - return 255 - data - - def label(self, data, connectivity): - structure = ndimage.morphology.generate_binary_structure(data.ndim, - connectivity) - return ndimage.label(data, structure=structure)[0] - - def cut_histogram(self, data, tolerance): - hist = ndimage.histogram(data, 0, 256, 256) - csum = numpy.cumsum(hist) - cut = csum[255] / tolerance - for i in xrange(len(csum)): - if csum[i] > cut: - newmin = i - break - meanvalue = data.mean() - return numpy.where(data < newmin, meanvalue, data) - - def applyfilter(self, data): - if None in self._filters[self.paramNdfilter.value]: - call = getattr(self, self.paramNdfilter.value) - else: - call = getattr(ndimage, self.paramNdfilter.value) - args = {} - for par in self._filters[self.paramNdfilter.value]: - if par != None: - args[par] = self.getParam(par).value - #print args - return call(data, **args) - - @Worker.plug(Connectors.TYPE_IMAGE) - def ndimage(self, image, subscriber=0): - self._unit = image.unit - if "iterations" in self._filters[self.paramNdfilter.value]: - runs = 1 - else: - runs = self.paramIterations.value - newdata = pile(self.applyfilter, image.data, runs, self.paramPile.value) - longname = "%s" % (self.paramNdfilter.value, ) - result = DataContainer.FieldContainer( - newdata, - copy.deepcopy(image.unit), - None, - copy.deepcopy(image.mask), - copy.deepcopy(image.dimensions), - longname, - image.shortname, - copy.deepcopy(image.attributes), - False) - result.seal() - return result Modified: trunk/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py 2011-11-17 10:26:46 UTC (rev 701) @@ -53,14 +53,28 @@ REVISION = "$Revision$"[11:-1] name = "Threshold" _sockets = [("image", Connectors.TYPE_IMAGE)] - _params = [("threshold", "Threshold", 160, None), + _params = [("threshold", "Threshold", "160.0", None), + ("unit", "Unit", "ignore", None) # ("mode", "Mode(absolute/coverage)", # ["absolute", "coverage"], None) ] @Worker.plug(Connectors.TYPE_IMAGE) def threshold(self, image, subscriber=0): - th = self.paramThreshold.value + th = float(self.paramThreshold.value) + if self.paramUnit.value.lower() != 'ignore': + from pyphant.quantities import Quantity, isQuantity + try: + unit = float(self.paramUnit.value) + assert not isQuantity(image.unit) + except ValueError: + try: + unit = Quantity(self.paramUnit.value) + except TypeError: + unit = Quantity(1.0, self.paramUnit.value) + assert isQuantity(image.unit) + assert unit.isCompatible(image.unit.unit) + th *= unit / image.unit resultArray = scipy.where(image.data < th, ImageProcessing.FEATURE_COLOR, ImageProcessing.BACKGROUND_COLOR) @@ -68,4 +82,4 @@ dimensions=copy.deepcopy(image.dimensions), longname=u"Binary Image", shortname=u"B") result.seal() - return result \ No newline at end of file + return result Modified: trunk/src/workers/ImageProcessing/ImageProcessing/Watershed.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/Watershed.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/Watershed.py 2011-11-17 10:26:46 UTC (rev 701) @@ -39,7 +39,6 @@ # $Source$ from pyphant.core import (Worker, Connectors, DataContainer) -from ImageProcessing.NDImageWorker import pile import copy import heapq import scipy @@ -96,7 +95,7 @@ @Worker.plug(Connectors.TYPE_IMAGE) def wsworker(self, image, markers, subscriber=0): self._markers = markers.data - newdata = pile(self.watershed, image.data) + newdata = self.watershed(image.data) longname = "Watershed" result = DataContainer.FieldContainer(newdata, copy.deepcopy(image.unit), Modified: trunk/src/workers/ImageProcessing/ImageProcessing/__init__.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/__init__.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/__init__.py 2011-11-17 10:26:46 UTC (rev 701) @@ -56,9 +56,9 @@ "Gradient", "ImageLoaderWorker", "InvertWorker", + "LoadZStack", "MarkInclusions", "Medianiser", - "NDImageWorker", "SkeletonizeFeature", "ThresholdingWorker", "UltimatePointsCalculator", Modified: trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py 2011-05-23 12:48:36 UTC (rev 700) +++ trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py 2011-11-17 10:26:46 UTC (rev 701) @@ -31,7 +31,8 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -u"""Provides unittest classes for AutoFocus worker. +u"""Provides unittest classes for AutoFocus, LoadZStack +and MarkInclusions worker. """ __id__ = "$Id$".replace('$','') @@ -46,32 +47,8 @@ from ImageProcessing import __path__ as ppath importDir = os.path.join(ppath[0], "tests", "resources", "zstack") -from pyphant.quantities import Quantity -import numpy -import scipy -def importZStack(filenames, zUnit, zValues): - from pyphant.core.DataContainer import FieldContainer - zDim = FieldContainer(data=zValues, unit=zUnit, - shortname='z', longname='Z Axis') - yDim = FieldContainer(data=numpy.arange(.0, 400.0, 1.0) * 1.29, - unit=Quantity('1.0 mum'), - shortname='y', longname='Y Axis') - xDim = FieldContainer(data=numpy.arange(.0, 400.0, 1.0) * 1.29, - unit=Quantity('1.0 mum'), - shortname='x', longname='X Axis') - imgData = numpy.zeros((zDim.data.shape[0], yDim.data.shape[0], - xDim.data.shape[0]), dtype='uint8') - for i, filename in enumerate(filenames): - imgData[i] = scipy.misc.imread(os.path.join(importDir, filename), - flatten=True) - zStack = FieldContainer(data=imgData, dimensions=[zDim, yDim, xDim], - shortname='I', longname='ZStack') - zStack.seal() - return zStack - - class ZStackTestCase(unittest.TestCase): def setUp(self): pass @@ -87,12 +64,13 @@ def testZStack(self): print "Importing ZStack..." - zstack = importZStack( - filenames=filter(lambda x: x.endswith('.tif'), - sorted(os.listdir(importDir))), - zUnit=Quantity('1.0 mum'), - zValues = numpy.arange(0.0, 601.0, 100.0) - ) + from ImageProcessing.LoadZStack import LoadZStack + loader = LoadZStack() + loader.paramPath.value = importDir + loader.paramDz.value = '100.0 mum' + loader.paramDy.value = '1.29 mum' + loader.paramDx.value = '1.29 mum' + zstack = loader.loadImageAsGreyScale() print "Done." print "Calculating ZStack-statistics..." from ImageProcessing.AutoFocus import AutoFocus @@ -114,11 +92,15 @@ def testSingle(self): print "Importing single image..." - zstack = importZStack( - filenames=['TestZStack_z03.tif'], - zUnit=Quantity('1.0 mum'), - zValues = numpy.array([300.0, ]) - ) + from ImageProcessing.LoadZStack import LoadZStack + loader = LoadZStack() + loader.paramPath.value = os.path.join(importDir, 'TestZStack_z00.tif') + loader.paramDz.value = '100.0 mum' + loader.paramDy.value = '1.29 mum' + loader.paramDx.value = '1.29 mum' + loader.paramStartz.value = '300.0 mum' + loader.paramZClip.value = '3:4' + zstack = loader.loadImageAsGreyScale() print "Done." print "Calculating single image statistics..." from ImageProcessing.AutoFocus import AutoFocus @@ -138,7 +120,24 @@ self.check((300.0, 0.0), statistics['zPos'].data[imin]) self.check((7.0 * mul, mul), statistics['diameter'].data[imin]) + def testMarkInclusions(self): + from ImageProcessing.LoadZStack import LoadZStack + from ImageProcessing.MarkInclusions import MarkInclusions + loader = LoadZStack() + loader.paramPath.value = importDir + loader.paramDz.value = '100.0 mum' + loader.paramDy.value = '1.29 mum' + loader.paramDx.value = '1.29 mum' + zstack = loader.loadImageAsGreyScale() + from ImageProcessing.AutoFocus import AutoFocus + afw = AutoFocus() + statistics = afw.getStatistics(zstack) + minc = MarkInclusions() + marked = minc.markInclusions(zstack, statistics) + self.assertEqual(zstack.dimensions, marked.dimensions) + self.assertEqual(zstack.unit, marked.unit) + if __name__ == "__main__": import sys if len(sys.argv) == 1: Added: trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py (rev 0) +++ trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestCoverage.py 2011-11-17 10:26:46 UTC (rev 701) @@ -0,0 +1,88 @@ +# -*- 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... [truncated message content] |
From: <zk...@us...> - 2011-05-23 12:48:46
|
Revision: 700 http://pyphant.svn.sourceforge.net/pyphant/?rev=700&view=rev Author: zklaus Date: 2011-05-23 12:48:36 +0000 (Mon, 23 May 2011) Log Message: ----------- Merge branch 'master' into svn-trunk * master: (42 commits) Enh: Added loadRecipe method to H5FileHandler Fix: Workaround for Statistics.Histogram Fix: Worker.py: unwanted sharing of annotations Fix: KM: removed ProgressDialog if no wx present Enh: Faster hashing for FieldContainers Fix: Docstrings in toolboxes Merge: Autofocus Fix: Type of name parameter of workers Bar chart: Increase range from [0:ymax] to [min(ymin,0):ymax] MRA: - Bugfix: Local Extrema Systematically Shifted - "OSC.MRA" Bugfix: Removed systematic error in calculation of local extrema Fix: Dimensions in AlgebraWorker Revert: Undo last 2 commits Fix: tried to fix dimensions in AlgebraWorker Fix: started working on dimensions in AlgebraWorker Fix: AlgebraWorker: Sealing of DCs Enh: Added wildcard support to FileButton Test: Tried working on the FileButton of FMFLoader Fix: Put workers back into the ImageProcessing toolbox Fix: Made OscMapper worker independent of OscAbsorption ... Modified Paths: -------------- trunk/src/pyphant/pyphant/core/DataContainer.py trunk/src/pyphant/pyphant/core/FieldContainer.py trunk/src/pyphant/pyphant/core/H5FileHandler.py trunk/src/pyphant/pyphant/core/Helpers.py trunk/src/pyphant/pyphant/core/KnowledgeManager.py trunk/src/pyphant/pyphant/core/Worker.py trunk/src/pyphant/pyphant/tests/TestDataContainer.py trunk/src/pyphant/pyphant/visualizers/Chart.py trunk/src/pyphant/pyphant/visualizers/ZStackVisualizer.py trunk/src/pyphant/pyphant/visualizers/__init__.py trunk/src/pyphant/pyphant/wxgui2/paramvisualization/FileButton.py trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py trunk/src/workers/ImageProcessing/ImageProcessing/ApplyMask.py trunk/src/workers/ImageProcessing/ImageProcessing/AutoFocus.py trunk/src/workers/ImageProcessing/ImageProcessing/BiThresholdingWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/CoverageWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/DiffWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/DistanceMapper.py trunk/src/workers/ImageProcessing/ImageProcessing/EdgeFillWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/EdgeTouchingFeatureRemover.py trunk/src/workers/ImageProcessing/ImageProcessing/EnhanceContrast.py trunk/src/workers/ImageProcessing/ImageProcessing/FindLocalExtrema.py trunk/src/workers/ImageProcessing/ImageProcessing/FitBackground.py trunk/src/workers/ImageProcessing/ImageProcessing/Gradient.py trunk/src/workers/ImageProcessing/ImageProcessing/ImageLoaderWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/InvertWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/Medianiser.py trunk/src/workers/ImageProcessing/ImageProcessing/NDImageWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/OptimalContrastWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/SkeletonizeFeature.py trunk/src/workers/ImageProcessing/ImageProcessing/ThresholdingWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/UltimatePointsCalculator.py trunk/src/workers/ImageProcessing/ImageProcessing/Watershed.py trunk/src/workers/ImageProcessing/ImageProcessing/__init__.py trunk/src/workers/ImageProcessing/setup.py trunk/src/workers/OSC/OSC/ErrorEstimator.py trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py trunk/src/workers/OSC/OSC/ExtremumFinder.py trunk/src/workers/OSC/OSC/OscAbsorption.py trunk/src/workers/OSC/OSC/__init__.py trunk/src/workers/OSC/OSC/tests/TestMRA.py trunk/src/workers/Statistics/Statistics/Histogram.py trunk/src/workers/Statistics/setup.py trunk/src/workers/fmfile/fmfile/FMFLoader.py trunk/src/workers/tools/setup.py trunk/src/workers/tools/tools/__init__.py Added Paths: ----------- trunk/src/workers/ImageProcessing/ImageProcessing/MarkInclusions.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/TestAutoFocus.py trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/ trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/ trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z00.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z01.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z02.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z03.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z04.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z05.tif trunk/src/workers/ImageProcessing/ImageProcessing/tests/resources/zstack/TestZStack_z06.tif trunk/src/workers/OSC/OSC/OscMapper.py trunk/src/workers/tools/tools/AddColumn.py trunk/src/workers/tools/tools/AlgebraWorker.py trunk/src/workers/tools/tools/ColumnExtractor.py trunk/src/workers/tools/tools/ExtractRows.py trunk/src/workers/tools/tools/MRA.py trunk/src/workers/tools/tools/Slicing.py Removed Paths: ------------- trunk/src/pyphant/pyphant/core/XMLHandler.py trunk/src/pyphant/pyphant/core/ZStackManager.py trunk/src/pyphant/pyphant/tests/TestZStacks.py trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z00.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z01.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z02.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z03.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z04.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z05.tif trunk/src/pyphant/pyphant/tests/resources/zstack/TestZStack_z06.tif trunk/src/pyphant/pyphant/tests/resources/zstack/_meta.xml trunk/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml trunk/src/pyphant/pyphant/visualizers/SingleValueVisualizer.py trunk/src/workers/ImageProcessing/ImageProcessing/FeatureRatio.py trunk/src/workers/ImageProcessing/ImageProcessing/FilterWorker.py trunk/src/workers/ImageProcessing/ImageProcessing/MarkAF.py trunk/src/workers/ImageProcessing/ImageProcessing/Reduce.py trunk/src/workers/ImageProcessing/ImageProcessing/SliceSelector.py trunk/src/workers/OSC/OSC/AddColumn.py trunk/src/workers/OSC/OSC/MRA.py trunk/src/workers/OSC/OSC/Slicing.py Modified: trunk/src/pyphant/pyphant/core/DataContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/DataContainer.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/DataContainer.py 2011-05-23 12:48:36 UTC (rev 700) @@ -36,7 +36,7 @@ ============================================================================= The *DataContainer* is Pypahnt's preferred data exchange class. It is -designed to maximise the interoperability of the various workers +designed to maximize the interoperability of the various workers provided by Pyphant. It can be seen as an interface for exchanging data between workers and @@ -58,7 +58,7 @@ ============================================================= The *SampleContainer* combines different FieldContainers that have the -same numer of sample points to a table-like representation. It stores +same number of sample points to a table-like representation. It stores different observations on the same subject per row whereby each column comprises a quantity of the same kind. Each row can be regarded as the realization of a random variable. @@ -71,10 +71,9 @@ import copy, hashlib, threading, numpy, StringIO import os, platform, datetime, socket, urlparse -from pyphant.quantities import (isQuantity, - Quantity) +from pyphant.quantities import (isQuantity, Quantity) import Helpers - +from ast import (NodeTransformer, NodeVisitor) import logging _logger = logging.getLogger("pyphant") @@ -83,7 +82,7 @@ enc = lambda s: unicode(s, "utf-8") def parseId(id): - u"""Returns tupple (HASH, TYPESTRING) from given .id attribute.""" + u"""Returns tuple (HASH, TYPESTRING) from given .id attribute.""" resUri = urlparse.urlsplit(id) return resUri[2].split('/')[-1].split('.') #(hash, uriType) @@ -293,446 +292,152 @@ def numberOfColumns(self): return len(self.columns) - def _getCommands(self, expression): + def calcColumn(self, exprStr, shortname, longname): """ - This method generates nested tuples of filter commands to be applied - to a SampleContainer out of a string expression. For details of the - output see SampleContainer.filter() - expression -- String describing the filter commands. For details - see SampleContainer.filter(expression) + Return an unsealed FieldContainer generated from `exprStr`. + + Parameters + ---------- + exprStr : str + Expression has to be a string. Specifies the mathematical + operations which will be evaluated to generate a new FieldContainer + containing the result. `exprStr` may contain FieldContainers, + PhysicalQuantities, Booleans and Numbers as well as the operators + listed below. + + shortname : str + The `shortname` of the returned FieldContainer. + + longname : str + The `longname`of the returned FieldContainer. + + Syntax + ------ + FieldContainer + FieldContainers can be adressed by their `shortname`or `longname`. + For a FieldContainer with shortname="exampleFC" the syntax within + `exprStr` is: + col("exampleFC") + where `col` stands for column and may be `Col` or `COL` as well. + Adressing by `longname` works analogously. + + PhysicalQuantity + Within the expression PhysicalQuantities have to be enquoted: + "10kg", "100 m", "5 kg * m / s ** 2" + where the whitespaces are optional. + + Booleans and Numbers + Can just be used without quotes or braces within `exprStr`: + True, False, 1.2, 10 + + Operators + --------- + A list of all implemented operations that can be used within `exprStr` + sorted by precedence from lowest precedence (least binding) to highest + precedence (most binding): + + Comparisons: <, <=, >, >=, <>, !=, == + Bitwise OR: | + Bitwise XOR: ^ + Bitwise AND: & + Addition and Subtraction: +, - + Multiplication, Division: *, / + Positive, Negative, Bitwise NOT: +x, -x, ~x + + Not implemented: and, or, not, **, //, %, if - else + + Examples + -------- + Some examples of valid expressions will be given. + Data: + distance = FieldContainer(scipy.array([5., 10., 1.]), + Quantity('1.0 m'), + longname=u"Distance", + shortname=u"s") + time = FieldContainer(scipy.array([3., 4., 5.]), + Quantity('1.0 s'), + longname=u"Time", + shortname=u"t") + Examplary expressions: + exprStr = "col('Distance') / col('Time')" + exprStr = "col('Distance') - '1 m'" + exprStr = "col('t') >= '4 s'" + exprStr = "(col('s') > '1 m') & (COL('Time') == '3s')" + """ - #TODO: compare SCColumns with each other, - # allow multi dimensional columns (think up new syntax) - import re - #test for expressions containing whitespaces only: - if len(re.findall(r'\S', expression)) == 0: - return () - #prepare regular expressions - reDoubleQuotes = re.compile(r'("[^"][^"]*")') - reSplit = re.compile( - r'(<(?!=)|<=|>(?!=)|>=|==|!=|not|NOT|and|AND|or|OR|\(|\))' - ) - reCompareOp = re.compile(r'<|>|==|!=') - #split the expression - DQList = reDoubleQuotes.split(expression) - splitlist = [] - for dq in DQList: - if reDoubleQuotes.match(dq) != None: splitlist.append(dq) - else: splitlist.extend(reSplit.split(dq)) - #identify splitted Elements - al = [] #<-- abstractlist containing tuples of (type, expression) - for e in splitlist: - if len(re.findall(r'\S', e)) == 0: pass #<-- skip whitespaces - elif reCompareOp.match(e) != None: - al.append(('CompareOp', e)) - elif reSplit.match(e) != None: - al.append(('Delimiter', e.lower())) - elif reDoubleQuotes.match(e) != None: - column = None - try: - column = self[e[1:-1]] - except: - raise IndexError( - 'Could not find column ' + e + ' in "' - + self.longname + '".' - ) - al.append(('SCColumn', column)) + exprStr = exprStr or 'True' + import ast + rpn = ReplaceName(self) + expr = compile(exprStr, "<calcColumn>", 'eval', ast.PyCF_ONLY_AST) + replacedExpr = rpn.visit(expr) + rpo = ReplaceOperator(rpn.localDict) + factorExpr = rpo.visit(replacedExpr) + localDict = dict([(key, value.data) \ + for key, value in rpn.localDict.iteritems()]) + data = eval(compile(factorExpr, '<calcColumn>', 'eval'), {}, localDict) + unitcalc = UnitCalculator(rpn.localDict) + unit, dims = unitcalc.getUnitAndDim(replacedExpr) + if dims is None: + assert not isinstance(data, numpy.ndarray) + for col in self.columns: + checkDimensions(col.dimensions[0], + self.columns[0].dimensions[0]) + shape = self.columns[0].dimensions[0].data.shape + if data: + data = numpy.ones(shape, dtype=bool) else: - try: - phq = Quantity(e) - al.append(('PhysQuant', phq)) - continue - except: - try: - number = Quantity(e+' m') - al.append(('Number', eval(e))) - continue - except: pass - raise ValueError, "Error parsing expression: " + e - #resolve multiple CompareOps like a <= b <= c == d: - i = 0 - values = ['PhysQuant', 'SCColumn', 'Number'] - start_sequence = -1 - while i < len(al) - 4: - if ((al[i][0] in values) and (al[i+1][0] == 'CompareOp') - and (al[i+2][0] in values) and (al[i+3][0] == 'CompareOp') - and (al[i+4][0] in values)): - if start_sequence == -1: - start_sequence = i - al.insert(i+3, ('Delimiter', 'and')) - al.insert(i+4, al[i+2]) - i += 4 - else: - #'not' has higher precedence than 'and': - if start_sequence != -1: - al.insert(start_sequence, ('Delimiter', '(')) - al.insert(i+4, ('Delimiter', ')')) - start_sequence = -1 - i += 3 - else: - i += 1 - if start_sequence != -1: - al.insert(start_sequence, ('Delimiter', '(')) - al.insert(i+4, ('Delimiter', ')')) - #identify atomar components like "a" <= 10m, 10s > "b", - #... and compress them: - if al[0][0] == 'CompareOp': - raise ValueError( - al[0][1] + " may not stand at the beginning of an expression!" - ) - i = 1 - valid = False - while i < len(al): - if al[i][0] == 'CompareOp': - left = al.pop(i-1) - middle = al.pop(i-1) - right = al.pop(i-1) - if left[0] not in values: - raise TypeError, str(left[1]) + " is not a proper value." - if right[0] not in values: - raise TypeError, str(right[1]) + " is not a proper value." - al.insert(i-1, ('Atomar', left, middle[1], right)) - valid = True - i += 1 - if not valid: - raise ValueError( - "There has to be at least one valid comparison: " + expression - ) + data = numpy.zeros(shape, dtype=bool) + dims = [self.columns[0].dimensions[0]] + field = FieldContainer(data, unit, dimensions=dims, + longname=longname, shortname=shortname) + return field - def compressBraces(sublist): - """ - Identifies braces and compresses them recursively. - sublist -- list of filter commands - """ - openbraces = 0 - start = 0 - end = 0 - finished = False - for i in range(len(sublist)): - if sublist[i] == ('Delimiter', '('): - openbraces += 1 - if openbraces == 1 and not finished: - start = i - elif sublist[i] == ('Delimiter', ')'): - openbraces -= 1 - if openbraces == 0 and not finished: - end = i - finished = True - if openbraces != 0: - raise ValueError( - "There are unmatched braces within the expression: " - + expression - ) - if start == 0 and end == 0: - #no more braces found: end of recursion - return sublist[:] - else: - if end-start == 1: - raise ValueError( - "There are braces enclosing nothing in the expression: " - + expression - ) - middle = None - if end-start == 2: - #discard unnecessary braces in order to reduce - #recursion depth later on: - middle = sublist[start+1:start+2] - else: - middle = [('Brace', compressBraces(sublist[start+1:end]))] - return sublist[0:start]+middle+compressBraces(sublist[end+1:]) - #TODO: The following three methods could be merged into one generalized - #method for compressing unitary and binary operators. This would be - #useful in a future version when there are lots of operators to be - #supported. + def filter(self, exprStr, shortname='', longname=''): + """ + Return an unsealed SampleContainer containing only those rows where + `exprStr` was evaluated to be True. This method replaces the old + filter method and is mostly capable of the same operations, yet the + syntax has changed slightly. - def compressNot(sublist): - """ - Identifies "not"s and compresses them recursively. - sublist -- list of filter commands - """ - i = 0 - while i < len(sublist): - if sublist[i] == ('Delimiter', 'not'): - if i+1 >= len(sublist): - raise ValueError( - "'not' must not stand at the end of an expression: " - + expression - ) - x = sublist[i+1] - if x[0] == 'Atomar': - retlist = sublist[0:i] + [('NOT', x)] - retlist += compressNot(sublist[i+2:]) - return retlist - elif x[0] == 'Brace': - retlist = sublist[0:i] - retlist += [('NOT', ('Brace', compressNot(x[1])))] - retlist += compressNot(sublist[i+2:]) - return retlist - else: - raise ValueError( - "'not' cannot be applied to " + str(x) + "." - ) - elif sublist[i][0] == 'Brace': - retlist = sublist[0:i] - retlist += [('Brace', compressNot(sublist[i][1]))] - retlist += compressNot(sublist[i+1:]) - return retlist - i += 1 - return sublist[:] + Parameters + ---------- + exprStr : str + A string with a logical expression that has to evaluate to be + either True or False. This can be for example an inequality or + a comparison. For all possible operations and a description of + the syntax as well as examples see `calcColumn`. - def compressAnd(sublist, start=0): - """ - Identifies "and"s and compresses them recursively: - start -- start == 1 indicates that the 1st element of sublist - has already been compressed. This is necessary for - binary operators. - sublist -- list of filter commands - """ - i = start - while i < len(sublist): - if sublist[i] == ('Delimiter', 'and'): - left = None - if start == 1 and i == 1: left = sublist[i-1] - else: left = compressAnd(sublist[i-1:i])[0] - if left[0] not in ['NOT', 'AND', 'Brace', 'Atomar']: - raise ValueError( - "'and' cannot be applied to " + str(left) + "." - ) - right = compressAnd(sublist[i+1:i+2])[0] - if right[0] not in ['NOT', 'AND', 'Brace', 'Atomar']: - raise ValueError( - "'and' cannot be applied to " + str(right) + "." - ) - retlist = sublist[0:i-1] - retlist += compressAnd([('AND', left, right)]+sublist[i+2:], - 1) - return retlist - elif sublist[i][0] == 'Brace': - retlist = sublist[0:i] - retlist += compressAnd([('Brace', - compressAnd(sublist[i][1]))] - + sublist[i+1:], 1) - return retlist - elif sublist[i][0] == 'NOT': - retlist = sublist[0:i] - retlist += compressAnd([('NOT', - compressAnd([sublist[i][1]])[0])] - + sublist[i+1:], 1) - return retlist - i += 1 - return sublist[:] + shortname, longname : str, default='' + Specify the short and long name of the resulting FC. - def compressOrDCB(sublist, start=0): - """ - Identifies "or"s and compresses them recursively. - Decompresses braces in order to reduce recursion depth later on. - start -- start == 1 indicates that the 1st element of sublist - has already been compressed. This is necessary for - binary operators. - sublist -- list of filter commands - """ - i = start - while i < len(sublist): - if sublist[i] == ('Delimiter', 'or'): - left = None - if start == 1 and i == 1: left = sublist[i-1] - else: left = compressOrDCB(sublist[i-1:i])[0] - if left[0] not in ['NOT', 'AND', 'Atomar', 'OR']: - raise ValueError( - "'or' cannot be applied to " + str(left) + "." - ) - right = compressOrDCB(sublist[i+1:i+2])[0] - if right[0] not in ['NOT', 'AND', 'Atomar', 'OR']: - raise ValueError( - "'or' cannot be applied to " + str(right) + "." - ) - retlist = sublist[0:i-1] - retlist += compressOrDCB([('OR', left, right)] - + sublist[i+2:], 1) - return retlist - elif sublist[i][0] == 'Brace': - inner = compressOrDCB(sublist[i][1]) - if len(inner) != 1: - raise ValueError( - "Expression could not be parsed completely." - "(probably missing keyword): " + expression - ) - retlist = sublist[0:i] - retlist += compressOrDCB(inner + sublist[i+1:], 1) - return retlist - elif sublist[i][0] == 'NOT': - retlist = sublist[0:i] - retlist += compressOrDCB( - [('NOT', compressOrDCB([sublist[i][1]])[0])] - + sublist[i+1:], 1 - ) - return retlist - elif sublist[i][0] == 'AND': - retlist = sublist[0:i] - retlist += compressOrDCB( - [('AND', - compressOrDCB([sublist[i][1]])[0], - compressOrDCB([sublist[i][2]])[0])] - + sublist[i+1:], 1) - return retlist - i += 1 - return sublist[:] - compressed = compressOrDCB(compressAnd(compressNot(compressBraces(al)))) - if len(compressed) != 1: - raise ValueError( - "Expression could not be parsed completely" - "(probably missing keyword): " + expression - ) - return compressed[0] + """ + shortname = shortname or self.shortname + longname = longname or self.longname + mask = self.calcColumn(exprStr, 'm', 'mask') + assert isinstance(mask.unit, float) + mask = mask.data + return self.extractRows(mask, shortname, longname) - def filter(self, expression): + def extractRows(self, mask, shortname, longname): """ - Returns a new SampleContainer with filter commands applied to it. - expression -- can be either a string expression or nested tuples - of commands. In case expression is a string (or unicode), - the following syntax holds: - Let's define - <atomar> := <value> <CompareOp> <value> - where <value> is either a SC Column accessed as - "longname" or "shortname" (including the double quotes) - or a number or a string representing a Quantity - (e.g. 300nm). And <CompareOp> can be ==, !=, <, <=, >, >=. - Then a valid expression <expression> is: - - <atomar> - - (<expression>) - - not <expression> - - <expression> and <expression> - - <expression> or <expression> - - NOT, AND, OR is equivalent to not, and, or - Precedence is as follows: - - multiple CompareOps are evaluated: - e.g. a <= b < c --> (a <= b and b < c) - - <atomar> - - braces - - not - - and - - or - If expression is a nested tuple, syntax is as follows: - <value> is either ('SCColumn', FieldContainer instance) - or ('PhysQuant', Quantity instance) - or ('Number', int float etc.) - <CompareOp> is in ['==', '!=', ...] - A valid nested tuple <nt> can be: - - ('Atomar', <value>, <CompareOp>, <value>) - - ('NOT', <nt>) - - ('AND', <nt>, <nt>) - - ('OR', <nt>, <nt>) - Precedence is obtained from the way the tuples are nested. - """ - #determine type of expression: - from types import StringType, UnicodeType, TupleType - commands = None - if isinstance(expression, UnicodeType): - commands = self._getCommands(expression.encode('utf-8')) - elif isinstance(expression, StringType): - commands = self._getCommands(expression) - elif isinstance(expression, TupleType) or expression == None: - commands = expression - else: - raise TypeError( - "Expression has to be of StringType, UnicodeType," - "TupleType or None. Found " + str(type(expression)) - + " instead!" - ) - #check for empty commands: - if commands == None or commands == (): - return copy.deepcopy(self) - #generate boolean numpymask from commands using fast numpy methods: - def evaluateAtomar(atomar): - left = atomar[1] - if left[0] == 'SCColumn': - if left[1].data.ndim != 1: - raise NotImplementedError( - 'Comparing columns of dimensions other than one ' - 'is not yet implemented: "' + left[1].longname + '"' - ) - right = atomar[3] - if right[0] == 'SCColumn': - if right[1].data.ndim != 1: - raise NotImplementedError( - 'Comparing columns of dimensions other than one ' - 'is not yet implemented: "' + right[1].longname + '"' - ) - leftvalue = None - rightvalue = None - if left[0] == 'SCColumn' and right[0] == 'SCColumn': - number = right[1].unit/left[1].unit - if isQuantity(number): - raise TypeError( - 'Cannot compare "' + left[1].longname + '" to "' - + right[1].longname + '".' - ) - leftvalue = left[1].data - rightvalue = right[1].data*number - elif left[0] == 'SCColumn': - number = right[1]/left[1].unit - if isQuantity(number): - raise TypeError( - 'Cannot compare "' + left[1].longname - + '" to ' + str(right[1]) + '".' - ) - leftvalue = left[1].data - rightvalue = number - elif right[0] == 'SCColumn': - number = left[1]/right[1].unit - if isQuantity(number): - raise TypeError( - "Cannot compare " + str(left[1]) + ' to "' - + right[1].longname + '".' - ) - leftvalue = number - rightvalue = right[1].data - else: - raise ValueError( - "At least one argument of '" + atomar[2][1] - + "' has to be a column." - ) - if atomar[2] == '==': return leftvalue == rightvalue - elif atomar[2] == '!=': return leftvalue != rightvalue - elif atomar[2] == '<=': return leftvalue <= rightvalue - elif atomar[2] == '<' : return leftvalue < rightvalue - elif atomar[2] == '>=': return leftvalue >= rightvalue - elif atomar[2] == '>' : return leftvalue > rightvalue - raise ValueError, "Invalid atomar expression: " + str(atomar) + Return an unsealed SampleContainer that contains only selected rows. The + selection is specified via the `mask`. - def getMaskFromCommands(cmds): - """ - Returns a boolean numpy mask from given commands. - cmds -- nested tuples of commands (see SampleContainer.filter()) - """ - if cmds[0] == 'Atomar': - return evaluateAtomar(cmds) - elif cmds[0] == 'AND': - left = getMaskFromCommands(cmds[1]) - right = getMaskFromCommands(cmds[2]) - if left.shape != right.shape: - raise TypeError( - "Cannot apply 'and' to columns of different shape: " - + str(left.shape) + ", " + str(right.shape) - ) - return numpy.logical_and(left, right) - elif cmds[0] == 'OR': - left = getMaskFromCommands(cmds[1]) - right = getMaskFromCommands(cmds[2]) - if left.shape != right.shape: - raise TypeError( - "Cannot apply 'or' to columns of different shape: " - + str(left.shape) + ", " + str(right.shape) - ) - return numpy.logical_or(left, right) - elif cmds[0] == 'NOT': - return numpy.logical_not(getMaskFromCommands(cmds[1])) - numpymask = getMaskFromCommands(commands) + Parameters + ---------- + mask : numpy array of Boolean values + The length of the array has to be equal to the length of the columns + of the SampleContainer. If the value of mask[n] is + True, the nth row is part of the result, else it is discarded. + + shortname, longname : str + Specify the short and long name of the resulting FC. + + """ maskedcolumns = [] for col in self.columns: - maskedcol = None try: - maskedcol = col.getMaskedFC(numpymask) + maskedcol = col.getMaskedFC(mask) except ValueError: raise ValueError( 'Column "' + col.longname + '" has not enough rows!' @@ -744,11 +449,12 @@ maskedcolumns.append(maskedcol) #build new SampleContainer from masked columns and return it result = SampleContainer(maskedcolumns, - longname=self.longname, - shortname=self.shortname, + longname=longname, + shortname=shortname, attributes=copy.deepcopy(self.attributes)) return result + def assertEqual(con1, con2, rtol=1e-5, atol=1e-8): diagnosis = StringIO.StringIO() testReport = logging.StreamHandler(diagnosis) @@ -759,3 +465,179 @@ return True else: raise AssertionError, diagnosis.getvalue() + + +class LocationFixingNodeTransformer(NodeTransformer): + def visit(self, *args, **kargs): + result = NodeTransformer.visit(self, *args, **kargs) + from ast import fix_missing_locations + fix_missing_locations(result) + return result + + +class ReplaceName(LocationFixingNodeTransformer): + def __init__(self, sampleContainer): + self.localDict = {} + self.count = 0 + self.sc = sampleContainer + + def visit_Call(self, node): + from ast import (Name, Load) + if isinstance(node.func, Name) and node.func.id.lower() == 'col': + newName = self.getName(self.sc[node.args[0].s]) + return Name(newName, Load()) + + def visit_Str(self, node): + from ast import (Name, Load) + quantity = Quantity(node.s) + class QuantityDummy(object): + pass + dummy = QuantityDummy() + dummy.unit = Quantity(1.0, quantity.unit) + dummy.data = quantity.value + dummy.dimensions = None + newName = self.getName(dummy) + return Name(newName, Load()) + + def getName(self, ref): + newName = "N%s" % self.count + self.count += 1 + self.localDict[newName] = ref + return newName + + +class ReplaceOperator(LocationFixingNodeTransformer): + def __init__(self, localDict): + self.localDict = localDict + + def visit_BinOp(self, node): + from ast import (Add, Sub, BinOp) + self.generic_visit(node) + unitcalc = UnitCalculator(self.localDict) + leftUD = unitcalc.getUnitAndDim(node.left) + rightUD = unitcalc.getUnitAndDim(node.right) + checkDimensions(leftUD[1], rightUD[1]) + if isinstance(node.op,(Add, Sub)): + factor = rightUD[0] / leftUD[0] + right = self.withFactor(factor, node.right) + binOp = BinOp(node.left, node.op, right) + return binOp + else: + return node + + def visit_Compare(self, node): + from ast import Compare + self.generic_visit(node) + unitcalc = UnitCalculator(self.localDict) + leftUD = unitcalc.getUnitAndDim(node.left) + listUD = [unitcalc.getUnitAndDim(comp) for comp in node.comparators] + nonNoneDims = [ud[1] for ud in listUD + [leftUD] if ud[1] is not None] + for dims in nonNoneDims: + checkDimensions(nonNoneDims[0], dims) + factorlist = [ud[0] / leftUD[0] for ud in listUD] + newComplist = [self.withFactor(*t) \ + for t in zip(factorlist, node.comparators)] + compOp = Compare(node.left, node.ops, newComplist) + compOpTrans = self.compBreaker(compOp) + return compOpTrans + + def withFactor(self, factor, node): + from ast import (BinOp, Num, Mult) + if not isinstance(factor, float): + raise ValueError('Incompatible units!') + if factor == 1.0: + return node + return BinOp(Num(factor), Mult(), node) + + def compBreaker(self, node): + from ast import (Compare, BinOp, BitAnd) + assert isinstance(node, Compare) + if len(node.comparators) == 1: + return node + else: + comp1 = Compare(node.left, node.ops[0:1], + node.comparators[0:1]) + comp2 = Compare(node.comparators[0], + node.ops[1:], node.comparators[1:]) + newNode = BinOp(comp1, BitAnd(), self.compBreaker(comp2)) + return newNode + + +class UnitCalculator(object): + def __init__(self, localDict): + self.localDict = localDict + + def getUnitAndDim(self, node): + from ast import (Expression, Name, Num, + BinOp, Add, Mult, Div, Sub, + Compare, BoolOp, UnaryOp, + BitOr, BitXor, BitAnd) + if isinstance(node, Expression): + return self.getUnitAndDim(node.body) + elif isinstance(node, Name): + if node.id in ['True', 'False']: + return (1.0, None) + else: + column = self.localDict[node.id] + return (column.unit, column.dimensions) + elif isinstance(node, Num): + return (1.0, None) + elif isinstance(node, BinOp): + left = self.getUnitAndDim(node.left) + right = self.getUnitAndDim(node.right) + dimensions = checkDimensions(left[1], right[1]) + if isinstance(node.op, (Add, Sub)): + if not isinstance(left[0] / right[0], float): + raise ValueError("units %s, %s not compatible" \ + % (left, right)) + unit = left[0] + elif isinstance(node.op, Mult): + unit = left[0] * right[0] + elif isinstance(node.op, Div): + unit = left[0] / right[0] + elif isinstance(node.op, (BitOr, BitXor, BitAnd)): + if not isinstance(left[0], float): + raise ValueError( + "Type %s cannot be interpreted as a Boolean" % left) + if not isinstance(right[0], float): + raise ValueError( + "Type %s cannot be interpreted as a Boolean" % right) + unit = 1.0 + else: + raise NotImplementedError() + return (unit, dimensions) + elif isinstance(node, Compare): + left = self.getUnitAndDim(node.left) + nonNoneDims = [] + if left[1] is not None: + nonNoneDims.append(left[1]) + for comparator in node.comparators: + right = self.getUnitAndDim(comparator) + if right[1] is not None: + nonNoneDims.append(right[1]) + if not isinstance(left[0] / right[0], float): + raise ValueError("units %s, %s not compatible" \ + % (left[0], right[0])) + if len(nonNoneDims) >= 1: + for dims in nonNoneDims: + checkDimensions(nonNoneDims[0], dims) + dimensions = nonNoneDims[0] + else: + dimensions = None + return (1.0, dimensions) + elif isinstance(node, BoolOp): + raise NotImplementedError( + 'BoolOps not supported. Use bitwise ops instead (&, |)!') + elif isinstance(node, UnaryOp): + return self.getUnitAndDim(node.operand) + else: + raise NotImplementedError() + + +def checkDimensions(dimensions1, dimensions2): + if dimensions1 is not None and dimensions2 is not None and \ + dimensions1 != dimensions2: + msg = 'Dimensions "%s" and "%s" do not match!' \ + % (dimensions1, dimensions2) + raise ValueError(msg) + return dimensions1 or dimensions2 Modified: trunk/src/pyphant/pyphant/core/FieldContainer.py =================================================================== --- trunk/src/pyphant/pyphant/core/FieldContainer.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/FieldContainer.py 2011-05-23 12:48:36 UTC (rev 700) @@ -288,12 +288,15 @@ if m == None: m = hashlib.md5() super(FieldContainer, self).generateHash(m) - m.update(str(self.data.tolist())) + #m.update(str(self.data.tolist())) + m.update(self.data.dumps()) m.update(str(self.unit)) if self.error!=None: - m.update(str(self.error.tolist())) + #m.update(str(self.error.tolist())) + m.update(self.error.dumps()) if self.mask!=None: - m.update(str(self.mask.tolist())) + #m.update(str(self.mask.tolist())) + m.update(self.mask.dumps()) [m.update(dim.hash) for dim in self._dimensions] return enc(m.hexdigest()) @@ -648,8 +651,8 @@ def getMaskedFC(self, numpymask): """ - Returns a new FieldContainer instance that emerges from this instance - by clipping along the primary axis according to the + Return an unsealed FieldContainer instance that emerges from + this instance by clipping along the primary axis according to the entries in the parameter numpymask, i.e. all entries where numpymask is set to False are discarded. numpymask -- Numpy array with Boolean values Modified: trunk/src/pyphant/pyphant/core/H5FileHandler.py =================================================================== --- trunk/src/pyphant/pyphant/core/H5FileHandler.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/H5FileHandler.py 2011-05-23 12:48:36 UTC (rev 700) @@ -121,7 +121,7 @@ try: resNode._g_checkHasChild('dimensions') except tables.NoSuchNodeError: - return True + return True return False def loadDataContainer(self, dcId): @@ -220,6 +220,9 @@ summary['attributes'] = attributes return summary + def loadRecipe(self): + return PyTablesPersister.loadRecipe(self.handle) + def saveDataContainer(self, result): """ Saves a given DataContainer instance to the HDF5 file. Modified: trunk/src/pyphant/pyphant/core/Helpers.py =================================================================== --- trunk/src/pyphant/pyphant/core/Helpers.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/Helpers.py 2011-05-23 12:48:36 UTC (rev 700) @@ -40,8 +40,12 @@ if homedir == '~': homedir = os.getcwdu() path = os.path.join(homedir, '.pyphant', subdir) - if not os.path.isdir(path): - os.makedirs(path) + # Create the dir in a multi process save way: + try: + os.makedirs(path) #<-- ignores EEXIST in all but top recursion levels + except OSError, ose: + if ose.errno != os.errno.EEXIST: + raise return path def getUsername(): @@ -154,3 +158,28 @@ output = plug.getResult() socket.pullPlug() return output + +def makeSC(column_data, longnames, shortnames, longname, shortname, + attributes={}): + unzipped = zip(*column_data) + assert len(unzipped) == len(longnames) == len(shortnames) + def get_column_fc(col, ln, sn): + try: + from pyphant.quantities import Quantity + unit = Quantity(1.0, col[0].unit) + data = [quant.value for quant in col] + except (KeyError, AttributeError): + unit = 1 + data = col + from numpy import array + from pyphant.core.DataContainer import FieldContainer + fc = FieldContainer(data=array(data), unit=unit, + longname=ln, shortname=sn) + return fc + columns = [get_column_fc(col, ln, sn) for col, ln, sn \ + in zip(unzipped, longnames, shortnames)] + from pyphant.core.DataContainer import SampleContainer + sc = SampleContainer(longname=longname, shortname=shortname, + attributes=attributes, columns=columns) + sc.seal() + return sc Modified: trunk/src/pyphant/pyphant/core/KnowledgeManager.py =================================================================== --- trunk/src/pyphant/pyphant/core/KnowledgeManager.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/KnowledgeManager.py 2011-05-23 12:48:36 UTC (rev 700) @@ -198,11 +198,14 @@ for fname in [afname for afname in files if afname.endswith('.h5')]: flist.append(os.path.realpath(os.path.join(directory, fname))) os.path.walk(getPyphantPath(KM_PATH), accumulate_files, file_list) - from wx import (ProgressDialog, PyNoAppError) try: - pdial = ProgressDialog('Rebuilding index...', ' ' * 100, - maximum=len(file_list)) - except PyNoAppError: + from wx import (ProgressDialog, PyNoAppError) + try: + pdial = ProgressDialog('Rebuilding index...', ' ' * 100, + maximum=len(file_list)) + except PyNoAppError: + pdial = None + except ImportError: pdial = None count = 1 for realname in file_list: Modified: trunk/src/pyphant/pyphant/core/Worker.py =================================================================== --- trunk/src/pyphant/pyphant/core/Worker.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/Worker.py 2011-05-23 12:48:36 UTC (rev 700) @@ -81,9 +81,12 @@ _plugs=[] _params=[] DEFAULT_ANNOTATIONS={"pos":(0,0)} - def __init__(self, parent=None, annotations={}): - self._annotations=annotations - map(lambda k: self._annotations.setdefault(k, Worker.DEFAULT_ANNOTATIONS[k]), + def __init__(self, parent=None, annotations=None): + if annotations is None: + annotations = {} + self._annotations = annotations + map(lambda k: self._annotations.setdefault( + k, Worker.DEFAULT_ANNOTATIONS[k]), Worker.DEFAULT_ANNOTATIONS.keys()) self.parent=parent self.initSockets(self._sockets) @@ -144,7 +147,7 @@ self._params={} self._order=[] self.addParam('name',Param.createParam(self,'name','Name', - self.__class__.__name__)) + self.name)) for (name, displayName, value, subtype) in params: p=Param.createParam(self, name, displayName, value, subtype) setattr(self, 'param'+self.upperFirstLetter(name), p) Deleted: trunk/src/pyphant/pyphant/core/XMLHandler.py =================================================================== --- trunk/src/pyphant/pyphant/core/XMLHandler.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/XMLHandler.py 2011-05-23 12:48:36 UTC (rev 700) @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2006-2009, 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. - -""" -TODO -""" -__id__ = "$Id$" -__author__ = "$Author$" -__version__ = "$Revision$" -# $Source$: - -import xml.sax - - -class XMLElement(object): - - def __init__(self, name, attrs, parent, content=''): - self.name = name - self.attributes = attrs - self.parent = parent - self.children = {} - self.content = content - if parent != None: - parent[name] = self - - def __getitem__(self, key): - return self.children[key] - - def __setitem__(self, key, item): - self.children[key] = item - - -class XMLHandler(xml.sax.handler.ContentHandler): - - def __init__(self): - self.current_element = None - self.root_element = None - - def startElement(self, name, attrs): - if self.root_element == None: - element = XMLElement(name, attrs, None) - self.root_element = element - self.current_element = element - else: - element = XMLElement(name, attrs, self.current_element) - self.current_element = element - - def endElement(self, name): - assert name == self.current_element.name - self.current_element = self.current_element.parent - - def characters(self, content): - if self.current_element != None: - self.current_element.content += content - - -def getXMLRoot(filename_or_stream): - handler = XMLHandler() - xml.sax.parse(filename_or_stream, handler) - return handler.root_element Deleted: trunk/src/pyphant/pyphant/core/ZStackManager.py =================================================================== --- trunk/src/pyphant/pyphant/core/ZStackManager.py 2010-09-13 08:56:34 UTC (rev 699) +++ trunk/src/pyphant/pyphant/core/ZStackManager.py 2011-05-23 12:48:36 UTC (rev 700) @@ -1,300 +0,0 @@ -#!/usr/bin/env python2.5 -# -*- coding: utf-8 -*- - -# Copyright (c) 2006-2009, 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"""Provides ZStackManager -""" - -__id__ = "$Id$".replace('$','') -__author__ = "$Author$".replace('$','') -__version__ = "$Revision$".replace('$','') -# $Source$ - - -from pyphant.quantities import Quantity -from pyphant.core.DataContainer import (FieldContainer, SampleContainer) -import scipy -import Image -from pyphant.core.KnowledgeManager import KnowledgeManager -import os -import re -kmanager = KnowledgeManager.getInstance() - - -class ZStack(object): - def __init__(self, sc_id=None, meta=None, temporary=False): - """Initializes a ZStack from an existing id or metadata""" - assert (sc_id is None) is not (meta is None) - self.temporary = temporary - if sc_id is not None: - self.repr_sc = kmanager.getDataContainer(sc_id) - else: - self.repr_sc = self._import_zstack(meta) - - @staticmethod - def _get_image_fcs(images_meta, temporary=False): - zvalues = [] - emd5s = [] - files = [] - from wx import (ProgressDialog, PyNoAppError) - try: - pdial = ProgressDialog('Importing ZStack...', ' ' * 50, - maximum=len(images_meta)) - except PyNoAppError: - pdial = None - count = 1 - for img_meta in images_meta: - if pdial is not None: - pdial.Update(count, os.path.basename(img_meta['imgFilename'])) - count += 1 - files.append(img_meta['xmlFilename']) - img = Image.open(img_meta['imgFilename']) - data = scipy.misc.fromimage(img, flatten=True) - zvalue = img_meta['z-pos'] - yunit = Quantity(1.0, img_meta['height'].unit) - xunit = Quantity(1.0, img_meta['width'].unit) - ydata = scipy.arange(img_meta['height[pixel]']) \ - * img_meta['y-factor'].inUnitsOf(yunit.unit).value \ - + img_meta['y-pos'].inUnitsOf(yunit.unit).value - xdata = scipy.arange(img_meta['width[pixel]']) \ - * img_meta['x-factor'].inUnitsOf(xunit.unit).value \ - + img_meta['x-pos'].inUnitsOf(xunit.unit).value - dimensions = [FieldContainer(ydata, - unit=yunit, - longname=u'y-axis', - shortname=u'y'), - FieldContainer(xdata, - unit=xunit, - longname=u'x-axis', - shortname=u'x')] - fcattr = {'vmin':0, 'vmax':255} - fcattr.update(img_meta) - img_fc = FieldContainer(data=data, - longname=os.path.basename( - img_meta['imgFilename']), - shortname="i", - dimensions=dimensions, attributes=fcattr) - img_fc.seal() - kmanager.registerDataContainer(img_fc, temporary=temporary) - emd5s.append(img_fc.id) - zvalues.append(zvalue.value) - if len(zvalues) == 0: - return None, None, None - zfc = FieldContainer(scipy.array(zvalues), longname='z-value', - shortname='z', unit=Quantity(1.0, zvalue.unit)) - filefc = FieldContainer(scipy.array(files), longname='filename', - shortname='f') - emd5fc = FieldContainer(scipy.array(emd5s), longname='emd5', - shortname='i') - if pdial is not None: - pdial.Destroy() - return zfc, filefc, emd5fc - - def _import_zstack(self, meta): - zfc, filefc, emd5fc = ZStack._get_image_fcs(meta, self.temporary) - if zfc == None: - return None - attributes = {} - attributes['ZStackType'] = 'RawSC' - attributes['xmlFilename'] = meta[0]['xmlFilename'] - attributes['crystal'] = meta[0]['crystal'] - ssc = SampleContainer([zfc, filefc, emd5fc], - meta[0]['ZStackName'], - "z", - attributes) - ssc.seal() - kmanager.registerDataContainer(ssc, temporary=self.temporary) - return ssc - - -class ZStackManager(object): - def importZStack(self, xmlFName, name, crystal, temporary=False): - metaReader = getMetaReader(xmlFName, name, crystal) - meta = metaReader.getMeta() - return ZStack(meta=meta, temporary=temporary) - - def getZStacks(self): - """Returns a list of all ZStacks in the pool""" - search_dict = {'type':'sample', 'attributes':{'ZStackType':'RawSC'}} - search_result = kmanager.search(['id'], search_dict) - if len(search_result) == 0: - return [] - return [ZStack(zs_id[0]) for zs_id in search_result] - - def getZStackByName(self, name): - search_dict = {'type':'sample', 'attributes':{'ZStackType':'RawSC'}, - 'longname':name} - sresult = kmanager.search(['id'], search_dict) - if sresult == []: - raise ValueError("There is no ZStack called %s!" \ - % name) - return ZStack(sc_id=sresult[0][0]) - - -class MetaReader(object): - def __init__(self, xmlFName, name, crystal): - self.xmlFN... [truncated message content] |
From: <zk...@us...> - 2010-09-13 08:56:43
|
Revision: 699 http://pyphant.svn.sourceforge.net/pyphant/?rev=699&view=rev Author: zklaus Date: 2010-09-13 08:56:34 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: removed unneeded variable setup Changed pyphant/Core/Helper.py to use getpass. Bugfix: Logo is loaded from base64 encoded string. Added splash screen: This version needs to be started in src/pyphant/pyphant/wxgui2 or doc/logo in order to find the splash screen image. pyphantLogo module with docstring. Base64 coded pyphant logo. Fix: ZStacks: refractive index Fix: Restore parameters to DCSource workers Cosm: Added line feed to README Modified Paths: -------------- trunk/doc/demo/README trunk/src/pyphant/pyphant/core/Helpers.py trunk/src/pyphant/pyphant/core/ZStackManager.py trunk/src/pyphant/pyphant/tests/TestZStacks.py trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py trunk/src/workers/tools/tools/DCSource.py trunk/src/workers/tools/tools/FCSource.py trunk/src/workers/tools/tools/SCSource.py Added Paths: ----------- trunk/doc/logo/ trunk/doc/logo/mklogo.py trunk/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png trunk/doc/logo/pyphantLogo.py trunk/src/pyphant/pyphant/wxgui2/pyphantLogo.py Modified: trunk/doc/demo/README =================================================================== --- trunk/doc/demo/README 2010-07-18 18:51:16 UTC (rev 698) +++ trunk/doc/demo/README 2010-09-13 08:56:34 UTC (rev 699) @@ -2,4 +2,5 @@ wxPythant demo.h5 #Start scripting example with -./simpleScripting.py \ No newline at end of file +./simpleScripting.py + Added: trunk/doc/logo/mklogo.py =================================================================== --- trunk/doc/logo/mklogo.py (rev 0) +++ trunk/doc/logo/mklogo.py 2010-09-13 08:56:34 UTC (rev 699) @@ -0,0 +1,49 @@ +copyright="""# -*- coding: utf-8 -*- + +# Copyright (c) 2010, Andreas W. Liehr (li...@us...) +# 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. + +""" + +"""Creates pyphantLogo.py, a python modul including a base 64 encoded PNG file of the Pyphant logo.""" + +import base64 +picname = 'pyphant-shade-Information-Analysis-Framework-ARTS-small.png' +file = open(picname,'rb') +logo = file.read() +file.close() +pic_b64 = logo.encode('base64') + +file = open("pyphantLogo.py",'w') +file.write(copyright) +file.write("\"\"\""+ +"""Python modul including a base 64 encoded PNG file of the Pyphant logo based on %s.""" % picname +"\"\"\"\n\n" + ) +file.write("pic_b64 = \"\"\"%s\"\"\"\n" % pic_b64) +file.close() Added: trunk/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png =================================================================== --- trunk/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png (rev 0) +++ trunk/doc/logo/pyphant-shade-Information-Analysis-Framework-ARTS-small.png 2010-09-13 08:56:34 UTC (rev 699) @@ -0,0 +1,978 @@ +\x89PNG + + |
From: <zk...@us...> - 2010-07-18 18:51:22
|
Revision: 698 http://pyphant.svn.sourceforge.net/pyphant/?rev=698&view=rev Author: zklaus Date: 2010-07-18 18:51:16 +0000 (Sun, 18 Jul 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: Fix typo, remove debug print. Fix: Add proper handling of maskless fields to PlotFrame; better unit handling. Enh: Add legend to viewOSC script. Modified Paths: -------------- trunk/doc/demo/viewOSC.py trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py Modified: trunk/doc/demo/viewOSC.py =================================================================== --- trunk/doc/demo/viewOSC.py 2010-07-14 10:41:43 UTC (rev 697) +++ trunk/doc/demo/viewOSC.py 2010-07-18 18:51:16 UTC (rev 698) @@ -182,7 +182,7 @@ residuum = (simulation.dimensions[0].data-thickness.data[index])**2 absorption = simulation.data[residuum.argmin(),:] pylab.plot(simulation.dimensions[1].data, - absorption,label="$%s$"%simulation.shortname) + absorption,label="$%s$ functional"%simulation.shortname) title = "Functional based: " + title_template % (thickness[index].shortname, thickness.data[index], thickness.unit.unit.name()) @@ -194,7 +194,7 @@ residuum = (simulation.dimensions[0].data-thickness.data[index])**2 absorption = simulation.data[residuum.argmin(),:] pylab.plot(simulation.dimensions[1].data, - absorption,label="$%s$"%simulation.shortname) + absorption,label="$%s$ immediate"%simulation.shortname) title += "\nImmediate: " + title_template % (thickness[index].shortname, thickness.data[index], thickness.unit.unit.name()) @@ -223,6 +223,7 @@ label ="$\\Delta%s$"%maximaPos.shortname, linestyle='dashed') pylab.title(title) pylab.xlabel(simulation.dimensions[1].label) + pylab.legend(loc="lower left") def noisyAbsorption(recipe, curvNo, noIndicators): worker = recipe.getWorker("Slicing") Modified: trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py 2010-07-14 10:41:43 UTC (rev 697) +++ trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py 2010-07-18 18:51:16 UTC (rev 698) @@ -49,8 +49,8 @@ from pyphant.core import DataContainer from pyphant.wxgui2.DataVisReg import DataVisReg from pyphant.quantities import isQuantity, Quantity +from pyphant.quantities.ParseQuantities import str2unit - class PlotPanel (wx.PyPanel): """The PlotPanel has a Figure and a Canvas. OnSize events simply set a flag, and the actual resizing of the figure is triggered by an Idle event.""" @@ -122,10 +122,15 @@ if not isinstance(aspect, Quantity): self.ax.set_aspect(aspect) try: - mask = numpy.logical_not(self.c.mask) - x = self.x.data[mask] - y = self.y.data[mask] - c = self.c.data[mask] + if self.c.mask!=None: + mask = numpy.logical_not(self.c.mask) + x = self.x.data[mask] + y = self.y.data[mask] + c = self.c.data[mask] + else: + x = self.x.data + y = self.y.data + c = self.c.data self.scat = self.ax.scatter(x,y, s=numpy.pi*(self.radius/self.x.unit)**2, c=c, @@ -231,9 +236,9 @@ self.vmin_text.Value=str(vmin) vmax = numpy.nanmax(field.data).round()*field.unit self.vmax_text.Value=str(vmax) - self.plot_panel.vmin = Quantity(self.vmin_text.Value) - self.plot_panel.vmax = Quantity(self.vmax_text.Value) - self.plot_panel.radius = Quantity(self.radius_text.Value) + self.plot_panel.vmin = str2unit(self.vmin_text.Value) + self.plot_panel.vmax = str2unit(self.vmax_text.Value) + self.plot_panel.radius = str2unit(self.radius_text.Value) self.plot_panel.draw() self.GetSizer().Fit(self) Modified: trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py =================================================================== --- trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py 2010-07-14 10:41:43 UTC (rev 697) +++ trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py 2010-07-18 18:51:16 UTC (rev 698) @@ -75,14 +75,14 @@ minima_model = model[self.paramMinima_model.value] maxima_model = model[self.paramMaxima_model.value] minima_experimental = experimental[self.paramMinima_experimental.value] - minima_experimantal = minima_experimental.inUnitsOf(minima_model) + minima_experimental = minima_experimental.inUnitsOf(minima_model) minima = minima_experimental.data.transpose() if minima_experimental.error != None: minima_error = iter(minima_experimental.error.transpose()) else: minima_error = None maxima_experimental = experimental[self.paramMaxima_experimental.value] - maxima_experimantal = maxima_experimental.inUnitsOf(maxima_model) + maxima_experimental = maxima_experimental.inUnitsOf(maxima_model) maxima = maxima_experimental.data.transpose() if maxima_experimental.error != None: maxima_error = iter(maxima_experimental.error.transpose()) @@ -119,7 +119,6 @@ grades.append(numpy.nan) continue grades.append(grade) - print grades[-1] grades = numpy.array(grades) i = numpy.nanargmin(grades) if numpy.isnan(i): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2010-07-14 10:41:51
|
Revision: 697 http://pyphant.svn.sourceforge.net/pyphant/?rev=697&view=rev Author: zklaus Date: 2010-07-14 10:41:43 +0000 (Wed, 14 Jul 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Enh: Now the viewOSC script also displays result from the alternative method. Modified Paths: -------------- trunk/doc/demo/viewOSC.py Modified: trunk/doc/demo/viewOSC.py =================================================================== --- trunk/doc/demo/viewOSC.py 2010-07-12 21:47:51 UTC (rev 696) +++ trunk/doc/demo/viewOSC.py 2010-07-14 10:41:43 UTC (rev 697) @@ -166,30 +166,48 @@ pylab.show() def compareAbsorption(recipe, curvNo, noIndicators): - worker = recipe.getWorker("Slicing") - noisyAbsorption = worker.plugExtract.getResult() - worker = recipe.getWorker("ThicknessModeller") - simulation = worker.plugCalcAbsorption.getResult() - worker = recipe.getWorker("MRA Exp") - minimaPos = worker.plugMra.getResult()[r'\lambda_{min}'].inUnitsOf(simulation.dimensions[1]) - maximaPos = worker.plugMra.getResult()[r'\lambda_{max}'].inUnitsOf(simulation.dimensions[1]) worker = recipe.getWorker("AddColumn") - table = worker.plugCompute.getResult(subscriber=TextSubscriber("Add Column")) + table = worker.plugCompute.getResult(subscriber=TextSubscriber("Result Functional")) xPos = table[u"x-position"] yPos = table[u"y-position"] - thickness = table[u"thickness"] index = curvNo2Index(table[u"pixel"], curvNo) - result = "$%s_{%s}$(%s %s,%s %s)=%s %s" % (thickness[index].shortname,curvNo, + title_template = "$%%s_{%s}$(%s %s,%s %s)=%%s %%s" % (curvNo, xPos.data[index],xPos.unit.unit.name(), - yPos.data[index],yPos.unit.unit.name(), - thickness.data[index], - thickness.unit.unit.name()) + yPos.data[index],yPos.unit.unit.name()) + + worker = recipe.getWorker("ThicknessModeller") + simulation = worker.plugCalcAbsorption.getResult() + + thickness = table[u"thickness"] residuum = (simulation.dimensions[0].data-thickness.data[index])**2 absorption = simulation.data[residuum.argmin(),:] + pylab.plot(simulation.dimensions[1].data, + absorption,label="$%s$"%simulation.shortname) + title = "Functional based: " + title_template % (thickness[index].shortname, + thickness.data[index], + thickness.unit.unit.name()) + + try: + worker = recipe.getWorker("Res Direct") + table = worker.plugCompute.getResult(subscriber=TextSubscriber("Result without Functional")) + thickness = table[u"thickness"] + residuum = (simulation.dimensions[0].data-thickness.data[index])**2 + absorption = simulation.data[residuum.argmin(),:] + pylab.plot(simulation.dimensions[1].data, + absorption,label="$%s$"%simulation.shortname) + title += "\nImmediate: " + title_template % (thickness[index].shortname, + thickness.data[index], + thickness.unit.unit.name()) + except: + pass + + worker = recipe.getWorker("Slicing") + noisyAbsorption = worker.plugExtract.getResult() + worker = recipe.getWorker("MRA Exp") + minimaPos = worker.plugMra.getResult()[r'\lambda_{min}'].inUnitsOf(simulation.dimensions[1]) + maximaPos = worker.plugMra.getResult()[r'\lambda_{max}'].inUnitsOf(simulation.dimensions[1]) pylab.plot(noisyAbsorption.dimensions[1].inUnitsOf(simulation.dimensions[1]).data, noisyAbsorption.data[index,:],label="$%s$"%noisyAbsorption.shortname) - pylab.plot(simulation.dimensions[1].data, - absorption,label="$%s$"%simulation.shortname) if not noIndicators: pylab.vlines(minimaPos.data[:,index],0.1,1.0, label ="$%s$"%minimaPos.shortname) @@ -203,7 +221,7 @@ label ="$\\Delta%s$"%maximaPos.shortname, linestyle='dashed') pylab.vlines(maximaPos.data[:,index]-maximaPos.error[:,index],0.1,1.0, label ="$\\Delta%s$"%maximaPos.shortname, linestyle='dashed') - pylab.title(result) + pylab.title(title) pylab.xlabel(simulation.dimensions[1].label) def noisyAbsorption(recipe, curvNo, noIndicators): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2010-07-12 21:47:59
|
Revision: 696 http://pyphant.svn.sourceforge.net/pyphant/?rev=696&view=rev Author: zklaus Date: 2010-07-12 21:47:51 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Enh: Add EstimateParameterFromValues.py Enh: Add removal of second lamp peak to Absorbtion calculation. Fix: Improve progress handling in Compute Functional. Enh: PlotFrame now takes the mask of the value column into account. Fix: MRA can now deal with curves without extrema. Modified Paths: -------------- trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py trunk/src/workers/OSC/OSC/ComputeFunctional.py trunk/src/workers/OSC/OSC/MRA.py trunk/src/workers/OSC/OSC/OscAbsorption.py trunk/src/workers/OSC/OSC/__init__.py Added Paths: ----------- trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py Modified: trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py =================================================================== --- trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py 2010-07-12 20:43:11 UTC (rev 695) +++ trunk/src/pyphant/pyphant/visualizers/ConfigurablePlot.py 2010-07-12 21:47:51 UTC (rev 696) @@ -122,9 +122,13 @@ if not isinstance(aspect, Quantity): self.ax.set_aspect(aspect) try: - self.scat = self.ax.scatter(self.x.data, self.y.data, + mask = numpy.logical_not(self.c.mask) + x = self.x.data[mask] + y = self.y.data[mask] + c = self.c.data[mask] + self.scat = self.ax.scatter(x,y, s=numpy.pi*(self.radius/self.x.unit)**2, - c=self.c.data, + c=c, vmin=self.vmin, vmax=self.vmax) self.colorbar = self.figure.colorbar(self.scat, format=F(self.c), ax=self.ax) @@ -223,9 +227,9 @@ if self.plot_panel.c_key != colorVariable: self.plot_panel.c_key = colorVariable field = self.dataContainer[colorVariable] - vmin = field.data.min().round()*field.unit + vmin = numpy.nanmin(field.data).round()*field.unit self.vmin_text.Value=str(vmin) - vmax = field.data.max().round()*field.unit + vmax = numpy.nanmax(field.data).round()*field.unit self.vmax_text.Value=str(vmax) self.plot_panel.vmin = Quantity(self.vmin_text.Value) self.plot_panel.vmax = Quantity(self.vmax_text.Value) Modified: trunk/src/workers/OSC/OSC/ComputeFunctional.py =================================================================== --- trunk/src/workers/OSC/OSC/ComputeFunctional.py 2010-07-12 20:43:11 UTC (rev 695) +++ trunk/src/workers/OSC/OSC/ComputeFunctional.py 2010-07-12 21:47:51 UTC (rev 696) @@ -57,7 +57,7 @@ _params = [("extentX", u"Extension of x-axis [%%]", 10, None), ("extentY", u"Extension of y-axis [%%]", 10, None)] - def computeDistances(self, field, subscriber=1): + def computeDistances(self, field, subscriber=1, percentage=0): xGrid,yGrid = numpy.meshgrid(field.dimensions[-1].data,field.dimensions[-2].data) x = numpy.extract(numpy.logical_not(numpy.isnan(field.data)),xGrid) xCon = DataContainer.FieldContainer(x,unit=field.dimensions[-1].unit, @@ -80,8 +80,7 @@ distances = numpy.zeros(x.shape,'f') ni = functional.shape[0] nj = functional.shape[1] - increment = 100.0/(ni*nj) - percentage = 0 + increment = 50.0/(ni*nj) for i in xrange(ni): for j in xrange(nj): for k in xrange(len(x)): @@ -99,7 +98,8 @@ @Worker.plug(Connectors.TYPE_ARRAY) def compute(self, field, subscriber=1): - functionals = DataContainer.SampleContainer([self.computeDistances(column, subscriber) for column in field], + percentage = 0 + functionals = DataContainer.SampleContainer([self.computeDistances(column, subscriber, percentage) for column in field], longname='Functionals of %s'%field.longname, shortname='F_{%s}'%field.shortname) functionals.seal() Added: trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py =================================================================== --- trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py (rev 0) +++ trunk/src/workers/OSC/OSC/EstimateParameterFromValues.py 2010-07-12 21:47:51 UTC (rev 696) @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2008-2009, Rectorate of the University of Freiburg +# Copyright (c) 2009, Andreas W. Liehr (li...@us...) +# 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 pyphant import quantities +import copy + +class EstimateParameterFromValues(Worker.Worker): + API = 2 + VERSION = 1 + REVISION = "$Revision$"[11:-1] + name = "Estimate Parameter" + + _sockets = [("model", Connectors.TYPE_ARRAY), + ("experimental", Connectors.TYPE_ARRAY)] + _params = [("minima_model", u"Minima in the model", [u"Minima"], None), + ("maxima_model", u"Maxima in the model", [u"Maxima"], None), + ("minima_experimental", u"Minima in the experiment", [u"Minima"], None), + ("maxima_experimental", u"Maxima in the experiment", [u"Maxima"], None), + ("extentX", u"Extension of x-axis [%%]", 10, None), + ("extentY", u"Extension of y-axis [%%]", 10, None)] + + def refreshParams(self, subscriber=None): + if self.socketModel.isFull(): + templ = self.socketModel.getResult( subscriber ) + self.paramMinima_model.possibleValues = templ.longnames.keys() + self.paramMaxima_model.possibleValues = templ.longnames.keys() + if self.socketExperimental.isFull(): + templ = self.socketExperimental.getResult( subscriber ) + self.paramMinima_experimental.possibleValues = templ.longnames.keys() + self.paramMaxima_experimental.possibleValues = templ.longnames.keys() + + @Worker.plug(Connectors.TYPE_IMAGE) + def compute(self, model, experimental, subscriber=1): + minima_model = model[self.paramMinima_model.value] + maxima_model = model[self.paramMaxima_model.value] + minima_experimental = experimental[self.paramMinima_experimental.value] + minima_experimantal = minima_experimental.inUnitsOf(minima_model) + minima = minima_experimental.data.transpose() + if minima_experimental.error != None: + minima_error = iter(minima_experimental.error.transpose()) + else: + minima_error = None + maxima_experimental = experimental[self.paramMaxima_experimental.value] + maxima_experimantal = maxima_experimental.inUnitsOf(maxima_model) + maxima = maxima_experimental.data.transpose() + if maxima_experimental.error != None: + maxima_error = iter(maxima_experimental.error.transpose()) + else: + maxima_error = None + parameter = [] + inc = 100.0/float(len(minima)) + acc = inc + subscriber %= acc + mask = [] + for row_minima, row_maxima in zip(minima, maxima): + if minima_error: + filtered_minima_error = filter( + lambda c: not numpy.isnan(c), minima_error.next()) + else: + filtered_minima_error = None + if maxima_error: + filtered_maxima_error = filter( + lambda c: not numpy.isnan(c), maxima_error.next()) + else: + filtered_maxima_error = None + row_minima = numpy.array(filter(lambda c: not numpy.isnan(c), row_minima)) + row_maxima = numpy.array(filter(lambda c: not numpy.isnan(c), row_minima)) + grades = [] + for rm_minima, rm_maxima in zip(minima_model.data.transpose(), maxima_model.data.transpose()): + rm_minima = filter(lambda c: not numpy.isnan(c), rm_minima) + rm_maxima = filter(lambda c: not numpy.isnan(c), rm_maxima) + grade = 0 + if len(rm_minima) == len(row_minima): + grade = sum(numpy.abs(numpy.array(rm_minima)-row_minima)) + if len(rm_maxima) == len(row_maxima): + grade += sum(numpy.abs(numpy.array(rm_maxima)-row_maxima)) + if grade == 0: + grades.append(numpy.nan) + continue + grades.append(grade) + print grades[-1] + grades = numpy.array(grades) + i = numpy.nanargmin(grades) + if numpy.isnan(i): + mask.append(True) + parameter.append(numpy.nan) + else: + mask.append(False) + parameter.append(minima_model.dimensions[1].data[i]) + acc += inc + subscriber %= acc + result = DataContainer.FieldContainer( + numpy.array(parameter), + mask = numpy.array(mask), + longname = minima_model.dimensions[-1].longname, + shortname = minima_model.dimensions[-1].shortname, + unit = minima_model.dimensions[-1].unit) + result.seal() + return result Modified: trunk/src/workers/OSC/OSC/MRA.py =================================================================== --- trunk/src/workers/OSC/OSC/MRA.py 2010-07-12 20:43:11 UTC (rev 695) +++ trunk/src/workers/OSC/OSC/MRA.py 2010-07-12 21:47:51 UTC (rev 696) @@ -116,10 +116,18 @@ convolvedField = convolveMRA(field, sigma) lastMinima = findMinima(convolvedField, numb_edge, lastMinima) lastMaxima = findMaxima(convolvedField, numb_edge, lastMaxima) - pos_minima = dim.data[numpy.array(lastMinima)+1] - error_minima = numpy.abs(pos_minima - dim.data[numpy.array(firstMinima)+1]) - pos_maxima = dim.data[numpy.array(lastMaxima)+1] - error_maxima = numpy.abs(pos_maxima - dim.data[numpy.array(firstMaxima)+1]) + if len(lastMinima)>0 and len(firstMinima)>0: + pos_minima = dim.data[numpy.array(lastMinima)+1] + error_minima = numpy.abs(pos_minima - dim.data[numpy.array(firstMinima)+1]) + else: + pos_minima = numpy.array([],dtype=dim.data.dtype) + error_minima = numpy.array([],dtype=dim.data.dtype) + if len(lastMaxima)>0 and len(firstMaxima)>0: + pos_maxima = dim.data[numpy.array(lastMaxima)+1] + error_maxima = numpy.abs(pos_maxima - dim.data[numpy.array(firstMaxima)+1]) + else: + pos_maxima = numpy.array([],dtype=dim.data.dtype) + error_maxima = numpy.array([],dtype=dim.data.dtype) return ((pos_minima, error_minima), (pos_maxima, error_maxima)) def pos_error_to_data_container(p_e): Modified: trunk/src/workers/OSC/OSC/OscAbsorption.py =================================================================== --- trunk/src/workers/OSC/OSC/OscAbsorption.py 2010-07-12 20:43:11 UTC (rev 695) +++ trunk/src/workers/OSC/OSC/OscAbsorption.py 2010-07-12 21:47:51 UTC (rev 696) @@ -73,6 +73,22 @@ indexDict = IndexDict(offset,fmax,fstep) return (offset, fstep, indexDict) +def removePeak(Abso, lower, upper): + dim = Abso.dimensions[-1] + minVal = lower/dim.unit + maxVal = upper/dim.unit + high_part = numpy.argwhere(minVal<dim.data).flatten() + low_part = numpy.argwhere(dim.data<maxVal).flatten() + lamp_interval = numpy.intersect1d(high_part, low_part) + min_index = lamp_interval[0] + max_index = lamp_interval[-1] + steps = max_index-min_index + for row in Abso.data: + min_value = row[min_index] + max_value = row[max_index] + step_size = (max_value-min_value)/steps + row[lamp_interval] = min_value + (lamp_interval-min_index)*step_size + class OscAbsorptionCalculator(Worker.Worker): API = 2 VERSION = 1 @@ -100,20 +116,12 @@ shortname=ur'\tilde{A}') Abso.dimensions[-1] = I.dimensions[-1] if self.paramMask_lamp.value==1: - dim = Abso.dimensions[-1] - minVal = quantities.Quantity('654nm')/dim.unit - maxVal = quantities.Quantity('660nm')/dim.unit - high_part = numpy.argwhere(minVal<dim.data).flatten() - low_part = numpy.argwhere(dim.data<maxVal).flatten() - lamp_interval = numpy.intersect1d(high_part, low_part) - min_index = lamp_interval[0] - max_index = lamp_interval[-1] - steps = max_index-min_index - for row in Abso.data: - min_value = row[min_index] - max_value = row[max_index] - step_size = (max_value-min_value)/steps - row[lamp_interval] = min_value + (lamp_interval-min_index)*step_size + removePeak(Abso, + quantities.Quantity('654nm'), + quantities.Quantity('660nm')) + removePeak(Abso, + quantities.Quantity('920nm'), + quantities.Quantity('980nm')) Abso.seal() return Abso Modified: trunk/src/workers/OSC/OSC/__init__.py =================================================================== --- trunk/src/workers/OSC/OSC/__init__.py 2010-07-12 20:43:11 UTC (rev 695) +++ trunk/src/workers/OSC/OSC/__init__.py 2010-07-12 21:47:51 UTC (rev 696) @@ -45,6 +45,7 @@ "ComputeFunctional", "ErrorEstimator", "EstimateParameter", + "EstimateParameterFromValues", "ExtremumFinder", "MRA", "OscAbsorption", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2010-07-12 20:43:18
|
Revision: 695 http://pyphant.svn.sourceforge.net/pyphant/?rev=695&view=rev Author: zklaus Date: 2010-07-12 20:43:11 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Enh: Import of single microscopy images Modified Paths: -------------- trunk/src/pyphant/pyphant/core/ZStackManager.py trunk/src/pyphant/pyphant/tests/TestZStacks.py trunk/src/pyphant/pyphant/tests/resources/zstack/_meta.xml trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py trunk/src/workers/ImageProcessing/ImageProcessing/MarkAF.py Added Paths: ----------- trunk/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml Modified: trunk/src/pyphant/pyphant/core/ZStackManager.py =================================================================== --- trunk/src/pyphant/pyphant/core/ZStackManager.py 2010-07-08 13:13:29 UTC (rev 694) +++ trunk/src/pyphant/pyphant/core/ZStackManager.py 2010-07-12 20:43:11 UTC (rev 695) @@ -39,65 +39,27 @@ # $Source$ -from pyphant.core.XMLHandler import getXMLRoot from pyphant.quantities import Quantity from pyphant.core.DataContainer import (FieldContainer, SampleContainer) import scipy import Image from pyphant.core.KnowledgeManager import KnowledgeManager import os +import re kmanager = KnowledgeManager.getInstance() class ZStack(object): - def __init__(self, sc_id=None, name=None, xml_file=None, temporary=False): - """Initializes a ZStack from an existing id or a local source""" - assert (sc_id is None) is not (xml_file is None) + def __init__(self, sc_id=None, meta=None, temporary=False): + """Initializes a ZStack from an existing id or metadata""" + assert (sc_id is None) is not (meta is None) self.temporary = temporary - self._recipe_path = None if sc_id is not None: self.repr_sc = kmanager.getDataContainer(sc_id) else: - assert name is not None - self.repr_sc = self._import_zstack(name, - os.path.realpath(xml_file)) + self.repr_sc = self._import_zstack(meta) @staticmethod - def _get_images_meta(xml_file): - def getFloat(xmlelement): - return float(xmlelement.content.strip().replace(',', '.')) - - def getMum(xmlelement): - return Quantity(getFloat(xmlelement), 'mum') - - base_path = os.path.dirname(xml_file) - xml_root = getXMLRoot(xml_file) - images_meta = [] - for ztag in [value for key, value in xml_root.children.iteritems()\ - if key.startswith('z')]: - meta = {} - fname = xml_root['Tags']['V5'].content.strip() - root, ext = os.path.splitext(fname) - fname = "%s_%s%s" % (root, ztag.name, ext) - meta['img_filename'] = os.path.join(base_path, fname) - meta['zvi_filename'] = os.path.join( - base_path, xml_root['Tags']['V150'].content.strip()) - meta['xml_filename'] = xml_file - meta['zid'] = ztag.name - ztag = ztag['Tags'] - meta['timestamp'] = ztag['V44'].content.strip() - meta['width'] = int(ztag['V3'].content.strip()) - meta['height'] = int(ztag['V4'].content.strip()) - meta['x-pos'] = getMum(ztag['V15']) - meta['y-pos'] = getMum(ztag['V16']) - meta['z-pos'] = getMum(ztag['V93']) - meta['pixel_width'] = getMum(xml_root['Scaling']['Factor_0']) - meta['pixel_height'] = getMum(xml_root['Scaling']['Factor_1']) - images_meta.append(meta) - images_meta.sort(key = lambda x: x['z-pos'].value) - return images_meta - - @staticmethod def _get_image_fcs(images_meta, temporary=False): zvalues = [] emd5s = [] @@ -111,47 +73,43 @@ count = 1 for img_meta in images_meta: if pdial is not None: - pdial.Update(count, os.path.basename(img_meta['img_filename'])) + pdial.Update(count, os.path.basename(img_meta['imgFilename'])) count += 1 - files.append(img_meta['xml_filename']) - img = Image.open(img_meta['img_filename']) + files.append(img_meta['xmlFilename']) + img = Image.open(img_meta['imgFilename']) data = scipy.misc.fromimage(img, flatten=True) zvalue = img_meta['z-pos'] - ydata = scipy.arange(img_meta['height']) \ - * img_meta['pixel_height'].inUnitsOf('mum').value \ - + img_meta['y-pos'].inUnitsOf('mum').value - xdata = scipy.arange(img_meta['width']) \ - * img_meta['pixel_width'].inUnitsOf('mum').value \ - + img_meta['x-pos'].inUnitsOf('mum').value + yunit = Quantity(1.0, img_meta['height'].unit) + xunit = Quantity(1.0, img_meta['width'].unit) + ydata = scipy.arange(img_meta['height[pixel]']) \ + * img_meta['y-factor'].inUnitsOf(yunit.unit).value \ + + img_meta['y-pos'].inUnitsOf(yunit.unit).value + xdata = scipy.arange(img_meta['width[pixel]']) \ + * img_meta['x-factor'].inUnitsOf(xunit.unit).value \ + + img_meta['x-pos'].inUnitsOf(xunit.unit).value dimensions = [FieldContainer(ydata, - unit=Quantity(1.0, 'mum'), + unit=yunit, longname=u'y-axis', shortname=u'y'), FieldContainer(xdata, - unit=Quantity(1.0, 'mum'), + unit=xunit, longname=u'x-axis', shortname=u'x')] - fcattr = {'img_filename':img_meta['img_filename'], - 'xml_filename':img_meta['xml_filename'], - 'zvi_filename':img_meta['zvi_filename'], - 'zvalue':zvalue, - 'timestamp':img_meta['timestamp'], - 'zid':img_meta['zid'], - 'ZStackType':'RawImage', - 'vmin':0, 'vmax':255} + fcattr = {'vmin':0, 'vmax':255} + fcattr.update(img_meta) img_fc = FieldContainer(data=data, longname=os.path.basename( - img_meta['img_filename']), + img_meta['imgFilename']), shortname="i", dimensions=dimensions, attributes=fcattr) img_fc.seal() kmanager.registerDataContainer(img_fc, temporary=temporary) emd5s.append(img_fc.id) - zvalues.append(zvalue.inUnitsOf('mum').value) + zvalues.append(zvalue.value) if len(zvalues) == 0: return None, None, None zfc = FieldContainer(scipy.array(zvalues), longname='z-value', - shortname='z', unit=Quantity(1.0, 'mum')) + shortname='z', unit=Quantity(1.0, zvalue.unit)) filefc = FieldContainer(scipy.array(files), longname='filename', shortname='f') emd5fc = FieldContainer(scipy.array(emd5s), longname='emd5', @@ -160,26 +118,16 @@ pdial.Destroy() return zfc, filefc, emd5fc - @staticmethod - def _estimate_ztol(zfc): - zmums = [(float(zvalue) * zfc.unit).inUnitsOf('mum').value \ - for zvalue in zfc.data] - zmums.sort() - diffs = [] - for index in xrange(len(zmums) - 1): - diffs.append(zmums[index + 1] - zmums[index]) - return Quantity(2.0 * sum(diffs) / float(len(diffs)), 'mum') - - def _import_zstack(self, name, xml_file): - images_meta = ZStack._get_images_meta(xml_file) - zfc, filefc, emd5fc = ZStack._get_image_fcs(images_meta, self.temporary) + def _import_zstack(self, meta): + zfc, filefc, emd5fc = ZStack._get_image_fcs(meta, self.temporary) if zfc == None: return None attributes = {} - attributes['ztol'] = ZStack._estimate_ztol(zfc) attributes['ZStackType'] = 'RawSC' + attributes['xmlFilename'] = meta[0]['xmlFilename'] + attributes['crystal'] = meta[0]['crystal'] ssc = SampleContainer([zfc, filefc, emd5fc], - name, + meta[0]['ZStackName'], "z", attributes) ssc.seal() @@ -188,9 +136,10 @@ class ZStackManager(object): - def addZStack(self, zstack): - """Adds a given zstack to the pool""" - kmanager.registerDataContainer(zstack.repr_sc) + def importZStack(self, xmlFName, name, crystal, temporary=False): + metaReader = getMetaReader(xmlFName, name, crystal) + meta = metaReader.getMeta() + return ZStack(meta=meta, temporary=temporary) def getZStacks(self): """Returns a list of all ZStacks in the pool""" @@ -208,3 +157,141 @@ raise ValueError("There is no ZStack called %s!" \ % name) return ZStack(sc_id=sresult[0][0]) + + +class MetaReader(object): + def __init__(self, xmlFName, name, crystal): + self.xmlFName = xmlFName + from pyphant.core.XMLHandler import getXMLRoot + self.xmlRoot = getXMLRoot(xmlFName) + self.zStackName = name + self.crystal = crystal + + def getMeta(self): + getStr = lambda x: x.content.strip() + def getTag(tag, tagstr): + for subtag in tagstr.split(':'): + tag = tag[subtag] + return tag + common_meta = {} + for key, tagstr in self.commonTagDict.iteritems(): + common_meta[key] = getStr(getTag(self.xmlRoot, tagstr)) + common_meta['xmlFilename'] = self.xmlFName + images_meta = [] + for ztag in [value for key, value in self.xmlRoot.children.iteritems()\ + if self.tagRe.match(key) is not None]: + meta = common_meta.copy() + for key, tagstr in self.imageTagDict.iteritems(): + meta[key] = getStr(getTag(ztag, tagstr)) + meta['zid'] = self.getZId(ztag.name) + meta['pid'] = self.getPId(ztag.name) + meta['imgFilename'] = self.getImgFName(ztag.name) + meta['ZStackName'] = self.zStackName + meta['crystal'] = self.crystal + images_meta.append(meta) + self.validateMeta(images_meta) + images_meta.sort(key = lambda x: x['z-pos'].value) + return images_meta + + +class ZStackMetaReader(MetaReader): + commonTagDict = {'scalingfactor 0':'Scaling:Factor_0', + 'scalingfactor 1':'Scaling:Factor_1', + 'SF type 0':'Scaling:Type_0', + 'SF type 1':'Scaling:Type_1', + 'width[pixel]':'Tags:V25', + 'height[pixel]':'Tags:V26', + 'width':'Tags:V30', + 'height':'Tags:V33', + 'width type':'Tags:V28', + 'height type':'Tags:V31', + 'x-factor':'Tags:V29', + 'y-factor':'Tags:V32', + 'x-pos':'Tags:V48', + 'y-pos':'Tags:V49', + 'objective':'Tags:V101'} + imageTagDict = {'timestamp':'Tags:V44', + 'z-pos':'Tags:V93'} + tagRe = re.compile(r'^z[0-9]+$') + + def getImgFName(self, ztagname): + fname = self.xmlRoot['Tags']['V5'].content.strip() + root, ext = os.path.splitext(fname) + fname = "%s_%s%s" % (root, ztagname, ext) + return os.path.join(os.path.dirname(self.xmlFName), fname) + + def getZId(self, ztagname): + return int(ztagname[1:]) + + def getPId(self, ztagname): + return 0 + + def validateMeta(self, meta): + getFloat = lambda x: float(x.replace(',', '.')) + getMum = lambda x: Quantity(getFloat(x), 'mum') + mumErr = 'Expected micrometre but got different unit!' + for img_meta in meta: + assert img_meta.pop('SF type 0') == '76', mumErr + assert img_meta.pop('SF type 1') == '76', mumErr + assert img_meta.pop('width type') == '76', mumErr + assert img_meta.pop('height type') == '76', mumErr + assert getFloat(img_meta.pop('scalingfactor 0')) \ + == getFloat(img_meta['x-factor']) + assert getFloat(img_meta.pop('scalingfactor 1')) \ + == getFloat(img_meta['y-factor']) + for key in ['width', 'height', 'x-factor', 'y-factor', 'x-pos', + 'y-pos', 'z-pos']: + img_meta[key] = getMum(img_meta[key]) + for key in ['width[pixel]', 'height[pixel]']: + img_meta[key] = int(img_meta[key]) + assert img_meta['width[pixel]'] == int(round(img_meta['width'] /\ + img_meta['x-factor'])), "x scaling is void" + assert img_meta['height[pixel]'] == int(round(img_meta['height'] /\ + img_meta['y-factor'])), "y scaling is void" + + +class SingleMetaReader(ZStackMetaReader): + commonTagDict = {'scalingfactor 0':'Scaling:Factor_0', + 'scalingfactor 1':'Scaling:Factor_1', + 'SF type 0':'Scaling:Type_0', + 'SF type 1':'Scaling:Type_1', + 'width[pixel]':'Tags:V11', + 'height[pixel]':'Tags:V12', + 'width':'Tags:V16', + 'height':'Tags:V19', + 'width type':'Tags:V14', + 'height type':'Tags:V17', + 'x-factor':'Tags:V15', + 'y-factor':'Tags:V18', + 'x-pos':'Tags:V41', + 'y-pos':'Tags:V42', + 'objective':'Tags:V93', + 'timestamp':'Tags:V50', + 'z-pos':'Tags:V99'} + imageTagDict = {} + tagRe = re.compile(r'^_single$') + + def getZId(self, ztagname): + return 0 + + def getImgFName(self, ztagname): + fname = self.xmlRoot['Tags']['V5'].content.strip() + return os.path.join(os.path.dirname(self.xmlFName), fname) + +META_READERS = [ZStackMetaReader, SingleMetaReader] + +def getMetaReader(xml, name, crystal): + from pyphant.core.XMLHandler import getXMLRoot + root = getXMLRoot(xml) + matched = False + for key in root.children.iterkeys(): + for mreader in META_READERS: + if mreader.tagRe.match(key) is not None: + matched = True + break + if matched: + break + if matched: + return mreader(xml, name, crystal) + else: + raise ValueError("Unknown file format in file: %s" % xml) Modified: trunk/src/pyphant/pyphant/tests/TestZStacks.py =================================================================== --- trunk/src/pyphant/pyphant/tests/TestZStacks.py 2010-07-08 13:13:29 UTC (rev 694) +++ trunk/src/pyphant/pyphant/tests/TestZStacks.py 2010-07-12 20:43:11 UTC (rev 695) @@ -60,12 +60,12 @@ import os from pyphant.core import KnowledgeManager from pyphant import __path__ as ppath - from pyphant.core.ZStackManager import ZStack + from pyphant.core.ZStackManager import ZStackManager print "Importing ZStack..." - zstack = ZStack(name="TestCase_ZStack", - xml_file=os.path.join(ppath[0], "tests", "resources", + zstack = ZStackManager().importZStack(name="TestCase_ZStack", + xmlFName=os.path.join(ppath[0], "tests", "resources", "zstack", "_meta.xml"), - temporary=True) + temporary=True, crystal='TestCrystal') print "Done." print "Calculating ZStack-statistics..." from ImageProcessing.AutoFocus import AutoFocus @@ -84,7 +84,25 @@ self.check((300.0, 0.0), statistics['z-pos'].data[imin]) self.check((7.0, 1.0), statistics['diameter'].data[imin]) + def testSingle(self): + import os + from pyphant.core import KnowledgeManager + from pyphant import __path__ as ppath + from pyphant.core.ZStackManager import ZStackManager + print "Importing single image..." + zstack = ZStackManager().importZStack(name="TestCase_Single", + xmlFName=os.path.join(ppath[0], "tests", "resources", + "zstack", "single_meta.xml"), + temporary=True, crystal='TestCrystal2') + print "Done." + print "Calculating single image statistics..." + from ImageProcessing.AutoFocus import AutoFocus + afw = AutoFocus() + statistics = afw.get_statistics_sc(zstack.repr_sc) + print "Done." + assert len(statistics['diameter'].data) == 2 + if __name__ == "__main__": import sys if len(sys.argv) == 1: Modified: trunk/src/pyphant/pyphant/tests/resources/zstack/_meta.xml =================================================================== --- trunk/src/pyphant/pyphant/tests/resources/zstack/_meta.xml 2010-07-08 13:13:29 UTC (rev 694) +++ trunk/src/pyphant/pyphant/tests/resources/zstack/_meta.xml 2010-07-12 20:43:11 UTC (rev 695) @@ -2,11 +2,23 @@ <ROOT> <Tags> <V5>TestZStack.tif</V5> - <V150></V150> + <V25>400</V25> + <V26>400</V26> + <V29>1,0</V29> + <V30>400,0</V30> + <V28>76</V28> + <V32>1,0</V32> + <V33>400,0</V33> + <V31>76</V31> + <V48>0,0</V48> + <V49>0,0</V49> + <V101>TestObjective</V101> </Tags> <Scaling> <Factor_0>1,00</Factor_0> <Factor_1>1,00</Factor_1> + <Type_0>76</Type_0> + <Type_1>76</Type_1> </Scaling> <z00> <Tags> Added: trunk/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml =================================================================== --- trunk/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml (rev 0) +++ trunk/src/pyphant/pyphant/tests/resources/zstack/single_meta.xml 2010-07-12 20:43:11 UTC (rev 695) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8" ?> +<ROOT> + <Tags> + <V5>TestZStack_z04.tif</V5> + <V11>400</V11> + <V12>400</V12> + <V15>1,0</V15> + <V16>400,0</V16> + <V14>76</V14> + <V18>1,0</V18> + <V19>400,0</V19> + <V17>76</V17> + <V41>0,0</V41> + <V42>0,0</V42> + <V93>TestObjective</V93> + <V50>12.07.2010 09:40:00</V50> + <V99>0,0</V99> + </Tags> + <Scaling> + <Factor_0>1,00</Factor_0> + <Factor_1>1,00</Factor_1> + <Type_0>76</Type_0> + <Type_1>76</Type_1> + </Scaling> + <_single> + <Tags> + </Tags> + </_single> +</ROOT> Modified: trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py =================================================================== --- trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2010-07-08 13:13:29 UTC (rev 694) +++ trunk/src/pyphant/pyphant/wxgui2/wxPyphantApplication.py 2010-07-12 20:43:11 UTC (rev 695) @@ -480,7 +480,7 @@ defaultFile="", wildcard=wc, style=wx.OPEN) if dlg.ShowModal() == wx.ID_OK: filename = os.path.realpath(dlg.GetPath()) - from pyphant.core.ZStackManager import (ZStack, ZStackManager) + from pyphant.core.ZStackManager import ZStackManager tedlg = wx.TextEntryDialog(self, "Enter name for ZStack:", "", "ZStack") if tedlg.ShowModal() == wx.ID_OK: @@ -491,10 +491,15 @@ cpt2 = "Error" msg2 = "ZStack %s already exists!" % name except ValueError: - zstack = ZStack(name=name, xml_file=filename) - zsm.addZStack(zstack) - cpt2 = "Info" - msg2 = "Successfully imported ZStack." + tedlg2 = wx.TextEntryDialog(self, "Enter crystal name:", + "", "Crystal01") + if tedlg2.ShowModal() == wx.ID_OK: + crystal = tedlg2.GetValue() + zsm.importZStack(name=name, xmlFName=filename, + crystal=crystal) + cpt2 = "Info" + msg2 = "Successfully imported ZStack." + tedlg2.Destroy() dlg2 = wx.MessageDialog(self, msg2, cpt2, wx.OK) dlg2.ShowModal() dlg2.Destroy() Modified: trunk/src/workers/ImageProcessing/ImageProcessing/MarkAF.py =================================================================== --- trunk/src/workers/ImageProcessing/ImageProcessing/MarkAF.py 2010-07-08 13:13:29 UTC (rev 694) +++ trunk/src/workers/ImageProcessing/ImageProcessing/MarkAF.py 2010-07-12 20:43:11 UTC (rev 695) @@ -106,7 +106,7 @@ output_img = deepcopy(image) if vmin is not None: output_img.attributes.update({'vmin':vmin, 'vmax':vmax}) - mf_z = int(image.attributes['zid'][-2:]) + mf_z = image.attributes['zid'] slicess = [(slice(yt, yp), slice(xt, xp)) \ for yt, yp, xt, xp, z in zip( statistics['yt'].data, statistics['yp'].data, @@ -125,7 +125,7 @@ output_img = deepcopy(image) output_img.data = numpy.zeros(image.data.shape, dtype=image.data.dtype) - mf_z = int(image.attributes['zid'][-2:]) + mf_z = image.attributes['zid'] labelslicess = [(label, (slice(yt, yp), slice(xt, xp))) \ for label, yt, yp, xt, xp, z in zip( statistics['label'].data, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zk...@us...> - 2010-07-08 13:13:35
|
Revision: 694 http://pyphant.svn.sourceforge.net/pyphant/?rev=694&view=rev Author: zklaus Date: 2010-07-08 13:13:29 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Fix: Fixes problem in ParseQuantities. Modified Paths: -------------- trunk/src/pyphant/pyphant/quantities/ParseQuantities.py Modified: trunk/src/pyphant/pyphant/quantities/ParseQuantities.py =================================================================== --- trunk/src/pyphant/pyphant/quantities/ParseQuantities.py 2010-07-07 10:24:27 UTC (rev 693) +++ trunk/src/pyphant/pyphant/quantities/ParseQuantities.py 2010-07-08 13:13:29 UTC (rev 694) @@ -66,7 +66,6 @@ if FMFversion not in ['1.0','1.1']: raise ValueError, 'FMFversion %s not supported.' % FMFversion else: - unit = unit.replace('^', '**') try: unit = unit.replace('^', '**') if FMFversion=='1.1': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |