This returns an instance of a new spline_array with all the fixins, and the data from a.
555703
def copy_spline_array(a):
    

    b = spline_array()

    b.x_splines = a.x_splines
    b.y_splines = a.y_splines
    b.max_y_splines = a.max_y_splines
    b.xmin = a.xmin     
    b.xmax = a.xmax
    b.ymin = a.ymin
    b.ymax = a.ymax
    b.xlabel = a.xlabel
    b.ylabel = a.ylabel
    b.zlabel = a.zlabel
    b.simple = a.simple
    

    b.generate_y_values()    

    return b
309935
def create_background_map(data, bsx, bsy):
    """"""
    sx, sy = data.shape
    mx = sx // bsx
    my = sy // bsy
    comp = []
    rms = []
    # Rows
    sp = numpy.split(data, numpy.arange(bsx, sx, bsx), axis=0)
    for s in sp:
        # Columns
        rp = numpy.split(s, numpy.arange(bsy, sy, bsy), axis=1)
        for r in rp:
            b, r = background_estimator(r)
            comp.append(b)
            rms.append(r)

    # Reconstructed image
    z = numpy.array(comp)
    z.shape = (mx, my)
    # median filter
    ndfilter.median_filter(z, size=(3, 3), output=z)

    # Interpolate to the original size
    new = _interpolation(z, sx, sy, mx, my)

    # Interpolate the rms
    z = numpy.array(rms)
    z.shape = (mx, my)
    nrms = _interpolation(z, sx, sy, mx, my)

    return new, nrms
898043
def resample(self, inds):
        
        new = copy.deepcopy(self)
        for arr in self.arrays:
            x = getattr(new, arr)
            setattr(new, arr, x[inds])
        return new
1352684
def spline_interpolate(x1, y1, x2):
    
    sp = Spline(x1, y1)
    return sp(x2)
421265
def new(cls, shapes, start_x, start_y, x_scale, y_scale):
        
        return cls(
            shapes, int(round(start_x)), int(round(start_y)),
            x_scale, y_scale
        )
456599
def _fix_slice(self, inputs, new_attr):
        """"""
        begin = new_attr.get('begin')
        end = new_attr.get('end')
        axes = new_attr.get('axis', tuple(range(len(begin))))
        slice_op = mx.sym.slice_axis(inputs[0], axis=axes[0], begin=begin[0], end=end[0])
        if len(axes) > 1:
            for i, axis in enumerate(axes):
                slice_op = mx.sym.slice_axis(slice_op, axis=axis, begin=begin[i], end=end[i])
        return slice_op
1223691
public static float Spline(float x, int numKnots, float[] knots) {
        int span;
        int numSpans = numKnots - 3;
        float k0, k1, k2, k3;
        float c0, c1, c2, c3;

        if (numSpans < 1)
            throw new IllegalArgumentException("Too few knots in spline");

        x = x > 1 ? 1 : x;
        x = x < 0 ? 0 : x;
        x *= numSpans;
        span = (int) x;
        if (span > numKnots - 4)
            span = numKnots - 4;
        x -= span;

        k0 = knots[span];
        k1 = knots[span + 1];
        k2 = knots[span + 2];
        k3 = knots[span + 3];

        c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3;
        c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3;
        c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3;
        c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3;

        return ((c3 * x + c2) * x + c1) * x + c0;
    }
1214964
def _array_2d_repr(self):
        """"""

        sc_array = np.zeros((self.nmax + 1, 2 * self.mmax + 1),
                            dtype=np.complex128)

        lst = self._reshape_n_vecs()
        sc_array[0:self.nmax + 1, self.mmax] = lst[0]
        for m in xrange(1, self.mmax + 1):
            sc_array[m:self.nmax + 1, self.mmax - m] = lst[2 * m - 1]
            sc_array[m:self.nmax + 1, self.mmax + m] = lst[2 * m]

        return sc_array
