From: Jeff E. <gi...@gi...> - 2010-04-29 01:23:15
|
make i2g work with numpy or numarray numarray is on the way out; ubuntu 10.04 moved it to universe. the future alternative is apparently numpy. this also has the happy side-effect of fixing the longstanding 64-bit incompatibility of i2g http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=f787468 --- src/emc/usr_intf/axis/scripts/image-to-gcode.py | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/emc/usr_intf/axis/scripts/image-to-gcode.py b/src/emc/usr_intf/axis/scripts/image-to-gcode.py index b49736c..08ffb62 100644 --- a/src/emc/usr_intf/axis/scripts/image-to-gcode.py +++ b/src/emc/usr_intf/axis/scripts/image-to-gcode.py @@ -23,8 +23,17 @@ sys.path.insert(0, os.path.join(BASE, "lib", "python")) import gettext; gettext.install("emc2", localedir=os.path.join(BASE, "share", "locale"), unicode=True) -import Image, numarray -import numarray.ieeespecial as ieee +import Image + +try: + import numpy.numarray as numarray + import numpy.core + olderr = numpy.core.seterr(divide='ignore') + plus_inf = (numarray.array((1.,))/0.)[0] + numpy.core.seterr(**olderr) +except ImportError: + import numarray, numarray.ieeespecial + plus_inf = numarray.ieeespecial.inf from rs274.author import Gcode import rs274.options @@ -54,7 +63,7 @@ def make_tool_shape(f, wdia, resp): dia = int(wdia*res+.5) wrad = wdia/2. if dia < 2: dia = 2 - n = numarray.array([[ieee.plus_inf] * dia] * dia, type="Float32") + n = numarray.array([[plus_inf] * dia] * dia, type="Float32") hdia = dia / 2. l = [] for x in range(dia): |