repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1356-L1385 |
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",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1388-L1405 |
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",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1408-L1428 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1470-L1483 |
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"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1486-L1503 |
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... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1519-L1543 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1546-L1605 |
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",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1608-L1612 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1615-L1632 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1635-L1648 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1442-L1467 |
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... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_source_scan_gdac_data.py#L77-L106 |
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",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/calibrate_hit_or.py#L20-L148 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1423-L1442 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1445-L1457 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1493-L1507 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L175-L219 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L265-L323 |
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"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L466-L563 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L660-L830 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L858-L866 |
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",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L868-L879 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.handle_err | def handle_err(self, exc):
'''Handling of Exceptions.
Parameters
----------
exc : list, tuple
Information of the exception of the format (type, value, traceback).
Uses the return value of sys.exc_info().
'''
if self.reset_rx_on_error and isinstanc... | python | def handle_err(self, exc):
'''Handling of Exceptions.
Parameters
----------
exc : list, tuple
Information of the exception of the format (type, value, traceback).
Uses the return value of sys.exc_info().
'''
if self.reset_rx_on_error and isinstanc... | [
"def",
"handle_err",
"(",
"self",
",",
"exc",
")",
":",
"if",
"self",
".",
"reset_rx_on_error",
"and",
"isinstance",
"(",
"exc",
"[",
"1",
"]",
",",
"(",
"RxSyncError",
",",
"EightbTenbError",
")",
")",
":",
"self",
".",
"fifo_readout",
".",
"print_reado... | Handling of Exceptions.
Parameters
----------
exc : list, tuple
Information of the exception of the format (type, value, traceback).
Uses the return value of sys.exc_info(). | [
"Handling",
"of",
"Exceptions",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L881-L897 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.get_configuration | def get_configuration(self, module_id, run_number=None):
''' Returns the configuration for a given module ID.
The working directory is searched for a file matching the module_id with the
given run number. If no run number is defined the last successfull run defines
the run number.
... | python | def get_configuration(self, module_id, run_number=None):
''' Returns the configuration for a given module ID.
The working directory is searched for a file matching the module_id with the
given run number. If no run number is defined the last successfull run defines
the run number.
... | [
"def",
"get_configuration",
"(",
"self",
",",
"module_id",
",",
"run_number",
"=",
"None",
")",
":",
"def",
"find_file",
"(",
"run_number",
")",
":",
"module_path",
"=",
"self",
".",
"get_module_path",
"(",
"module_id",
")",
"for",
"root",
",",
"_",
",",
... | Returns the configuration for a given module ID.
The working directory is searched for a file matching the module_id with the
given run number. If no run number is defined the last successfull run defines
the run number. | [
"Returns",
"the",
"configuration",
"for",
"a",
"given",
"module",
"ID",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L904-L938 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.select_module | def select_module(self, module_id):
''' Select module and give access to the module.
'''
if not isinstance(module_id, basestring) and isinstance(module_id, Iterable) and set(module_id) - set(self._modules):
raise ValueError('Module IDs invalid:' % ", ".join(set(module_id) - set(self.... | python | def select_module(self, module_id):
''' Select module and give access to the module.
'''
if not isinstance(module_id, basestring) and isinstance(module_id, Iterable) and set(module_id) - set(self._modules):
raise ValueError('Module IDs invalid:' % ", ".join(set(module_id) - set(self.... | [
"def",
"select_module",
"(",
"self",
",",
"module_id",
")",
":",
"if",
"not",
"isinstance",
"(",
"module_id",
",",
"basestring",
")",
"and",
"isinstance",
"(",
"module_id",
",",
"Iterable",
")",
"and",
"set",
"(",
"module_id",
")",
"-",
"set",
"(",
"self... | Select module and give access to the module. | [
"Select",
"module",
"and",
"give",
"access",
"to",
"the",
"module",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1014-L1077 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.deselect_module | def deselect_module(self):
''' Deselect module and cleanup.
'''
self._enabled_fe_channels = [] # ignore any RX sync errors
self._readout_fifos = []
self._filter = []
self._converter = []
self.dut['TX']['OUTPUT_ENABLE'] = 0
self._current_module_handle = No... | python | def deselect_module(self):
''' Deselect module and cleanup.
'''
self._enabled_fe_channels = [] # ignore any RX sync errors
self._readout_fifos = []
self._filter = []
self._converter = []
self.dut['TX']['OUTPUT_ENABLE'] = 0
self._current_module_handle = No... | [
"def",
"deselect_module",
"(",
"self",
")",
":",
"self",
".",
"_enabled_fe_channels",
"=",
"[",
"]",
"# ignore any RX sync errors",
"self",
".",
"_readout_fifos",
"=",
"[",
"]",
"self",
".",
"_filter",
"=",
"[",
"]",
"self",
".",
"_converter",
"=",
"[",
"]... | Deselect module and cleanup. | [
"Deselect",
"module",
"and",
"cleanup",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1079-L1089 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.enter_sync | def enter_sync(self):
''' Waiting for all threads to appear, then continue.
'''
if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]:
raise RuntimeError('Thread name "%s" is not valid.')
if self._scan_threads and self.current_module... | python | def enter_sync(self):
''' Waiting for all threads to appear, then continue.
'''
if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]:
raise RuntimeError('Thread name "%s" is not valid.')
if self._scan_threads and self.current_module... | [
"def",
"enter_sync",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scan_threads",
"and",
"self",
".",
"current_module_handle",
"not",
"in",
"[",
"t",
".",
"name",
"for",
"t",
"in",
"self",
".",
"_scan_threads",
"]",
":",
"raise",
"RuntimeError",
"(",
"'Thr... | Waiting for all threads to appear, then continue. | [
"Waiting",
"for",
"all",
"threads",
"to",
"appear",
"then",
"continue",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1169-L1184 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.exit_sync | def exit_sync(self):
''' Waiting for all threads to appear, then continue.
'''
if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]:
raise RuntimeError('Thread name "%s" is not valid.')
if self._scan_threads and self.current_module_... | python | def exit_sync(self):
''' Waiting for all threads to appear, then continue.
'''
if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]:
raise RuntimeError('Thread name "%s" is not valid.')
if self._scan_threads and self.current_module_... | [
"def",
"exit_sync",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scan_threads",
"and",
"self",
".",
"current_module_handle",
"not",
"in",
"[",
"t",
".",
"name",
"for",
"t",
"in",
"self",
".",
"_scan_threads",
"]",
":",
"raise",
"RuntimeError",
"(",
"'Thre... | Waiting for all threads to appear, then continue. | [
"Waiting",
"for",
"all",
"threads",
"to",
"appear",
"then",
"continue",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1186-L1201 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.readout | def readout(self, *args, **kwargs):
''' Running the FIFO readout while executing other statements.
Starting and stopping of the FIFO readout is synchronized between the threads.
'''
timeout = kwargs.pop('timeout', 10.0)
self.start_readout(*args, **kwargs)
try:
... | python | def readout(self, *args, **kwargs):
''' Running the FIFO readout while executing other statements.
Starting and stopping of the FIFO readout is synchronized between the threads.
'''
timeout = kwargs.pop('timeout', 10.0)
self.start_readout(*args, **kwargs)
try:
... | [
"def",
"readout",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"timeout",
"=",
"kwargs",
".",
"pop",
"(",
"'timeout'",
",",
"10.0",
")",
"self",
".",
"start_readout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":"... | Running the FIFO readout while executing other statements.
Starting and stopping of the FIFO readout is synchronized between the threads. | [
"Running",
"the",
"FIFO",
"readout",
"while",
"executing",
"other",
"statements",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1204-L1222 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.start_readout | def start_readout(self, *args, **kwargs):
''' Starting the FIFO readout.
Starting of the FIFO readout is executed only once by a random thread.
Starting of the FIFO readout is synchronized between all threads reading out the FIFO.
'''
# Pop parameters for fifo_readout.start
... | python | def start_readout(self, *args, **kwargs):
''' Starting the FIFO readout.
Starting of the FIFO readout is executed only once by a random thread.
Starting of the FIFO readout is synchronized between all threads reading out the FIFO.
'''
# Pop parameters for fifo_readout.start
... | [
"def",
"start_readout",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Pop parameters for fifo_readout.start",
"callback",
"=",
"kwargs",
".",
"pop",
"(",
"'callback'",
",",
"self",
".",
"handle_data",
")",
"errback",
"=",
"kwargs",
"."... | Starting the FIFO readout.
Starting of the FIFO readout is executed only once by a random thread.
Starting of the FIFO readout is synchronized between all threads reading out the FIFO. | [
"Starting",
"the",
"FIFO",
"readout",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1224-L1254 |
SiLab-Bonn/pyBAR | pybar/fei4_run_base.py | Fei4RunBase.stop_readout | def stop_readout(self, timeout=10.0):
''' Stopping the FIFO readout.
Stopping of the FIFO readout is executed only once by a random thread.
Stopping of the FIFO readout is synchronized between all threads reading out the FIFO.
'''
if self._scan_threads and self.current_module_ha... | python | def stop_readout(self, timeout=10.0):
''' Stopping the FIFO readout.
Stopping of the FIFO readout is executed only once by a random thread.
Stopping of the FIFO readout is synchronized between all threads reading out the FIFO.
'''
if self._scan_threads and self.current_module_ha... | [
"def",
"stop_readout",
"(",
"self",
",",
"timeout",
"=",
"10.0",
")",
":",
"if",
"self",
".",
"_scan_threads",
"and",
"self",
".",
"current_module_handle",
"not",
"in",
"[",
"t",
".",
"name",
"for",
"t",
"in",
"self",
".",
"_scan_threads",
"]",
":",
"r... | Stopping the FIFO readout.
Stopping of the FIFO readout is executed only once by a random thread.
Stopping of the FIFO readout is synchronized between all threads reading out the FIFO. | [
"Stopping",
"the",
"FIFO",
"readout",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1256-L1274 |
SiLab-Bonn/pyBAR | pybar/scans/analyze_timewalk.py | get_charge | def get_charge(max_tdc, tdc_calibration_values, tdc_pixel_calibration): # Return the charge from calibration
''' Interpolatet the TDC calibration for each pixel from 0 to max_tdc'''
charge_calibration = np.zeros(shape=(80, 336, max_tdc))
for column in range(80):
for row in range(336):
a... | python | def get_charge(max_tdc, tdc_calibration_values, tdc_pixel_calibration): # Return the charge from calibration
''' Interpolatet the TDC calibration for each pixel from 0 to max_tdc'''
charge_calibration = np.zeros(shape=(80, 336, max_tdc))
for column in range(80):
for row in range(336):
a... | [
"def",
"get_charge",
"(",
"max_tdc",
",",
"tdc_calibration_values",
",",
"tdc_pixel_calibration",
")",
":",
"# Return the charge from calibration",
"charge_calibration",
"=",
"np",
".",
"zeros",
"(",
"shape",
"=",
"(",
"80",
",",
"336",
",",
"max_tdc",
")",
")",
... | Interpolatet the TDC calibration for each pixel from 0 to max_tdc | [
"Interpolatet",
"the",
"TDC",
"calibration",
"for",
"each",
"pixel",
"from",
"0",
"to",
"max_tdc"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_timewalk.py#L21-L33 |
SiLab-Bonn/pyBAR | pybar/scans/analyze_timewalk.py | get_charge_calibration | def get_charge_calibration(calibation_file, max_tdc):
''' Open the hit or calibration file and return the calibration per pixel'''
with tb.open_file(calibation_file, mode="r") as in_file_calibration_h5:
tdc_calibration = in_file_calibration_h5.root.HitOrCalibration[:, :, :, 1]
tdc_calibration_va... | python | def get_charge_calibration(calibation_file, max_tdc):
''' Open the hit or calibration file and return the calibration per pixel'''
with tb.open_file(calibation_file, mode="r") as in_file_calibration_h5:
tdc_calibration = in_file_calibration_h5.root.HitOrCalibration[:, :, :, 1]
tdc_calibration_va... | [
"def",
"get_charge_calibration",
"(",
"calibation_file",
",",
"max_tdc",
")",
":",
"with",
"tb",
".",
"open_file",
"(",
"calibation_file",
",",
"mode",
"=",
"\"r\"",
")",
"as",
"in_file_calibration_h5",
":",
"tdc_calibration",
"=",
"in_file_calibration_h5",
".",
"... | Open the hit or calibration file and return the calibration per pixel | [
"Open",
"the",
"hit",
"or",
"calibration",
"file",
"and",
"return",
"the",
"calibration",
"per",
"pixel"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_timewalk.py#L36-L41 |
SiLab-Bonn/pyBAR | pybar/ViTablesPlugin/pybar_plugin.py | pyBarPlugin.addEntry | def addEntry(self):
"""Add the `Plot pyBAR data`. entry to `Dataset` menu.
"""
export_icon = QtGui.QIcon()
pixmap = QtGui.QPixmap(os.path.join(PLUGINSDIR,
'csv/icons/document-export.png'))
export_icon.addPixmap(pixmap, QtGui.QIcon.Norma... | python | def addEntry(self):
"""Add the `Plot pyBAR data`. entry to `Dataset` menu.
"""
export_icon = QtGui.QIcon()
pixmap = QtGui.QPixmap(os.path.join(PLUGINSDIR,
'csv/icons/document-export.png'))
export_icon.addPixmap(pixmap, QtGui.QIcon.Norma... | [
"def",
"addEntry",
"(",
"self",
")",
":",
"export_icon",
"=",
"QtGui",
".",
"QIcon",
"(",
")",
"pixmap",
"=",
"QtGui",
".",
"QPixmap",
"(",
"os",
".",
"path",
".",
"join",
"(",
"PLUGINSDIR",
",",
"'csv/icons/document-export.png'",
")",
")",
"export_icon",
... | Add the `Plot pyBAR data`. entry to `Dataset` menu. | [
"Add",
"the",
"Plot",
"pyBAR",
"data",
".",
"entry",
"to",
"Dataset",
"menu",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L145-L172 |
SiLab-Bonn/pyBAR | pybar/ViTablesPlugin/pybar_plugin.py | pyBarPlugin.updateDatasetMenu | def updateDatasetMenu(self):
"""Update the `export` QAction when the Dataset menu is pulled down.
This method is a slot. See class ctor for details.
"""
enabled = True
current = self.vtgui.dbs_tree_view.currentIndex()
if current:
leaf = self.vtgui.dbs_tree_mo... | python | def updateDatasetMenu(self):
"""Update the `export` QAction when the Dataset menu is pulled down.
This method is a slot. See class ctor for details.
"""
enabled = True
current = self.vtgui.dbs_tree_view.currentIndex()
if current:
leaf = self.vtgui.dbs_tree_mo... | [
"def",
"updateDatasetMenu",
"(",
"self",
")",
":",
"enabled",
"=",
"True",
"current",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_view",
".",
"currentIndex",
"(",
")",
"if",
"current",
":",
"leaf",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_model",
".",
"no... | Update the `export` QAction when the Dataset menu is pulled down.
This method is a slot. See class ctor for details. | [
"Update",
"the",
"export",
"QAction",
"when",
"the",
"Dataset",
"menu",
"is",
"pulled",
"down",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L174-L186 |
SiLab-Bonn/pyBAR | pybar/ViTablesPlugin/pybar_plugin.py | pyBarPlugin.plot | def plot(self):
"""Export a given dataset to a `CSV` file.
This method is a slot connected to the `export` QAction. See the
:meth:`addEntry` method for details.
"""
# The PyTables node tied to the current leaf of the databases tree
current = self.vtgui.dbs_tree_view.curr... | python | def plot(self):
"""Export a given dataset to a `CSV` file.
This method is a slot connected to the `export` QAction. See the
:meth:`addEntry` method for details.
"""
# The PyTables node tied to the current leaf of the databases tree
current = self.vtgui.dbs_tree_view.curr... | [
"def",
"plot",
"(",
"self",
")",
":",
"# The PyTables node tied to the current leaf of the databases tree",
"current",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_view",
".",
"currentIndex",
"(",
")",
"leaf",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_model",
".",
"n... | Export a given dataset to a `CSV` file.
This method is a slot connected to the `export` QAction. See the
:meth:`addEntry` method for details. | [
"Export",
"a",
"given",
"dataset",
"to",
"a",
"CSV",
"file",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L188-L214 |
SiLab-Bonn/pyBAR | pybar/ViTablesPlugin/pybar_plugin.py | pyBarPlugin.helpAbout | def helpAbout(self):
"""Brief description of the plugin.
"""
# Text to be displayed
about_text = translate('pyBarPlugin',
"""<qt>
<p>Data plotting plug-in for pyBAR.
</qt>""",
'About')
descr =... | python | def helpAbout(self):
"""Brief description of the plugin.
"""
# Text to be displayed
about_text = translate('pyBarPlugin',
"""<qt>
<p>Data plotting plug-in for pyBAR.
</qt>""",
'About')
descr =... | [
"def",
"helpAbout",
"(",
"self",
")",
":",
"# Text to be displayed",
"about_text",
"=",
"translate",
"(",
"'pyBarPlugin'",
",",
"\"\"\"<qt>\n <p>Data plotting plug-in for pyBAR.\n </qt>\"\"\"",
",",
"'About'",
")",
"descr",
"=",
"dict",
"(",
"module_na... | Brief description of the plugin. | [
"Brief",
"description",
"of",
"the",
"plugin",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L216-L234 |
SiLab-Bonn/pyBAR | pybar/daq/fei4_raw_data.py | send_meta_data | def send_meta_data(socket, conf, name):
'''Sends the config via ZeroMQ to a specified socket. Is called at the beginning of a run and when the config changes. Conf can be any config dictionary.
'''
meta_data = dict(
name=name,
conf=conf
)
try:
socket.send_json(meta_data, flag... | python | def send_meta_data(socket, conf, name):
'''Sends the config via ZeroMQ to a specified socket. Is called at the beginning of a run and when the config changes. Conf can be any config dictionary.
'''
meta_data = dict(
name=name,
conf=conf
)
try:
socket.send_json(meta_data, flag... | [
"def",
"send_meta_data",
"(",
"socket",
",",
"conf",
",",
"name",
")",
":",
"meta_data",
"=",
"dict",
"(",
"name",
"=",
"name",
",",
"conf",
"=",
"conf",
")",
"try",
":",
"socket",
".",
"send_json",
"(",
"meta_data",
",",
"flags",
"=",
"zmq",
".",
... | Sends the config via ZeroMQ to a specified socket. Is called at the beginning of a run and when the config changes. Conf can be any config dictionary. | [
"Sends",
"the",
"config",
"via",
"ZeroMQ",
"to",
"a",
"specified",
"socket",
".",
"Is",
"called",
"at",
"the",
"beginning",
"of",
"a",
"run",
"and",
"when",
"the",
"config",
"changes",
".",
"Conf",
"can",
"be",
"any",
"config",
"dictionary",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L13-L23 |
SiLab-Bonn/pyBAR | pybar/daq/fei4_raw_data.py | send_data | def send_data(socket, data, scan_parameters={}, name='ReadoutData'):
'''Sends the data of every read out (raw data and meta data) via ZeroMQ to a specified socket
'''
if not scan_parameters:
scan_parameters = {}
data_meta_data = dict(
name=name,
dtype=str(data[0].dtype),
... | python | def send_data(socket, data, scan_parameters={}, name='ReadoutData'):
'''Sends the data of every read out (raw data and meta data) via ZeroMQ to a specified socket
'''
if not scan_parameters:
scan_parameters = {}
data_meta_data = dict(
name=name,
dtype=str(data[0].dtype),
... | [
"def",
"send_data",
"(",
"socket",
",",
"data",
",",
"scan_parameters",
"=",
"{",
"}",
",",
"name",
"=",
"'ReadoutData'",
")",
":",
"if",
"not",
"scan_parameters",
":",
"scan_parameters",
"=",
"{",
"}",
"data_meta_data",
"=",
"dict",
"(",
"name",
"=",
"n... | Sends the data of every read out (raw data and meta data) via ZeroMQ to a specified socket | [
"Sends",
"the",
"data",
"of",
"every",
"read",
"out",
"(",
"raw",
"data",
"and",
"meta",
"data",
")",
"via",
"ZeroMQ",
"to",
"a",
"specified",
"socket"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L26-L44 |
SiLab-Bonn/pyBAR | pybar/daq/fei4_raw_data.py | open_raw_data_file | def open_raw_data_file(filename, mode="w", title="", scan_parameters=None, socket_address=None):
'''Mimics pytables.open_file() and stores the configuration and run configuration
Returns:
RawDataFile Object
Examples:
with open_raw_data_file(filename = self.scan_data_filename, title=self.scan_id, s... | python | def open_raw_data_file(filename, mode="w", title="", scan_parameters=None, socket_address=None):
'''Mimics pytables.open_file() and stores the configuration and run configuration
Returns:
RawDataFile Object
Examples:
with open_raw_data_file(filename = self.scan_data_filename, title=self.scan_id, s... | [
"def",
"open_raw_data_file",
"(",
"filename",
",",
"mode",
"=",
"\"w\"",
",",
"title",
"=",
"\"\"",
",",
"scan_parameters",
"=",
"None",
",",
"socket_address",
"=",
"None",
")",
":",
"return",
"RawDataFile",
"(",
"filename",
"=",
"filename",
",",
"mode",
"... | Mimics pytables.open_file() and stores the configuration and run configuration
Returns:
RawDataFile Object
Examples:
with open_raw_data_file(filename = self.scan_data_filename, title=self.scan_id, scan_parameters=[scan_parameter]) as raw_data_file:
# do something here
raw_data_file.app... | [
"Mimics",
"pytables",
".",
"open_file",
"()",
"and",
"stores",
"the",
"configuration",
"and",
"run",
"configuration"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L47-L58 |
SiLab-Bonn/pyBAR | pybar/daq/fei4_raw_data.py | save_raw_data_from_data_queue | def save_raw_data_from_data_queue(data_queue, filename, mode='a', title='', scan_parameters=None): # mode="r+" to append data, raw_data_file_h5 must exist, "w" to overwrite raw_data_file_h5, "a" to append data, if raw_data_file_h5 does not exist it is created
'''Writing raw data file from data queue
If you ne... | python | def save_raw_data_from_data_queue(data_queue, filename, mode='a', title='', scan_parameters=None): # mode="r+" to append data, raw_data_file_h5 must exist, "w" to overwrite raw_data_file_h5, "a" to append data, if raw_data_file_h5 does not exist it is created
'''Writing raw data file from data queue
If you ne... | [
"def",
"save_raw_data_from_data_queue",
"(",
"data_queue",
",",
"filename",
",",
"mode",
"=",
"'a'",
",",
"title",
"=",
"''",
",",
"scan_parameters",
"=",
"None",
")",
":",
"# mode=\"r+\" to append data, raw_data_file_h5 must exist, \"w\" to overwrite raw_data_file_h5, \"a\" ... | Writing raw data file from data queue
If you need to write raw data once in a while this function may make it easy for you. | [
"Writing",
"raw",
"data",
"file",
"from",
"data",
"queue"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L240-L248 |
SiLab-Bonn/pyBAR | pybar/scans/tune_fei4.py | Fei4Tuning.scan | def scan(self):
'''Metascript that calls other scripts to tune the FE.
Parameters
----------
cfg_name : string
Name of the config to be created. This config holds the tuning results.
target_threshold : int
The target threshold value in PlsrDAC.
... | python | def scan(self):
'''Metascript that calls other scripts to tune the FE.
Parameters
----------
cfg_name : string
Name of the config to be created. This config holds the tuning results.
target_threshold : int
The target threshold value in PlsrDAC.
... | [
"def",
"scan",
"(",
"self",
")",
":",
"for",
"iteration",
"in",
"range",
"(",
"0",
",",
"self",
".",
"global_iterations",
")",
":",
"# tune iteratively with decreasing range to save time\r",
"if",
"self",
".",
"stop_run",
".",
"is_set",
"(",
")",
":",
"break",... | Metascript that calls other scripts to tune the FE.
Parameters
----------
cfg_name : string
Name of the config to be created. This config holds the tuning results.
target_threshold : int
The target threshold value in PlsrDAC.
target_charge : int
... | [
"Metascript",
"that",
"calls",
"other",
"scripts",
"to",
"tune",
"the",
"FE",
".",
"Parameters",
"----------",
"cfg_name",
":",
"string",
"Name",
"of",
"the",
"config",
"to",
"be",
"created",
".",
"This",
"config",
"holds",
"the",
"tuning",
"results",
".",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/tune_fei4.py#L92-L184 |
SiLab-Bonn/pyBAR | pybar/analysis/plotting/plotting.py | plot_linear_relation | def plot_linear_relation(x, y, x_err=None, y_err=None, title=None, point_label=None, legend=None, plot_range=None, plot_range_y=None, x_label=None, y_label=None, y_2_label=None, log_x=False, log_y=False, size=None, filename=None):
''' Takes point data (x,y) with errors(x,y) and fits a straight line. The deviation ... | python | def plot_linear_relation(x, y, x_err=None, y_err=None, title=None, point_label=None, legend=None, plot_range=None, plot_range_y=None, x_label=None, y_label=None, y_2_label=None, log_x=False, log_y=False, size=None, filename=None):
''' Takes point data (x,y) with errors(x,y) and fits a straight line. The deviation ... | [
"def",
"plot_linear_relation",
"(",
"x",
",",
"y",
",",
"x_err",
"=",
"None",
",",
"y_err",
"=",
"None",
",",
"title",
"=",
"None",
",",
"point_label",
"=",
"None",
",",
"legend",
"=",
"None",
",",
"plot_range",
"=",
"None",
",",
"plot_range_y",
"=",
... | Takes point data (x,y) with errors(x,y) and fits a straight line. The deviation to this line is also plotted, showing the offset.
Parameters
----------
x, y, x_err, y_err: iterable
filename: string, PdfPages object or None
PdfPages file object: plot is appended to the pdf
stri... | [
"Takes",
"point",
"data",
"(",
"x",
"y",
")",
"with",
"errors",
"(",
"x",
"y",
")",
"and",
"fits",
"a",
"straight",
"line",
".",
"The",
"deviation",
"to",
"this",
"line",
"is",
"also",
"plotted",
"showing",
"the",
"offset",
".",
"Parameters",
"--------... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L52-L121 |
SiLab-Bonn/pyBAR | pybar/analysis/plotting/plotting.py | plot_profile_histogram | def plot_profile_histogram(x, y, n_bins=100, title=None, x_label=None, y_label=None, log_y=False, filename=None):
'''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.
... | python | def plot_profile_histogram(x, y, n_bins=100, title=None, x_label=None, y_label=None, log_y=False, filename=None):
'''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.
... | [
"def",
"plot_profile_histogram",
"(",
"x",
",",
"y",
",",
"n_bins",
"=",
"100",
",",
"title",
"=",
"None",
",",
"x_label",
"=",
"None",
",",
"y_label",
"=",
"None",
",",
"log_y",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"if",
"len",
"(... | 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... | [
"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"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L241-L284 |
SiLab-Bonn/pyBAR | pybar/analysis/plotting/plotting.py | round_to_multiple | def round_to_multiple(number, multiple):
'''Rounding up to the nearest multiple of any positive integer
Parameters
----------
number : int, float
Input number.
multiple : int
Round up to multiple of multiple. Will be converted to int. Must not be equal zero.
Returns
... | python | def round_to_multiple(number, multiple):
'''Rounding up to the nearest multiple of any positive integer
Parameters
----------
number : int, float
Input number.
multiple : int
Round up to multiple of multiple. Will be converted to int. Must not be equal zero.
Returns
... | [
"def",
"round_to_multiple",
"(",
"number",
",",
"multiple",
")",
":",
"multiple",
"=",
"int",
"(",
"multiple",
")",
"if",
"multiple",
"==",
"0",
":",
"multiple",
"=",
"1",
"ceil_mod_number",
"=",
"number",
"-",
"number",
"%",
"(",
"-",
"multiple",
")",
... | Rounding up to the nearest multiple of any positive integer
Parameters
----------
number : int, float
Input number.
multiple : int
Round up to multiple of multiple. Will be converted to int. Must not be equal zero.
Returns
-------
ceil_mod_number : int
Rou... | [
"Rounding",
"up",
"to",
"the",
"nearest",
"multiple",
"of",
"any",
"positive",
"integer",
"Parameters",
"----------",
"number",
":",
"int",
"float",
"Input",
"number",
".",
"multiple",
":",
"int",
"Round",
"up",
"to",
"multiple",
"of",
"multiple",
".",
"Will... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L352-L374 |
SiLab-Bonn/pyBAR | pybar/analysis/plotting/plotting.py | hist_quantiles | def hist_quantiles(hist, prob=(0.05, 0.95), return_indices=False, copy=True):
'''Calculate quantiles from histograms, cuts off hist below and above given quantile. This function will not cut off more than the given values.
Parameters
----------
hist : array_like, iterable
Input histogram ... | python | def hist_quantiles(hist, prob=(0.05, 0.95), return_indices=False, copy=True):
'''Calculate quantiles from histograms, cuts off hist below and above given quantile. This function will not cut off more than the given values.
Parameters
----------
hist : array_like, iterable
Input histogram ... | [
"def",
"hist_quantiles",
"(",
"hist",
",",
"prob",
"=",
"(",
"0.05",
",",
"0.95",
")",
",",
"return_indices",
"=",
"False",
",",
"copy",
"=",
"True",
")",
":",
"# make np array\r",
"hist_t",
"=",
"np",
".",
"array",
"(",
"hist",
")",
"# calculate cumulat... | Calculate quantiles from histograms, cuts off hist below and above given quantile. This function will not cut off more than the given values.
Parameters
----------
hist : array_like, iterable
Input histogram with dimension at most 1.
prob : float, list, tuple
List of quantiles to... | [
"Calculate",
"quantiles",
"from",
"histograms",
"cuts",
"off",
"hist",
"below",
"and",
"above",
"given",
"quantile",
".",
"This",
"function",
"will",
"not",
"cut",
"off",
"more",
"than",
"the",
"given",
"values",
".",
"Parameters",
"----------",
"hist",
":",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L831-L879 |
SiLab-Bonn/pyBAR | pybar/analysis/plotting/plotting.py | hist_last_nonzero | def hist_last_nonzero(hist, return_index=False, copy=True):
'''Find the last nonzero index and mask the remaining entries.
Parameters
----------
hist : array_like, iterable
Input histogram with dimension at most 1.
return_index : bool, optional
If true, return the index.
... | python | def hist_last_nonzero(hist, return_index=False, copy=True):
'''Find the last nonzero index and mask the remaining entries.
Parameters
----------
hist : array_like, iterable
Input histogram with dimension at most 1.
return_index : bool, optional
If true, return the index.
... | [
"def",
"hist_last_nonzero",
"(",
"hist",
",",
"return_index",
"=",
"False",
",",
"copy",
"=",
"True",
")",
":",
"# make np array\r",
"hist_t",
"=",
"np",
".",
"array",
"(",
"hist",
")",
"index",
"=",
"(",
"np",
".",
"where",
"(",
"hist_t",
")",
"[",
... | Find the last nonzero index and mask the remaining entries.
Parameters
----------
hist : array_like, iterable
Input histogram with dimension at most 1.
return_index : bool, optional
If true, return the index.
copy : bool, optional
Whether to copy the input data (Tru... | [
"Find",
"the",
"last",
"nonzero",
"index",
"and",
"mask",
"the",
"remaining",
"entries",
".",
"Parameters",
"----------",
"hist",
":",
"array_like",
"iterable",
"Input",
"histogram",
"with",
"dimension",
"at",
"most",
"1",
".",
"return_index",
":",
"bool",
"op... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L882-L910 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.readout | def readout(self, fifo, no_data_timeout=None):
'''Readout thread continuously reading FIFO.
Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque).
'''
logging.info('Starting readout thread for %s', fifo)
time_last... | python | def readout(self, fifo, no_data_timeout=None):
'''Readout thread continuously reading FIFO.
Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque).
'''
logging.info('Starting readout thread for %s', fifo)
time_last... | [
"def",
"readout",
"(",
"self",
",",
"fifo",
",",
"no_data_timeout",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"'Starting readout thread for %s'",
",",
"fifo",
")",
"time_last_data",
"=",
"time",
"(",
")",
"time_wait",
"=",
"0.0",
"empty_reads",
"="... | Readout thread continuously reading FIFO.
Readout thread, which uses read_raw_data_from_fifo() and appends data to self._fifo_data_deque (collection.deque). | [
"Readout",
"thread",
"continuously",
"reading",
"FIFO",
".",
"Readout",
"thread",
"which",
"uses",
"read_raw_data_from_fifo",
"()",
"and",
"appends",
"data",
"to",
"self",
".",
"_fifo_data_deque",
"(",
"collection",
".",
"deque",
")",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L270-L320 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.worker | def worker(self, fifo):
'''Worker thread continuously filtering and converting data when data becomes available.
'''
logging.debug('Starting worker thread for %s', fifo)
self._fifo_conditions[fifo].acquire()
while True:
try:
data_tuple = self._f... | python | def worker(self, fifo):
'''Worker thread continuously filtering and converting data when data becomes available.
'''
logging.debug('Starting worker thread for %s', fifo)
self._fifo_conditions[fifo].acquire()
while True:
try:
data_tuple = self._f... | [
"def",
"worker",
"(",
"self",
",",
"fifo",
")",
":",
"logging",
".",
"debug",
"(",
"'Starting worker thread for %s'",
",",
"fifo",
")",
"self",
".",
"_fifo_conditions",
"[",
"fifo",
"]",
".",
"acquire",
"(",
")",
"while",
"True",
":",
"try",
":",
"data_t... | Worker thread continuously filtering and converting data when data becomes available. | [
"Worker",
"thread",
"continuously",
"filtering",
"and",
"converting",
"data",
"when",
"data",
"becomes",
"available",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L322-L352 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.writer | def writer(self, index, no_data_timeout=None):
'''Writer thread continuously calling callback function for writing data when data becomes available.
'''
is_fe_data_header = logical_and(is_fe_word, is_data_header)
logging.debug('Starting writer thread with index %d', index)
s... | python | def writer(self, index, no_data_timeout=None):
'''Writer thread continuously calling callback function for writing data when data becomes available.
'''
is_fe_data_header = logical_and(is_fe_word, is_data_header)
logging.debug('Starting writer thread with index %d', index)
s... | [
"def",
"writer",
"(",
"self",
",",
"index",
",",
"no_data_timeout",
"=",
"None",
")",
":",
"is_fe_data_header",
"=",
"logical_and",
"(",
"is_fe_word",
",",
"is_data_header",
")",
"logging",
".",
"debug",
"(",
"'Starting writer thread with index %d'",
",",
"index",... | Writer thread continuously calling callback function for writing data when data becomes available. | [
"Writer",
"thread",
"continuously",
"calling",
"callback",
"function",
"for",
"writing",
"data",
"when",
"data",
"becomes",
"available",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L354-L403 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.get_data_from_buffer | def get_data_from_buffer(self, filter_func=None, converter_func=None):
'''Reads local data buffer and returns data and meta data list.
Returns
-------
data : list
List of data and meta data dicts.
'''
if self._is_running:
raise RuntimeErr... | python | def get_data_from_buffer(self, filter_func=None, converter_func=None):
'''Reads local data buffer and returns data and meta data list.
Returns
-------
data : list
List of data and meta data dicts.
'''
if self._is_running:
raise RuntimeErr... | [
"def",
"get_data_from_buffer",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_running",
":",
"raise",
"RuntimeError",
"(",
"'Readout thread running'",
")",
"if",
"not",
"self",
".",
"fill_buf... | Reads local data buffer and returns data and meta data list.
Returns
-------
data : list
List of data and meta data dicts. | [
"Reads",
"local",
"data",
"buffer",
"and",
"returns",
"data",
"and",
"meta",
"data",
"list",
".",
"Returns",
"-------",
"data",
":",
"list",
"List",
"of",
"data",
"and",
"meta",
"data",
"dicts",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L425-L437 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.get_raw_data_from_buffer | def get_raw_data_from_buffer(self, filter_func=None, converter_func=None):
'''Reads local data buffer and returns raw data array.
Returns
-------
data : np.array
An array containing data words from the local data buffer.
'''
if self._is_running:
... | python | def get_raw_data_from_buffer(self, filter_func=None, converter_func=None):
'''Reads local data buffer and returns raw data array.
Returns
-------
data : np.array
An array containing data words from the local data buffer.
'''
if self._is_running:
... | [
"def",
"get_raw_data_from_buffer",
"(",
"self",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_running",
":",
"raise",
"RuntimeError",
"(",
"'Readout thread running'",
")",
"if",
"not",
"self",
".",
"fill... | Reads local data buffer and returns raw data array.
Returns
-------
data : np.array
An array containing data words from the local data buffer. | [
"Reads",
"local",
"data",
"buffer",
"and",
"returns",
"raw",
"data",
"array",
".",
"Returns",
"-------",
"data",
":",
"np",
".",
"array",
"An",
"array",
"containing",
"data",
"words",
"from",
"the",
"local",
"data",
"buffer",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L439-L451 |
SiLab-Bonn/pyBAR | pybar/daq/fifo_readout.py | FifoReadout.read_raw_data_from_fifo | def read_raw_data_from_fifo(self, fifo, filter_func=None, converter_func=None):
'''Reads FIFO data and returns raw data array.
Returns
-------
data : np.array
An array containing FIFO data words.
'''
return convert_data_array(self.dut[fifo].get_data()... | python | def read_raw_data_from_fifo(self, fifo, filter_func=None, converter_func=None):
'''Reads FIFO data and returns raw data array.
Returns
-------
data : np.array
An array containing FIFO data words.
'''
return convert_data_array(self.dut[fifo].get_data()... | [
"def",
"read_raw_data_from_fifo",
"(",
"self",
",",
"fifo",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"return",
"convert_data_array",
"(",
"self",
".",
"dut",
"[",
"fifo",
"]",
".",
"get_data",
"(",
")",
",",
"filter_fu... | Reads FIFO data and returns raw data array.
Returns
-------
data : np.array
An array containing FIFO data words. | [
"Reads",
"FIFO",
"data",
"and",
"returns",
"raw",
"data",
"array",
".",
"Returns",
"-------",
"data",
":",
"np",
".",
"array",
"An",
"array",
"containing",
"FIFO",
"data",
"words",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L453-L461 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | get_item_from_queue | def get_item_from_queue(Q, timeout=0.01):
""" Attempts to retrieve an item from the queue Q. If Q is
empty, None is returned.
Blocks for 'timeout' seconds in case the queue is empty,
so don't use this method for speedy retrieval of multiple
items (use get_all_from_queue for th... | python | def get_item_from_queue(Q, timeout=0.01):
""" Attempts to retrieve an item from the queue Q. If Q is
empty, None is returned.
Blocks for 'timeout' seconds in case the queue is empty,
so don't use this method for speedy retrieval of multiple
items (use get_all_from_queue for th... | [
"def",
"get_item_from_queue",
"(",
"Q",
",",
"timeout",
"=",
"0.01",
")",
":",
"try",
":",
"item",
"=",
"Q",
".",
"get",
"(",
"True",
",",
"0.01",
")",
"except",
"Queue",
".",
"Empty",
":",
"return",
"None",
"return",
"item"
] | Attempts to retrieve an item from the queue Q. If Q is
empty, None is returned.
Blocks for 'timeout' seconds in case the queue is empty,
so don't use this method for speedy retrieval of multiple
items (use get_all_from_queue for that). | [
"Attempts",
"to",
"retrieve",
"an",
"item",
"from",
"the",
"queue",
"Q",
".",
"If",
"Q",
"is",
"empty",
"None",
"is",
"returned",
".",
"Blocks",
"for",
"timeout",
"seconds",
"in",
"case",
"the",
"queue",
"is",
"empty",
"so",
"don",
"t",
"use",
"this",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L38-L51 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | argmin_list | def argmin_list(seq, func):
""" Return a list of elements of seq[i] with the lowest
func(seq[i]) scores.
>>> argmin_list(['one', 'to', 'three', 'or'], len)
['to', 'or']
"""
best_score, best = func(seq[0]), []
for x in seq:
x_score = func(x)
if x_score < b... | python | def argmin_list(seq, func):
""" Return a list of elements of seq[i] with the lowest
func(seq[i]) scores.
>>> argmin_list(['one', 'to', 'three', 'or'], len)
['to', 'or']
"""
best_score, best = func(seq[0]), []
for x in seq:
x_score = func(x)
if x_score < b... | [
"def",
"argmin_list",
"(",
"seq",
",",
"func",
")",
":",
"best_score",
",",
"best",
"=",
"func",
"(",
"seq",
"[",
"0",
"]",
")",
",",
"[",
"]",
"for",
"x",
"in",
"seq",
":",
"x_score",
"=",
"func",
"(",
"x",
")",
"if",
"x_score",
"<",
"best_sco... | Return a list of elements of seq[i] with the lowest
func(seq[i]) scores.
>>> argmin_list(['one', 'to', 'three', 'or'], len)
['to', 'or'] | [
"Return",
"a",
"list",
"of",
"elements",
"of",
"seq",
"[",
"i",
"]",
"with",
"the",
"lowest",
"func",
"(",
"seq",
"[",
"i",
"]",
")",
"scores",
".",
">>>",
"argmin_list",
"(",
"[",
"one",
"to",
"three",
"or",
"]",
"len",
")",
"[",
"to",
"or",
"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L62-L75 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | flatten_iterable | def flatten_iterable(iterable):
"""flatten iterable, but leaves out strings
[[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6]
"""
for item in iterable:
if isinstance(item, collections.Iterable) and not isinstance(item, basestring):
for sub in flatten_iterable(item):
... | python | def flatten_iterable(iterable):
"""flatten iterable, but leaves out strings
[[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6]
"""
for item in iterable:
if isinstance(item, collections.Iterable) and not isinstance(item, basestring):
for sub in flatten_iterable(item):
... | [
"def",
"flatten_iterable",
"(",
"iterable",
")",
":",
"for",
"item",
"in",
"iterable",
":",
"if",
"isinstance",
"(",
"item",
",",
"collections",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"item",
",",
"basestring",
")",
":",
"for",
"sub",
"in... | flatten iterable, but leaves out strings
[[[1, 2, 3], [4, 5]], 6] -> [1, 2, 3, 4, 5, 6] | [
"flatten",
"iterable",
"but",
"leaves",
"out",
"strings",
"[[[",
"1",
"2",
"3",
"]",
"[",
"4",
"5",
"]]",
"6",
"]",
"-",
">",
"[",
"1",
"2",
"3",
"4",
"5",
"6",
"]"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L198-L209 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | iterable | def iterable(item):
"""generate iterable from item, but leaves out strings
"""
if isinstance(item, collections.Iterable) and not isinstance(item, basestring):
return item
else:
return [item] | python | def iterable(item):
"""generate iterable from item, but leaves out strings
"""
if isinstance(item, collections.Iterable) and not isinstance(item, basestring):
return item
else:
return [item] | [
"def",
"iterable",
"(",
"item",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"collections",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"item",
",",
"basestring",
")",
":",
"return",
"item",
"else",
":",
"return",
"[",
"item",
"]"
] | generate iterable from item, but leaves out strings | [
"generate",
"iterable",
"from",
"item",
"but",
"leaves",
"out",
"strings"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L212-L219 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | natsorted | def natsorted(seq, cmp=natcmp):
"Returns a copy of seq, sorted by natural string sort."
import copy
temp = copy.copy(seq)
natsort(temp, cmp)
return temp | python | def natsorted(seq, cmp=natcmp):
"Returns a copy of seq, sorted by natural string sort."
import copy
temp = copy.copy(seq)
natsort(temp, cmp)
return temp | [
"def",
"natsorted",
"(",
"seq",
",",
"cmp",
"=",
"natcmp",
")",
":",
"import",
"copy",
"temp",
"=",
"copy",
".",
"copy",
"(",
"seq",
")",
"natsort",
"(",
"temp",
",",
"cmp",
")",
"return",
"temp"
] | Returns a copy of seq, sorted by natural string sort. | [
"Returns",
"a",
"copy",
"of",
"seq",
"sorted",
"by",
"natural",
"string",
"sort",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L258-L263 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | get_iso_time | def get_iso_time():
'''returns time as ISO string, mapping to and from datetime in ugly way
convert to string with str()
'''
t1 = time.time()
t2 = datetime.datetime.fromtimestamp(t1)
t4 = t2.__str__()
try:
t4a, t4b = t4.split(".", 1)
except ValueError:
t4a = t... | python | def get_iso_time():
'''returns time as ISO string, mapping to and from datetime in ugly way
convert to string with str()
'''
t1 = time.time()
t2 = datetime.datetime.fromtimestamp(t1)
t4 = t2.__str__()
try:
t4a, t4b = t4.split(".", 1)
except ValueError:
t4a = t... | [
"def",
"get_iso_time",
"(",
")",
":",
"t1",
"=",
"time",
".",
"time",
"(",
")",
"t2",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"t1",
")",
"t4",
"=",
"t2",
".",
"__str__",
"(",
")",
"try",
":",
"t4a",
",",
"t4b",
"=",
"t4",
"... | returns time as ISO string, mapping to and from datetime in ugly way
convert to string with str() | [
"returns",
"time",
"as",
"ISO",
"string",
"mapping",
"to",
"and",
"from",
"datetime",
"in",
"ugly",
"way",
"convert",
"to",
"string",
"with",
"str",
"()"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L267-L282 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | get_float_time | def get_float_time():
'''returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's
'''
t1 = time.time()
t2 = datetime.datetime.fromtimestamp(t1)
return time.mktime(t2.timetuple()) + 1e-6 * t2.microsecond | python | def get_float_time():
'''returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's
'''
t1 = time.time()
t2 = datetime.datetime.fromtimestamp(t1)
return time.mktime(t2.timetuple()) + 1e-6 * t2.microsecond | [
"def",
"get_float_time",
"(",
")",
":",
"t1",
"=",
"time",
".",
"time",
"(",
")",
"t2",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"t1",
")",
"return",
"time",
".",
"mktime",
"(",
"t2",
".",
"timetuple",
"(",
")",
")",
"+",
"1e-6"... | returns time as double precision floats - Time64 in pytables - mapping to and from python datetime's | [
"returns",
"time",
"as",
"double",
"precision",
"floats",
"-",
"Time64",
"in",
"pytables",
"-",
"mapping",
"to",
"and",
"from",
"python",
"datetime",
"s"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L285-L291 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | groupby_dict | def groupby_dict(dictionary, key):
''' Group dict of dicts by key.
'''
return dict((k, list(g)) for k, g in itertools.groupby(sorted(dictionary.keys(), key=lambda name: dictionary[name][key]), key=lambda name: dictionary[name][key])) | python | def groupby_dict(dictionary, key):
''' Group dict of dicts by key.
'''
return dict((k, list(g)) for k, g in itertools.groupby(sorted(dictionary.keys(), key=lambda name: dictionary[name][key]), key=lambda name: dictionary[name][key])) | [
"def",
"groupby_dict",
"(",
"dictionary",
",",
"key",
")",
":",
"return",
"dict",
"(",
"(",
"k",
",",
"list",
"(",
"g",
")",
")",
"for",
"k",
",",
"g",
"in",
"itertools",
".",
"groupby",
"(",
"sorted",
"(",
"dictionary",
".",
"keys",
"(",
")",
",... | Group dict of dicts by key. | [
"Group",
"dict",
"of",
"dicts",
"by",
"key",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L313-L316 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | zip_nofill | def zip_nofill(*iterables):
'''Zipping iterables without fillvalue.
Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue
'''
return (tuple([entry for entry in iterable if entry is not None]) for iterable in itertools.izip_longest(*iterables, fillvalue=None)) | python | def zip_nofill(*iterables):
'''Zipping iterables without fillvalue.
Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue
'''
return (tuple([entry for entry in iterable if entry is not None]) for iterable in itertools.izip_longest(*iterables, fillvalue=None)) | [
"def",
"zip_nofill",
"(",
"*",
"iterables",
")",
":",
"return",
"(",
"tuple",
"(",
"[",
"entry",
"for",
"entry",
"in",
"iterable",
"if",
"entry",
"is",
"not",
"None",
"]",
")",
"for",
"iterable",
"in",
"itertools",
".",
"izip_longest",
"(",
"*",
"itera... | Zipping iterables without fillvalue.
Note: https://stackoverflow.com/questions/38054593/zip-longest-without-fillvalue | [
"Zipping",
"iterables",
"without",
"fillvalue",
".",
"Note",
":",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"38054593",
"/",
"zip",
"-",
"longest",
"-",
"without",
"-",
"fillvalue"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L334-L339 |
SiLab-Bonn/pyBAR | pybar/utils/utils.py | find_file_dir_up | def find_file_dir_up(filename, path=None, n=None):
'''Finding file in directory upwards.
'''
if path is None:
path = os.getcwd()
i = 0
while True:
current_path = path
for _ in range(i):
current_path = os.path.split(current_path)[0]
if os.path.isf... | python | def find_file_dir_up(filename, path=None, n=None):
'''Finding file in directory upwards.
'''
if path is None:
path = os.getcwd()
i = 0
while True:
current_path = path
for _ in range(i):
current_path = os.path.split(current_path)[0]
if os.path.isf... | [
"def",
"find_file_dir_up",
"(",
"filename",
",",
"path",
"=",
"None",
",",
"n",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"os",
".",
"getcwd",
"(",
")",
"i",
"=",
"0",
"while",
"True",
":",
"current_path",
"=",
"path",
... | Finding file in directory upwards. | [
"Finding",
"file",
"in",
"directory",
"upwards",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/utils/utils.py#L342-L360 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | load_configuration_from_text_file | def load_configuration_from_text_file(register, configuration_file):
'''Loading configuration from text files to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Full path (directory and filename) of the configuration file. If na... | python | def load_configuration_from_text_file(register, configuration_file):
'''Loading configuration from text files to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Full path (directory and filename) of the configuration file. If na... | [
"def",
"load_configuration_from_text_file",
"(",
"register",
",",
"configuration_file",
")",
":",
"logging",
".",
"info",
"(",
"\"Loading configuration: %s\"",
"%",
"configuration_file",
")",
"register",
".",
"configuration_file",
"=",
"configuration_file",
"config_dict",
... | Loading configuration from text files to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Full path (directory and filename) of the configuration file. If name is not given, reload configuration from file. | [
"Loading",
"configuration",
"from",
"text",
"files",
"to",
"register",
"object",
"Parameters",
"----------",
"register",
":",
"pybar",
".",
"fei4",
".",
"register",
"object",
"configuration_file",
":",
"string",
"Full",
"path",
"(",
"directory",
"and",
"filename",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L715-L781 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | load_configuration_from_hdf5 | def load_configuration_from_hdf5(register, configuration_file, node=''):
'''Loading configuration from HDF5 file to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
... | python | def load_configuration_from_hdf5(register, configuration_file, node=''):
'''Loading configuration from HDF5 file to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
... | [
"def",
"load_configuration_from_hdf5",
"(",
"register",
",",
"configuration_file",
",",
"node",
"=",
"''",
")",
":",
"def",
"load_conf",
"(",
")",
":",
"logging",
".",
"info",
"(",
"\"Loading configuration: %s\"",
"%",
"h5_file",
".",
"filename",
")",
"register"... | Loading configuration from HDF5 file to register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
node : string
Additional identifier (subgroup). Useful when more than... | [
"Loading",
"configuration",
"from",
"HDF5",
"file",
"to",
"register",
"object",
"Parameters",
"----------",
"register",
":",
"pybar",
".",
"fei4",
".",
"register",
"object",
"configuration_file",
":",
"string",
"file",
"Filename",
"of",
"the",
"HDF5",
"configurati... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L784-L860 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | save_configuration_to_text_file | def save_configuration_to_text_file(register, configuration_file):
'''Saving configuration to text files from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Filename of the configuration file.
'''
configuration_path, ... | python | def save_configuration_to_text_file(register, configuration_file):
'''Saving configuration to text files from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Filename of the configuration file.
'''
configuration_path, ... | [
"def",
"save_configuration_to_text_file",
"(",
"register",
",",
"configuration_file",
")",
":",
"configuration_path",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"configuration_file",
")",
"if",
"os",
".",
"path",
".",
"split",
"(",
"configuratio... | Saving configuration to text files from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string
Filename of the configuration file. | [
"Saving",
"configuration",
"to",
"text",
"files",
"from",
"register",
"object",
"Parameters",
"----------",
"register",
":",
"pybar",
".",
"fei4",
".",
"register",
"object",
"configuration_file",
":",
"string",
"Filename",
"of",
"the",
"configuration",
"file",
"."... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L863-L930 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | save_configuration_to_hdf5 | def save_configuration_to_hdf5(register, configuration_file, name=''):
'''Saving configuration to HDF5 file from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
... | python | def save_configuration_to_hdf5(register, configuration_file, name=''):
'''Saving configuration to HDF5 file from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
... | [
"def",
"save_configuration_to_hdf5",
"(",
"register",
",",
"configuration_file",
",",
"name",
"=",
"''",
")",
":",
"def",
"save_conf",
"(",
")",
":",
"logging",
".",
"info",
"(",
"\"Saving configuration: %s\"",
"%",
"h5_file",
".",
"filename",
")",
"register",
... | Saving configuration to HDF5 file from register object
Parameters
----------
register : pybar.fei4.register object
configuration_file : string, file
Filename of the HDF5 configuration file or file object.
name : string
Additional identifier (subgroup). Useful when storing mo... | [
"Saving",
"configuration",
"to",
"HDF5",
"file",
"from",
"register",
"object",
"Parameters",
"----------",
"register",
":",
"pybar",
".",
"fei4",
".",
"register",
"object",
"configuration_file",
":",
"string",
"file",
"Filename",
"of",
"the",
"HDF5",
"configuratio... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L933-L1019 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.load_configuration | def load_configuration(self, configuration_file):
'''Loading configuration
Parameters
----------
configuration_file : string
Path to the configuration file (text or HDF5 file).
'''
if os.path.isfile(configuration_file):
if not isinstance(... | python | def load_configuration(self, configuration_file):
'''Loading configuration
Parameters
----------
configuration_file : string
Path to the configuration file (text or HDF5 file).
'''
if os.path.isfile(configuration_file):
if not isinstance(... | [
"def",
"load_configuration",
"(",
"self",
",",
"configuration_file",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"configuration_file",
")",
":",
"if",
"not",
"isinstance",
"(",
"configuration_file",
",",
"tb",
".",
"file",
".",
"File",
")",
"and... | Loading configuration
Parameters
----------
configuration_file : string
Path to the configuration file (text or HDF5 file). | [
"Loading",
"configuration",
"Parameters",
"----------",
"configuration_file",
":",
"string",
"Path",
"to",
"the",
"configuration",
"file",
"(",
"text",
"or",
"HDF5",
"file",
")",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L135-L149 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.save_configuration | def save_configuration(self, configuration_file):
'''Saving configuration
Parameters
----------
configuration_file : string
Filename of the configuration file.
'''
if not isinstance(configuration_file, tb.file.File) and os.path.splitext(configuration_... | python | def save_configuration(self, configuration_file):
'''Saving configuration
Parameters
----------
configuration_file : string
Filename of the configuration file.
'''
if not isinstance(configuration_file, tb.file.File) and os.path.splitext(configuration_... | [
"def",
"save_configuration",
"(",
"self",
",",
"configuration_file",
")",
":",
"if",
"not",
"isinstance",
"(",
"configuration_file",
",",
"tb",
".",
"file",
".",
"File",
")",
"and",
"os",
".",
"path",
".",
"splitext",
"(",
"configuration_file",
")",
"[",
"... | Saving configuration
Parameters
----------
configuration_file : string
Filename of the configuration file. | [
"Saving",
"configuration",
"Parameters",
"----------",
"configuration_file",
":",
"string",
"Filename",
"of",
"the",
"configuration",
"file",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L151-L162 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_commands | def get_commands(self, command_name, **kwargs):
"""get fe_command from command name and keyword arguments
wrapper for build_commands()
implements FEI4 specific behavior
"""
chip_id = kwargs.pop("ChipID", self.chip_id_bitarray)
commands = []
if command_n... | python | def get_commands(self, command_name, **kwargs):
"""get fe_command from command name and keyword arguments
wrapper for build_commands()
implements FEI4 specific behavior
"""
chip_id = kwargs.pop("ChipID", self.chip_id_bitarray)
commands = []
if command_n... | [
"def",
"get_commands",
"(",
"self",
",",
"command_name",
",",
"*",
"*",
"kwargs",
")",
":",
"chip_id",
"=",
"kwargs",
".",
"pop",
"(",
"\"ChipID\"",
",",
"self",
".",
"chip_id_bitarray",
")",
"commands",
"=",
"[",
"]",
"if",
"command_name",
"==",
"\"zero... | get fe_command from command name and keyword arguments
wrapper for build_commands()
implements FEI4 specific behavior | [
"get",
"fe_command",
"from",
"command",
"name",
"and",
"keyword",
"arguments",
"wrapper",
"for",
"build_commands",
"()",
"implements",
"FEI4",
"specific",
"behavior"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L205-L410 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.build_command | def build_command(self, command_name, **kwargs):
"""build command from command_name and keyword values
Returns
-------
command_bitvector : list
List of bitarrays.
Usage
-----
Receives: command name as defined inside xml file, key-value-pair... | python | def build_command(self, command_name, **kwargs):
"""build command from command_name and keyword values
Returns
-------
command_bitvector : list
List of bitarrays.
Usage
-----
Receives: command name as defined inside xml file, key-value-pair... | [
"def",
"build_command",
"(",
"self",
",",
"command_name",
",",
"*",
"*",
"kwargs",
")",
":",
"# command_name = command_name.lower()\r",
"command_bitvector",
"=",
"bitarray",
"(",
"0",
",",
"endian",
"=",
"'little'",
")",
"if",
"command_name",
"not",
"in",
... | build command from command_name and keyword values
Returns
-------
command_bitvector : list
List of bitarrays.
Usage
-----
Receives: command name as defined inside xml file, key-value-pairs as defined inside bit stream filed for each command | [
"build",
"command",
"from",
"command_name",
"and",
"keyword",
"values",
"Returns",
"-------",
"command_bitvector",
":",
"list",
"List",
"of",
"bitarrays",
".",
"Usage",
"-----",
"Receives",
":",
"command",
"name",
"as",
"defined",
"inside",
"xml",
"file",
"key",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L412-L465 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_global_register_attributes | def get_global_register_attributes(self, register_attribute, do_sort=True, **kwargs):
"""Calculating register numbers from register names.
Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2)
Receives: attribute name to be returned, dict... | python | def get_global_register_attributes(self, register_attribute, do_sort=True, **kwargs):
"""Calculating register numbers from register names.
Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2)
Receives: attribute name to be returned, dict... | [
"def",
"get_global_register_attributes",
"(",
"self",
",",
"register_attribute",
",",
"do_sort",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# speed up of the most often used keyword name\r",
"try",
":",
"names",
"=",
"iterable",
"(",
"kwargs",
".",
"pop",
"(... | Calculating register numbers from register names.
Usage: get_global_register_attributes("attribute_name", name = [regname_1, regname_2, ...], addresses = 2)
Receives: attribute name to be returned, dictionaries (kwargs) of register attributes and values for making cuts
Returns: list of attr... | [
"Calculating",
"register",
"numbers",
"from",
"register",
"names",
".",
"Usage",
":",
"get_global_register_attributes",
"(",
"attribute_name",
"name",
"=",
"[",
"regname_1",
"regname_2",
"...",
"]",
"addresses",
"=",
"2",
")",
"Receives",
":",
"attribute",
"name",... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L467-L493 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_global_register_objects | def get_global_register_objects(self, do_sort=None, reverse=False, **kwargs):
"""Generate register objects (list) from register name list
Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3])
Receives: keyword lists of register names, add... | python | def get_global_register_objects(self, do_sort=None, reverse=False, **kwargs):
"""Generate register objects (list) from register name list
Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3])
Receives: keyword lists of register names, add... | [
"def",
"get_global_register_objects",
"(",
"self",
",",
"do_sort",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# speed up of the most often used keyword name\r",
"try",
":",
"names",
"=",
"iterable",
"(",
"kwargs",
".",
"pop",
... | Generate register objects (list) from register name list
Usage: get_global_register_objects(name = ["Amp2Vbn", "GateHitOr", "DisableColumnCnfg"], address = [2, 3])
Receives: keyword lists of register names, addresses,... for making cuts
Returns: list of register objects | [
"Generate",
"register",
"objects",
"(",
"list",
")",
"from",
"register",
"name",
"list",
"Usage",
":",
"get_global_register_objects",
"(",
"name",
"=",
"[",
"Amp2Vbn",
"GateHitOr",
"DisableColumnCnfg",
"]",
"address",
"=",
"[",
"2",
"3",
"]",
")",
"Receives",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L495-L518 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_global_register_bitsets | def get_global_register_bitsets(self, register_addresses): # TOTO: add sorting
"""Calculating register bitsets from register addresses.
Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...])
Receives: list of register addresses
Returns: list of register bitsets
... | python | def get_global_register_bitsets(self, register_addresses): # TOTO: add sorting
"""Calculating register bitsets from register addresses.
Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...])
Receives: list of register addresses
Returns: list of register bitsets
... | [
"def",
"get_global_register_bitsets",
"(",
"self",
",",
"register_addresses",
")",
":",
"# TOTO: add sorting\r",
"register_bitsets",
"=",
"[",
"]",
"for",
"register_address",
"in",
"register_addresses",
":",
"register_objects",
"=",
"self",
".",
"get_global_register_objec... | Calculating register bitsets from register addresses.
Usage: get_global_register_bitsets([regaddress_1, regaddress_2, ...])
Receives: list of register addresses
Returns: list of register bitsets | [
"Calculating",
"register",
"bitsets",
"from",
"register",
"addresses",
".",
"Usage",
":",
"get_global_register_bitsets",
"(",
"[",
"regaddress_1",
"regaddress_2",
"...",
"]",
")",
"Receives",
":",
"list",
"of",
"register",
"addresses",
"Returns",
":",
"list",
"of"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L520-L548 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_pixel_register_objects | def get_pixel_register_objects(self, do_sort=None, reverse=False, **kwargs):
"""Generate register objects (list) from register name list
Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"])
Receives: keyword lists of register names, addresses,...
Returns: list of register obj... | python | def get_pixel_register_objects(self, do_sort=None, reverse=False, **kwargs):
"""Generate register objects (list) from register name list
Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"])
Receives: keyword lists of register names, addresses,...
Returns: list of register obj... | [
"def",
"get_pixel_register_objects",
"(",
"self",
",",
"do_sort",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# speed up of the most often used keyword name\r",
"try",
":",
"names",
"=",
"iterable",
"(",
"kwargs",
".",
"pop",
... | Generate register objects (list) from register name list
Usage: get_pixel_register_objects(name = ["TDAC", "FDAC"])
Receives: keyword lists of register names, addresses,...
Returns: list of register objects | [
"Generate",
"register",
"objects",
"(",
"list",
")",
"from",
"register",
"name",
"list",
"Usage",
":",
"get_pixel_register_objects",
"(",
"name",
"=",
"[",
"TDAC",
"FDAC",
"]",
")",
"Receives",
":",
"keyword",
"lists",
"of",
"register",
"names",
"addresses",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L550-L573 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.get_pixel_register_bitset | def get_pixel_register_bitset(self, register_object, bit_no, dc_no):
"""Calculating pixel register bitsets from pixel register addresses.
Usage: get_pixel_register_bitset(object, bit_number, double_column_number)
Receives: register object, bit number, double column number
Returns: ... | python | def get_pixel_register_bitset(self, register_object, bit_no, dc_no):
"""Calculating pixel register bitsets from pixel register addresses.
Usage: get_pixel_register_bitset(object, bit_number, double_column_number)
Receives: register object, bit number, double column number
Returns: ... | [
"def",
"get_pixel_register_bitset",
"(",
"self",
",",
"register_object",
",",
"bit_no",
",",
"dc_no",
")",
":",
"if",
"not",
"0",
"<=",
"dc_no",
"<",
"40",
":",
"raise",
"ValueError",
"(",
"\"Pixel register %s: DC out of range\"",
"%",
"register_object",
"[",
"'... | Calculating pixel register bitsets from pixel register addresses.
Usage: get_pixel_register_bitset(object, bit_number, double_column_number)
Receives: register object, bit number, double column number
Returns: double column bitset | [
"Calculating",
"pixel",
"register",
"bitsets",
"from",
"pixel",
"register",
"addresses",
".",
"Usage",
":",
"get_pixel_register_bitset",
"(",
"object",
"bit_number",
"double_column_number",
")",
"Receives",
":",
"register",
"object",
"bit",
"number",
"double",
"column... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L575-L597 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.create_restore_point | def create_restore_point(self, name=None):
'''Creating a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated.
'''
if name is None:
for i in iter(int, 1):
... | python | def create_restore_point(self, name=None):
'''Creating a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated.
'''
if name is None:
for i in iter(int, 1):
... | [
"def",
"create_restore_point",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"for",
"i",
"in",
"iter",
"(",
"int",
",",
"1",
")",
":",
"name",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
".",
"st... | Creating a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated. | [
"Creating",
"a",
"configuration",
"restore",
"point",
".",
"Parameters",
"----------",
"name",
":",
"str",
"Name",
"of",
"the",
"restore",
"point",
".",
"If",
"not",
"given",
"a",
"md5",
"hash",
"will",
"be",
"generated",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L607-L627 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.restore | def restore(self, name=None, keep=False, last=True, global_register=True, pixel_register=True):
'''Restoring a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated.
keep : bool
... | python | def restore(self, name=None, keep=False, last=True, global_register=True, pixel_register=True):
'''Restoring a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated.
keep : bool
... | [
"def",
"restore",
"(",
"self",
",",
"name",
"=",
"None",
",",
"keep",
"=",
"False",
",",
"last",
"=",
"True",
",",
"global_register",
"=",
"True",
",",
"pixel_register",
"=",
"True",
")",
":",
"if",
"name",
"is",
"None",
":",
"if",
"keep",
":",
"na... | Restoring a configuration restore point.
Parameters
----------
name : str
Name of the restore point. If not given, a md5 hash will be generated.
keep : bool
Keeping restore point for later use.
last : bool
If name is not given, the la... | [
"Restoring",
"a",
"configuration",
"restore",
"point",
".",
"Parameters",
"----------",
"name",
":",
"str",
"Name",
"of",
"the",
"restore",
"point",
".",
"If",
"not",
"given",
"a",
"md5",
"hash",
"will",
"be",
"generated",
".",
"keep",
":",
"bool",
"Keepin... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L629-L660 |
SiLab-Bonn/pyBAR | pybar/fei4/register.py | FEI4Register.clear_restore_points | def clear_restore_points(self, name=None):
'''Deleting all/a configuration restore points/point.
Parameters
----------
name : str
Name of the restore point to be deleted. If not given, all restore points will be deleted.
'''
if name is None:
... | python | def clear_restore_points(self, name=None):
'''Deleting all/a configuration restore points/point.
Parameters
----------
name : str
Name of the restore point to be deleted. If not given, all restore points will be deleted.
'''
if name is None:
... | [
"def",
"clear_restore_points",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"self",
".",
"config_state",
".",
"clear",
"(",
")",
"else",
":",
"del",
"self",
".",
"config_state",
"[",
"name",
"]"
] | Deleting all/a configuration restore points/point.
Parameters
----------
name : str
Name of the restore point to be deleted. If not given, all restore points will be deleted. | [
"Deleting",
"all",
"/",
"a",
"configuration",
"restore",
"points",
"/",
"point",
".",
"Parameters",
"----------",
"name",
":",
"str",
"Name",
"of",
"the",
"restore",
"point",
"to",
"be",
"deleted",
".",
"If",
"not",
"given",
"all",
"restore",
"points",
"wi... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L662-L673 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | save_configuration_dict | def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs):
'''Stores any configuration dictionary to HDF5 file.
Parameters
----------
h5_file : string, file
Filename of the HDF5 configuration file or file object.
configuation_name : str
Configuration n... | python | def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs):
'''Stores any configuration dictionary to HDF5 file.
Parameters
----------
h5_file : string, file
Filename of the HDF5 configuration file or file object.
configuation_name : str
Configuration n... | [
"def",
"save_configuration_dict",
"(",
"h5_file",
",",
"configuation_name",
",",
"configuration",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"save_conf",
"(",
")",
":",
"try",
":",
"h5_file",
".",
"remove_node",
"(",
"h5_file",
".",
"root",
".",
"configuratio... | Stores any configuration dictionary to HDF5 file.
Parameters
----------
h5_file : string, file
Filename of the HDF5 configuration file or file object.
configuation_name : str
Configuration name. Will be used for table name.
configuration : dict
Configuration diction... | [
"Stores",
"any",
"configuration",
"dictionary",
"to",
"HDF5",
"file",
".",
"Parameters",
"----------",
"h5_file",
":",
"string",
"file",
"Filename",
"of",
"the",
"HDF5",
"configuration",
"file",
"or",
"file",
"object",
".",
"configuation_name",
":",
"str",
"Conf... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L13-L49 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | convert_data_array | def convert_data_array(array, filter_func=None, converter_func=None): # TODO: add copy parameter, otherwise in-place
'''Filter and convert raw data numpy array (numpy.ndarray).
Parameters
----------
array : numpy.array
Raw data array.
filter_func : function
Function that ta... | python | def convert_data_array(array, filter_func=None, converter_func=None): # TODO: add copy parameter, otherwise in-place
'''Filter and convert raw data numpy array (numpy.ndarray).
Parameters
----------
array : numpy.array
Raw data array.
filter_func : function
Function that ta... | [
"def",
"convert_data_array",
"(",
"array",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"# TODO: add copy parameter, otherwise in-place\r",
"# if filter_func != None:\r",
"# if not hasattr(filter_func, '__call__'):\r",
"# ra... | Filter and convert raw data numpy array (numpy.ndarray).
Parameters
----------
array : numpy.array
Raw data array.
filter_func : function
Function that takes array and returns true or false for each item in array.
converter_func : function
Function that takes array ... | [
"Filter",
"and",
"convert",
"raw",
"data",
"numpy",
"array",
"(",
"numpy",
".",
"ndarray",
")",
".",
"Parameters",
"----------",
"array",
":",
"numpy",
".",
"array",
"Raw",
"data",
"array",
".",
"filter_func",
":",
"function",
"Function",
"that",
"takes",
... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L52-L79 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | convert_data_iterable | def convert_data_iterable(data_iterable, filter_func=None, converter_func=None): # TODO: add concatenate parameter
'''Convert raw data in data iterable.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_star... | python | def convert_data_iterable(data_iterable, filter_func=None, converter_func=None): # TODO: add concatenate parameter
'''Convert raw data in data iterable.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_star... | [
"def",
"convert_data_iterable",
"(",
"data_iterable",
",",
"filter_func",
"=",
"None",
",",
"converter_func",
"=",
"None",
")",
":",
"# TODO: add concatenate parameter\r",
"data_list",
"=",
"[",
"]",
"for",
"item",
"in",
"data_iterable",
":",
"data_list",
".",
"ap... | Convert raw data in data iterable.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status).
filter_func : function
Function that takes array and returns true or false for eac... | [
"Convert",
"raw",
"data",
"in",
"data",
"iterable",
".",
"Parameters",
"----------",
"data_iterable",
":",
"iterable",
"Iterable",
"where",
"each",
"element",
"is",
"a",
"tuple",
"with",
"following",
"content",
":",
"(",
"raw",
"data",
"timestamp_start",
"timest... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L82-L102 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | data_array_from_data_iterable | def data_array_from_data_iterable(data_iterable):
'''Convert data iterable to raw data numpy array.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status).
Returns
------... | python | def data_array_from_data_iterable(data_iterable):
'''Convert data iterable to raw data numpy array.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status).
Returns
------... | [
"def",
"data_array_from_data_iterable",
"(",
"data_iterable",
")",
":",
"try",
":",
"data_array",
"=",
"np",
".",
"concatenate",
"(",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"data_iterable",
"]",
")",
"except",
"ValueError",
":",
"# length is 0\r",
... | Convert data iterable to raw data numpy array.
Parameters
----------
data_iterable : iterable
Iterable where each element is a tuple with following content: (raw data, timestamp_start, timestamp_stop, status).
Returns
-------
data_array : numpy.array
concatenated data... | [
"Convert",
"data",
"iterable",
"to",
"raw",
"data",
"numpy",
"array",
".",
"Parameters",
"----------",
"data_iterable",
":",
"iterable",
"Iterable",
"where",
"each",
"element",
"is",
"a",
"tuple",
"with",
"following",
"content",
":",
"(",
"raw",
"data",
"times... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L105-L122 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | convert_tdc_to_channel | def convert_tdc_to_channel(channel):
''' Converts TDC words at a given channel to common TDC header (0x4).
'''
def f(value):
filter_func = logical_and(is_tdc_word, is_tdc_from_channel(channel))
select = filter_func(value)
value[select] = np.bitwise_and(value[select], 0x0FFFFFFF... | python | def convert_tdc_to_channel(channel):
''' Converts TDC words at a given channel to common TDC header (0x4).
'''
def f(value):
filter_func = logical_and(is_tdc_word, is_tdc_from_channel(channel))
select = filter_func(value)
value[select] = np.bitwise_and(value[select], 0x0FFFFFFF... | [
"def",
"convert_tdc_to_channel",
"(",
"channel",
")",
":",
"def",
"f",
"(",
"value",
")",
":",
"filter_func",
"=",
"logical_and",
"(",
"is_tdc_word",
",",
"is_tdc_from_channel",
"(",
"channel",
")",
")",
"select",
"=",
"filter_func",
"(",
"value",
")",
"valu... | Converts TDC words at a given channel to common TDC header (0x4). | [
"Converts",
"TDC",
"words",
"at",
"a",
"given",
"channel",
"to",
"common",
"TDC",
"header",
"(",
"0x4",
")",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L151-L161 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | is_data_from_channel | def is_data_from_channel(channel=4): # function factory
'''Selecting FE data from given channel.
Parameters
----------
channel : int
Channel number (4 is default channel on Single Chip Card).
Returns
-------
Function.
Usage:
1 Selecting FE data from channel 4... | python | def is_data_from_channel(channel=4): # function factory
'''Selecting FE data from given channel.
Parameters
----------
channel : int
Channel number (4 is default channel on Single Chip Card).
Returns
-------
Function.
Usage:
1 Selecting FE data from channel 4... | [
"def",
"is_data_from_channel",
"(",
"channel",
"=",
"4",
")",
":",
"# function factory\r",
"if",
"channel",
">=",
"0",
"and",
"channel",
"<",
"16",
":",
"def",
"f",
"(",
"value",
")",
":",
"return",
"np",
".",
"equal",
"(",
"np",
".",
"right_shift",
"(... | Selecting FE data from given channel.
Parameters
----------
channel : int
Channel number (4 is default channel on Single Chip Card).
Returns
-------
Function.
Usage:
1 Selecting FE data from channel 4 (combine with is_fe_word):
filter_fe_data_from_channel_... | [
"Selecting",
"FE",
"data",
"from",
"given",
"channel",
".",
"Parameters",
"----------",
"channel",
":",
"int",
"Channel",
"number",
"(",
"4",
"is",
"default",
"channel",
"on",
"Single",
"Chip",
"Card",
")",
".",
"Returns",
"-------",
"Function",
".",
"Usage"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L164-L196 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | logical_and | def logical_and(f1, f2): # function factory
'''Logical and from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
Usage:
filter_func=logical_and(is_data_rec... | python | def logical_and(f1, f2): # function factory
'''Logical and from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
Usage:
filter_func=logical_and(is_data_rec... | [
"def",
"logical_and",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f",
"(",
"value",
")",
":",
"return",
"np",
".",
"logical_and",
"(",
"f1",
"(",
"value",
")",
",",
"f2",
"(",
"value",
")",
")",
"f",
".",
"__name__",
"=",
"\"(\"... | Logical and from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
Usage:
filter_func=logical_and(is_data_record, is_data_from_channel(4)) # new filter function
... | [
"Logical",
"and",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function",
"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L199-L218 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | logical_or | def logical_or(f1, f2): # function factory
'''Logical or from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical_o... | python | def logical_or(f1, f2): # function factory
'''Logical or from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical_o... | [
"def",
"logical_or",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f",
"(",
"value",
")",
":",
"return",
"np",
".",
"logical_or",
"(",
"f1",
"(",
"value",
")",
",",
"f2",
"(",
"value",
")",
")",
"f",
".",
"__name__",
"=",
"\"(\"",... | Logical or from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function. | [
"Logical",
"or",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function",
".... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L221-L236 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | logical_not | def logical_not(f): # function factory
'''Logical not from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical_not(... | python | def logical_not(f): # function factory
'''Logical not from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical_not(... | [
"def",
"logical_not",
"(",
"f",
")",
":",
"# function factory\r",
"def",
"f",
"(",
"value",
")",
":",
"return",
"np",
".",
"logical_not",
"(",
"f",
"(",
"value",
")",
")",
"f",
".",
"__name__",
"=",
"\"not_\"",
"+",
"f",
".",
"__name__",
"return",
"f... | Logical not from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function. | [
"Logical",
"not",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function",
"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L239-L254 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | logical_xor | def logical_xor(f1, f2): # function factory
'''Logical xor from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical... | python | def logical_xor(f1, f2): # function factory
'''Logical xor from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function.
'''
def f(value):
return np.logical... | [
"def",
"logical_xor",
"(",
"f1",
",",
"f2",
")",
":",
"# function factory\r",
"def",
"f",
"(",
"value",
")",
":",
"return",
"np",
".",
"logical_xor",
"(",
"f1",
"(",
"value",
")",
",",
"f2",
"(",
"value",
")",
")",
"f",
".",
"__name__",
"=",
"\"(\"... | Logical xor from functions.
Parameters
----------
f1, f2 : function
Function that takes array and returns true or false for each item in array.
Returns
-------
Function. | [
"Logical",
"xor",
"from",
"functions",
".",
"Parameters",
"----------",
"f1",
"f2",
":",
"function",
"Function",
"that",
"takes",
"array",
"and",
"returns",
"true",
"or",
"false",
"for",
"each",
"item",
"in",
"array",
".",
"Returns",
"-------",
"Function",
"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L257-L272 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | get_trigger_data | def get_trigger_data(value, mode=0):
'''Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2)
'''
if mode == 2:
return np.right_shift(np.bitwise_and(value, 0x7FFF0000), 16), np.bitwise_and(value, 0x0000FFFF)
else:
retur... | python | def get_trigger_data(value, mode=0):
'''Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2)
'''
if mode == 2:
return np.right_shift(np.bitwise_and(value, 0x7FFF0000), 16), np.bitwise_and(value, 0x0000FFFF)
else:
retur... | [
"def",
"get_trigger_data",
"(",
"value",
",",
"mode",
"=",
"0",
")",
":",
"if",
"mode",
"==",
"2",
":",
"return",
"np",
".",
"right_shift",
"(",
"np",
".",
"bitwise_and",
"(",
"value",
",",
"0x7FFF0000",
")",
",",
"16",
")",
",",
"np",
".",
"bitwis... | Returns 31bit trigger counter (mode=0), 31bit timestamp (mode=1), 15bit timestamp and 16bit trigger counter (mode=2) | [
"Returns",
"31bit",
"trigger",
"counter",
"(",
"mode",
"=",
"0",
")",
"31bit",
"timestamp",
"(",
"mode",
"=",
"1",
")",
"15bit",
"timestamp",
"and",
"16bit",
"trigger",
"counter",
"(",
"mode",
"=",
"2",
")"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L315-L321 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | get_col_row_tot_array_from_data_record_array | def get_col_row_tot_array_from_data_record_array(array): # TODO: max ToT
'''Convert raw data array to column, row, and ToT array.
Parameters
----------
array : numpy.array
Raw data array.
Returns
-------
Tuple of arrays.
'''
def get_col_row_tot_1_array_from_dat... | python | def get_col_row_tot_array_from_data_record_array(array): # TODO: max ToT
'''Convert raw data array to column, row, and ToT array.
Parameters
----------
array : numpy.array
Raw data array.
Returns
-------
Tuple of arrays.
'''
def get_col_row_tot_1_array_from_dat... | [
"def",
"get_col_row_tot_array_from_data_record_array",
"(",
"array",
")",
":",
"# TODO: max ToT\r",
"def",
"get_col_row_tot_1_array_from_data_record_array",
"(",
"value",
")",
":",
"return",
"np",
".",
"right_shift",
"(",
"np",
".",
"bitwise_and",
"(",
"value",
",",
"... | Convert raw data array to column, row, and ToT array.
Parameters
----------
array : numpy.array
Raw data array.
Returns
-------
Tuple of arrays. | [
"Convert",
"raw",
"data",
"array",
"to",
"column",
"row",
"and",
"ToT",
"array",
".",
"Parameters",
"----------",
"array",
":",
"numpy",
".",
"array",
"Raw",
"data",
"array",
".",
"Returns",
"-------",
"Tuple",
"of",
"arrays",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L342-L370 |
SiLab-Bonn/pyBAR | pybar/daq/readout_utils.py | interpret_pixel_data | def interpret_pixel_data(data, dc, pixel_array, invert=True):
'''Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching.
The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit).
Parameters
----------
... | python | def interpret_pixel_data(data, dc, pixel_array, invert=True):
'''Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching.
The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit).
Parameters
----------
... | [
"def",
"interpret_pixel_data",
"(",
"data",
",",
"dc",
",",
"pixel_array",
",",
"invert",
"=",
"True",
")",
":",
"# data validity cut, VR has to follow an AR\r",
"index_value",
"=",
"np",
".",
"where",
"(",
"is_address_record",
"(",
"data",
")",
")",
"[",
"0",
... | Takes the pixel raw data and interprets them. This includes consistency checks and pixel/data matching.
The data has to come from one double column only but can have more than one pixel bit (e.g. TDAC = 5 bit).
Parameters
----------
data : numpy.ndarray
The raw data words.
dc : int
... | [
"Takes",
"the",
"pixel",
"raw",
"data",
"and",
"interprets",
"them",
".",
"This",
"includes",
"consistency",
"checks",
"and",
"pixel",
"/",
"data",
"matching",
".",
"The",
"data",
"has",
"to",
"come",
"from",
"one",
"double",
"column",
"only",
"but",
"can"... | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/readout_utils.py#L428-L499 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData.set_standard_settings | def set_standard_settings(self):
'''Set all settings to their standard values.
'''
if self.is_open(self.out_file_h5):
self.out_file_h5.close()
self.out_file_h5 = None
self._setup_clusterizer()
self.chunk_size = 3000000
self.n_injections = None
... | python | def set_standard_settings(self):
'''Set all settings to their standard values.
'''
if self.is_open(self.out_file_h5):
self.out_file_h5.close()
self.out_file_h5 = None
self._setup_clusterizer()
self.chunk_size = 3000000
self.n_injections = None
... | [
"def",
"set_standard_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_open",
"(",
"self",
".",
"out_file_h5",
")",
":",
"self",
".",
"out_file_h5",
".",
"close",
"(",
")",
"self",
".",
"out_file_h5",
"=",
"None",
"self",
".",
"_setup_clusterizer",
... | Set all settings to their standard values. | [
"Set",
"all",
"settings",
"to",
"their",
"standard",
"values",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L263-L312 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData.trig_count | def trig_count(self, value):
"""Set the numbers of BCIDs (usually 16) of one event."""
self._trig_count = 16 if value == 0 else value
self.interpreter.set_trig_count(self._trig_count) | python | def trig_count(self, value):
"""Set the numbers of BCIDs (usually 16) of one event."""
self._trig_count = 16 if value == 0 else value
self.interpreter.set_trig_count(self._trig_count) | [
"def",
"trig_count",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_trig_count",
"=",
"16",
"if",
"value",
"==",
"0",
"else",
"value",
"self",
".",
"interpreter",
".",
"set_trig_count",
"(",
"self",
".",
"_trig_count",
")"
] | Set the numbers of BCIDs (usually 16) of one event. | [
"Set",
"the",
"numbers",
"of",
"BCIDs",
"(",
"usually",
"16",
")",
"of",
"one",
"event",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L531-L534 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData.max_tot_value | def max_tot_value(self, value):
"""Set maximum ToT value that is considered to be a hit"""
self._max_tot_value = value
self.interpreter.set_max_tot(self._max_tot_value)
self.histogram.set_max_tot(self._max_tot_value)
self.clusterizer.set_max_hit_charge(self._max_tot_value) | python | def max_tot_value(self, value):
"""Set maximum ToT value that is considered to be a hit"""
self._max_tot_value = value
self.interpreter.set_max_tot(self._max_tot_value)
self.histogram.set_max_tot(self._max_tot_value)
self.clusterizer.set_max_hit_charge(self._max_tot_value) | [
"def",
"max_tot_value",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_max_tot_value",
"=",
"value",
"self",
".",
"interpreter",
".",
"set_max_tot",
"(",
"self",
".",
"_max_tot_value",
")",
"self",
".",
"histogram",
".",
"set_max_tot",
"(",
"self",
".... | Set maximum ToT value that is considered to be a hit | [
"Set",
"maximum",
"ToT",
"value",
"that",
"is",
"considered",
"to",
"be",
"a",
"hit"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L542-L547 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData.interpret_word_table | def interpret_word_table(self, analyzed_data_file=None, use_settings_from_file=True, fei4b=None):
'''Interprets the raw data word table of all given raw data files with the c++ library.
Creates the h5 output file and PDF plots.
Parameters
----------
analyzed_data_file : string
... | python | def interpret_word_table(self, analyzed_data_file=None, use_settings_from_file=True, fei4b=None):
'''Interprets the raw data word table of all given raw data files with the c++ library.
Creates the h5 output file and PDF plots.
Parameters
----------
analyzed_data_file : string
... | [
"def",
"interpret_word_table",
"(",
"self",
",",
"analyzed_data_file",
"=",
"None",
",",
"use_settings_from_file",
"=",
"True",
",",
"fei4b",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"'Interpreting raw data file(s): '",
"+",
"(",
"', '",
")",
".",
"... | Interprets the raw data word table of all given raw data files with the c++ library.
Creates the h5 output file and PDF plots.
Parameters
----------
analyzed_data_file : string
The file name of the output analyzed data file. If None, the output analyzed data file
... | [
"Interprets",
"the",
"raw",
"data",
"word",
"table",
"of",
"all",
"given",
"raw",
"data",
"files",
"with",
"the",
"c",
"++",
"library",
".",
"Creates",
"the",
"h5",
"output",
"file",
"and",
"PDF",
"plots",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L643-L921 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData.analyze_hit_table | def analyze_hit_table(self, analyzed_data_file=None, analyzed_data_out_file=None):
'''Analyzes a hit table with the c++ histogrammming/clusterizer.
Parameters
----------
analyzed_data_file : string
The filename of the analyzed data file. If None, the analyzed data file
... | python | def analyze_hit_table(self, analyzed_data_file=None, analyzed_data_out_file=None):
'''Analyzes a hit table with the c++ histogrammming/clusterizer.
Parameters
----------
analyzed_data_file : string
The filename of the analyzed data file. If None, the analyzed data file
... | [
"def",
"analyze_hit_table",
"(",
"self",
",",
"analyzed_data_file",
"=",
"None",
",",
"analyzed_data_out_file",
"=",
"None",
")",
":",
"close_analyzed_data_file",
"=",
"False",
"if",
"analyzed_data_file",
"is",
"not",
"None",
":",
"# if an output file name is specified ... | Analyzes a hit table with the c++ histogrammming/clusterizer.
Parameters
----------
analyzed_data_file : string
The filename of the analyzed data file. If None, the analyzed data file
specified during initialization is taken.
Filename extension (.h5) does not... | [
"Analyzes",
"a",
"hit",
"table",
"with",
"the",
"c",
"++",
"histogrammming",
"/",
"clusterizer",
"."
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1067-L1204 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData._deduce_settings_from_file | def _deduce_settings_from_file(self, opened_raw_data_file): # TODO: parse better
'''Tries to get the scan parameters needed for analysis from the raw data file
'''
try: # take infos raw data files (not avalable in old files)
flavor = opened_raw_data_file.root.configuration.miscella... | python | def _deduce_settings_from_file(self, opened_raw_data_file): # TODO: parse better
'''Tries to get the scan parameters needed for analysis from the raw data file
'''
try: # take infos raw data files (not avalable in old files)
flavor = opened_raw_data_file.root.configuration.miscella... | [
"def",
"_deduce_settings_from_file",
"(",
"self",
",",
"opened_raw_data_file",
")",
":",
"# TODO: parse better",
"try",
":",
"# take infos raw data files (not avalable in old files)",
"flavor",
"=",
"opened_raw_data_file",
".",
"root",
".",
"configuration",
".",
"miscellaneou... | Tries to get the scan parameters needed for analysis from the raw data file | [
"Tries",
"to",
"get",
"the",
"scan",
"parameters",
"needed",
"for",
"analysis",
"from",
"the",
"raw",
"data",
"file"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1399-L1431 |
SiLab-Bonn/pyBAR | pybar/analysis/analyze_raw_data.py | AnalyzeRawData._get_plsr_dac_charge | def _get_plsr_dac_charge(self, plsr_dac_array, no_offset=False):
'''Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis
'''
charge = np.zeros_like(self.c_low_mask, dtype=np.float16) # charge in electrons
if self.... | python | def _get_plsr_dac_charge(self, plsr_dac_array, no_offset=False):
'''Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis
'''
charge = np.zeros_like(self.c_low_mask, dtype=np.float16) # charge in electrons
if self.... | [
"def",
"_get_plsr_dac_charge",
"(",
"self",
",",
"plsr_dac_array",
",",
"no_offset",
"=",
"False",
")",
":",
"charge",
"=",
"np",
".",
"zeros_like",
"(",
"self",
".",
"c_low_mask",
",",
"dtype",
"=",
"np",
".",
"float16",
")",
"# charge in electrons",
"if",
... | Takes the PlsrDAC calibration and the stored C-high/C-low mask to calculate the charge from the PlsrDAC array on a pixel basis | [
"Takes",
"the",
"PlsrDAC",
"calibration",
"and",
"the",
"stored",
"C",
"-",
"high",
"/",
"C",
"-",
"low",
"mask",
"to",
"calculate",
"the",
"charge",
"from",
"the",
"PlsrDAC",
"array",
"on",
"a",
"pixel",
"basis"
] | train | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analyze_raw_data.py#L1433-L1442 |
yougov/solr-doc-manager | mongo_connector/doc_managers/solr_doc_manager.py | DocManager._parse_fields | def _parse_fields(self, result, field_name):
""" If Schema access, parse fields and build respective lists
"""
field_list = []
for key, value in result.get('schema', {}).get(field_name, {}).items():
if key not in field_list:
field_list.append(key)
retu... | python | def _parse_fields(self, result, field_name):
""" If Schema access, parse fields and build respective lists
"""
field_list = []
for key, value in result.get('schema', {}).get(field_name, {}).items():
if key not in field_list:
field_list.append(key)
retu... | [
"def",
"_parse_fields",
"(",
"self",
",",
"result",
",",
"field_name",
")",
":",
"field_list",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"result",
".",
"get",
"(",
"'schema'",
",",
"{",
"}",
")",
".",
"get",
"(",
"field_name",
",",
"{",
"}",... | If Schema access, parse fields and build respective lists | [
"If",
"Schema",
"access",
"parse",
"fields",
"and",
"build",
"respective",
"lists"
] | train | https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L83-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.