Skip to content

Instantly share code, notes, and snippets.

View agoose77's full-sized avatar
🏠
Working from home

Angus Hollands agoose77

🏠
Working from home
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""Namespace related functionality for the xonsh shell.
The following whos routine was forked from the IPython project:
* Copyright (c) 2008-2014, IPython Development Team
* Copyright (C) 2001-2007 Fernando Perez <[email protected]>
* Copyright (c) 2001, Janko Hauser <[email protected]>
* Copyright (c) 2001, Nathaniel Gray <[email protected]>
"""
from xonsh.built_ins import XSH
from xonsh.tools import unthreadable
@njit_at()
def rolling_statistics(y: ak.Array, builder: ak.ArrayBuilder, u: int):
y = np.asarray(y)
result = np.zeros((len(y), 2), dtype=np.float64)
m = len(y)
n = u * 2 + 1
last_var = result[u, 0] = np.var(y[:n])
last_mean = result[u, 1] = np.mean(y[:n])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def pad(array, pad_width, mode="edge", highlevel=True, behavior=None):
if isinstance(pad_width, int):
pad_width = (pad_width,)
if len(pad_width) == 1:
before = after = pad_width[0]
else:
before, after = pad_width
def apply(array):
def pad_regular(array, pad_width, highlevel=True, behavior=None):
# If not regular, could convert to indexedarray and update indices
def apply(array):
array = ak.to_regular(array, highlevel=False)
local_ix = np.pad(np.arange(array.size), pad_width, mode="edge")
ix = np.lib.stride_tricks.as_strided(
local_ix, shape=(len(array), len(local_ix)), strides=(0,) + local_ix.strides
)
return array[ak.from_regular(ix)]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
input data
input range
variable start
variable stop
variable event
output adc uint8
output bin uint8