Changeset 6768


Ignore:
Timestamp:
Apr 8, 2009, 1:17:20 PM (15 years ago)
Author:
rwilson
Message:

Removed use of Numeric.Randomarray.

Location:
branches/numpy/anuga
Files:
3 edited

Legend:

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

    r6689 r6768  
    99from warnings import warn
    1010from string import lower
    11 from RandomArray import randint, seed, get_seed
    1211from copy import deepcopy
    1312import copy
     
    1514from Scientific.IO.NetCDF import NetCDFFile
    1615import numpy as num
     16from numpy.random import randint, seed
    1717
    1818from anuga.coordinate_transforms.lat_long_UTM_conversion import UTMtoLL
     
    713713        # plus recalcule seed when no seed provided.
    714714        if seed_num is not None:
    715             seed(seed_num, seed_num)
     715            seed(seed_num)
    716716        else:
    717717            seed()
    718718
    719         if verbose: print "seed:", get_seed()
     719        #if verbose: print "seed:", get_seed()
    720720
    721721        random_num = randint(0, self_size-1, (int(new_size),))
  • branches/numpy/anuga/geospatial_data/test_geospatial_data.py

    r6441 r6768  
    16881688
    16891689            P = G1.get_data_points(absolute=False)
    1690             expected = [[5.0, 4.0], [4.0, 3.0], [4.0, 2.0],
    1691                         [3.0, 1.0], [2.0, 3.0]]
     1690            expected = [[5.,4.], [4.,1.], [2.,4.], [2.,3.], [1.,4.]]
     1691            #            expected = [[5.0, 4.0], [4.0, 3.0], [4.0, 2.0],
     1692                                     #            [3.0, 1.0], [2.0, 3.0]]
    16921693            msg = 'Expected %s, but\nP=%s' % (str(expected), str(P))
    16931694            assert num.allclose(P, expected), msg
    16941695
    16951696            A = G1.get_attributes()
    1696             expected = [24, 18, 17, 11, 8]
     1697            expected = [24, 16, 9, 8, 4]
    16971698            msg = 'expected=%s, but A=%s' % (str(expected), str(A))
    16981699            assert num.allclose(A, expected), msg
     
    17031704        # below is a workaround until randint works on cyclones compute nodes
    17041705        if get_host_name()[8:9] != '0':
    1705             from RandomArray import randint,seed
    1706 
    1707             seed(100,100)
     1706            from numpy.random import randint, seed
     1707
     1708            seed((100, 100))
    17081709            a_points = randint(0, 999999, (10,2))
    17091710            points = a_points.tolist()
     
    17191720
    17201721            P = G1.get_data_points(absolute=False)
    1721             expected = [[982420., 28233.]]
     1722            expected = [[425835., 137518.]]
    17221723            msg = 'expected=%s, but\nP=%s' % (str(expected), str(P))
    17231724            assert num.allclose(P, expected), msg
     
    18141815            os.remove(mesh_filename)
    18151816
    1816             assert(alpha == 0.01)
     1817            msg = 'alpha=%s' % str(alpha)
     1818            # 0.01 was expected with Numeric.RandomArray RNG
     1819            assert alpha==1.0, msg
    18171820
    18181821    def test_find_optimal_smoothing_parameter2(self):
  • branches/numpy/anuga/utilities/test_numerical_tools.py

    r6740 r6768  
    44import unittest
    55import numpy as num
     6from numpy.random import uniform, seed
    67
    78from math import sqrt, pi
     
    298299        from util_ext import gradient as gradient_c
    299300
    300         from RandomArray import uniform, seed
    301         seed(17, 53)
     301        seed((17, 53))
    302302
    303303        x0, x1, x2, y0, y1, y2 = uniform(0.0,3.0,6)
Note: See TracChangeset for help on using the changeset viewer.