예제 #1
0
    'extrap': False,
    'arrays': False,
    }
    #surface.doit(bounds, stop, step=step)
   #'multiquadric','inverse','gaussian','linear','cubic','quintic','thin_plate'

    # impose data filter (so X >= 0 and Y >= 0) 
    from mystic.filters import generate_mask, generate_filter
    from mystic.constraints import impose_bounds
    _bounds = impose_bounds((0.0, None))(lambda x:x)
    filter = generate_filter(generate_mask(_bounds, _bounds))
    # from numpy import round as _round
    #############

    # get trajectories
    surface.Sample(bounds, stop, all=all, filter=filter)#, constraints=_round)
    print("TOOK: %s" % (time.time() - start))
#   exit()
    # get interpolated function
    surface.Interpolate(**args)
    # check extrema  #XXX: put _min,_max in Interpolate? (downsampled)
    f = lambda x,z: (z,surface.surrogate(*x))
    print("min: {}; min@f: {}".format(*f(*surface._min())))
    print("max: {}; max@f: {}".format(*f(*surface._max())))

#   print("TOOK: %s" % (time.time() - start))

    # plot interpolated surface
    axes = (0,1)
    vals = () # use remaining minima as the fixed values
    surface.Plot(step=step, scale=scale, shift=shift, density=density, axes=axes, vals=vals)
예제 #2
0
    density = 9
    shift = 0
    scale = 0
    step = 200
    args = {
        #'smooth': 0,
        'method': 'thin_plate',
        'extrap': False,
        'arrays': False,
    }
    #surface.doit(bounds, stop, step=step)
    #'multiquadric','inverse','gaussian','linear','cubic','quintic','thin_plate'
    #############

    # get trajectories
    surface.Sample(bounds, stop, all=all)
    print("TOOK: %s" % (time.time() - start))
    #   exit()
    # get interpolated function
    surface.Interpolate(**args)
    # check extrema  #XXX: put _min,_max in Interpolate? (downsampled)
    f = lambda x, z: (z, surface.surrogate(*x))
    print("min: {}; min@f: {}".format(*f(*surface._min())))
    print("max: {}; max@f: {}".format(*f(*surface._max())))

    #   print("TOOK: %s" % (time.time() - start))

    # plot surface
    axes = (0, 1)
    vals = ()  # use remaining minima as the fixed values
    surface.Plot(step=step,