code: def to_json(self, path, points=50, meta=None):
          
          pointspace = self.pointspace(num=points)
          fit_points = numpy.dstack(pointspace['fit'])[0]
          data_points = numpy.dstack(pointspace['data'])[0]
  
          fit = [ [ point[0],  point[1] ] for point in fit_points ]
          data = [ [ point[0],  point[1] ] for point in data_points ]
  
          obj = {'data': data, 'fit': fit}
          if meta: obj['meta'] = meta
  
          f = open(path, 'w')
          json.dump(obj, f)
          f.close
docs: Write the results of the fit to a json file at `path`.
  
          `points` will define the length of the `fit` array.
  
          If `meta` is given, a `meta` key be added with the given value.
  
          The json object has the form
  
              #!text
              {
                  'data': [ [x1, y1], [x2, y2], ... ],
                  'fit': [ [x1, y1], [x2, y2], ... ],
                  'meta': meta
              }