Changeset 4838


Ignore:
Timestamp:
Nov 21, 2007, 9:40:40 AM (16 years ago)
Author:
steve
Message:

Changed exception in fit_interpolation from ToFewPointsError? to
TooFewPointsError?

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/documentation/user_manual/demos/cairns/runcairns.py

    r4809 r4838  
    9595# Setup computational domain
    9696#------------------------------------------------------------------------------
    97 
    98 domain = Domain(meshname, use_cache=True, verbose=True)
     97from anuga.abstract_2d_finite_volumes.pmesh2domain import pmesh_to_domain_instance
     98from anuga.caching import cache
     99
     100##domain = cache(Domain(meshname, use_cache=True, verbose=True)
     101
     102domain = cache(pmesh_to_domain_instance,
     103               (meshname, Domain),
     104               dependencies = [meshname])
    99105
    100106print 'Number of triangles = ', len(domain)
     
    112118
    113119
     120
     121domain.points_file_block_line_size = 50000
    114122
    115123#------------------------------------------------------------------------------
  • anuga_core/source/anuga/fit_interpolate/fit.py

    r4822 r4838  
    4141
    4242import exceptions
    43 class ToFewPointsError(exceptions.Exception): pass
     43class TooFewPointsError(exceptions.Exception): pass
    4444class VertsWithNoTrianglesError(exceptions.Exception): pass
    4545
     
    213213            self.D[v0,v2] += e20
    214214
    215 
    216215    def get_D(self):
    217216        return self.D.todense()
     217
    218218
    219219
     
    324324         
    325325        """
     326
    326327        # use blocking to load in the point info
    327328        if type(point_coordinates_or_filename) == types.StringType:
     
    350351                   
    351352                # Build the array
     353
    352354                points = geo_block.get_data_points(absolute=True)
    353355                z = geo_block.get_attributes(attribute_name=attribute_name)
    354                 self.build_fit_subset(points, z)
     356                self.build_fit_subset(points, z, verbose=verbose)
    355357
    356358               
     
    379381            msg += 'Alternatively, set smoothing parameter alpha to a small '
    380382            msg += 'positive value,\ne.g. 1.0e-3.'
    381             raise ToFewPointsError(msg)
     383            raise TooFewPointsError(msg)
    382384
    383385        self._build_coefficient_matrix_B(verbose)
     
    545547    # Caching happens at the higher level anyway.
    546548   
     549
    547550    if mesh is None:
    548551        # FIXME(DSG): Throw errors if triangles or vertex_coordinates
  • anuga_core/source/anuga/fit_interpolate/test_fit.py

    r4779 r4838  
    549549        try:
    550550            f = interp.fit(data_points,z)
    551         except ToFewPointsError:
     551        except TooFewPointsError:
    552552            pass
    553553
  • anuga_validation/convergence_study/animatesww2d_alt.py

    r4715 r4838  
    104104    max_stage = max(max(max_stages))
    105105    stage_axis = [0, max_x, min_stage-1, max_stage+1]
    106     from pylab import plot, xlabel, ylabel, savefig, close, hold, axis, title
     106    from pylab import plot, xlabel, ylabel, savefig, close, hold, axis, title,show
    107107    hold(False)
    108108    figs = []
     
    110110    #max_vec = zeros(100, Float)
    111111
    112     if sys.platform == 'win32':
     112    #if sys.platform == 'win32':
     113    try:
    113114        for i in range(0,n,20):
    114115            #max_vec[i] = max(stage[i,:])
     
    121122            title(name)
    122123            figs.append(name)
     124            show()
     125    except:
     126        pass
     127   
    123128
    124129    close('all')
  • anuga_validation/convergence_study/convergence_structured.py

    r4722 r4838  
    2323# Setup computational domain
    2424#------------------------------------------------------------------------------
    25 dx = 200.
     25dx = 100.
    2626dy = dx
    2727L = 100000.
    28 W = 3000.
     28W = dx
    2929
    3030# structured mesh
     
    3535#points, vertices, boundary = rectangular_cross(1000, 100, 20, 3) # Basic mesh
    3636domain = Domain(points, vertices, boundary)
    37 domain.set_timestepping_method('rk2')
    38 domain.set_default_order(2)
     37
     38
    3939## # unstructured mesh
    4040## poly_domain = [[0,-W],[0,W],[L,W],[L,-W]]
     
    5050## # Create domain
    5151## domain = Domain(meshname, use_cache=True, verbose = True)
    52 domain.set_name('myexample6')               
     52
     53domain.set_timestepping_method('euler')
     54domain.set_default_order(2)
     55domain.set_name('myexample9')               
    5356domain.set_datadir('.')                     # Use current directory for output
     57
     58domain.beta_w      = 100.0
     59domain.beta_w_dry  = 0.2
     60domain.beta_uh     = 100.0
     61domain.beta_uh_dry = 0.2
     62domain.beta_vh     = 100.0
     63domain.beta_vh_dry = 0.2
     64domain.beta_h      = 100.0
    5465
    5566#------------------------------------------------------------------------------
     
    8394domain.set_boundary({'left': Bw, 'right': Bt, 'top': Br, 'bottom': Br})
    8495
    85 #from anuga.visualiser import RealtimeVisualiser
    86 #vis = RealtimeVisualiser(domain)
    87 #vis.render_quantity_height("elevation", dynamic=False)
    88 #vis.render_quantity_height("stage", dynamic=True)
    89 #vis.colour_height_quantity('stage', (0.0, 0.0, 0.8))
    90 #vis.start()
     96## from anuga.visualiser import RealtimeVisualiser
     97## vis = RealtimeVisualiser(domain)
     98## vis.render_quantity_height("elevation", dynamic=False)
     99## vis.render_quantity_height("stage", dynamic=True, zScale=100.0)
     100## #vis.colour_height_quantity('stage', (0.0, 0.0, 0.8))
     101## vis.colour_height_quantity('stage', (lambda q:q['stage'], -1, 1))
     102## vis.start()
    91103
    92104#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.