# XXX: not sure the best thing to do @simple_block def array(value): """ Converts the value to a Numpy array. """ return np.array(value) @simple_block def list2array(value): """ Converts a list of uniform elements to a Numpy array. """ return np.array(value, dtype=value[0].dtype) register_simple_block(np.mean, "mean", params={"axis": 0}, doc="Wrapper around :np:data:`np.mean`.") register_simple_block(np.square, "square", doc="Wrapper around :np:data:`np.square`.") register_simple_block(np.log, "log", doc="Wrapper around :np:data:`np.log`.") register_simple_block(np.abs, "abs", doc="Wrapper around :np:data:`np.absolute`.") register_simple_block(np.sign, "sign", doc="Wrapper around :np:data:`np.sign`.") register_simple_block(np.arctan, "arctan", doc="Wrapper around :np:data:`np.arctan`.") register_simple_block(np.real, "real", doc="Wrapper around :np:data:`np.real`.") register_simple_block(
def norm2(value): # @ReservedAssignment ''' Returns the norm of the vector. ''' return np.linalg.norm(value) # XXX: not sure the best thing to do @simple_block def array(value): ''' Converts the value to a Numpy array. ''' return np.array(value) @simple_block def list2array(value): """ Converts a list of uniform elements to a Numpy array. """ return np.array(value, dtype=value[0].dtype) register_simple_block(np.mean, 'mean', params={'axis': 0}, doc='Wrapper around :np:data:`np.mean`.') register_simple_block(np.square, 'square', doc='Wrapper around :np:data:`np.square`.') register_simple_block(np.log, 'log', doc='Wrapper around :np:data:`np.log`.') register_simple_block(np.abs, 'abs', doc='Wrapper around :np:data:`np.absolute`.') register_simple_block(np.sign, 'sign', doc='Wrapper around :np:data:`np.sign`.') register_simple_block(np.arctan, 'arctan', doc='Wrapper around :np:data:`np.arctan`.')
from procgraph import register_simple_block from procgraph_images.copied_from_reprep import skim_top_and_bottom def skim(a, percent=5): return skim_top_and_bottom(a, percent) register_simple_block(skim, doc=skim_top_and_bottom.__doc__) #doc='Skims the top and bottom percentile from the data.')
# XXX: not sure the best thing to do @simple_block def array(value): ''' Converts the value to a Numpy array. ''' return np.array(value) @simple_block def list2array(value): """ Converts a list of uniform elements to a Numpy array. """ return np.array(value, dtype=value[0].dtype) register_simple_block(np.mean, 'mean', params={'axis': 0}, doc='Wrapper around :np:data:`np.mean`.') register_simple_block(np.square, 'square', doc='Wrapper around :np:data:`np.square`.') register_simple_block(np.log, 'log', doc='Wrapper around :np:data:`np.log`.') register_simple_block(np.abs, 'abs', doc='Wrapper around :np:data:`np.absolute`.') register_simple_block(np.sign, 'sign', doc='Wrapper around :np:data:`np.sign`.')
from numpy import sign from procgraph import Block, register_simple_block from .utils import my_pickle_load register_simple_block(lambda x: 1.0 / x, 'one_over') def count_less_than_zero(values): ''' Returns the fraction of zero elements in the array. ''' ok = (values <= 0).mean() return ok register_simple_block(count_less_than_zero) class BGDSPredictor(Block): Block.alias('bgds_predictor') Block.config('G', 'Data produced by camera_bgds_boot_display') Block.input('gx', 'Gradient of image along direction x.') Block.input('gy', 'Gradient of image along direction y.') Block.input('y_dot', 'Derivative of y.') Block.input('commands', 'Commands (``[vx,vy,omega]``).') Block.output('y_dot_pred', 'Predicted y_dot') Block.output('error', 'Disagreement between actual and predicted y_dot.') def init(self):