fixed import statements python3 compatibility

PolyLineROI.getArrayRegion correctly applies mask to N-dimensional data
fixed multiprocess for python2.6 compatibility
This commit is contained in:
Luke Campagnola 2013-04-29 08:13:28 -04:00
parent 1a0b5921df
commit e0e1123d33
6 changed files with 15 additions and 8 deletions

View File

@ -1 +1 @@
from __main__ import run from .__main__ import run

View File

@ -1,12 +1,18 @@
import sys, os, subprocess, time import sys, os, subprocess, time
import initExample try:
from . import initExample
except ValueError:
sys.excepthook(*sys.exc_info())
print("examples/ can not be executed as a script; please run 'python -m examples' instead.")
sys.exit(1)
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE
if USE_PYSIDE: if USE_PYSIDE:
from exampleLoaderTemplate_pyside import Ui_Form from .exampleLoaderTemplate_pyside import Ui_Form
else: else:
from exampleLoaderTemplate_pyqt import Ui_Form from .exampleLoaderTemplate_pyqt import Ui_Form
import os, sys import os, sys
from pyqtgraph.pgcollections import OrderedDict from pyqtgraph.pgcollections import OrderedDict

View File

@ -154,7 +154,8 @@ def importModules(path, globals, locals, excludes=()):
try: try:
if len(path) > 0: if len(path) > 0:
modName = path + '.' + modName modName = path + '.' + modName
mod = __import__(modName, globals, locals, fromlist=['*']) #mod = __import__(modName, globals, locals, fromlist=['*'])
mod = __import__(modName, globals, locals, ['*'], 1)
mods[modName] = mod mods[modName] = mod
except: except:
import traceback import traceback

View File

@ -1771,7 +1771,7 @@ class PolyLineROI(ROI):
shape = [1] * data.ndim shape = [1] * data.ndim
shape[axes[0]] = sliced.shape[axes[0]] shape[axes[0]] = sliced.shape[axes[0]]
shape[axes[1]] = sliced.shape[axes[1]] shape[axes[1]] = sliced.shape[axes[1]]
return sliced * mask return sliced * mask.reshape(shape)
class LineSegmentROI(ROI): class LineSegmentROI(ROI):

View File

@ -129,7 +129,7 @@ class Parallelize(object):
self.childs.append(proc) self.childs.append(proc)
## Keep track of the progress of each worker independently. ## Keep track of the progress of each worker independently.
self.progress = {ch.childPid: [] for ch in self.childs} self.progress = dict([(ch.childPid, []) for ch in self.childs])
## for each child process, self.progress[pid] is a list ## for each child process, self.progress[pid] is a list
## of task indexes. The last index is the task currently being ## of task indexes. The last index is the task currently being
## processed; all others are finished. ## processed; all others are finished.

View File

@ -803,7 +803,7 @@ class ObjectProxy(object):
return val return val
def _getProxyOptions(self): def _getProxyOptions(self):
return {k: self._getProxyOption(k) for k in self._proxyOptions} return dict([(k, self._getProxyOption(k)) for k in self._proxyOptions])
def __reduce__(self): def __reduce__(self):
return (unpickleObjectProxy, (self._processId, self._proxyId, self._typeStr, self._attributes)) return (unpickleObjectProxy, (self._processId, self._proxyId, self._typeStr, self._attributes))