1009461
def interp1d(x,Z,xout,spline=False,kind='linear',fill_value=np.NaN,**kwargs):
    

    linear = not spline
    
    
    nx=len(x)
    
    if linear :
        
        try :
            f = scipy.interpolate.interp1d(x, Z, kind=kind,bounds_error=False,fill_value=fill_value,**kwargs)
            Zout = f(xout)
        except RuntimeError : Zout = np.repeat(np.NaN,nx)

    else :
        tck = scipy.interpolate.splrep(x,Z,s=0)
        try : Zout = scipy.interpolate.splev(xout,tck,der=0,**kwargs)
        except RuntimeError : Zout = np.repeat(np.NaN,nx)

    return Zout
99859
private void smoothData() {
        final int SIZE = DATA_LIST.size();
        double y;

        switch (smoothFunction) {
            case CONTINUOUS_AVERAGE:
                // Add first point
                pointList.add(new Point2D.Double(0, ((DATA_LIST.getFirst().getValue() - lo) * (1 / scaleY) + offset)));

                // Add the averaged points
                for (int i = 1; i < SIZE - 1; i++) {
                    //System.out.println((a * dataList.get(i - 1) + b * dataList.get(i) + c * (dataList.get( i + 1))) / (a + b + c));
                    y = continuousAverage(DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue());
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }

                // Add last point
                pointList.add(new Point2D.Double((DATA_LIST.getLast().getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((DATA_LIST.getLast().getValue() - lo) * (1 / scaleY) + offset)));
                break;

            case CUBIC_SPLINE:
                for (int i = 2; i < SIZE - 1; i++) {
                    y = cubicInterpolate(DATA_LIST.get(i - 2).getValue(), DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;

            case HERMITE:
                for (int i = 2; i < SIZE - 1; i++) {
                    y = hermiteInterpolate(DATA_LIST.get(i - 2).getValue(), DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i - 0).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5, 0, 0);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;

            case COSINUS:

            default:
                for (int i = 0; i < SIZE - 1; i++) {
                    y = cosInterpolate(DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;
        }
    }
957053
function clone(a) {
    var out = new Float32Array(3)
    out[0] = a[0]
    out[1] = a[1]
    out[2] = a[2]
    return out
}
165172
def _pys2shape(self, line):
        """"""

        self.code_array.shape = self._get_key(*self._split_tidy(line))
710357
def corrArray(self, inputArray):
        
        outputArray = numpy.vstack([numpy.nan_to_num(currSpline(inputArray))
                                    for currSpline in self.splines
                                    ]).mean(axis=0)
        return outputArray
1337236
def maybe_wrap_array(original, new_array):
    
    # in case func lost array's metadata
    if isinstance(new_array, np.ndarray) and new_array.shape == original.shape:
        return original.__array_wrap__(new_array)
    else:
        return new_array
1036110
def array(self):
        
        return np.geomspace(self.start, self.stop, self.num, self.endpoint)
1249526
def array(shape, dtype=_np.float64, autolock=False):
    """"""
    assert _NP_AVAILABLE, "To use the shared array object, numpy must be available!"
    if not isinstance(dtype, _np.dtype):
        dtype = _np.dtype(dtype)
    # Not bothering to translate the numpy dtypes to ctype types directly,
    # because they're only partially supported. Instead, create a byte ctypes
    # array of the right size and use a view of the appropriate datatype.
    shared_arr = _multiprocessing.Array(
        "b", int(_np.prod(shape) * dtype.alignment), lock=autolock
    )
    with _warnings.catch_warnings():
        # For more information on why this is necessary, see
        # https://www.reddit.com/r/Python/comments/j3qjb/parformatlabpool_replacement
        _warnings.simplefilter("ignore", RuntimeWarning)
        data = _np.ctypeslib.as_array(shared_arr).view(dtype).reshape(shape)
    return data
615069
def new_batch(self):
        
        i = next(self.slicer)
        return self.X_all[i], self.Y_all[i]