Load (resampled) array of window ji_win and apply custom function on it.
178107
def _process_window(self, ji_win, func, **kwargs):
        
        arr = self.get_arrays(ji_win)
        result = func(arr, **kwargs)
        return result
851665
def _load_variable(func, program_id, index):
    """"""
    n = 64  # max name length TODO: read from card
    bufsize = GLsizei(n)
    length = pointer(GLsizei(0))
    size = pointer(GLint(0))
    type = pointer(GLenum(0))
    uname = create_string_buffer(n)
    func(program_id, index, bufsize, length, size, type, uname)
    return size[0], type[0], uname.value.decode('utf8')
1005362
def _load_general(data, targets):
    """"""
    for d_src, d_targets in zip(data, targets):
        if isinstance(d_targets, nd.NDArray):
            d_src.copyto(d_targets)
        else:
            assert d_targets[-1][0].stop == d_src.shape[0], \
                "Batch size miss match. Expected %d, got %d"%( \
                    d_targets[-1][0].stop, d_src.shape[0])
            for slice_idx, d_dst in d_targets:
                d_src[slice_idx].copyto(d_dst)
243691
def load_data(self, filename, ext):
        """"""
        from spyder_kernels.utils.iofuncs import iofunctions
        from spyder_kernels.utils.misc import fix_reference_name

        glbs = self._mglobals()

        load_func = iofunctions.load_funcs[ext]
        data, error_message = load_func(filename)

        if error_message:
            return error_message

        for key in list(data.keys()):
            new_key = fix_reference_name(key, blacklist=list(glbs.keys()))
            if new_key != key:
                data[new_key] = data.pop(key)

        try:
            glbs.update(data)
        except Exception as error:
            return str(error)

        return None
1219878
def running_windows(iterable, size):
    
    fifo = collections.deque(maxlen=size)
    for i in iterable:
        fifo.append(i)
        if len(fifo) == size:
            yield list(fifo)
1230187
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.range.element()

        # TODO: this pipes CUDA arrays through NumPy. Write native operator.
        with writable_array(out) as out_arr:
            finite_diff(x.asarray(), axis=self.axis, dx=self.dx,
                        method=self.method, pad_mode=self.pad_mode,
                        pad_const=self.pad_const, out=out_arr)
        return out
135447
def preprocess_xarray(func):
    
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        args = tuple(a.metpy.unit_array if isinstance(a, xr.DataArray) else a for a in args)
        kwargs = {name: (v.metpy.unit_array if isinstance(v, xr.DataArray) else v)
                  for name, v in kwargs.items()}
        return func(*args, **kwargs)
    return wrapper
522928
def load(self, data, size=None):
        """"""
        self.bind()
        if size is None:
            # ffi's sizeof understands arrays
            size = sizeof(data)
        if size == self.buffer_size:
            # same size - no need to allocate new buffer, just copy
            glBufferSubData(
                self.array_type,
                0,
                size,
                to_raw_pointer(data)
            )
        else:
            # buffer size has changed - need to allocate new buffer in the GPU
            glBufferData(
                self.array_type,
                size,
                to_raw_pointer(data),
                self.draw_type
            )
            self.buffer_size = size
        self.unbind()
848906
def load_files(files):
    """"""

    for py_file in files:
        LOG.debug("exec %s", py_file)
        execfile(py_file, globals(), locals())
807706
function boot(nboot, bootfun) {
  var data = [];
  for (var i = 2; i < arguments.length; ++i) {
    data[i - 2] = arguments[i];
  }
  var sample = [];
  for (var i = 0; i < data.length; ++i) {
    sample[i] = data[i].slice(0);
  }
  var n = data[0].length;
  var res = Array(nboot);
  for (var i = 0; i < nboot; ++i) {
    for (var j = 0; j < n; ++j) {
      var idx = Math.floor(n * Math.random());
      for (var k = 0; k < sample.length; ++k) {
        sample[k][j] = data[k][idx];
      }
    }
    res[i] = bootfun.apply(null, sample);
  }
  return res;
}
636004
function( array, results ) {
		var ret = results || [];

		if ( array != null ) {
			// The window, strings (and functions) also have 'length'
			// The extra typeof function check is to prevent crashes
			// in Safari 2 (See: #3039)
			if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
				push.call( ret, array );
			} else {
				jQuery.merge( ret, array );
			}
		}

		return ret;
	}
