repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
SiriDB/siridb-connector
siridb/connector/lib/protocol.py
_SiriDBProtocol.data_received
def data_received(self, data): ''' override asyncio.Protocol ''' self._buffered_data.extend(data) while self._buffered_data: size = len(self._buffered_data) if self._data_package is None: if size < DataPackage.struct_datapackage.size: ...
python
def data_received(self, data): ''' override asyncio.Protocol ''' self._buffered_data.extend(data) while self._buffered_data: size = len(self._buffered_data) if self._data_package is None: if size < DataPackage.struct_datapackage.size: ...
[ "def", "data_received", "(", "self", ",", "data", ")", ":", "self", ".", "_buffered_data", ".", "extend", "(", "data", ")", "while", "self", ".", "_buffered_data", ":", "size", "=", "len", "(", "self", ".", "_buffered_data", ")", "if", "self", ".", "_d...
override asyncio.Protocol
[ "override", "asyncio", ".", "Protocol" ]
dff33c183899c3ee21c3eab6b90cf4668afef1b0
https://github.com/SiriDB/siridb-connector/blob/dff33c183899c3ee21c3eab6b90cf4668afef1b0/siridb/connector/lib/protocol.py#L128-L151
train
SiriDB/siridb-connector
siridb/connector/lib/protocol.py
_SiriDBInfoProtocol.connection_made
def connection_made(self, transport): ''' override _SiriDBProtocol ''' self.transport = transport self.remote_ip, self.port = transport.get_extra_info('peername')[:2] logging.debug( 'Connection made (address: {} port: {})' .format(self.remote_ip,...
python
def connection_made(self, transport): ''' override _SiriDBProtocol ''' self.transport = transport self.remote_ip, self.port = transport.get_extra_info('peername')[:2] logging.debug( 'Connection made (address: {} port: {})' .format(self.remote_ip,...
[ "def", "connection_made", "(", "self", ",", "transport", ")", ":", "self", ".", "transport", "=", "transport", "self", ".", "remote_ip", ",", "self", ".", "port", "=", "transport", ".", "get_extra_info", "(", "'peername'", ")", "[", ":", "2", "]", "loggi...
override _SiriDBProtocol
[ "override", "_SiriDBProtocol" ]
dff33c183899c3ee21c3eab6b90cf4668afef1b0
https://github.com/SiriDB/siridb-connector/blob/dff33c183899c3ee21c3eab6b90cf4668afef1b0/siridb/connector/lib/protocol.py#L234-L249
train
SiriDB/siridb-connector
siridb/connector/lib/connection.py
SiriDBConnection._register_server
def _register_server(self, server, timeout=30): '''Register a new SiriDB Server. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request. ''' result = self._loop.run_until_complete( self._protoc...
python
def _register_server(self, server, timeout=30): '''Register a new SiriDB Server. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request. ''' result = self._loop.run_until_complete( self._protoc...
[ "def", "_register_server", "(", "self", ",", "server", ",", "timeout", "=", "30", ")", ":", "result", "=", "self", ".", "_loop", ".", "run_until_complete", "(", "self", ".", "_protocol", ".", "send_package", "(", "CPROTO_REQ_REGISTER_SERVER", ",", "data", "=...
Register a new SiriDB Server. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request.
[ "Register", "a", "new", "SiriDB", "Server", "." ]
dff33c183899c3ee21c3eab6b90cf4668afef1b0
https://github.com/SiriDB/siridb-connector/blob/dff33c183899c3ee21c3eab6b90cf4668afef1b0/siridb/connector/lib/connection.py#L65-L75
train
SiriDB/siridb-connector
siridb/connector/lib/connection.py
SiriDBConnection._get_file
def _get_file(self, fn, timeout=30): '''Request a SiriDB configuration file. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request. ''' msg = FILE_MAP.get(fn, None) if msg is None: rai...
python
def _get_file(self, fn, timeout=30): '''Request a SiriDB configuration file. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request. ''' msg = FILE_MAP.get(fn, None) if msg is None: rai...
[ "def", "_get_file", "(", "self", ",", "fn", ",", "timeout", "=", "30", ")", ":", "msg", "=", "FILE_MAP", ".", "get", "(", "fn", ",", "None", ")", "if", "msg", "is", "None", ":", "raise", "FileNotFoundError", "(", "'Cannot get file {!r}. Available file '", ...
Request a SiriDB configuration file. This method is used by the SiriDB manage tool and should not be used otherwise. Full access rights are required for this request.
[ "Request", "a", "SiriDB", "configuration", "file", "." ]
dff33c183899c3ee21c3eab6b90cf4668afef1b0
https://github.com/SiriDB/siridb-connector/blob/dff33c183899c3ee21c3eab6b90cf4668afef1b0/siridb/connector/lib/connection.py#L77-L90
train
transitland/mapzen-geohash
mzgeohash/geohash.py
_bits_to_float
def _bits_to_float(bits, lower=-90.0, middle=0.0, upper=90.0): """Convert GeoHash bits to a float.""" for i in bits: if i: lower = middle else: upper = middle middle = (upper + lower) / 2 return middle
python
def _bits_to_float(bits, lower=-90.0, middle=0.0, upper=90.0): """Convert GeoHash bits to a float.""" for i in bits: if i: lower = middle else: upper = middle middle = (upper + lower) / 2 return middle
[ "def", "_bits_to_float", "(", "bits", ",", "lower", "=", "-", "90.0", ",", "middle", "=", "0.0", ",", "upper", "=", "90.0", ")", ":", "for", "i", "in", "bits", ":", "if", "i", ":", "lower", "=", "middle", "else", ":", "upper", "=", "middle", "mid...
Convert GeoHash bits to a float.
[ "Convert", "GeoHash", "bits", "to", "a", "float", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L8-L16
train
transitland/mapzen-geohash
mzgeohash/geohash.py
_float_to_bits
def _float_to_bits(value, lower=-90.0, middle=0.0, upper=90.0, length=15): """Convert a float to a list of GeoHash bits.""" ret = [] for i in range(length): if value >= middle: lower = middle ret.append(1) else: upper = middle ret.append(0) middle = (upper + lower) / 2 return...
python
def _float_to_bits(value, lower=-90.0, middle=0.0, upper=90.0, length=15): """Convert a float to a list of GeoHash bits.""" ret = [] for i in range(length): if value >= middle: lower = middle ret.append(1) else: upper = middle ret.append(0) middle = (upper + lower) / 2 return...
[ "def", "_float_to_bits", "(", "value", ",", "lower", "=", "-", "90.0", ",", "middle", "=", "0.0", ",", "upper", "=", "90.0", ",", "length", "=", "15", ")", ":", "ret", "=", "[", "]", "for", "i", "in", "range", "(", "length", ")", ":", "if", "va...
Convert a float to a list of GeoHash bits.
[ "Convert", "a", "float", "to", "a", "list", "of", "GeoHash", "bits", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L18-L29
train
transitland/mapzen-geohash
mzgeohash/geohash.py
_geohash_to_bits
def _geohash_to_bits(value): """Convert a GeoHash to a list of GeoHash bits.""" b = map(BASE32MAP.get, value) ret = [] for i in b: out = [] for z in range(5): out.append(i & 0b1) i = i >> 1 ret += out[::-1] return ret
python
def _geohash_to_bits(value): """Convert a GeoHash to a list of GeoHash bits.""" b = map(BASE32MAP.get, value) ret = [] for i in b: out = [] for z in range(5): out.append(i & 0b1) i = i >> 1 ret += out[::-1] return ret
[ "def", "_geohash_to_bits", "(", "value", ")", ":", "b", "=", "map", "(", "BASE32MAP", ".", "get", ",", "value", ")", "ret", "=", "[", "]", "for", "i", "in", "b", ":", "out", "=", "[", "]", "for", "z", "in", "range", "(", "5", ")", ":", "out",...
Convert a GeoHash to a list of GeoHash bits.
[ "Convert", "a", "GeoHash", "to", "a", "list", "of", "GeoHash", "bits", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L31-L41
train
transitland/mapzen-geohash
mzgeohash/geohash.py
_bits_to_geohash
def _bits_to_geohash(value): """Convert a list of GeoHash bits to a GeoHash.""" ret = [] # Get 5 bits at a time for i in (value[i:i+5] for i in xrange(0, len(value), 5)): # Convert binary to integer # Note: reverse here, the slice above doesn't work quite right in reverse. total = sum([(bit*2**count...
python
def _bits_to_geohash(value): """Convert a list of GeoHash bits to a GeoHash.""" ret = [] # Get 5 bits at a time for i in (value[i:i+5] for i in xrange(0, len(value), 5)): # Convert binary to integer # Note: reverse here, the slice above doesn't work quite right in reverse. total = sum([(bit*2**count...
[ "def", "_bits_to_geohash", "(", "value", ")", ":", "ret", "=", "[", "]", "# Get 5 bits at a time", "for", "i", "in", "(", "value", "[", "i", ":", "i", "+", "5", "]", "for", "i", "in", "xrange", "(", "0", ",", "len", "(", "value", ")", ",", "5", ...
Convert a list of GeoHash bits to a GeoHash.
[ "Convert", "a", "list", "of", "GeoHash", "bits", "to", "a", "GeoHash", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L43-L53
train
transitland/mapzen-geohash
mzgeohash/geohash.py
decode
def decode(value): """Decode a geohash. Returns a (lon,lat) pair.""" assert value, "Invalid geohash: %s"%value # Get the GeoHash bits bits = _geohash_to_bits(value) # Unzip the GeoHash bits. lon = bits[0::2] lat = bits[1::2] # Convert to lat/lon return ( _bits_to_float(lon, lower=-180.0, upper=180...
python
def decode(value): """Decode a geohash. Returns a (lon,lat) pair.""" assert value, "Invalid geohash: %s"%value # Get the GeoHash bits bits = _geohash_to_bits(value) # Unzip the GeoHash bits. lon = bits[0::2] lat = bits[1::2] # Convert to lat/lon return ( _bits_to_float(lon, lower=-180.0, upper=180...
[ "def", "decode", "(", "value", ")", ":", "assert", "value", ",", "\"Invalid geohash: %s\"", "%", "value", "# Get the GeoHash bits", "bits", "=", "_geohash_to_bits", "(", "value", ")", "# Unzip the GeoHash bits.", "lon", "=", "bits", "[", "0", ":", ":", "2", "]...
Decode a geohash. Returns a (lon,lat) pair.
[ "Decode", "a", "geohash", ".", "Returns", "a", "(", "lon", "lat", ")", "pair", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L56-L68
train
transitland/mapzen-geohash
mzgeohash/geohash.py
encode
def encode(lonlat, length=12): """Encode a (lon,lat) pair to a GeoHash.""" assert len(lonlat) == 2, "Invalid lon/lat: %s"%lonlat # Half the length for each component. length /= 2 lon = _float_to_bits(lonlat[0], lower=-180.0, upper=180.0, length=length*5) lat = _float_to_bits(lonlat[1], lower=-90.0, upper=90...
python
def encode(lonlat, length=12): """Encode a (lon,lat) pair to a GeoHash.""" assert len(lonlat) == 2, "Invalid lon/lat: %s"%lonlat # Half the length for each component. length /= 2 lon = _float_to_bits(lonlat[0], lower=-180.0, upper=180.0, length=length*5) lat = _float_to_bits(lonlat[1], lower=-90.0, upper=90...
[ "def", "encode", "(", "lonlat", ",", "length", "=", "12", ")", ":", "assert", "len", "(", "lonlat", ")", "==", "2", ",", "\"Invalid lon/lat: %s\"", "%", "lonlat", "# Half the length for each component.", "length", "/=", "2", "lon", "=", "_float_to_bits", "(", ...
Encode a (lon,lat) pair to a GeoHash.
[ "Encode", "a", "(", "lon", "lat", ")", "pair", "to", "a", "GeoHash", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L70-L82
train
transitland/mapzen-geohash
mzgeohash/geohash.py
adjacent
def adjacent(geohash, direction): """Return the adjacent geohash for a given direction.""" # Based on an MIT licensed implementation by Chris Veness from: # http://www.movable-type.co.uk/scripts/geohash.html assert direction in 'nsew', "Invalid direction: %s"%direction assert geohash, "Invalid geohash: %s"%...
python
def adjacent(geohash, direction): """Return the adjacent geohash for a given direction.""" # Based on an MIT licensed implementation by Chris Veness from: # http://www.movable-type.co.uk/scripts/geohash.html assert direction in 'nsew', "Invalid direction: %s"%direction assert geohash, "Invalid geohash: %s"%...
[ "def", "adjacent", "(", "geohash", ",", "direction", ")", ":", "# Based on an MIT licensed implementation by Chris Veness from:", "# http://www.movable-type.co.uk/scripts/geohash.html", "assert", "direction", "in", "'nsew'", ",", "\"Invalid direction: %s\"", "%", "direction", "...
Return the adjacent geohash for a given direction.
[ "Return", "the", "adjacent", "geohash", "for", "a", "given", "direction", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L84-L108
train
transitland/mapzen-geohash
mzgeohash/geohash.py
neighbors
def neighbors(geohash): """Return all neighboring geohashes.""" return { 'n': adjacent(geohash, 'n'), 'ne': adjacent(adjacent(geohash, 'n'), 'e'), 'e': adjacent(geohash, 'e'), 'se': adjacent(adjacent(geohash, 's'), 'e'), 's': adjacent(geohash, 's'), 'sw': adjacent(adjacent(geohash, 's'), ...
python
def neighbors(geohash): """Return all neighboring geohashes.""" return { 'n': adjacent(geohash, 'n'), 'ne': adjacent(adjacent(geohash, 'n'), 'e'), 'e': adjacent(geohash, 'e'), 'se': adjacent(adjacent(geohash, 's'), 'e'), 's': adjacent(geohash, 's'), 'sw': adjacent(adjacent(geohash, 's'), ...
[ "def", "neighbors", "(", "geohash", ")", ":", "return", "{", "'n'", ":", "adjacent", "(", "geohash", ",", "'n'", ")", ",", "'ne'", ":", "adjacent", "(", "adjacent", "(", "geohash", ",", "'n'", ")", ",", "'e'", ")", ",", "'e'", ":", "adjacent", "(",...
Return all neighboring geohashes.
[ "Return", "all", "neighboring", "geohashes", "." ]
5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad
https://github.com/transitland/mapzen-geohash/blob/5264d16dc2df00ebc4aedaa78ca8c6ee3fd655ad/mzgeohash/geohash.py#L110-L122
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
thunkify
def thunkify(thread_name=None, daemon=True, default_func=None): '''Make a function immediately return a function of no args which, when called, waits for the result, which will start being processed in another thread. Taken from https://wiki.python.org/moin/PythonDecoratorLibrary. ''' def actual_dec...
python
def thunkify(thread_name=None, daemon=True, default_func=None): '''Make a function immediately return a function of no args which, when called, waits for the result, which will start being processed in another thread. Taken from https://wiki.python.org/moin/PythonDecoratorLibrary. ''' def actual_dec...
[ "def", "thunkify", "(", "thread_name", "=", "None", ",", "daemon", "=", "True", ",", "default_func", "=", "None", ")", ":", "def", "actual_decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "thunked", "(", "*", "arg...
Make a function immediately return a function of no args which, when called, waits for the result, which will start being processed in another thread. Taken from https://wiki.python.org/moin/PythonDecoratorLibrary.
[ "Make", "a", "function", "immediately", "return", "a", "function", "of", "no", "args", "which", "when", "called", "waits", "for", "the", "result", "which", "will", "start", "being", "processed", "in", "another", "thread", ".", "Taken", "from", "https", ":", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L362-L410
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
set_event_when_keyboard_interrupt
def set_event_when_keyboard_interrupt(_lambda): '''Decorator function that sets Threading.Event() when keyboard interrupt (Ctrl+C) was raised Parameters ---------- _lambda : function Lambda function that points to Threading.Event() object Returns ------- wrapper : function Exa...
python
def set_event_when_keyboard_interrupt(_lambda): '''Decorator function that sets Threading.Event() when keyboard interrupt (Ctrl+C) was raised Parameters ---------- _lambda : function Lambda function that points to Threading.Event() object Returns ------- wrapper : function Exa...
[ "def", "set_event_when_keyboard_interrupt", "(", "_lambda", ")", ":", "def", "wrapper", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapped_f", "(", "self", ",", "*", "f_args", ",", "*", "*", "f_kwargs", ")", ":", "try", ":", "f", "(", ...
Decorator function that sets Threading.Event() when keyboard interrupt (Ctrl+C) was raised Parameters ---------- _lambda : function Lambda function that points to Threading.Event() object Returns ------- wrapper : function Examples -------- @set_event_when_keyboard_interru...
[ "Decorator", "function", "that", "sets", "Threading", ".", "Event", "()", "when", "keyboard", "interrupt", "(", "Ctrl", "+", "C", ")", "was", "raised" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L655-L686
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.run_id
def run_id(self): '''Run name without whitespace ''' s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', self.__class__.__name__) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
python
def run_id(self): '''Run name without whitespace ''' s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', self.__class__.__name__) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
[ "def", "run_id", "(", "self", ")", ":", "s1", "=", "re", ".", "sub", "(", "'(.)([A-Z][a-z]+)'", ",", "r'\\1_\\2'", ",", "self", ".", "__class__", ".", "__name__", ")", "return", "re", ".", "sub", "(", "'([a-z0-9])([A-Z])'", ",", "r'\\1_\\2'", ",", "s1", ...
Run name without whitespace
[ "Run", "name", "without", "whitespace" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L83-L87
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.conf
def conf(self): '''Configuration (namedtuple) ''' conf = namedtuple('conf', field_names=self._conf.keys()) return conf(**self._conf)
python
def conf(self): '''Configuration (namedtuple) ''' conf = namedtuple('conf', field_names=self._conf.keys()) return conf(**self._conf)
[ "def", "conf", "(", "self", ")", ":", "conf", "=", "namedtuple", "(", "'conf'", ",", "field_names", "=", "self", ".", "_conf", ".", "keys", "(", ")", ")", "return", "conf", "(", "*", "*", "self", ".", "_conf", ")" ]
Configuration (namedtuple)
[ "Configuration", "(", "namedtuple", ")" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L90-L94
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.run_conf
def run_conf(self): '''Run configuration (namedtuple) ''' run_conf = namedtuple('run_conf', field_names=self._run_conf.keys()) return run_conf(**self._run_conf)
python
def run_conf(self): '''Run configuration (namedtuple) ''' run_conf = namedtuple('run_conf', field_names=self._run_conf.keys()) return run_conf(**self._run_conf)
[ "def", "run_conf", "(", "self", ")", ":", "run_conf", "=", "namedtuple", "(", "'run_conf'", ",", "field_names", "=", "self", ".", "_run_conf", ".", "keys", "(", ")", ")", "return", "run_conf", "(", "*", "*", "self", ".", "_run_conf", ")" ]
Run configuration (namedtuple)
[ "Run", "configuration", "(", "namedtuple", ")" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L97-L101
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.default_run_conf
def default_run_conf(self): '''Default run configuration (namedtuple) ''' default_run_conf = namedtuple('default_run_conf', field_names=self._default_run_conf.keys()) return default_run_conf(**self._default_run_conf)
python
def default_run_conf(self): '''Default run configuration (namedtuple) ''' default_run_conf = namedtuple('default_run_conf', field_names=self._default_run_conf.keys()) return default_run_conf(**self._default_run_conf)
[ "def", "default_run_conf", "(", "self", ")", ":", "default_run_conf", "=", "namedtuple", "(", "'default_run_conf'", ",", "field_names", "=", "self", ".", "_default_run_conf", ".", "keys", "(", ")", ")", "return", "default_run_conf", "(", "*", "*", "self", ".",...
Default run configuration (namedtuple)
[ "Default", "run", "configuration", "(", "namedtuple", ")" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L110-L114
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase._init
def _init(self, run_conf, run_number=None): '''Initialization before a new run. ''' self.stop_run.clear() self.abort_run.clear() self._run_status = run_status.running self._write_run_number(run_number) self._init_run_conf(run_conf)
python
def _init(self, run_conf, run_number=None): '''Initialization before a new run. ''' self.stop_run.clear() self.abort_run.clear() self._run_status = run_status.running self._write_run_number(run_number) self._init_run_conf(run_conf)
[ "def", "_init", "(", "self", ",", "run_conf", ",", "run_number", "=", "None", ")", ":", "self", ".", "stop_run", ".", "clear", "(", ")", "self", ".", "abort_run", ".", "clear", "(", ")", "self", ".", "_run_status", "=", "run_status", ".", "running", ...
Initialization before a new run.
[ "Initialization", "before", "a", "new", "run", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L188-L195
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.connect_cancel
def connect_cancel(self, functions): '''Run given functions when a run is cancelled. ''' self._cancel_functions = [] for func in functions: if isinstance(func, basestring) and hasattr(self, func) and callable(getattr(self, func)): self._cancel_functions.append...
python
def connect_cancel(self, functions): '''Run given functions when a run is cancelled. ''' self._cancel_functions = [] for func in functions: if isinstance(func, basestring) and hasattr(self, func) and callable(getattr(self, func)): self._cancel_functions.append...
[ "def", "connect_cancel", "(", "self", ",", "functions", ")", ":", "self", ".", "_cancel_functions", "=", "[", "]", "for", "func", "in", "functions", ":", "if", "isinstance", "(", "func", ",", "basestring", ")", "and", "hasattr", "(", "self", ",", "func",...
Run given functions when a run is cancelled.
[ "Run", "given", "functions", "when", "a", "run", "is", "cancelled", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L248-L258
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.handle_cancel
def handle_cancel(self, **kwargs): '''Cancelling a run. ''' for func in self._cancel_functions: f_args = getargspec(func)[0] f_kwargs = {key: kwargs[key] for key in f_args if key in kwargs} func(**f_kwargs)
python
def handle_cancel(self, **kwargs): '''Cancelling a run. ''' for func in self._cancel_functions: f_args = getargspec(func)[0] f_kwargs = {key: kwargs[key] for key in f_args if key in kwargs} func(**f_kwargs)
[ "def", "handle_cancel", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "func", "in", "self", ".", "_cancel_functions", ":", "f_args", "=", "getargspec", "(", "func", ")", "[", "0", "]", "f_kwargs", "=", "{", "key", ":", "kwargs", "[", "key", ...
Cancelling a run.
[ "Cancelling", "a", "run", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L260-L266
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.stop
def stop(self, msg=None): '''Stopping a run. Control for loops. Gentle stop/abort. This event should provide a more gentle abort. The run should stop ASAP but the run is still considered complete. ''' if not self.stop_run.is_set(): if msg: logging.info('%s%s ...
python
def stop(self, msg=None): '''Stopping a run. Control for loops. Gentle stop/abort. This event should provide a more gentle abort. The run should stop ASAP but the run is still considered complete. ''' if not self.stop_run.is_set(): if msg: logging.info('%s%s ...
[ "def", "stop", "(", "self", ",", "msg", "=", "None", ")", ":", "if", "not", "self", ".", "stop_run", ".", "is_set", "(", ")", ":", "if", "msg", ":", "logging", ".", "info", "(", "'%s%s Stopping run...'", ",", "msg", ",", "(", "''", "if", "msg", "...
Stopping a run. Control for loops. Gentle stop/abort. This event should provide a more gentle abort. The run should stop ASAP but the run is still considered complete.
[ "Stopping", "a", "run", ".", "Control", "for", "loops", ".", "Gentle", "stop", "/", "abort", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L268-L278
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunBase.abort
def abort(self, msg=None): '''Aborting a run. Control for loops. Immediate stop/abort. The implementation should stop a run ASAP when this event is set. The run is considered incomplete. ''' if not self.abort_run.is_set(): if msg: logging.error('%s%s Aborting...
python
def abort(self, msg=None): '''Aborting a run. Control for loops. Immediate stop/abort. The implementation should stop a run ASAP when this event is set. The run is considered incomplete. ''' if not self.abort_run.is_set(): if msg: logging.error('%s%s Aborting...
[ "def", "abort", "(", "self", ",", "msg", "=", "None", ")", ":", "if", "not", "self", ".", "abort_run", ".", "is_set", "(", ")", ":", "if", "msg", ":", "logging", ".", "error", "(", "'%s%s Aborting run...'", ",", "msg", ",", "(", "''", "if", "msg", ...
Aborting a run. Control for loops. Immediate stop/abort. The implementation should stop a run ASAP when this event is set. The run is considered incomplete.
[ "Aborting", "a", "run", ".", "Control", "for", "loops", ".", "Immediate", "stop", "/", "abort", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L280-L291
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunManager.run_run
def run_run(self, run, conf=None, run_conf=None, use_thread=False, catch_exception=True): '''Runs a run in another thread. Non-blocking. Parameters ---------- run : class, object Run class or object. run_conf : str, dict, file Specific configuration for t...
python
def run_run(self, run, conf=None, run_conf=None, use_thread=False, catch_exception=True): '''Runs a run in another thread. Non-blocking. Parameters ---------- run : class, object Run class or object. run_conf : str, dict, file Specific configuration for t...
[ "def", "run_run", "(", "self", ",", "run", ",", "conf", "=", "None", ",", "run_conf", "=", "None", ",", "use_thread", "=", "False", ",", "catch_exception", "=", "True", ")", ":", "if", "isinstance", "(", "conf", ",", "basestring", ")", "and", "os", "...
Runs a run in another thread. Non-blocking. Parameters ---------- run : class, object Run class or object. run_conf : str, dict, file Specific configuration for the run. use_thread : bool If True, run run in thread and returns blocking functio...
[ "Runs", "a", "run", "in", "another", "thread", ".", "Non", "-", "blocking", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L513-L578
train
SiLab-Bonn/pyBAR
pybar/run_manager.py
RunManager.run_primlist
def run_primlist(self, primlist, skip_remaining=False): '''Runs runs from a primlist. Parameters ---------- primlist : string Filename of primlist. skip_remaining : bool If True, skip remaining runs, if a run does not exit with status FINISHED. N...
python
def run_primlist(self, primlist, skip_remaining=False): '''Runs runs from a primlist. Parameters ---------- primlist : string Filename of primlist. skip_remaining : bool If True, skip remaining runs, if a run does not exit with status FINISHED. N...
[ "def", "run_primlist", "(", "self", ",", "primlist", ",", "skip_remaining", "=", "False", ")", ":", "runlist", "=", "self", ".", "open_primlist", "(", "primlist", ")", "for", "index", ",", "run", "in", "enumerate", "(", "runlist", ")", ":", "logging", "....
Runs runs from a primlist. Parameters ---------- primlist : string Filename of primlist. skip_remaining : bool If True, skip remaining runs, if a run does not exit with status FINISHED. Note ---- Primlist is a text file of the following f...
[ "Runs", "runs", "from", "a", "primlist", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L580-L602
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
analyze_beam_spot
def analyze_beam_spot(scan_base, combine_n_readouts=1000, chunk_size=10000000, plot_occupancy_hists=False, output_pdf=None, output_file=None): ''' Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupanc...
python
def analyze_beam_spot(scan_base, combine_n_readouts=1000, chunk_size=10000000, plot_occupancy_hists=False, output_pdf=None, output_file=None): ''' Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupanc...
[ "def", "analyze_beam_spot", "(", "scan_base", ",", "combine_n_readouts", "=", "1000", ",", "chunk_size", "=", "10000000", ",", "plot_occupancy_hists", "=", "False", ",", "output_pdf", "=", "None", ",", "output_file", "=", "None", ")", ":", "time_stamp", "=", "...
Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupancy is determined for the given combined events and stored into a pdf file. At the end the beam x and y is plotted into a scatter plot with absolute ...
[ "Determines", "the", "mean", "x", "and", "y", "beam", "spot", "position", "as", "a", "function", "of", "time", ".", "Therefore", "the", "data", "of", "a", "fixed", "number", "of", "read", "outs", "are", "combined", "(", "combine_n_readouts", ")", ".", "T...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L23-L99
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
analyze_event_rate
def analyze_event_rate(scan_base, combine_n_readouts=1000, time_line_absolute=True, output_pdf=None, output_file=None): ''' Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data i...
python
def analyze_event_rate(scan_base, combine_n_readouts=1000, time_line_absolute=True, output_pdf=None, output_file=None): ''' Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data i...
[ "def", "analyze_event_rate", "(", "scan_base", ",", "combine_n_readouts", "=", "1000", ",", "time_line_absolute", "=", "True", ",", "output_pdf", "=", "None", ",", "output_file", "=", "None", ")", ":", "time_stamp", "=", "[", "]", "rate", "=", "[", "]", "s...
Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data info and stored into a pdf file. Parameters ---------- scan_base: list of str scan base names (e.g.: ['...
[ "Determines", "the", "number", "of", "events", "as", "a", "function", "of", "time", ".", "Therefore", "the", "data", "of", "a", "fixed", "number", "of", "read", "outs", "are", "combined", "(", "combine_n_readouts", ")", ".", "The", "number", "of", "events"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L102-L147
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
analyse_n_cluster_per_event
def analyse_n_cluster_per_event(scan_base, include_no_cluster=False, time_line_absolute=True, combine_n_readouts=1000, chunk_size=10000000, plot_n_cluster_hists=False, output_pdf=None, output_file=None): ''' Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of re...
python
def analyse_n_cluster_per_event(scan_base, include_no_cluster=False, time_line_absolute=True, combine_n_readouts=1000, chunk_size=10000000, plot_n_cluster_hists=False, output_pdf=None, output_file=None): ''' Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of re...
[ "def", "analyse_n_cluster_per_event", "(", "scan_base", ",", "include_no_cluster", "=", "False", ",", "time_line_absolute", "=", "True", ",", "combine_n_readouts", "=", "1000", ",", "chunk_size", "=", "10000000", ",", "plot_n_cluster_hists", "=", "False", ",", "outp...
Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). Parameters ---------- scan_base: list of str scan base names (e.g.: ['//data//SCC_50_fei4_self_trigger_scan_390', ] include_no_cluster: bool ...
[ "Determines", "the", "number", "of", "cluster", "per", "event", "as", "a", "function", "of", "time", ".", "Therefore", "the", "data", "of", "a", "fixed", "number", "of", "read", "outs", "are", "combined", "(", "combine_n_readouts", ")", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L150-L248
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
select_hits_from_cluster_info
def select_hits_from_cluster_info(input_file_hits, output_file_hits, cluster_size_condition, n_cluster_condition, chunk_size=4000000): ''' Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or clus...
python
def select_hits_from_cluster_info(input_file_hits, output_file_hits, cluster_size_condition, n_cluster_condition, chunk_size=4000000): ''' Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or clus...
[ "def", "select_hits_from_cluster_info", "(", "input_file_hits", ",", "output_file_hits", ",", "cluster_size_condition", ",", "n_cluster_condition", ",", "chunk_size", "=", "4000000", ")", ":", "logging", ".", "info", "(", "'Write hits of events from '", "+", "str", "(",...
Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or cluster size. To increase the analysis speed a event index for the input hit file is created first. Since a cluster hit table can be created to...
[ "Takes", "a", "hit", "table", "and", "stores", "only", "selected", "hits", "into", "a", "new", "table", ".", "The", "selection", "is", "done", "on", "an", "event", "base", "and", "events", "are", "selected", "if", "they", "have", "a", "certain", "number"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L251-L285
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
select_hits
def select_hits(input_file_hits, output_file_hits, condition=None, cluster_size_condition=None, n_cluster_condition=None, chunk_size=5000000): ''' Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if this expression evaluates to true the h...
python
def select_hits(input_file_hits, output_file_hits, condition=None, cluster_size_condition=None, n_cluster_condition=None, chunk_size=5000000): ''' Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if this expression evaluates to true the h...
[ "def", "select_hits", "(", "input_file_hits", ",", "output_file_hits", ",", "condition", "=", "None", ",", "cluster_size_condition", "=", "None", ",", "n_cluster_condition", "=", "None", ",", "chunk_size", "=", "5000000", ")", ":", "logging", ".", "info", "(", ...
Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if this expression evaluates to true the hit is taken. One can also select hits from cluster conditions. This selection is done on an event basis, meaning events are selected where the clus...
[ "Takes", "a", "hit", "table", "and", "stores", "only", "selected", "hits", "into", "a", "new", "table", ".", "The", "selection", "of", "hits", "is", "done", "with", "a", "numexp", "string", ".", "Only", "if", "this", "expression", "evaluates", "to", "tru...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L288-L338
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
analyze_cluster_size_per_scan_parameter
def analyze_cluster_size_per_scan_parameter(input_file_hits, output_file_cluster_size, parameter='GDAC', max_chunk_size=10000000, overwrite_output_files=False, output_pdf=None): ''' This method takes multiple hit files and determines the cluster size for different scan parameter values of Parameters -----...
python
def analyze_cluster_size_per_scan_parameter(input_file_hits, output_file_cluster_size, parameter='GDAC', max_chunk_size=10000000, overwrite_output_files=False, output_pdf=None): ''' This method takes multiple hit files and determines the cluster size for different scan parameter values of Parameters -----...
[ "def", "analyze_cluster_size_per_scan_parameter", "(", "input_file_hits", ",", "output_file_cluster_size", ",", "parameter", "=", "'GDAC'", ",", "max_chunk_size", "=", "10000000", ",", "overwrite_output_files", "=", "False", ",", "output_pdf", "=", "None", ")", ":", "...
This method takes multiple hit files and determines the cluster size for different scan parameter values of Parameters ---------- input_files_hits: string output_file_cluster_size: string The data file with the results parameter: string The name of the parameter to separate the dat...
[ "This", "method", "takes", "multiple", "hit", "files", "and", "determines", "the", "cluster", "size", "for", "different", "scan", "parameter", "values", "of" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L341-L425
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
histogram_cluster_table
def histogram_cluster_table(analyzed_data_file, output_file, chunk_size=10000000): '''Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array. The 3rd dimension of the occupancy array is the number of different scan parameters used Parameters ---------- ana...
python
def histogram_cluster_table(analyzed_data_file, output_file, chunk_size=10000000): '''Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array. The 3rd dimension of the occupancy array is the number of different scan parameters used Parameters ---------- ana...
[ "def", "histogram_cluster_table", "(", "analyzed_data_file", ",", "output_file", ",", "chunk_size", "=", "10000000", ")", ":", "with", "tb", ".", "open_file", "(", "analyzed_data_file", ",", "mode", "=", "\"r\"", ")", "as", "in_file_h5", ":", "with", "tb", "."...
Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array. The 3rd dimension of the occupancy array is the number of different scan parameters used Parameters ---------- analyzed_data_file : string HDF5 filename of the file containing the cluster table. I...
[ "Reads", "in", "the", "cluster", "info", "table", "in", "chunks", "and", "histograms", "the", "seed", "pixels", "into", "one", "occupancy", "array", ".", "The", "3rd", "dimension", "of", "the", "occupancy", "array", "is", "the", "number", "of", "different", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L428-L482
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis.py
analyze_hits_per_scan_parameter
def analyze_hits_per_scan_parameter(analyze_data, scan_parameters=None, chunk_size=50000): '''Takes the hit table and analyzes the hits per scan parameter Parameters ---------- analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a f...
python
def analyze_hits_per_scan_parameter(analyze_data, scan_parameters=None, chunk_size=50000): '''Takes the hit table and analyzes the hits per scan parameter Parameters ---------- analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a f...
[ "def", "analyze_hits_per_scan_parameter", "(", "analyze_data", ",", "scan_parameters", "=", "None", ",", "chunk_size", "=", "50000", ")", ":", "if", "analyze_data", ".", "out_file_h5", "is", "None", "or", "analyze_data", ".", "out_file_h5", ".", "isopen", "==", ...
Takes the hit table and analyzes the hits per scan parameter Parameters ---------- analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a file name with the hit data given (AnalyzeRawData._analyzed_data_file) scan_parameters : list o...
[ "Takes", "the", "hit", "table", "and", "analyzes", "the", "hits", "per", "scan", "parameter" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L485-L541
train
SiLab-Bonn/pyBAR
pybar/scans/calibrate_plsr_dac_transient.py
interpret_data_from_tektronix
def interpret_data_from_tektronix(preamble, data): ''' Interprets raw data from Tektronix returns: lists of x, y values in seconds/volt''' # Y mode ("WFMPRE:PT_FMT"): # Xn = XZEro + XINcr (n - PT_Off) # Yn = YZEro + YMUlt (yn - YOFf) voltage = np.array(data, dtype=np.float) meta_data = pream...
python
def interpret_data_from_tektronix(preamble, data): ''' Interprets raw data from Tektronix returns: lists of x, y values in seconds/volt''' # Y mode ("WFMPRE:PT_FMT"): # Xn = XZEro + XINcr (n - PT_Off) # Yn = YZEro + YMUlt (yn - YOFf) voltage = np.array(data, dtype=np.float) meta_data = pream...
[ "def", "interpret_data_from_tektronix", "(", "preamble", ",", "data", ")", ":", "# Y mode (\"WFMPRE:PT_FMT\"):", "# Xn = XZEro + XINcr (n - PT_Off)", "# Yn = YZEro + YMUlt (yn - YOFf)", "voltage", "=", "np", ".", "array", "(", "data", ",", "dtype", "=", "np", ".", "floa...
Interprets raw data from Tektronix returns: lists of x, y values in seconds/volt
[ "Interprets", "raw", "data", "from", "Tektronix", "returns", ":", "lists", "of", "x", "y", "values", "in", "seconds", "/", "volt" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/calibrate_plsr_dac_transient.py#L24-L42
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
read_chip_sn
def read_chip_sn(self): '''Reading Chip S/N Note ---- Bits [MSB-LSB] | [15] | [14-6] | [5-0] Content | reserved | wafer number | chip number ''' commands = [] commands.extend(self.register.get_commands("ConfMode")) self.register_utils.send_commands(com...
python
def read_chip_sn(self): '''Reading Chip S/N Note ---- Bits [MSB-LSB] | [15] | [14-6] | [5-0] Content | reserved | wafer number | chip number ''' commands = [] commands.extend(self.register.get_commands("ConfMode")) self.register_utils.send_commands(com...
[ "def", "read_chip_sn", "(", "self", ")", ":", "commands", "=", "[", "]", "commands", ".", "extend", "(", "self", ".", "register", ".", "get_commands", "(", "\"ConfMode\"", ")", ")", "self", ".", "register_utils", ".", "send_commands", "(", "commands", ")",...
Reading Chip S/N Note ---- Bits [MSB-LSB] | [15] | [14-6] | [5-0] Content | reserved | wafer number | chip number
[ "Reading", "Chip", "S", "/", "N", "Note", "----", "Bits", "[", "MSB", "-", "LSB", "]", "|", "[", "15", "]", "|", "[", "14", "-", "6", "]", "|", "[", "5", "-", "0", "]", "Content", "|", "reserved", "|", "wafer", "number", "|", "chip", "number"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L264-L313
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
read_global_register
def read_global_register(self, name, overwrite_config=False): '''The function reads the global register, interprets the data and returns the register value. Parameters ---------- name : register name overwrite_config : bool The read values overwrite the config in RAM if true. ...
python
def read_global_register(self, name, overwrite_config=False): '''The function reads the global register, interprets the data and returns the register value. Parameters ---------- name : register name overwrite_config : bool The read values overwrite the config in RAM if true. ...
[ "def", "read_global_register", "(", "self", ",", "name", ",", "overwrite_config", "=", "False", ")", ":", "self", ".", "register_utils", ".", "send_commands", "(", "self", ".", "register", ".", "get_commands", "(", "\"ConfMode\"", ")", ")", "with", "self", "...
The function reads the global register, interprets the data and returns the register value. Parameters ---------- name : register name overwrite_config : bool The read values overwrite the config in RAM if true. Returns ------- register value
[ "The", "function", "reads", "the", "global", "register", "interprets", "the", "data", "and", "returns", "the", "register", "value", ".", "Parameters", "----------", "name", ":", "register", "name", "overwrite_config", ":", "bool", "The", "read", "values", "overw...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L540-L586
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
read_pixel_register
def read_pixel_register(self, pix_regs=None, dcs=range(40), overwrite_config=False): '''The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register. Pixels without any data are masked. Parameters ---------- pix_regs ...
python
def read_pixel_register(self, pix_regs=None, dcs=range(40), overwrite_config=False): '''The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register. Pixels without any data are masked. Parameters ---------- pix_regs ...
[ "def", "read_pixel_register", "(", "self", ",", "pix_regs", "=", "None", ",", "dcs", "=", "range", "(", "40", ")", ",", "overwrite_config", "=", "False", ")", ":", "if", "pix_regs", "is", "None", ":", "pix_regs", "=", "[", "\"EnableDigInj\"", ",", "\"Imo...
The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register. Pixels without any data are masked. Parameters ---------- pix_regs : iterable, string List of pixel register to read (e.g. Enable, C_High, ...). ...
[ "The", "function", "reads", "the", "pixel", "register", "interprets", "the", "data", "and", "returns", "a", "masked", "numpy", "arrays", "with", "the", "data", "for", "the", "chosen", "pixel", "register", ".", "Pixels", "without", "any", "data", "are", "mask...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L598-L633
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
is_fe_ready
def is_fe_ready(self): '''Get FEI4 status of module. If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state. Returns ------- value : bool True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready. ''' with...
python
def is_fe_ready(self): '''Get FEI4 status of module. If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state. Returns ------- value : bool True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready. ''' with...
[ "def", "is_fe_ready", "(", "self", ")", ":", "with", "self", ".", "readout", "(", "fill_buffer", "=", "True", ",", "callback", "=", "None", ",", "errback", "=", "None", ")", ":", "commands", "=", "[", "]", "commands", ".", "extend", "(", "self", ".",...
Get FEI4 status of module. If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state. Returns ------- value : bool True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready.
[ "Get", "FEI4", "status", "of", "module", ".", "If", "FEI4", "is", "not", "ready", "resetting", "service", "records", "is", "necessary", "to", "bring", "the", "FEI4", "to", "a", "defined", "state", ".", "Returns", "-------", "value", ":", "bool", "True", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L636-L657
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
invert_pixel_mask
def invert_pixel_mask(mask): '''Invert pixel mask (0->1, 1(and greater)->0). Parameters ---------- mask : array-like Mask. Returns ------- inverted_mask : array-like Inverted Mask. ''' inverted_mask = np.ones(shape=(80, 336), dtype=np.dtype('>u1')) ...
python
def invert_pixel_mask(mask): '''Invert pixel mask (0->1, 1(and greater)->0). Parameters ---------- mask : array-like Mask. Returns ------- inverted_mask : array-like Inverted Mask. ''' inverted_mask = np.ones(shape=(80, 336), dtype=np.dtype('>u1')) ...
[ "def", "invert_pixel_mask", "(", "mask", ")", ":", "inverted_mask", "=", "np", ".", "ones", "(", "shape", "=", "(", "80", ",", "336", ")", ",", "dtype", "=", "np", ".", "dtype", "(", "'>u1'", ")", ")", "inverted_mask", "[", "mask", ">=", "1", "]", ...
Invert pixel mask (0->1, 1(and greater)->0). Parameters ---------- mask : array-like Mask. Returns ------- inverted_mask : array-like Inverted Mask.
[ "Invert", "pixel", "mask", "(", "0", "-", ">", "1", "1", "(", "and", "greater", ")", "-", ">", "0", ")", ".", "Parameters", "----------", "mask", ":", "array", "-", "like", "Mask", ".", "Returns", "-------", "inverted_mask", ":", "array", "-", "like"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L660-L675
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
make_pixel_mask
def make_pixel_mask(steps, shift, default=0, value=1, enable_columns=None, mask=None): '''Generate pixel mask. Parameters ---------- steps : int Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column). ...
python
def make_pixel_mask(steps, shift, default=0, value=1, enable_columns=None, mask=None): '''Generate pixel mask. Parameters ---------- steps : int Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column). ...
[ "def", "make_pixel_mask", "(", "steps", ",", "shift", ",", "default", "=", "0", ",", "value", "=", "1", ",", "enable_columns", "=", "None", ",", "mask", "=", "None", ")", ":", "shape", "=", "(", "80", ",", "336", ")", "# value = np.zeros(dimension, dtype...
Generate pixel mask. Parameters ---------- steps : int Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column). shift : int Shift mask by given value to the bottom (towards higher row numbers). F...
[ "Generate", "pixel", "mask", ".", "Parameters", "----------", "steps", ":", "int", "Number", "of", "mask", "steps", "e", ".", "g", ".", "steps", "=", "3", "(", "every", "third", "pixel", "is", "enabled", ")", "steps", "=", "336", "(", "one", "pixel", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L678-L738
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
make_pixel_mask_from_col_row
def make_pixel_mask_from_col_row(column, row, default=0, value=1): '''Generate mask from column and row lists Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of row values. default : int Value of pixels that are not ...
python
def make_pixel_mask_from_col_row(column, row, default=0, value=1): '''Generate mask from column and row lists Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of row values. default : int Value of pixels that are not ...
[ "def", "make_pixel_mask_from_col_row", "(", "column", ",", "row", ",", "default", "=", "0", ",", "value", "=", "1", ")", ":", "# FE columns and rows start from 1\r", "col_array", "=", "np", ".", "array", "(", "column", ")", "-", "1", "row_array", "=", "np", ...
Generate mask from column and row lists Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of row values. default : int Value of pixels that are not selected by the mask. value : int Value of pixels that are se...
[ "Generate", "mask", "from", "column", "and", "row", "lists", "Parameters", "----------", "column", ":", "iterable", "int", "List", "of", "colums", "values", ".", "row", ":", "iterable", "int", "List", "of", "row", "values", ".", "default", ":", "int", "Val...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L741-L767
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
make_box_pixel_mask_from_col_row
def make_box_pixel_mask_from_col_row(column, row, default=0, value=1): '''Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list. Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of r...
python
def make_box_pixel_mask_from_col_row(column, row, default=0, value=1): '''Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list. Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of r...
[ "def", "make_box_pixel_mask_from_col_row", "(", "column", ",", "row", ",", "default", "=", "0", ",", "value", "=", "1", ")", ":", "# FE columns and rows start from 1\r", "col_array", "=", "np", ".", "array", "(", "column", ")", "-", "1", "row_array", "=", "n...
Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list. Parameters ---------- column : iterable, int List of colums values. row : iterable, int List of row values. default : int Value of pixels that are not selected by...
[ "Generate", "box", "shaped", "mask", "from", "column", "and", "row", "lists", ".", "Takes", "the", "minimum", "and", "maximum", "value", "from", "each", "list", ".", "Parameters", "----------", "column", ":", "iterable", "int", "List", "of", "colums", "value...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L770-L797
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
make_xtalk_mask
def make_xtalk_mask(mask): """ Generate xtalk mask (row - 1, row + 1) from pixel mask. Parameters ---------- mask : ndarray Pixel mask. Returns ------- ndarray Xtalk mask. Example ------- Input: [[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0...
python
def make_xtalk_mask(mask): """ Generate xtalk mask (row - 1, row + 1) from pixel mask. Parameters ---------- mask : ndarray Pixel mask. Returns ------- ndarray Xtalk mask. Example ------- Input: [[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0...
[ "def", "make_xtalk_mask", "(", "mask", ")", ":", "col", ",", "row", "=", "mask", ".", "nonzero", "(", ")", "row_plus_one", "=", "row", "+", "1", "del_index", "=", "np", ".", "where", "(", "row_plus_one", ">", "335", ")", "row_plus_one", "=", "np", "....
Generate xtalk mask (row - 1, row + 1) from pixel mask. Parameters ---------- mask : ndarray Pixel mask. Returns ------- ndarray Xtalk mask. Example ------- Input: [[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 1 ... 0 1 ...
[ "Generate", "xtalk", "mask", "(", "row", "-", "1", "row", "+", "1", ")", "from", "pixel", "mask", ".", "Parameters", "----------", "mask", ":", "ndarray", "Pixel", "mask", ".", "Returns", "-------", "ndarray", "Xtalk", "mask", ".", "Example", "-------", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L800-L841
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
make_checkerboard_mask
def make_checkerboard_mask(column_distance, row_distance, column_offset=0, row_offset=0, default=0, value=1): """ Generate chessboard/checkerboard mask. Parameters ---------- column_distance : int Column distance of the enabled pixels. row_distance : int Row distance of...
python
def make_checkerboard_mask(column_distance, row_distance, column_offset=0, row_offset=0, default=0, value=1): """ Generate chessboard/checkerboard mask. Parameters ---------- column_distance : int Column distance of the enabled pixels. row_distance : int Row distance of...
[ "def", "make_checkerboard_mask", "(", "column_distance", ",", "row_distance", ",", "column_offset", "=", "0", ",", "row_offset", "=", "0", ",", "default", "=", "0", ",", "value", "=", "1", ")", ":", "col_shape", "=", "(", "336", ",", ")", "col", "=", "...
Generate chessboard/checkerboard mask. Parameters ---------- column_distance : int Column distance of the enabled pixels. row_distance : int Row distance of the enabled pixels. column_offset : int Additional column offset which shifts the columns by the given amount...
[ "Generate", "chessboard", "/", "checkerboard", "mask", ".", "Parameters", "----------", "column_distance", ":", "int", "Column", "distance", "of", "the", "enabled", "pixels", ".", "row_distance", ":", "int", "Row", "distance", "of", "the", "enabled", "pixels", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L844-L886
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
scan_loop
def scan_loop(self, command, repeat_command=100, use_delay=True, additional_delay=0, mask_steps=3, enable_mask_steps=None, enable_double_columns=None, same_mask_for_all_dc=False, fast_dc_loop=True, bol_function=None, eol_function=None, digital_injection=False, enable_shift_masks=None, disable_shift_masks=None, restore_...
python
def scan_loop(self, command, repeat_command=100, use_delay=True, additional_delay=0, mask_steps=3, enable_mask_steps=None, enable_double_columns=None, same_mask_for_all_dc=False, fast_dc_loop=True, bol_function=None, eol_function=None, digital_injection=False, enable_shift_masks=None, disable_shift_masks=None, restore_...
[ "def", "scan_loop", "(", "self", ",", "command", ",", "repeat_command", "=", "100", ",", "use_delay", "=", "True", ",", "additional_delay", "=", "0", ",", "mask_steps", "=", "3", ",", "enable_mask_steps", "=", "None", ",", "enable_double_columns", "=", "None...
Implementation of the scan loops (mask shifting, loop over double columns, repeatedly sending any arbitrary command). Parameters ---------- command : BitVector (FEI4) command that will be sent out serially. repeat_command : int The number of repetitions command will be sent out e...
[ "Implementation", "of", "the", "scan", "loops", "(", "mask", "shifting", "loop", "over", "double", "columns", "repeatedly", "sending", "any", "arbitrary", "command", ")", ".", "Parameters", "----------", "command", ":", "BitVector", "(", "FEI4", ")", "command", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L913-L1252
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
FEI4RegisterUtils.reset_service_records
def reset_service_records(self): '''Resetting Service Records This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode). This should be only issued after power up and in the case of a stuck FIFO, other...
python
def reset_service_records(self): '''Resetting Service Records This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode). This should be only issued after power up and in the case of a stuck FIFO, other...
[ "def", "reset_service_records", "(", "self", ")", ":", "logging", ".", "info", "(", "'Resetting Service Records'", ")", "commands", "=", "[", "]", "commands", ".", "extend", "(", "self", ".", "register", ".", "get_commands", "(", "\"ConfMode\"", ")", ")", "s...
Resetting Service Records This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode). This should be only issued after power up and in the case of a stuck FIFO, otherwise the BCID counter starts jumping.
[ "Resetting", "Service", "Records", "This", "will", "reset", "Service", "Record", "counters", ".", "This", "will", "also", "bring", "back", "alive", "some", "FE", "where", "the", "output", "FIFO", "is", "stuck", "(", "no", "data", "is", "coming", "out", "in...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L164-L180
train
SiLab-Bonn/pyBAR
pybar/fei4/register_utils.py
FEI4RegisterUtils.reset_bunch_counter
def reset_bunch_counter(self): '''Resetting Bunch Counter ''' logging.info('Resetting Bunch Counter') commands = [] commands.extend(self.register.get_commands("RunMode")) commands.extend(self.register.get_commands("BCR")) self.send_commands(commands) ...
python
def reset_bunch_counter(self): '''Resetting Bunch Counter ''' logging.info('Resetting Bunch Counter') commands = [] commands.extend(self.register.get_commands("RunMode")) commands.extend(self.register.get_commands("BCR")) self.send_commands(commands) ...
[ "def", "reset_bunch_counter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Resetting Bunch Counter'", ")", "commands", "=", "[", "]", "commands", ".", "extend", "(", "self", ".", "register", ".", "get_commands", "(", "\"RunMode\"", ")", ")", "comman...
Resetting Bunch Counter
[ "Resetting", "Bunch", "Counter" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L182-L193
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
generate_threshold_mask
def generate_threshold_mask(hist): '''Masking array elements when equal 0.0 or greater than 10 times the median Parameters ---------- hist : array_like Input data. Returns ------- masked array Returns copy of the array with masked elements. ''' masked_array = np.ma....
python
def generate_threshold_mask(hist): '''Masking array elements when equal 0.0 or greater than 10 times the median Parameters ---------- hist : array_like Input data. Returns ------- masked array Returns copy of the array with masked elements. ''' masked_array = np.ma....
[ "def", "generate_threshold_mask", "(", "hist", ")", ":", "masked_array", "=", "np", ".", "ma", ".", "masked_values", "(", "hist", ",", "0", ")", "masked_array", "=", "np", ".", "ma", ".", "masked_greater", "(", "masked_array", ",", "10", "*", "np", ".", ...
Masking array elements when equal 0.0 or greater than 10 times the median Parameters ---------- hist : array_like Input data. Returns ------- masked array Returns copy of the array with masked elements.
[ "Masking", "array", "elements", "when", "equal", "0", ".", "0", "or", "greater", "than", "10", "times", "the", "median" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L50-L66
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
unique_row
def unique_row(array, use_columns=None, selected_columns_only=False): '''Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row. The returned array can have all columns of the original array or only the columns defined in use_...
python
def unique_row(array, use_columns=None, selected_columns_only=False): '''Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row. The returned array can have all columns of the original array or only the columns defined in use_...
[ "def", "unique_row", "(", "array", ",", "use_columns", "=", "None", ",", "selected_columns_only", "=", "False", ")", ":", "if", "array", ".", "dtype", ".", "names", "is", "None", ":", "# normal array has no named dtype", "if", "use_columns", "is", "not", "None...
Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row. The returned array can have all columns of the original array or only the columns defined in use_columns. Parameters ---------- array : numpy.ndarray use_colu...
[ "Takes", "a", "numpy", "array", "and", "returns", "the", "array", "reduced", "to", "unique", "rows", ".", "If", "columns", "are", "defined", "only", "these", "columns", "are", "taken", "to", "define", "a", "unique", "row", ".", "The", "returned", "array", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L69-L108
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_ranges_from_array
def get_ranges_from_array(arr, append_last=True): '''Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length. Parameters ---------- arr : array like append_last: bool If True, append item with a pair of last array item and None. Returns ...
python
def get_ranges_from_array(arr, append_last=True): '''Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length. Parameters ---------- arr : array like append_last: bool If True, append item with a pair of last array item and None. Returns ...
[ "def", "get_ranges_from_array", "(", "arr", ",", "append_last", "=", "True", ")", ":", "right", "=", "arr", "[", "1", ":", "]", "if", "append_last", ":", "left", "=", "arr", "[", ":", "]", "right", "=", "np", ".", "append", "(", "right", ",", "None...
Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length. Parameters ---------- arr : array like append_last: bool If True, append item with a pair of last array item and None. Returns ------- numpy.array The array formed by pai...
[ "Takes", "an", "array", "and", "calculates", "ranges", "[", "start", "stop", "[", ".", "The", "last", "range", "end", "is", "none", "to", "keep", "the", "same", "length", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L111-L144
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
in1d_sorted
def in1d_sorted(ar1, ar2): """ Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster. """ if ar1.shape[0] == 0 or ar2.shape[0] == 0: # check for empty arrays to avoid crash return [] inds = ar2.searchsorted(ar1) inds[inds == len(ar2)] = 0 ...
python
def in1d_sorted(ar1, ar2): """ Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster. """ if ar1.shape[0] == 0 or ar2.shape[0] == 0: # check for empty arrays to avoid crash return [] inds = ar2.searchsorted(ar1) inds[inds == len(ar2)] = 0 ...
[ "def", "in1d_sorted", "(", "ar1", ",", "ar2", ")", ":", "if", "ar1", ".", "shape", "[", "0", "]", "==", "0", "or", "ar2", ".", "shape", "[", "0", "]", "==", "0", ":", "# check for empty arrays to avoid crash", "return", "[", "]", "inds", "=", "ar2", ...
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster.
[ "Does", "the", "same", "than", "np", ".", "in1d", "but", "uses", "the", "fact", "that", "ar1", "and", "ar2", "are", "sorted", ".", "Is", "therefore", "much", "faster", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L159-L168
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
central_difference
def central_difference(x, y): '''Returns the dy/dx(x) via central difference method Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like ''' if (len(x) != len(y)): raise ValueError("x, y must have the same length") z1 = np.hstack((y...
python
def central_difference(x, y): '''Returns the dy/dx(x) via central difference method Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like ''' if (len(x) != len(y)): raise ValueError("x, y must have the same length") z1 = np.hstack((y...
[ "def", "central_difference", "(", "x", ",", "y", ")", ":", "if", "(", "len", "(", "x", ")", "!=", "len", "(", "y", ")", ")", ":", "raise", "ValueError", "(", "\"x, y must have the same length\"", ")", "z1", "=", "np", ".", "hstack", "(", "(", "y", ...
Returns the dy/dx(x) via central difference method Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like
[ "Returns", "the", "dy", "/", "dx", "(", "x", ")", "via", "central", "difference", "method" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L171-L189
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_profile_histogram
def get_profile_histogram(x, y, n_bins=100): '''Takes 2D point data (x,y) and creates a profile histogram similar to the TProfile in ROOT. It calculates the y mean for every bin at the bin center and gives the y mean error as error bars. Parameters ---------- x : array like data x positions...
python
def get_profile_histogram(x, y, n_bins=100): '''Takes 2D point data (x,y) and creates a profile histogram similar to the TProfile in ROOT. It calculates the y mean for every bin at the bin center and gives the y mean error as error bars. Parameters ---------- x : array like data x positions...
[ "def", "get_profile_histogram", "(", "x", ",", "y", ",", "n_bins", "=", "100", ")", ":", "if", "len", "(", "x", ")", "!=", "len", "(", "y", ")", ":", "raise", "ValueError", "(", "'x and y dimensions have to be the same'", ")", "y", "=", "y", ".", "asty...
Takes 2D point data (x,y) and creates a profile histogram similar to the TProfile in ROOT. It calculates the y mean for every bin at the bin center and gives the y mean error as error bars. Parameters ---------- x : array like data x positions y : array like data y positions n_b...
[ "Takes", "2D", "point", "data", "(", "x", "y", ")", "and", "creates", "a", "profile", "histogram", "similar", "to", "the", "TProfile", "in", "ROOT", ".", "It", "calculates", "the", "y", "mean", "for", "every", "bin", "at", "the", "bin", "center", "and"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L192-L217
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_rate_normalization
def get_rate_normalization(hit_file, parameter, reference='event', cluster_file=None, plot=False, chunk_size=500000): ''' Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter) and returns an array with a normalization factor. This normal...
python
def get_rate_normalization(hit_file, parameter, reference='event', cluster_file=None, plot=False, chunk_size=500000): ''' Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter) and returns an array with a normalization factor. This normal...
[ "def", "get_rate_normalization", "(", "hit_file", ",", "parameter", ",", "reference", "=", "'event'", ",", "cluster_file", "=", "None", ",", "plot", "=", "False", ",", "chunk_size", "=", "500000", ")", ":", "logging", ".", "info", "(", "'Calculate the rate nor...
Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter) and returns an array with a normalization factor. This normalization factor has the length of the number of different parameters. If a cluster_file is specified also the number of clu...
[ "Takes", "different", "hit", "files", "(", "hit_files", ")", "extracts", "the", "number", "of", "events", "or", "the", "scan", "time", "(", "reference", ")", "per", "scan", "parameter", "(", "parameter", ")", "and", "returns", "an", "array", "with", "a", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L220-L300
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_parameter_value_from_file_names
def get_parameter_value_from_file_names(files, parameters=None, unique=False, sort=True): """ Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name in the first dimension and the corresponding parameter value in the second. The file names c...
python
def get_parameter_value_from_file_names(files, parameters=None, unique=False, sort=True): """ Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name in the first dimension and the corresponding parameter value in the second. The file names c...
[ "def", "get_parameter_value_from_file_names", "(", "files", ",", "parameters", "=", "None", ",", "unique", "=", "False", ",", "sort", "=", "True", ")", ":", "# unique=False", "logging", ".", "debug", "(", "'Get the parameter: '", "+", "str", "(", "parameters...
Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name in the first dimension and the corresponding parameter value in the second. The file names can be sorted by the parameter value, otherwise the order is kept. If unique is true every parameter is...
[ "Takes", "a", "list", "of", "files", "searches", "for", "the", "parameter", "name", "in", "the", "file", "name", "and", "returns", "a", "ordered", "dict", "with", "the", "file", "name", "in", "the", "first", "dimension", "and", "the", "corresponding", "par...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L361-L404
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_data_file_names_from_scan_base
def get_data_file_names_from_scan_base(scan_base, filter_str=['_analyzed.h5', '_interpreted.h5', '_cut.h5', '_result.h5', '_hists.h5'], sort_by_time=True, meta_data_v2=True): """ Generate a list of .h5 files which have a similar file name. Parameters ---------- scan_base : list, string List...
python
def get_data_file_names_from_scan_base(scan_base, filter_str=['_analyzed.h5', '_interpreted.h5', '_cut.h5', '_result.h5', '_hists.h5'], sort_by_time=True, meta_data_v2=True): """ Generate a list of .h5 files which have a similar file name. Parameters ---------- scan_base : list, string List...
[ "def", "get_data_file_names_from_scan_base", "(", "scan_base", ",", "filter_str", "=", "[", "'_analyzed.h5'", ",", "'_interpreted.h5'", ",", "'_cut.h5'", ",", "'_result.h5'", ",", "'_hists.h5'", "]", ",", "sort_by_time", "=", "True", ",", "meta_data_v2", "=", "True"...
Generate a list of .h5 files which have a similar file name. Parameters ---------- scan_base : list, string List of string or string of the scan base names. The scan_base will be used to search for files containing the string. The .h5 file extension will be added automatically. filter : list, s...
[ "Generate", "a", "list", "of", ".", "h5", "files", "which", "have", "a", "similar", "file", "name", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L407-L462
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_parameter_from_files
def get_parameter_from_files(files, parameters=None, unique=False, sort=True): ''' Takes a list of files, searches for the parameter name in the file name and in the file. Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second. If a scan paramet...
python
def get_parameter_from_files(files, parameters=None, unique=False, sort=True): ''' Takes a list of files, searches for the parameter name in the file name and in the file. Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second. If a scan paramet...
[ "def", "get_parameter_from_files", "(", "files", ",", "parameters", "=", "None", ",", "unique", "=", "False", ",", "sort", "=", "True", ")", ":", "logging", ".", "debug", "(", "'Get the parameter '", "+", "str", "(", "parameters", ")", "+", "' values from '"...
Takes a list of files, searches for the parameter name in the file name and in the file. Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second. If a scan parameter appears in the file name and in the file the first parameter setting has to be in th...
[ "Takes", "a", "list", "of", "files", "searches", "for", "the", "parameter", "name", "in", "the", "file", "name", "and", "in", "the", "file", ".", "Returns", "a", "ordered", "dict", "with", "the", "file", "name", "in", "the", "first", "dimension", "and", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L480-L555
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
check_parameter_similarity
def check_parameter_similarity(files_dict): """ Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input. """ try: parameter_names = files_dict.itervalues().next().keys() # get the parameter names of the first file, to check if ...
python
def check_parameter_similarity(files_dict): """ Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input. """ try: parameter_names = files_dict.itervalues().next().keys() # get the parameter names of the first file, to check if ...
[ "def", "check_parameter_similarity", "(", "files_dict", ")", ":", "try", ":", "parameter_names", "=", "files_dict", ".", "itervalues", "(", ")", ".", "next", "(", ")", ".", "keys", "(", ")", "# get the parameter names of the first file, to check if these are the same in...
Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input.
[ "Checks", "if", "the", "parameter", "names", "of", "all", "files", "are", "similar", ".", "Takes", "the", "dictionary", "from", "get_parameter_from_files", "output", "as", "input", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L558-L572
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
combine_meta_data
def combine_meta_data(files_dict, meta_data_v2=True): """ Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array. Parameters ---------- meta_data_v2 : bool True for new (v2) meta data format, False for the old (v1) format. """ if len(files_d...
python
def combine_meta_data(files_dict, meta_data_v2=True): """ Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array. Parameters ---------- meta_data_v2 : bool True for new (v2) meta data format, False for the old (v1) format. """ if len(files_d...
[ "def", "combine_meta_data", "(", "files_dict", ",", "meta_data_v2", "=", "True", ")", ":", "if", "len", "(", "files_dict", ")", ">", "10", ":", "logging", ".", "info", "(", "\"Combine the meta data from %d files\"", ",", "len", "(", "files_dict", ")", ")", "...
Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array. Parameters ---------- meta_data_v2 : bool True for new (v2) meta data format, False for the old (v1) format.
[ "Takes", "the", "dict", "of", "hdf5", "files", "and", "combines", "their", "meta", "data", "tables", "into", "one", "new", "numpy", "record", "array", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L575-L624
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
smooth_differentiation
def smooth_differentiation(x, y, weigths=None, order=5, smoothness=3, derivation=1): '''Returns the dy/dx(x) with the fit and differentiation of a spline curve Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like ''' if (len(x) != len(y)): ...
python
def smooth_differentiation(x, y, weigths=None, order=5, smoothness=3, derivation=1): '''Returns the dy/dx(x) with the fit and differentiation of a spline curve Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like ''' if (len(x) != len(y)): ...
[ "def", "smooth_differentiation", "(", "x", ",", "y", ",", "weigths", "=", "None", ",", "order", "=", "5", ",", "smoothness", "=", "3", ",", "derivation", "=", "1", ")", ":", "if", "(", "len", "(", "x", ")", "!=", "len", "(", "y", ")", ")", ":",...
Returns the dy/dx(x) with the fit and differentiation of a spline curve Parameters ---------- x : array like y : array like Returns ------- dy/dx : array like
[ "Returns", "the", "dy", "/", "dx", "(", "x", ")", "with", "the", "fit", "and", "differentiation", "of", "a", "spline", "curve" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L627-L642
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
reduce_sorted_to_intersect
def reduce_sorted_to_intersect(ar1, ar2): """ Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1. Parameters ---------- ar1 : (M,) array_like Input array. ar2 : array_like Input array. Returns ------- ar1, ar1 : ndarray, ndarray The ...
python
def reduce_sorted_to_intersect(ar1, ar2): """ Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1. Parameters ---------- ar1 : (M,) array_like Input array. ar2 : array_like Input array. Returns ------- ar1, ar1 : ndarray, ndarray The ...
[ "def", "reduce_sorted_to_intersect", "(", "ar1", ",", "ar2", ")", ":", "# Ravel both arrays, behavior for the first array could be different", "ar1", "=", "np", ".", "asarray", "(", "ar1", ")", ".", "ravel", "(", ")", "ar2", "=", "np", ".", "asarray", "(", "ar2"...
Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1. Parameters ---------- ar1 : (M,) array_like Input array. ar2 : array_like Input array. Returns ------- ar1, ar1 : ndarray, ndarray The intersection values.
[ "Takes", "two", "sorted", "arrays", "and", "return", "the", "intersection", "ar1", "in", "ar2", "ar2", "in", "ar1", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L645-L691
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_not_unique_values
def get_not_unique_values(array): '''Returns the values that appear at least twice in array. Parameters ---------- array : array like Returns ------- numpy.array ''' s = np.sort(array, axis=None) s = s[s[1:] == s[:-1]] return np.unique(s)
python
def get_not_unique_values(array): '''Returns the values that appear at least twice in array. Parameters ---------- array : array like Returns ------- numpy.array ''' s = np.sort(array, axis=None) s = s[s[1:] == s[:-1]] return np.unique(s)
[ "def", "get_not_unique_values", "(", "array", ")", ":", "s", "=", "np", ".", "sort", "(", "array", ",", "axis", "=", "None", ")", "s", "=", "s", "[", "s", "[", "1", ":", "]", "==", "s", "[", ":", "-", "1", "]", "]", "return", "np", ".", "un...
Returns the values that appear at least twice in array. Parameters ---------- array : array like Returns ------- numpy.array
[ "Returns", "the", "values", "that", "appear", "at", "least", "twice", "in", "array", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L694-L707
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_meta_data_index_at_scan_parameter
def get_meta_data_index_at_scan_parameter(meta_data_array, scan_parameter_name): '''Takes the analyzed meta_data table and returns the indices where the scan parameter changes Parameters ---------- meta_data_array : numpy.recordarray scan_parameter_name : string Returns ------- numpy.n...
python
def get_meta_data_index_at_scan_parameter(meta_data_array, scan_parameter_name): '''Takes the analyzed meta_data table and returns the indices where the scan parameter changes Parameters ---------- meta_data_array : numpy.recordarray scan_parameter_name : string Returns ------- numpy.n...
[ "def", "get_meta_data_index_at_scan_parameter", "(", "meta_data_array", ",", "scan_parameter_name", ")", ":", "scan_parameter_values", "=", "meta_data_array", "[", "scan_parameter_name", "]", "diff", "=", "np", ".", "concatenate", "(", "(", "[", "1", "]", ",", "np",...
Takes the analyzed meta_data table and returns the indices where the scan parameter changes Parameters ---------- meta_data_array : numpy.recordarray scan_parameter_name : string Returns ------- numpy.ndarray: first dimension: scan parameter value second dimension: index wh...
[ "Takes", "the", "analyzed", "meta_data", "table", "and", "returns", "the", "indices", "where", "the", "scan", "parameter", "changes" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L710-L730
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
select_hits
def select_hits(hits_array, condition=None): '''Selects the hits with condition. E.g.: condition = 'rel_BCID == 7 & event_number < 1000' Parameters ---------- hits_array : numpy.array condition : string A condition that is applied to the hits in numexpr. Only if the expression evaluates...
python
def select_hits(hits_array, condition=None): '''Selects the hits with condition. E.g.: condition = 'rel_BCID == 7 & event_number < 1000' Parameters ---------- hits_array : numpy.array condition : string A condition that is applied to the hits in numexpr. Only if the expression evaluates...
[ "def", "select_hits", "(", "hits_array", ",", "condition", "=", "None", ")", ":", "if", "condition", "is", "None", ":", "return", "hits_array", "for", "variable", "in", "set", "(", "re", ".", "findall", "(", "r'[a-zA-Z_]+'", ",", "condition", ")", ")", "...
Selects the hits with condition. E.g.: condition = 'rel_BCID == 7 & event_number < 1000' Parameters ---------- hits_array : numpy.array condition : string A condition that is applied to the hits in numexpr. Only if the expression evaluates to True the hit is taken. Returns ------- ...
[ "Selects", "the", "hits", "with", "condition", ".", "E", ".", "g", ".", ":", "condition", "=", "rel_BCID", "==", "7", "&", "event_number", "<", "1000" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L749-L770
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_hits_in_events
def get_hits_in_events(hits_array, events, assume_sorted=True, condition=None): '''Selects the hits that occurred in events and optional selection criterion. If a event range can be defined use the get_data_in_event_range function. It is much faster. Parameters ---------- hits_array : numpy.arr...
python
def get_hits_in_events(hits_array, events, assume_sorted=True, condition=None): '''Selects the hits that occurred in events and optional selection criterion. If a event range can be defined use the get_data_in_event_range function. It is much faster. Parameters ---------- hits_array : numpy.arr...
[ "def", "get_hits_in_events", "(", "hits_array", ",", "events", ",", "assume_sorted", "=", "True", ",", "condition", "=", "None", ")", ":", "logging", ".", "debug", "(", "\"Calculate hits that exists in the given %d events.\"", "%", "len", "(", "events", ")", ")", ...
Selects the hits that occurred in events and optional selection criterion. If a event range can be defined use the get_data_in_event_range function. It is much faster. Parameters ---------- hits_array : numpy.array events : array assume_sorted : bool Is true if the events to select ...
[ "Selects", "the", "hits", "that", "occurred", "in", "events", "and", "optional", "selection", "criterion", ".", "If", "a", "event", "range", "can", "be", "defined", "use", "the", "get_data_in_event_range", "function", ".", "It", "is", "much", "faster", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L773-L814
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_hits_of_scan_parameter
def get_hits_of_scan_parameter(input_file_hits, scan_parameters=None, try_speedup=False, chunk_size=10000000): '''Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters. Yields the hits in chunks, since they usually do not fit into memory. Parameters ...
python
def get_hits_of_scan_parameter(input_file_hits, scan_parameters=None, try_speedup=False, chunk_size=10000000): '''Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters. Yields the hits in chunks, since they usually do not fit into memory. Parameters ...
[ "def", "get_hits_of_scan_parameter", "(", "input_file_hits", ",", "scan_parameters", "=", "None", ",", "try_speedup", "=", "False", ",", "chunk_size", "=", "10000000", ")", ":", "with", "tb", ".", "open_file", "(", "input_file_hits", ",", "mode", "=", "\"r+\"", ...
Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters. Yields the hits in chunks, since they usually do not fit into memory. Parameters ---------- input_file_hits : pytable hdf5 file Has to include a hits node scan_parameters : iterable...
[ "Takes", "the", "hit", "table", "of", "a", "hdf5", "file", "and", "returns", "hits", "in", "chunks", "for", "each", "unique", "combination", "of", "scan_parameters", ".", "Yields", "the", "hits", "in", "chunks", "since", "they", "usually", "do", "not", "fi...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L817-L859
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_data_in_event_range
def get_data_in_event_range(array, event_start=None, event_stop=None, assume_sorted=True): '''Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[ Parameters ---------- array : numpy.array event_start : int, None event_stop : int, None assume_s...
python
def get_data_in_event_range(array, event_start=None, event_stop=None, assume_sorted=True): '''Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[ Parameters ---------- array : numpy.array event_start : int, None event_stop : int, None assume_s...
[ "def", "get_data_in_event_range", "(", "array", ",", "event_start", "=", "None", ",", "event_stop", "=", "None", ",", "assume_sorted", "=", "True", ")", ":", "logging", ".", "debug", "(", "\"Calculate data of the the given event range [\"", "+", "str", "(", "event...
Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[ Parameters ---------- array : numpy.array event_start : int, None event_stop : int, None assume_sorted : bool Set to true if the hits are sorted by the event_number. Increases speed. ...
[ "Selects", "the", "data", "(", "rows", "of", "a", "table", ")", "that", "occurred", "in", "the", "given", "event", "range", "[", "event_start", "event_stop", "[" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L862-L903
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
write_hits_in_events
def write_hits_in_events(hit_table_in, hit_table_out, events, start_hit_word=0, chunk_size=5000000, condition=None): '''Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be used if the get_hits_in_events function raises a memory error. ...
python
def write_hits_in_events(hit_table_in, hit_table_out, events, start_hit_word=0, chunk_size=5000000, condition=None): '''Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be used if the get_hits_in_events function raises a memory error. ...
[ "def", "write_hits_in_events", "(", "hit_table_in", ",", "hit_table_out", ",", "events", ",", "start_hit_word", "=", "0", ",", "chunk_size", "=", "5000000", ",", "condition", "=", "None", ")", ":", "if", "len", "(", "events", ")", ">", "0", ":", "# needed ...
Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be used if the get_hits_in_events function raises a memory error. Also a condition can be set to select hits. Parameters ---------- hit_table_in : pytable.table hit_table_ou...
[ "Selects", "the", "hits", "that", "occurred", "in", "events", "and", "writes", "them", "to", "a", "pytable", ".", "This", "function", "reduces", "the", "in", "RAM", "operations", "and", "has", "to", "be", "used", "if", "the", "get_hits_in_events", "function"...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L906-L941
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
write_hits_in_event_range
def write_hits_in_event_range(hit_table_in, hit_table_out, event_start=None, event_stop=None, start_hit_word=0, chunk_size=5000000, condition=None): '''Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM operations and ha...
python
def write_hits_in_event_range(hit_table_in, hit_table_out, event_start=None, event_stop=None, start_hit_word=0, chunk_size=5000000, condition=None): '''Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM operations and ha...
[ "def", "write_hits_in_event_range", "(", "hit_table_in", ",", "hit_table_out", ",", "event_start", "=", "None", ",", "event_stop", "=", "None", ",", "start_hit_word", "=", "0", ",", "chunk_size", "=", "5000000", ",", "condition", "=", "None", ")", ":", "loggin...
Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM operations and has to be used if the get_data_in_event_range function raises a memory error. Also a condition can be set to select hits. Parameters ---------- h...
[ "Selects", "the", "hits", "that", "occurred", "in", "given", "event", "range", "[", "event_start", "event_stop", "[", "and", "write", "them", "to", "a", "pytable", ".", "This", "function", "reduces", "the", "in", "RAM", "operations", "and", "has", "to", "b...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L944-L979
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_events_with_n_cluster
def get_events_with_n_cluster(event_number, condition='n_cluster==1'): '''Selects the events with a certain number of cluster. Parameters ---------- event_number : numpy.array Returns ------- numpy.array ''' logging.debug("Calculate events with clusters where " + condition) n_...
python
def get_events_with_n_cluster(event_number, condition='n_cluster==1'): '''Selects the events with a certain number of cluster. Parameters ---------- event_number : numpy.array Returns ------- numpy.array ''' logging.debug("Calculate events with clusters where " + condition) n_...
[ "def", "get_events_with_n_cluster", "(", "event_number", ",", "condition", "=", "'n_cluster==1'", ")", ":", "logging", ".", "debug", "(", "\"Calculate events with clusters where \"", "+", "condition", ")", "n_cluster_in_events", "=", "analysis_utils", ".", "get_n_cluster_...
Selects the events with a certain number of cluster. Parameters ---------- event_number : numpy.array Returns ------- numpy.array
[ "Selects", "the", "events", "with", "a", "certain", "number", "of", "cluster", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L982-L998
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_events_with_cluster_size
def get_events_with_cluster_size(event_number, cluster_size, condition='cluster_size==1'): '''Selects the events with cluster of a given cluster size. Parameters ---------- event_number : numpy.array cluster_size : numpy.array condition : string Returns ------- numpy.array ''' ...
python
def get_events_with_cluster_size(event_number, cluster_size, condition='cluster_size==1'): '''Selects the events with cluster of a given cluster size. Parameters ---------- event_number : numpy.array cluster_size : numpy.array condition : string Returns ------- numpy.array ''' ...
[ "def", "get_events_with_cluster_size", "(", "event_number", ",", "cluster_size", ",", "condition", "=", "'cluster_size==1'", ")", ":", "logging", ".", "debug", "(", "\"Calculate events with clusters with \"", "+", "condition", ")", "return", "np", ".", "unique", "(", ...
Selects the events with cluster of a given cluster size. Parameters ---------- event_number : numpy.array cluster_size : numpy.array condition : string Returns ------- numpy.array
[ "Selects", "the", "events", "with", "cluster", "of", "a", "given", "cluster", "size", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1001-L1016
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_events_with_error_code
def get_events_with_error_code(event_number, event_status, select_mask=0b1111111111111111, condition=0b0000000000000000): '''Selects the events with a certain error code. Parameters ---------- event_number : numpy.array event_status : numpy.array select_mask : int The mask that selects ...
python
def get_events_with_error_code(event_number, event_status, select_mask=0b1111111111111111, condition=0b0000000000000000): '''Selects the events with a certain error code. Parameters ---------- event_number : numpy.array event_status : numpy.array select_mask : int The mask that selects ...
[ "def", "get_events_with_error_code", "(", "event_number", ",", "event_status", ",", "select_mask", "=", "0b1111111111111111", ",", "condition", "=", "0b0000000000000000", ")", ":", "logging", ".", "debug", "(", "\"Calculate events with certain error code\"", ")", "return"...
Selects the events with a certain error code. Parameters ---------- event_number : numpy.array event_status : numpy.array select_mask : int The mask that selects the event error code to check. condition : int The value the selected event error code should have. Returns ...
[ "Selects", "the", "events", "with", "a", "certain", "error", "code", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1019-L1037
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_scan_parameter
def get_scan_parameter(meta_data_array, unique=True): '''Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary Parameters ---------- meta_data_array : numpy.ndarray unique: boolean If true only unique values for each scan para...
python
def get_scan_parameter(meta_data_array, unique=True): '''Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary Parameters ---------- meta_data_array : numpy.ndarray unique: boolean If true only unique values for each scan para...
[ "def", "get_scan_parameter", "(", "meta_data_array", ",", "unique", "=", "True", ")", ":", "try", ":", "last_not_parameter_column", "=", "meta_data_array", ".", "dtype", ".", "names", ".", "index", "(", "'error_code'", ")", "# for interpreted meta_data", "except", ...
Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary Parameters ---------- meta_data_array : numpy.ndarray unique: boolean If true only unique values for each scan parameter are returned Returns ------- python.dict{s...
[ "Takes", "the", "numpy", "meta", "data", "array", "and", "returns", "the", "different", "scan", "parameter", "settings", "and", "the", "name", "aligned", "in", "a", "dictionary" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1040-L1064
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_scan_parameters_table_from_meta_data
def get_scan_parameters_table_from_meta_data(meta_data_array, scan_parameters=None): '''Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data . Parameters ---------- meta_data_array : numpy.ndarray The array with the scan pa...
python
def get_scan_parameters_table_from_meta_data(meta_data_array, scan_parameters=None): '''Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data . Parameters ---------- meta_data_array : numpy.ndarray The array with the scan pa...
[ "def", "get_scan_parameters_table_from_meta_data", "(", "meta_data_array", ",", "scan_parameters", "=", "None", ")", ":", "if", "scan_parameters", "is", "None", ":", "try", ":", "last_not_parameter_column", "=", "meta_data_array", ".", "dtype", ".", "names", ".", "i...
Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data . Parameters ---------- meta_data_array : numpy.ndarray The array with the scan parameters. scan_parameters : list of strings The name of the scan parameters to t...
[ "Takes", "the", "meta", "data", "array", "and", "returns", "the", "scan", "parameter", "values", "as", "a", "view", "of", "a", "numpy", "array", "only", "containing", "the", "parameter", "data", ".", "Parameters", "----------", "meta_data_array", ":", "numpy",...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1067-L1095
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_scan_parameters_index
def get_scan_parameters_index(scan_parameter): '''Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations. Parameters ---------- scan_parameter : numpy.ndarray The table with the scan parameters. Returns ------- numpy.Histogr...
python
def get_scan_parameters_index(scan_parameter): '''Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations. Parameters ---------- scan_parameter : numpy.ndarray The table with the scan parameters. Returns ------- numpy.Histogr...
[ "def", "get_scan_parameters_index", "(", "scan_parameter", ")", ":", "_", ",", "index", "=", "np", ".", "unique", "(", "scan_parameter", ",", "return_index", "=", "True", ")", "index", "=", "np", ".", "sort", "(", "index", ")", "values", "=", "np", ".", ...
Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations. Parameters ---------- scan_parameter : numpy.ndarray The table with the scan parameters. Returns ------- numpy.Histogram
[ "Takes", "the", "scan", "parameter", "array", "and", "creates", "a", "scan", "parameter", "index", "labeling", "the", "unique", "scan", "parameter", "combinations", ".", "Parameters", "----------", "scan_parameter", ":", "numpy", ".", "ndarray", "The", "table", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1098-L1114
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_unique_scan_parameter_combinations
def get_unique_scan_parameter_combinations(meta_data_array, scan_parameters=None, scan_parameter_columns_only=False): '''Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters. If selected columns only is true, the ...
python
def get_unique_scan_parameter_combinations(meta_data_array, scan_parameters=None, scan_parameter_columns_only=False): '''Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters. If selected columns only is true, the ...
[ "def", "get_unique_scan_parameter_combinations", "(", "meta_data_array", ",", "scan_parameters", "=", "None", ",", "scan_parameter_columns_only", "=", "False", ")", ":", "try", ":", "last_not_parameter_column", "=", "meta_data_array", ".", "dtype", ".", "names", ".", ...
Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters. If selected columns only is true, the returned histogram only contains the selected columns. Parameters ---------- meta_data_array : numpy.ndarray ...
[ "Takes", "the", "numpy", "meta", "data", "array", "and", "returns", "the", "first", "rows", "with", "unique", "combinations", "of", "different", "scan", "parameter", "values", "for", "selected", "scan", "parameters", ".", "If", "selected", "columns", "only", "...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1117-L1149
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
data_aligned_at_events
def data_aligned_at_events(table, start_event_number=None, stop_event_number=None, start_index=None, stop_index=None, chunk_size=10000000, try_speedup=False, first_event_aligned=True, fail_on_missing_events=True): '''Takes the table with a event_number column and returns chunks with the size up to chunk_size. The c...
python
def data_aligned_at_events(table, start_event_number=None, stop_event_number=None, start_index=None, stop_index=None, chunk_size=10000000, try_speedup=False, first_event_aligned=True, fail_on_missing_events=True): '''Takes the table with a event_number column and returns chunks with the size up to chunk_size. The c...
[ "def", "data_aligned_at_events", "(", "table", ",", "start_event_number", "=", "None", ",", "stop_event_number", "=", "None", ",", "start_index", "=", "None", ",", "stop_index", "=", "None", ",", "chunk_size", "=", "10000000", ",", "try_speedup", "=", "False", ...
Takes the table with a event_number column and returns chunks with the size up to chunk_size. The chunks are chosen in a way that the events are not splitted. Additional parameters can be set to increase the readout speed. Events between a certain range can be selected. Also the start and the stop indices limit...
[ "Takes", "the", "table", "with", "a", "event_number", "column", "and", "returns", "chunks", "with", "the", "size", "up", "to", "chunk_size", ".", "The", "chunks", "are", "chosen", "in", "a", "way", "that", "the", "events", "are", "not", "splitted", ".", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1160-L1320
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
select_good_pixel_region
def select_good_pixel_region(hits, col_span, row_span, min_cut_threshold=0.2, max_cut_threshold=2.0): '''Takes the hit array and masks all pixels with a certain occupancy. Parameters ---------- hits : array like If dim > 2 the additional dimensions are summed up. min_cut_threshold : float ...
python
def select_good_pixel_region(hits, col_span, row_span, min_cut_threshold=0.2, max_cut_threshold=2.0): '''Takes the hit array and masks all pixels with a certain occupancy. Parameters ---------- hits : array like If dim > 2 the additional dimensions are summed up. min_cut_threshold : float ...
[ "def", "select_good_pixel_region", "(", "hits", ",", "col_span", ",", "row_span", ",", "min_cut_threshold", "=", "0.2", ",", "max_cut_threshold", "=", "2.0", ")", ":", "hits", "=", "np", ".", "sum", "(", "hits", ",", "axis", "=", "(", "-", "1", ")", ")...
Takes the hit array and masks all pixels with a certain occupancy. Parameters ---------- hits : array like If dim > 2 the additional dimensions are summed up. min_cut_threshold : float A number to specify the minimum threshold, which pixel to take. Pixels are masked if occupancy...
[ "Takes", "the", "hit", "array", "and", "masks", "all", "pixels", "with", "a", "certain", "occupancy", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1323-L1353
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_hit_rate_correction
def get_hit_rate_correction(gdacs, calibration_gdacs, cluster_size_histogram): '''Calculates a correction factor for single hit clusters at the given GDACs from the cluster_size_histogram via cubic interpolation. Parameters ---------- gdacs : array like The GDAC settings where the threshold sho...
python
def get_hit_rate_correction(gdacs, calibration_gdacs, cluster_size_histogram): '''Calculates a correction factor for single hit clusters at the given GDACs from the cluster_size_histogram via cubic interpolation. Parameters ---------- gdacs : array like The GDAC settings where the threshold sho...
[ "def", "get_hit_rate_correction", "(", "gdacs", ",", "calibration_gdacs", ",", "cluster_size_histogram", ")", ":", "logging", ".", "info", "(", "'Calculate the correction factor for the single hit cluster rate at %d given GDAC settings'", ",", "len", "(", "gdacs", ")", ")", ...
Calculates a correction factor for single hit clusters at the given GDACs from the cluster_size_histogram via cubic interpolation. Parameters ---------- gdacs : array like The GDAC settings where the threshold should be determined from the calibration calibration_gdacs : array like GDAC...
[ "Calculates", "a", "correction", "factor", "for", "single", "hit", "clusters", "at", "the", "given", "GDACs", "from", "the", "cluster_size_histogram", "via", "cubic", "interpolation", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1356-L1385
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_mean_threshold_from_calibration
def get_mean_threshold_from_calibration(gdac, mean_threshold_calibration): '''Calculates the mean threshold from the threshold calibration at the given gdac settings. If the given gdac value was not used during caluibration the value is determined by interpolation. Parameters ---------- gdacs : arr...
python
def get_mean_threshold_from_calibration(gdac, mean_threshold_calibration): '''Calculates the mean threshold from the threshold calibration at the given gdac settings. If the given gdac value was not used during caluibration the value is determined by interpolation. Parameters ---------- gdacs : arr...
[ "def", "get_mean_threshold_from_calibration", "(", "gdac", ",", "mean_threshold_calibration", ")", ":", "interpolation", "=", "interp1d", "(", "mean_threshold_calibration", "[", "'parameter_value'", "]", ",", "mean_threshold_calibration", "[", "'mean_threshold'", "]", ",", ...
Calculates the mean threshold from the threshold calibration at the given gdac settings. If the given gdac value was not used during caluibration the value is determined by interpolation. Parameters ---------- gdacs : array like The GDAC settings where the threshold should be determined from th...
[ "Calculates", "the", "mean", "threshold", "from", "the", "threshold", "calibration", "at", "the", "given", "gdac", "settings", ".", "If", "the", "given", "gdac", "value", "was", "not", "used", "during", "caluibration", "the", "value", "is", "determined", "by",...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1388-L1405
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_pixel_thresholds_from_calibration_array
def get_pixel_thresholds_from_calibration_array(gdacs, calibration_gdacs, threshold_calibration_array, bounds_error=True): '''Calculates the threshold for all pixels in threshold_calibration_array at the given GDAC settings via linear interpolation. The GDAC settings used during calibration have to be given. P...
python
def get_pixel_thresholds_from_calibration_array(gdacs, calibration_gdacs, threshold_calibration_array, bounds_error=True): '''Calculates the threshold for all pixels in threshold_calibration_array at the given GDAC settings via linear interpolation. The GDAC settings used during calibration have to be given. P...
[ "def", "get_pixel_thresholds_from_calibration_array", "(", "gdacs", ",", "calibration_gdacs", ",", "threshold_calibration_array", ",", "bounds_error", "=", "True", ")", ":", "if", "len", "(", "calibration_gdacs", ")", "!=", "threshold_calibration_array", ".", "shape", "...
Calculates the threshold for all pixels in threshold_calibration_array at the given GDAC settings via linear interpolation. The GDAC settings used during calibration have to be given. Parameters ---------- gdacs : array like The GDAC settings where the threshold should be determined from the calibr...
[ "Calculates", "the", "threshold", "for", "all", "pixels", "in", "threshold_calibration_array", "at", "the", "given", "GDAC", "settings", "via", "linear", "interpolation", ".", "The", "GDAC", "settings", "used", "during", "calibration", "have", "to", "be", "given",...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1408-L1428
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_n_cluster_per_event_hist
def get_n_cluster_per_event_hist(cluster_table): '''Calculates the number of cluster in every event. Parameters ---------- cluster_table : pytables.table Returns ------- numpy.Histogram ''' logging.info("Histogram number of cluster per event") cluster_in_events = analysis_utils...
python
def get_n_cluster_per_event_hist(cluster_table): '''Calculates the number of cluster in every event. Parameters ---------- cluster_table : pytables.table Returns ------- numpy.Histogram ''' logging.info("Histogram number of cluster per event") cluster_in_events = analysis_utils...
[ "def", "get_n_cluster_per_event_hist", "(", "cluster_table", ")", ":", "logging", ".", "info", "(", "\"Histogram number of cluster per event\"", ")", "cluster_in_events", "=", "analysis_utils", ".", "get_n_cluster_in_events", "(", "cluster_table", ")", "[", ":", ",", "1...
Calculates the number of cluster in every event. Parameters ---------- cluster_table : pytables.table Returns ------- numpy.Histogram
[ "Calculates", "the", "number", "of", "cluster", "in", "every", "event", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1470-L1483
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
get_data_statistics
def get_data_statistics(interpreted_files): '''Quick and dirty function to give as redmine compatible iverview table ''' print '| *File Name* | *File Size* | *Times Stamp* | *Events* | *Bad Events* | *Measurement time* | *# SR* | *Hits* |' # Mean Tot | Mean rel. BCID' for interpreted_file in interprete...
python
def get_data_statistics(interpreted_files): '''Quick and dirty function to give as redmine compatible iverview table ''' print '| *File Name* | *File Size* | *Times Stamp* | *Events* | *Bad Events* | *Measurement time* | *# SR* | *Hits* |' # Mean Tot | Mean rel. BCID' for interpreted_file in interprete...
[ "def", "get_data_statistics", "(", "interpreted_files", ")", ":", "print", "'| *File Name* | *File Size* | *Times Stamp* | *Events* | *Bad Events* | *Measurement time* | *# SR* | *Hits* |'", "# Mean Tot | Mean rel. BCID'", "for", "interpreted_file", "in", "interpreted_files", ":", "with"...
Quick and dirty function to give as redmine compatible iverview table
[ "Quick", "and", "dirty", "function", "to", "give", "as", "redmine", "compatible", "iverview", "table" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1486-L1503
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
contiguous_regions
def contiguous_regions(condition): """Finds contiguous True regions of the boolean array "condition". Returns a 2D array where the first column is the start index of the region and the second column is the end index. http://stackoverflow.com/questions/4494404/find-large-number-of-consecutive-values-fulf...
python
def contiguous_regions(condition): """Finds contiguous True regions of the boolean array "condition". Returns a 2D array where the first column is the start index of the region and the second column is the end index. http://stackoverflow.com/questions/4494404/find-large-number-of-consecutive-values-fulf...
[ "def", "contiguous_regions", "(", "condition", ")", ":", "# Find the indicies of changes in \"condition\"", "d", "=", "np", ".", "diff", "(", "condition", ",", "n", "=", "1", ")", "idx", ",", "=", "d", ".", "nonzero", "(", ")", "# We need to start things after t...
Finds contiguous True regions of the boolean array "condition". Returns a 2D array where the first column is the start index of the region and the second column is the end index. http://stackoverflow.com/questions/4494404/find-large-number-of-consecutive-values-fulfilling-condition-in-a-numpy-array
[ "Finds", "contiguous", "True", "regions", "of", "the", "boolean", "array", "condition", ".", "Returns", "a", "2D", "array", "where", "the", "first", "column", "is", "the", "start", "index", "of", "the", "region", "and", "the", "second", "column", "is", "th...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1519-L1543
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
check_bad_data
def check_bad_data(raw_data, prepend_data_headers=None, trig_count=None): """Checking FEI4 raw data array for corrupted data. """ consecutive_triggers = 16 if trig_count == 0 else trig_count is_fe_data_header = logical_and(is_fe_word, is_data_header) trigger_idx = np.where(is_trigger_word(raw_data) ...
python
def check_bad_data(raw_data, prepend_data_headers=None, trig_count=None): """Checking FEI4 raw data array for corrupted data. """ consecutive_triggers = 16 if trig_count == 0 else trig_count is_fe_data_header = logical_and(is_fe_word, is_data_header) trigger_idx = np.where(is_trigger_word(raw_data) ...
[ "def", "check_bad_data", "(", "raw_data", ",", "prepend_data_headers", "=", "None", ",", "trig_count", "=", "None", ")", ":", "consecutive_triggers", "=", "16", "if", "trig_count", "==", "0", "else", "trig_count", "is_fe_data_header", "=", "logical_and", "(", "i...
Checking FEI4 raw data array for corrupted data.
[ "Checking", "FEI4", "raw", "data", "array", "for", "corrupted", "data", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1546-L1605
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
consecutive
def consecutive(data, stepsize=1): """Converts array into chunks with consecutive elements of given step size. http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy """ return np.split(data, np.where(np.diff(data) != stepsize)[0] + 1)
python
def consecutive(data, stepsize=1): """Converts array into chunks with consecutive elements of given step size. http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy """ return np.split(data, np.where(np.diff(data) != stepsize)[0] + 1)
[ "def", "consecutive", "(", "data", ",", "stepsize", "=", "1", ")", ":", "return", "np", ".", "split", "(", "data", ",", "np", ".", "where", "(", "np", ".", "diff", "(", "data", ")", "!=", "stepsize", ")", "[", "0", "]", "+", "1", ")" ]
Converts array into chunks with consecutive elements of given step size. http://stackoverflow.com/questions/7352684/how-to-find-the-groups-of-consecutive-elements-from-an-array-in-numpy
[ "Converts", "array", "into", "chunks", "with", "consecutive", "elements", "of", "given", "step", "size", ".", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "7352684", "/", "how", "-", "to", "-", "find", "-", "the", "-", "groups",...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1608-L1612
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
print_raw_data_file
def print_raw_data_file(input_file, start_index=0, limit=200, flavor='fei4b', select=None, tdc_trig_dist=False, trigger_data_mode=0, meta_data_v2=True): """Printing FEI4 data from raw data file for debugging. """ with tb.open_file(input_file + '.h5', mode="r") as file_h5: if meta_data_v2: ...
python
def print_raw_data_file(input_file, start_index=0, limit=200, flavor='fei4b', select=None, tdc_trig_dist=False, trigger_data_mode=0, meta_data_v2=True): """Printing FEI4 data from raw data file for debugging. """ with tb.open_file(input_file + '.h5', mode="r") as file_h5: if meta_data_v2: ...
[ "def", "print_raw_data_file", "(", "input_file", ",", "start_index", "=", "0", ",", "limit", "=", "200", ",", "flavor", "=", "'fei4b'", ",", "select", "=", "None", ",", "tdc_trig_dist", "=", "False", ",", "trigger_data_mode", "=", "0", ",", "meta_data_v2", ...
Printing FEI4 data from raw data file for debugging.
[ "Printing", "FEI4", "data", "from", "raw", "data", "file", "for", "debugging", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1615-L1632
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
print_raw_data
def print_raw_data(raw_data, start_index=0, limit=200, flavor='fei4b', index_offset=0, select=None, tdc_trig_dist=False, trigger_data_mode=0): """Printing FEI4 raw data array for debugging. """ if not select: select = ['DH', 'TW', "AR", "VR", "SR", "DR", 'TDC', 'UNKNOWN FE WORD', 'UNKNOWN WORD'] ...
python
def print_raw_data(raw_data, start_index=0, limit=200, flavor='fei4b', index_offset=0, select=None, tdc_trig_dist=False, trigger_data_mode=0): """Printing FEI4 raw data array for debugging. """ if not select: select = ['DH', 'TW', "AR", "VR", "SR", "DR", 'TDC', 'UNKNOWN FE WORD', 'UNKNOWN WORD'] ...
[ "def", "print_raw_data", "(", "raw_data", ",", "start_index", "=", "0", ",", "limit", "=", "200", ",", "flavor", "=", "'fei4b'", ",", "index_offset", "=", "0", ",", "select", "=", "None", ",", "tdc_trig_dist", "=", "False", ",", "trigger_data_mode", "=", ...
Printing FEI4 raw data array for debugging.
[ "Printing", "FEI4", "raw", "data", "array", "for", "debugging", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1635-L1648
train
SiLab-Bonn/pyBAR
pybar/analysis/analysis_utils.py
ETA.update
def update(self, pbar): 'Updates the widget to show the ETA or total time when finished.' self.n_refresh += 1 if pbar.currval == 0: return 'ETA: --:--:--' elif pbar.finished: return 'Time: %s' % self.format_time(pbar.seconds_elapsed) else: ela...
python
def update(self, pbar): 'Updates the widget to show the ETA or total time when finished.' self.n_refresh += 1 if pbar.currval == 0: return 'ETA: --:--:--' elif pbar.finished: return 'Time: %s' % self.format_time(pbar.seconds_elapsed) else: ela...
[ "def", "update", "(", "self", ",", "pbar", ")", ":", "self", ".", "n_refresh", "+=", "1", "if", "pbar", ".", "currval", "==", "0", ":", "return", "'ETA: --:--:--'", "elif", "pbar", ".", "finished", ":", "return", "'Time: %s'", "%", "self", ".", "forma...
Updates the widget to show the ETA or total time when finished.
[ "Updates", "the", "widget", "to", "show", "the", "ETA", "or", "total", "time", "when", "finished", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1442-L1467
train
SiLab-Bonn/pyBAR
pybar/scans/analyze_source_scan_gdac_data.py
plot_result
def plot_result(x_p, y_p, y_p_e, smoothed_data, smoothed_data_diff, filename=None): ''' Fit spline to the profile histogramed data, differentiate, determine MPV and plot. Parameters ---------- x_p, y_p : array like data points (x,y) y_p_e : array like error bars in y...
python
def plot_result(x_p, y_p, y_p_e, smoothed_data, smoothed_data_diff, filename=None): ''' Fit spline to the profile histogramed data, differentiate, determine MPV and plot. Parameters ---------- x_p, y_p : array like data points (x,y) y_p_e : array like error bars in y...
[ "def", "plot_result", "(", "x_p", ",", "y_p", ",", "y_p_e", ",", "smoothed_data", ",", "smoothed_data_diff", ",", "filename", "=", "None", ")", ":", "logging", ".", "info", "(", "'Plot results'", ")", "plt", ".", "close", "(", ")", "p1", "=", "plt", "....
Fit spline to the profile histogramed data, differentiate, determine MPV and plot. Parameters ---------- x_p, y_p : array like data points (x,y) y_p_e : array like error bars in y
[ "Fit", "spline", "to", "the", "profile", "histogramed", "data", "differentiate", "determine", "MPV", "and", "plot", ".", "Parameters", "----------", "x_p", "y_p", ":", "array", "like", "data", "points", "(", "x", "y", ")", "y_p_e", ":", "array", "like", "e...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_source_scan_gdac_data.py#L77-L106
train
SiLab-Bonn/pyBAR
pybar/scans/calibrate_hit_or.py
create_hitor_calibration
def create_hitor_calibration(output_filename, plot_pixel_calibrations=False): '''Generating HitOr calibration file (_calibration.h5) from raw data file and plotting of calibration data. Parameters ---------- output_filename : string Input raw data file name. plot_pixel_calibrations :...
python
def create_hitor_calibration(output_filename, plot_pixel_calibrations=False): '''Generating HitOr calibration file (_calibration.h5) from raw data file and plotting of calibration data. Parameters ---------- output_filename : string Input raw data file name. plot_pixel_calibrations :...
[ "def", "create_hitor_calibration", "(", "output_filename", ",", "plot_pixel_calibrations", "=", "False", ")", ":", "logging", ".", "info", "(", "'Analyze HitOR calibration data and plot results of %s'", ",", "output_filename", ")", "with", "AnalyzeRawData", "(", "raw_data_f...
Generating HitOr calibration file (_calibration.h5) from raw data file and plotting of calibration data. Parameters ---------- output_filename : string Input raw data file name. plot_pixel_calibrations : bool, iterable If True, genearating additional pixel calibration plots. If l...
[ "Generating", "HitOr", "calibration", "file", "(", "_calibration", ".", "h5", ")", "from", "raw", "data", "file", "and", "plotting", "of", "calibration", "data", ".", "Parameters", "----------", "output_filename", ":", "string", "Input", "raw", "data", "file", ...
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/calibrate_hit_or.py#L20-L148
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
interval_timed
def interval_timed(interval): '''Interval timer decorator. Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256 ''' def decorator(f): @wraps(f) def wrapper(*args, **kwargs): stopped = Event() def...
python
def interval_timed(interval): '''Interval timer decorator. Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256 ''' def decorator(f): @wraps(f) def wrapper(*args, **kwargs): stopped = Event() def...
[ "def", "interval_timed", "(", "interval", ")", ":", "def", "decorator", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "stopped", "=", "Event", "(", ")", "def", "loop", "(",...
Interval timer decorator. Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256
[ "Interval", "timer", "decorator", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1423-L1442
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
interval_timer
def interval_timer(interval, func, *args, **kwargs): '''Interval timer function. Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708 ''' stopped = Event() def loop(): while not stopped.wait(interval): # the first call is after interval ...
python
def interval_timer(interval, func, *args, **kwargs): '''Interval timer function. Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708 ''' stopped = Event() def loop(): while not stopped.wait(interval): # the first call is after interval ...
[ "def", "interval_timer", "(", "interval", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "stopped", "=", "Event", "(", ")", "def", "loop", "(", ")", ":", "while", "not", "stopped", ".", "wait", "(", "interval", ")", ":", "# the f...
Interval timer function. Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708
[ "Interval", "timer", "function", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1445-L1457
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
send_mail
def send_mail(subject, body, smtp_server, user, password, from_addr, to_addrs): ''' Sends a run status mail with the traceback to a specified E-Mail address if a run crashes. ''' logging.info('Send status E-Mail (' + subject + ')') content = string.join(( "From: %s" % from_addr, "To: %s"...
python
def send_mail(subject, body, smtp_server, user, password, from_addr, to_addrs): ''' Sends a run status mail with the traceback to a specified E-Mail address if a run crashes. ''' logging.info('Send status E-Mail (' + subject + ')') content = string.join(( "From: %s" % from_addr, "To: %s"...
[ "def", "send_mail", "(", "subject", ",", "body", ",", "smtp_server", ",", "user", ",", "password", ",", "from_addr", ",", "to_addrs", ")", ":", "logging", ".", "info", "(", "'Send status E-Mail ('", "+", "subject", "+", "')'", ")", "content", "=", "string"...
Sends a run status mail with the traceback to a specified E-Mail address if a run crashes.
[ "Sends", "a", "run", "status", "mail", "with", "the", "traceback", "to", "a", "specified", "E", "-", "Mail", "address", "if", "a", "run", "crashes", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1493-L1507
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase._parse_module_cfgs
def _parse_module_cfgs(self): ''' Extracts the configuration of the modules. ''' # Adding here default run config parameters. if "dut" not in self._conf or self._conf["dut"] is None: raise ValueError('Parameter "dut" not defined.') if "dut_configuration" not in self._...
python
def _parse_module_cfgs(self): ''' Extracts the configuration of the modules. ''' # Adding here default run config parameters. if "dut" not in self._conf or self._conf["dut"] is None: raise ValueError('Parameter "dut" not defined.') if "dut_configuration" not in self._...
[ "def", "_parse_module_cfgs", "(", "self", ")", ":", "# Adding here default run config parameters.", "if", "\"dut\"", "not", "in", "self", ".", "_conf", "or", "self", ".", "_conf", "[", "\"dut\"", "]", "is", "None", ":", "raise", "ValueError", "(", "'Parameter \"...
Extracts the configuration of the modules.
[ "Extracts", "the", "configuration", "of", "the", "modules", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L175-L219
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase._set_default_cfg
def _set_default_cfg(self): ''' Sets the default parameters if they are not specified. ''' # adding special conf for accessing all DUT drivers self._module_cfgs[None] = { 'flavor': None, 'chip_address': None, 'FIFO': list(set([self._module_cfgs[module_...
python
def _set_default_cfg(self): ''' Sets the default parameters if they are not specified. ''' # adding special conf for accessing all DUT drivers self._module_cfgs[None] = { 'flavor': None, 'chip_address': None, 'FIFO': list(set([self._module_cfgs[module_...
[ "def", "_set_default_cfg", "(", "self", ")", ":", "# adding special conf for accessing all DUT drivers", "self", ".", "_module_cfgs", "[", "None", "]", "=", "{", "'flavor'", ":", "None", ",", "'chip_address'", ":", "None", ",", "'FIFO'", ":", "list", "(", "set",...
Sets the default parameters if they are not specified.
[ "Sets", "the", "default", "parameters", "if", "they", "are", "not", "specified", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L265-L323
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase.init_modules
def init_modules(self): ''' Initialize all modules consecutively''' for module_id, module_cfg in self._module_cfgs.items(): if module_id in self._modules or module_id in self._tx_module_groups: if module_id in self._modules: module_id_str = "module " + mod...
python
def init_modules(self): ''' Initialize all modules consecutively''' for module_id, module_cfg in self._module_cfgs.items(): if module_id in self._modules or module_id in self._tx_module_groups: if module_id in self._modules: module_id_str = "module " + mod...
[ "def", "init_modules", "(", "self", ")", ":", "for", "module_id", ",", "module_cfg", "in", "self", ".", "_module_cfgs", ".", "items", "(", ")", ":", "if", "module_id", "in", "self", ".", "_modules", "or", "module_id", "in", "self", ".", "_tx_module_groups"...
Initialize all modules consecutively
[ "Initialize", "all", "modules", "consecutively" ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L466-L563
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase.do_run
def do_run(self): ''' Start runs on all modules sequentially. Sets properties to access current module properties. ''' if self.broadcast_commands: # Broadcast FE commands if self.threaded_scan: with ExitStack() as restore_config_stack: # ...
python
def do_run(self): ''' Start runs on all modules sequentially. Sets properties to access current module properties. ''' if self.broadcast_commands: # Broadcast FE commands if self.threaded_scan: with ExitStack() as restore_config_stack: # ...
[ "def", "do_run", "(", "self", ")", ":", "if", "self", ".", "broadcast_commands", ":", "# Broadcast FE commands", "if", "self", ".", "threaded_scan", ":", "with", "ExitStack", "(", ")", "as", "restore_config_stack", ":", "# Configure each FE individually", "# Sort mo...
Start runs on all modules sequentially. Sets properties to access current module properties.
[ "Start", "runs", "on", "all", "modules", "sequentially", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L660-L830
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase.close
def close(self): '''Releasing hardware resources. ''' try: self.dut.close() except Exception: logging.warning('Closing DUT was not successful') else: logging.debug('Closed DUT')
python
def close(self): '''Releasing hardware resources. ''' try: self.dut.close() except Exception: logging.warning('Closing DUT was not successful') else: logging.debug('Closed DUT')
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "dut", ".", "close", "(", ")", "except", "Exception", ":", "logging", ".", "warning", "(", "'Closing DUT was not successful'", ")", "else", ":", "logging", ".", "debug", "(", "'Closed DUT'", ...
Releasing hardware resources.
[ "Releasing", "hardware", "resources", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L858-L866
train
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase.handle_data
def handle_data(self, data, new_file=False, flush=True): '''Handling of the data. Parameters ---------- data : list, tuple Data tuple of the format (data (np.array), last_time (float), curr_time (float), status (int)) ''' for i, module_id in enumerate(self._s...
python
def handle_data(self, data, new_file=False, flush=True): '''Handling of the data. Parameters ---------- data : list, tuple Data tuple of the format (data (np.array), last_time (float), curr_time (float), status (int)) ''' for i, module_id in enumerate(self._s...
[ "def", "handle_data", "(", "self", ",", "data", ",", "new_file", "=", "False", ",", "flush", "=", "True", ")", ":", "for", "i", ",", "module_id", "in", "enumerate", "(", "self", ".", "_selected_modules", ")", ":", "if", "data", "[", "i", "]", "is", ...
Handling of the data. Parameters ---------- data : list, tuple Data tuple of the format (data (np.array), last_time (float), curr_time (float), status (int))
[ "Handling", "of", "the", "data", "." ]
5ad95bbcd41cd358825823fb78f396cfce23593e
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L868-L879
train