text stringlengths 81 112k |
|---|
override asyncio.Protocol
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.str... |
override _SiriDBProtocol
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: {})'
... |
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.
def _register_server(self, server, timeout=30):
'''Register a new SiriDB Server.
This method is used by the SiriDB manage too... |
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.
def _get_file(self, fn, timeout=30):
'''Request a SiriDB configuration file.
This method is used by the SiriDB manage ... |
Convert GeoHash bits to a 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 |
Convert a float to a list of GeoHash 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(... |
Convert a GeoHash to a list of GeoHash 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 |
Convert a list of GeoHash bits to a 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 ri... |
Decode a geohash. Returns a (lon,lat) pair.
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 (
... |
Encode a (lon,lat) pair to a GeoHash.
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_t... |
Return the adjacent geohash for a given direction.
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... |
Return all neighboring geohashes.
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'... |
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 thunkify(thread_name=None, daemon=True, default_func=None):
'''Make a function immediate... |
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... |
Run name without whitespace
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() |
Configuration (namedtuple)
def conf(self):
'''Configuration (namedtuple)
'''
conf = namedtuple('conf', field_names=self._conf.keys())
return conf(**self._conf) |
Run configuration (namedtuple)
def run_conf(self):
'''Run configuration (namedtuple)
'''
run_conf = namedtuple('run_conf', field_names=self._run_conf.keys())
return run_conf(**self._run_conf) |
Default run configuration (namedtuple)
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) |
Initialization before a new run.
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... |
Run given functions when a run is cancelled.
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)):... |
Cancelling a run.
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) |
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.
def stop(self, msg=None):
'''Stopping a run. Control for loops. Gentle stop/abort.
This event should provide a more gentle ab... |
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.
def abort(self, msg=None):
'''Aborting a run. Control for loops. Immediate stop/abort.
The implementation should stop a run ASAP when th... |
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 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... |
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 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 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
... |
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 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... |
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... |
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... |
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... |
Interprets raw data from Tektronix
returns: lists of x, y values in seconds/volt
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 ... |
Reading Chip S/N
Note
----
Bits [MSB-LSB] | [15] | [14-6] | [5-0]
Content | reserved | wafer number | chip number
def read_chip_sn(self):
'''Reading Chip S/N
Note
----
Bits [MSB-LSB] | [15] | [14-6] | [5-0]
Content | reserved | ... |
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
def read_global_register(sel... |
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, ...).
... |
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.
def is_fe_ready(self):
'''Get FEI4 status o... |
Invert pixel mask (0->1, 1(and greater)->0).
Parameters
----------
mask : array-like
Mask.
Returns
-------
inverted_mask : array-like
Inverted Mask.
def invert_pixel_mask(mask):
'''Invert pixel mask (0->1, 1(and greater)->0).
Parameters
----------
... |
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 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 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 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 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... |
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... |
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.
def re... |
Resetting 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_... |
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.
def generate_threshold_mask(hist):
'''Masking array elements when equa... |
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 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... |
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster.
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 array... |
Returns the dy/dx(x) via central difference method
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like
def central_difference(x, y):
'''Returns the dy/dx(x) via central difference method
Parameters
----------
x : array like
y : array... |
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 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 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... |
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... |
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... |
Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input.
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.
"""
tr... |
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.
def combine_meta_data(files_dict, meta_data_v2=True):
"""
Takes the dict of hdf5 fi... |
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
def smooth_differentiation(x, y, weigths=None, order=5, smoothness=3, derivation=1):
'''Returns the dy/dx(x) with the fit and ... |
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.
def reduce_sorted_to_intersect(a... |
Returns the values that appear at least twice in array.
Parameters
----------
array : array like
Returns
-------
numpy.array
def get_not_unique_values(array):
'''Returns the values that appear at least twice in array.
Parameters
----------
array : array like
Returns
... |
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... |
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 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 ... |
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... |
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 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 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 events with a certain number of cluster.
Parameters
----------
event_number : numpy.array
Returns
-------
numpy.array
def get_events_with_n_cluster(event_number, condition='n_cluster==1'):
'''Selects the events with a certain number of cluster.
Parameters
----------
... |
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'):
'''Selects... |
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
... |
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 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 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
def get_scan_parameters_index(scan_parameter):
... |
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 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 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... |
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 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 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 number of cluster in every event.
Parameters
----------
cluster_table : pytables.table
Returns
-------
numpy.Histogram
def get_n_cluster_per_event_hist(cluster_table):
'''Calculates the number of cluster in every event.
Parameters
----------
cluster_table : pyt... |
Quick and dirty function to give as redmine compatible iverview table
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* ... |
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
def con... |
Checking FEI4 raw data array for corrupted 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)
... |
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
def consecutive(data, stepsize=1):
"""Converts array into chunks with consecutive elements of given step size.
http://sta... |
Printing FEI4 data from raw data file for debugging.
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', mod... |
Printing FEI4 raw data array for debugging.
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", ... |
Updates the widget to show the ETA or total time when finished.
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' % sel... |
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):
''... |
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... |
Interval timer decorator.
Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256
def interval_timed(interval):
'''Interval timer decorator.
Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every... |
Interval timer function.
Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708
def interval_timer(interval, func, *args, **kwargs):
'''Interval timer function.
Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708
'''... |
Sends a run status mail with the traceback to a specified E-Mail address if a run crashes.
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 (' +... |
Extracts the configuration of the modules.
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.')
... |
Sets the default parameters if they are not specified.
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,... |
Initialize all modules consecutively
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:
... |
Start runs on all modules sequentially.
Sets properties to access current module properties.
def do_run(self):
''' Start runs on all modules sequentially.
Sets properties to access current module properties.
'''
if self.broadcast_commands: # Broadcast FE commands
... |
Releasing hardware resources.
def close(self):
'''Releasing hardware resources.
'''
try:
self.dut.close()
except Exception:
logging.warning('Closing DUT was not successful')
else:
logging.debug('Closed DUT') |
Handling of the data.
Parameters
----------
data : list, tuple
Data tuple of the format (data (np.array), last_time (float), curr_time (float), status (int))
def handle_data(self, data, new_file=False, flush=True):
'''Handling of the data.
Parameters
------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.