29422
function ( resp ) {
	    	if ( resp instanceof Array ) {
	    		var arr = [];
	    		for ( var i = 0; i < resp.length; i++ ) {
	    			arr.push( expandEventToObject( resp[i] ) );
	    		}
	    		return arr;
	    	}
	    	return resp;
	    }
348612
def rolling_window(a, axis, window, center, fill_value):
    
    orig_shape = a.shape
    if axis < 0:
        axis = a.ndim + axis
    depth = {d: 0 for d in range(a.ndim)}
    depth[axis] = int(window / 2)
    # For evenly sized window, we need to crop the first point of each block.
    offset = 1 if window % 2 == 0 else 0

    if depth[axis] > min(a.chunks[axis]):
        raise ValueError(
            "For window size %d, every chunk should be larger than %d, "
            "but the smallest chunk size is %d. Rechunk your array\n"
            "with a larger chunk size or a chunk size that\n"
            "more evenly divides the shape of your array." %
            (window, depth[axis], min(a.chunks[axis])))

    # Although dask.overlap pads values to boundaries of the array,
    # the size of the generated array is smaller than what we want
    # if center == False.
    if center:
        start = int(window / 2)  # 10 -> 5,  9 -> 4
        end = window - 1 - start
    else:
        start, end = window - 1, 0
    pad_size = max(start, end) + offset - depth[axis]
    drop_size = 0
    # pad_size becomes more than 0 when the overlapped array is smaller than
    # needed. In this case, we need to enlarge the original array by padding
    # before overlapping.
    if pad_size > 0:
        if pad_size < depth[axis]:
            # overlapping requires each chunk larger than depth. If pad_size is
            # smaller than the depth, we enlarge this and truncate it later.
            drop_size = depth[axis] - pad_size
            pad_size = depth[axis]
        shape = list(a.shape)
        shape[axis] = pad_size
        chunks = list(a.chunks)
        chunks[axis] = (pad_size, )
        fill_array = da.full(shape, fill_value, dtype=a.dtype, chunks=chunks)
        a = da.concatenate([fill_array, a], axis=axis)

    boundary = {d: fill_value for d in range(a.ndim)}

    # create overlap arrays
    ag = overlap(a, depth=depth, boundary=boundary)

    # apply rolling func
    def func(x, window, axis=-1):
        x = np.asarray(x)
        rolling = nputils._rolling_window(x, window, axis)
        return rolling[(slice(None), ) * axis + (slice(offset, None), )]

    chunks = list(a.chunks)
    chunks.append(window)
    out = ag.map_blocks(func, dtype=a.dtype, new_axis=a.ndim, chunks=chunks,
                        window=window, axis=axis)

    # crop boundary.
    index = (slice(None),) * axis + (slice(drop_size,
                                           drop_size + orig_shape[axis]), )
    return out[index]
1326875
def batchWindows(windows, batchSize):
	
	return np.array_split(np.array(windows), len(windows) // batchSize)
685541
def load_builtins(self):
        """"""
        for raw_name in dir(builtins):
            if not raw_name.startswith('__'):

                if raw_name.startswith('_'):
                    function_name = raw_name[1:]
                else:
                    function_name = raw_name

                builtin_function = Function(function_name, getattr(builtins, raw_name))
                self.memory[function_name] = builtin_function
1198313
def load_sampleset(self, f, name):
        ''''''
        self.encoder_x = np.array(f[name + '_encoder_x'])
        self.decoder_x = np.array(f[name + '_decoder_x'])
        self.decoder_y = np.array(f[name + '_decoder_y'])
1011438
function(bufferOrArray, callback) {
    var self = this,
        ix = this.offset,
        frame = [],
        isArray = Object.prototype.toString.call( bufferOrArray) === '[object Array]';

    self.frameIx = 0;

    while (ix < bufferOrArray.length) {
      var value = isArray ? bufferOrArray[ix] : bufferOrArray['read' + self.sampleType](ix); 

      frame.push(this.map ? this.map[value] : value);

      if (frame.length == this.frameSize || ix+self.wordSize == bufferOrArray.length) finishFrame(frame);

      ix += self.wordSize;
    }

    // Did we not process any frames at all for some reason?
    if (this.frameIx == 0) callback(undefined);

    function finishFrame(frame) {
      if (this.scale) frame = frame.map(function (s, ix) {return s * self.scale[ix];});

      callback(frame, self.frameIx);

      if (ix != bufferOrArray.length - self.wordSize)
      {
          ix -= (self.frameSize - self.frameStep) * self.wordSize;

          self.frameIx++;
          frame.length = 0;
      }
    }
  }