Ejemplo n.º 1
0
#  param.extend(y_param)
#  return param


if __name__ == '__main__':
  ### conversions ###
  print("building a list of params(w,x,Y)...")
  pts = (2,2,2)
  param1 = [.5,.5,1,2, .25,.75,3,4, .125,.875,5,6, -1,-2,-3,-4,-5,-6,-7,-8]
  print("pts: %s" % str(pts))
  print("params: %s" % param1)
 
  print("\nbuilding a scenario from the params...")
  # [store Y as 'values' OR register(F) for Y=F(X) OR points store y as 'val' ?]
  from mystic.math.discrete import scenario
  pm = scenario()
  pm.load(param1, pts)
  print("pm.wts: %s" % str(pm.wts))
  print("pm.pos: %s" % str(pm.pos))
  W = pm.weights
  X = pm.coords
  Y = pm.values
  print("pm.weights: %s" % str(W))
  print("pm.coords: %s" % str(X))
  print("pm.values: %s" % str(Y))

  print("\nbuilding a dataset from the scenario...")
  # build a dataset (using X,Y)
  # [store W as 'weights' ?]
  from mystic.math.legacydata import dataset
  d = dataset()
Ejemplo n.º 2
0
  # at this point, we should have:
  #steps = [[0,1],[1,2],[2,3],[3,4,5,6,7,8]] or similar
  if flatten:
    from mystic.tools import flatten
    steps = [list(flatten(steps))]

  # plot all the scenario "data"
  from numpy import inf, e
  scale = e**(scale - 1.0)
  for v in range(len(steps)):
    if len(steps[v]) > 1: qp = float(max(steps[v]))
    else: qp = inf
    for s in steps[v]:
      par = eval("[params[q][%s][0] for q in range(len(params))]" % s)
      pm = scenario()
      pm.load(par, npts)
      d = dataset()
      d.load(pm.coords, pm.values)
      # dot color determined by number of simultaneous iterations
      t = str((s/qp)**scale)
      # get and plot dataset coords for selected axes      
      _coords = get_coords(d, xs, cs)
      # check if we are replacing an axis
      if _2D and xs == 0:
        if data: # adjust data so cone axis is last 
          _coords = [list(reversed(pt[:2]))+pt[2:] for pt in _coords]
      elif not _2D and vertical_cones and xs in range(len(bounds)):
        if data: # adjust data so cone axis is last 
          _coords = [swap(pt,xs) for pt in _coords]
      plot_data(a[v], _coords, bounds, color=t, strict=strict)
Ejemplo n.º 3
0
#  param.extend(y_param)
#  return param


if __name__ == '__main__':
  ### conversions ###
  print("building a list of params(w,x,Y)...")
  pts = (2,2,2)
  param1 = [.5,.5,1,2, .25,.75,3,4, .125,.875,5,6, -1,-2,-3,-4,-5,-6,-7,-8]
  print("pts: %s" % str(pts))
  print("params: %s" % param1)
 
  print("\nbuilding a scenario from the params...")
  # [store Y as 'values' OR register(F) for Y=F(X) OR points store y as 'val' ?]
  from mystic.math.discrete import scenario
  pm = scenario()
  pm.load(param1, pts)
  print("pm.wts: %s" % str(pm.wts))
  print("pm.pos: %s" % str(pm.pos))
  W = pm.weights
  X = pm.coords
  Y = pm.values
  print("pm.weights: %s" % str(W))
  print("pm.coords: %s" % str(X))
  print("pm.values: %s" % str(Y))

  print("\nbuilding a dataset from the scenario...")
  # build a dataset (using X,Y)
  # [store W as 'weights' ?]
  from mystic.math.legacydata import dataset
  d = dataset()
Ejemplo n.º 4
0
    # at this point, we should have:
    #steps = [[0,1],[1,2],[2,3],[3,4,5,6,7,8]] or similar
    if flatten:
        from mystic.tools import flatten
        steps = [list(flatten(steps))]

    # plot all the scenario "data"
    from numpy import inf, e
    scale = e**(scale - 1.0)
    for v in range(len(steps)):
        if len(steps[v]) > 1: qp = float(max(steps[v]))
        else: qp = inf
        for s in steps[v]:
            par = eval("[params[q][%s][0] for q in range(len(params))]" % s)
            pm = scenario()
            pm.load(par, npts)
            d = dataset()
            d.load(pm.coords, pm.values)
            # dot color determined by number of simultaneous iterations
            t = str((s / qp)**scale)
            # get and plot dataset coords for selected axes
            _coords = get_coords(d, xs, cs)
            # check if we are replacing an axis
            if _2D and xs == 0:
                if data:  # adjust data so cone axis is last
                    _coords = [
                        list(reversed(pt[:2])) + pt[2:] for pt in _coords
                    ]
            elif not _2D and vertical_cones and xs in range(len(bounds)):
                if data:  # adjust data so cone axis is last