Ignore:
Timestamp:
Feb 10, 2009, 11:11:04 AM (16 years ago)
Author:
rwilson
Message:

Initial commit of numpy changes. Still a long way to go.

Location:
branches/numpy
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/alpha_shape/alpha_shape.py

    r6174 r6304  
    2525from anuga.geospatial_data.geospatial_data import Geospatial_data
    2626
    27 import Numeric as num
     27import numpy as num
    2828
    2929
     
    8888                raise PointError, "Three points on a straight line"
    8989       
    90         #Convert input to Numeric arrays
    91         self.points = num.array(points, num.Float)
     90        #Convert input to numeric arrays
     91        self.points = num.array(points, num.float)
    9292
    9393   
     
    288288            zeroind = [k for k in range(len(denom)) if \
    289289                       (denom[k]< EPSILON and  denom[k] > -EPSILON)]
    290         try:
    291             dx = num.divide_safe(y31*dist21 - y21*dist31,denom)
    292             dy = num.divide_safe(x21*dist31 - x31*dist21,denom)
    293         except ZeroDivisionError:
    294             raise  AlphaError
    295            
     290
     291        if num.any(denom == 0.0):
     292            raise AlphaError
     293
     294        dx = num.divide(y31*dist21 - y21*dist31, denom)
     295        dy = num.divide(x21*dist31 - x31*dist21, denom)
     296
    296297        self.triradius = 0.5*num.sqrt(dx*dx + dy*dy)
    297298        #print "triangle radii", self.triradius
  • branches/numpy/anuga/alpha_shape/test_alpha_shape.py

    r6147 r6304  
    55import unittest
    66
    7 import Numeric as num
     7import numpy as num
    88
    99try:
Note: See TracChangeset for help on using the changeset viewer.