partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | RunManager.run_primlist | Runs runs from a primlist.
Parameters
----------
primlist : string
Filename of primlist.
skip_remaining : bool
If True, skip remaining runs, if a run does not exit with status FINISHED.
Note
----
Primlist is a text file of the following f... | pybar/run_manager.py | def run_primlist(self, primlist, skip_remaining=False):
'''Runs runs from a primlist.
Parameters
----------
primlist : string
Filename of primlist.
skip_remaining : bool
If True, skip remaining runs, if a run does not exit with status FINISHED.
N... | def run_primlist(self, primlist, skip_remaining=False):
'''Runs runs from a primlist.
Parameters
----------
primlist : string
Filename of primlist.
skip_remaining : bool
If True, skip remaining runs, if a run does not exit with status FINISHED.
N... | [
"Runs",
"runs",
"from",
"a",
"primlist",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/run_manager.py#L580-L602 | [
"def",
"run_primlist",
"(",
"self",
",",
"primlist",
",",
"skip_remaining",
"=",
"False",
")",
":",
"runlist",
"=",
"self",
".",
"open_primlist",
"(",
"primlist",
")",
"for",
"index",
",",
"run",
"in",
"enumerate",
"(",
"runlist",
")",
":",
"logging",
".... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | analyze_beam_spot | Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupancy is determined
for the given combined events and stored into a pdf file. At the end the beam x and y is plotted into a scatter plot with absolute ... | pybar/analysis/analysis.py | def analyze_beam_spot(scan_base, combine_n_readouts=1000, chunk_size=10000000, plot_occupancy_hists=False, output_pdf=None, output_file=None):
''' Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupanc... | def analyze_beam_spot(scan_base, combine_n_readouts=1000, chunk_size=10000000, plot_occupancy_hists=False, output_pdf=None, output_file=None):
''' Determines the mean x and y beam spot position as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The occupanc... | [
"Determines",
"the",
"mean",
"x",
"and",
"y",
"beam",
"spot",
"position",
"as",
"a",
"function",
"of",
"time",
".",
"Therefore",
"the",
"data",
"of",
"a",
"fixed",
"number",
"of",
"read",
"outs",
"are",
"combined",
"(",
"combine_n_readouts",
")",
".",
"T... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L23-L99 | [
"def",
"analyze_beam_spot",
"(",
"scan_base",
",",
"combine_n_readouts",
"=",
"1000",
",",
"chunk_size",
"=",
"10000000",
",",
"plot_occupancy_hists",
"=",
"False",
",",
"output_pdf",
"=",
"None",
",",
"output_file",
"=",
"None",
")",
":",
"time_stamp",
"=",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | analyze_event_rate | Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data info
and stored into a pdf file.
Parameters
----------
scan_base: list of str
scan base names (e.g.: ['... | pybar/analysis/analysis.py | def analyze_event_rate(scan_base, combine_n_readouts=1000, time_line_absolute=True, output_pdf=None, output_file=None):
''' Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data i... | def analyze_event_rate(scan_base, combine_n_readouts=1000, time_line_absolute=True, output_pdf=None, output_file=None):
''' Determines the number of events as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts'). The number of events is taken from the meta data i... | [
"Determines",
"the",
"number",
"of",
"events",
"as",
"a",
"function",
"of",
"time",
".",
"Therefore",
"the",
"data",
"of",
"a",
"fixed",
"number",
"of",
"read",
"outs",
"are",
"combined",
"(",
"combine_n_readouts",
")",
".",
"The",
"number",
"of",
"events"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L102-L147 | [
"def",
"analyze_event_rate",
"(",
"scan_base",
",",
"combine_n_readouts",
"=",
"1000",
",",
"time_line_absolute",
"=",
"True",
",",
"output_pdf",
"=",
"None",
",",
"output_file",
"=",
"None",
")",
":",
"time_stamp",
"=",
"[",
"]",
"rate",
"=",
"[",
"]",
"s... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | analyse_n_cluster_per_event | Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of read outs are combined ('combine_n_readouts').
Parameters
----------
scan_base: list of str
scan base names (e.g.: ['//data//SCC_50_fei4_self_trigger_scan_390', ]
include_no_cluster: bool
... | pybar/analysis/analysis.py | def analyse_n_cluster_per_event(scan_base, include_no_cluster=False, time_line_absolute=True, combine_n_readouts=1000, chunk_size=10000000, plot_n_cluster_hists=False, output_pdf=None, output_file=None):
''' Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of re... | def analyse_n_cluster_per_event(scan_base, include_no_cluster=False, time_line_absolute=True, combine_n_readouts=1000, chunk_size=10000000, plot_n_cluster_hists=False, output_pdf=None, output_file=None):
''' Determines the number of cluster per event as a function of time. Therefore the data of a fixed number of re... | [
"Determines",
"the",
"number",
"of",
"cluster",
"per",
"event",
"as",
"a",
"function",
"of",
"time",
".",
"Therefore",
"the",
"data",
"of",
"a",
"fixed",
"number",
"of",
"read",
"outs",
"are",
"combined",
"(",
"combine_n_readouts",
")",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L150-L248 | [
"def",
"analyse_n_cluster_per_event",
"(",
"scan_base",
",",
"include_no_cluster",
"=",
"False",
",",
"time_line_absolute",
"=",
"True",
",",
"combine_n_readouts",
"=",
"1000",
",",
"chunk_size",
"=",
"10000000",
",",
"plot_n_cluster_hists",
"=",
"False",
",",
"outp... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | select_hits_from_cluster_info | Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or cluster size.
To increase the analysis speed a event index for the input hit file is created first. Since a cluster hit table can be created to... | pybar/analysis/analysis.py | def select_hits_from_cluster_info(input_file_hits, output_file_hits, cluster_size_condition, n_cluster_condition, chunk_size=4000000):
''' Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or clus... | def select_hits_from_cluster_info(input_file_hits, output_file_hits, cluster_size_condition, n_cluster_condition, chunk_size=4000000):
''' Takes a hit table and stores only selected hits into a new table. The selection is done on an event base and events are selected if they have a certain number of cluster or clus... | [
"Takes",
"a",
"hit",
"table",
"and",
"stores",
"only",
"selected",
"hits",
"into",
"a",
"new",
"table",
".",
"The",
"selection",
"is",
"done",
"on",
"an",
"event",
"base",
"and",
"events",
"are",
"selected",
"if",
"they",
"have",
"a",
"certain",
"number"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L251-L285 | [
"def",
"select_hits_from_cluster_info",
"(",
"input_file_hits",
",",
"output_file_hits",
",",
"cluster_size_condition",
",",
"n_cluster_condition",
",",
"chunk_size",
"=",
"4000000",
")",
":",
"logging",
".",
"info",
"(",
"'Write hits of events from '",
"+",
"str",
"(",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | select_hits | Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if
this expression evaluates to true the hit is taken. One can also select hits from cluster conditions. This selection is done
on an event basis, meaning events are selected where the clus... | pybar/analysis/analysis.py | def select_hits(input_file_hits, output_file_hits, condition=None, cluster_size_condition=None, n_cluster_condition=None, chunk_size=5000000):
''' Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if
this expression evaluates to true the h... | def select_hits(input_file_hits, output_file_hits, condition=None, cluster_size_condition=None, n_cluster_condition=None, chunk_size=5000000):
''' Takes a hit table and stores only selected hits into a new table. The selection of hits is done with a numexp string. Only if
this expression evaluates to true the h... | [
"Takes",
"a",
"hit",
"table",
"and",
"stores",
"only",
"selected",
"hits",
"into",
"a",
"new",
"table",
".",
"The",
"selection",
"of",
"hits",
"is",
"done",
"with",
"a",
"numexp",
"string",
".",
"Only",
"if",
"this",
"expression",
"evaluates",
"to",
"tru... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L288-L338 | [
"def",
"select_hits",
"(",
"input_file_hits",
",",
"output_file_hits",
",",
"condition",
"=",
"None",
",",
"cluster_size_condition",
"=",
"None",
",",
"n_cluster_condition",
"=",
"None",
",",
"chunk_size",
"=",
"5000000",
")",
":",
"logging",
".",
"info",
"(",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | analyze_cluster_size_per_scan_parameter | This method takes multiple hit files and determines the cluster size for different scan parameter values of
Parameters
----------
input_files_hits: string
output_file_cluster_size: string
The data file with the results
parameter: string
The name of the parameter to separate the dat... | pybar/analysis/analysis.py | def analyze_cluster_size_per_scan_parameter(input_file_hits, output_file_cluster_size, parameter='GDAC', max_chunk_size=10000000, overwrite_output_files=False, output_pdf=None):
''' This method takes multiple hit files and determines the cluster size for different scan parameter values of
Parameters
-----... | def analyze_cluster_size_per_scan_parameter(input_file_hits, output_file_cluster_size, parameter='GDAC', max_chunk_size=10000000, overwrite_output_files=False, output_pdf=None):
''' This method takes multiple hit files and determines the cluster size for different scan parameter values of
Parameters
-----... | [
"This",
"method",
"takes",
"multiple",
"hit",
"files",
"and",
"determines",
"the",
"cluster",
"size",
"for",
"different",
"scan",
"parameter",
"values",
"of"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L341-L425 | [
"def",
"analyze_cluster_size_per_scan_parameter",
"(",
"input_file_hits",
",",
"output_file_cluster_size",
",",
"parameter",
"=",
"'GDAC'",
",",
"max_chunk_size",
"=",
"10000000",
",",
"overwrite_output_files",
"=",
"False",
",",
"output_pdf",
"=",
"None",
")",
":",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | histogram_cluster_table | Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array.
The 3rd dimension of the occupancy array is the number of different scan parameters used
Parameters
----------
analyzed_data_file : string
HDF5 filename of the file containing the cluster table. I... | pybar/analysis/analysis.py | def histogram_cluster_table(analyzed_data_file, output_file, chunk_size=10000000):
'''Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array.
The 3rd dimension of the occupancy array is the number of different scan parameters used
Parameters
----------
ana... | def histogram_cluster_table(analyzed_data_file, output_file, chunk_size=10000000):
'''Reads in the cluster info table in chunks and histograms the seed pixels into one occupancy array.
The 3rd dimension of the occupancy array is the number of different scan parameters used
Parameters
----------
ana... | [
"Reads",
"in",
"the",
"cluster",
"info",
"table",
"in",
"chunks",
"and",
"histograms",
"the",
"seed",
"pixels",
"into",
"one",
"occupancy",
"array",
".",
"The",
"3rd",
"dimension",
"of",
"the",
"occupancy",
"array",
"is",
"the",
"number",
"of",
"different",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L428-L482 | [
"def",
"histogram_cluster_table",
"(",
"analyzed_data_file",
",",
"output_file",
",",
"chunk_size",
"=",
"10000000",
")",
":",
"with",
"tb",
".",
"open_file",
"(",
"analyzed_data_file",
",",
"mode",
"=",
"\"r\"",
")",
"as",
"in_file_h5",
":",
"with",
"tb",
"."... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | analyze_hits_per_scan_parameter | Takes the hit table and analyzes the hits per scan parameter
Parameters
----------
analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a
file name with the hit data given (AnalyzeRawData._analyzed_data_file)
scan_parameters : list o... | pybar/analysis/analysis.py | def analyze_hits_per_scan_parameter(analyze_data, scan_parameters=None, chunk_size=50000):
'''Takes the hit table and analyzes the hits per scan parameter
Parameters
----------
analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a
f... | def analyze_hits_per_scan_parameter(analyze_data, scan_parameters=None, chunk_size=50000):
'''Takes the hit table and analyzes the hits per scan parameter
Parameters
----------
analyze_data : analysis.analyze_raw_data.AnalyzeRawData object with an opened hit file (AnalyzeRawData.out_file_h5) or a
f... | [
"Takes",
"the",
"hit",
"table",
"and",
"analyzes",
"the",
"hits",
"per",
"scan",
"parameter"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis.py#L485-L541 | [
"def",
"analyze_hits_per_scan_parameter",
"(",
"analyze_data",
",",
"scan_parameters",
"=",
"None",
",",
"chunk_size",
"=",
"50000",
")",
":",
"if",
"analyze_data",
".",
"out_file_h5",
"is",
"None",
"or",
"analyze_data",
".",
"out_file_h5",
".",
"isopen",
"==",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | interpret_data_from_tektronix | Interprets raw data from Tektronix
returns: lists of x, y values in seconds/volt | pybar/scans/calibrate_plsr_dac_transient.py | def interpret_data_from_tektronix(preamble, data):
''' Interprets raw data from Tektronix
returns: lists of x, y values in seconds/volt'''
# Y mode ("WFMPRE:PT_FMT"):
# Xn = XZEro + XINcr (n - PT_Off)
# Yn = YZEro + YMUlt (yn - YOFf)
voltage = np.array(data, dtype=np.float)
meta_data = pream... | def interpret_data_from_tektronix(preamble, data):
''' Interprets raw data from Tektronix
returns: lists of x, y values in seconds/volt'''
# Y mode ("WFMPRE:PT_FMT"):
# Xn = XZEro + XINcr (n - PT_Off)
# Yn = YZEro + YMUlt (yn - YOFf)
voltage = np.array(data, dtype=np.float)
meta_data = pream... | [
"Interprets",
"raw",
"data",
"from",
"Tektronix",
"returns",
":",
"lists",
"of",
"x",
"y",
"values",
"in",
"seconds",
"/",
"volt"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/calibrate_plsr_dac_transient.py#L24-L42 | [
"def",
"interpret_data_from_tektronix",
"(",
"preamble",
",",
"data",
")",
":",
"# Y mode (\"WFMPRE:PT_FMT\"):",
"# Xn = XZEro + XINcr (n - PT_Off)",
"# Yn = YZEro + YMUlt (yn - YOFf)",
"voltage",
"=",
"np",
".",
"array",
"(",
"data",
",",
"dtype",
"=",
"np",
".",
"floa... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | read_chip_sn | Reading Chip S/N
Note
----
Bits [MSB-LSB] | [15] | [14-6] | [5-0]
Content | reserved | wafer number | chip number | pybar/fei4/register_utils.py | def read_chip_sn(self):
'''Reading Chip S/N
Note
----
Bits [MSB-LSB] | [15] | [14-6] | [5-0]
Content | reserved | wafer number | chip number
'''
commands = []
commands.extend(self.register.get_commands("ConfMode"))
self.register_utils.send_commands(com... | def read_chip_sn(self):
'''Reading Chip S/N
Note
----
Bits [MSB-LSB] | [15] | [14-6] | [5-0]
Content | reserved | wafer number | chip number
'''
commands = []
commands.extend(self.register.get_commands("ConfMode"))
self.register_utils.send_commands(com... | [
"Reading",
"Chip",
"S",
"/",
"N",
"Note",
"----",
"Bits",
"[",
"MSB",
"-",
"LSB",
"]",
"|",
"[",
"15",
"]",
"|",
"[",
"14",
"-",
"6",
"]",
"|",
"[",
"5",
"-",
"0",
"]",
"Content",
"|",
"reserved",
"|",
"wafer",
"number",
"|",
"chip",
"number"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L264-L313 | [
"def",
"read_chip_sn",
"(",
"self",
")",
":",
"commands",
"=",
"[",
"]",
"commands",
".",
"extend",
"(",
"self",
".",
"register",
".",
"get_commands",
"(",
"\"ConfMode\"",
")",
")",
"self",
".",
"register_utils",
".",
"send_commands",
"(",
"commands",
")",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | read_global_register | The function reads the global register, interprets the data and returns the register value.
Parameters
----------
name : register name
overwrite_config : bool
The read values overwrite the config in RAM if true.
Returns
-------
register value | pybar/fei4/register_utils.py | def read_global_register(self, name, overwrite_config=False):
'''The function reads the global register, interprets the data and returns the register value.
Parameters
----------
name : register name
overwrite_config : bool
The read values overwrite the config in RAM if true.
... | def read_global_register(self, name, overwrite_config=False):
'''The function reads the global register, interprets the data and returns the register value.
Parameters
----------
name : register name
overwrite_config : bool
The read values overwrite the config in RAM if true.
... | [
"The",
"function",
"reads",
"the",
"global",
"register",
"interprets",
"the",
"data",
"and",
"returns",
"the",
"register",
"value",
".",
"Parameters",
"----------",
"name",
":",
"register",
"name",
"overwrite_config",
":",
"bool",
"The",
"read",
"values",
"overw... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L540-L586 | [
"def",
"read_global_register",
"(",
"self",
",",
"name",
",",
"overwrite_config",
"=",
"False",
")",
":",
"self",
".",
"register_utils",
".",
"send_commands",
"(",
"self",
".",
"register",
".",
"get_commands",
"(",
"\"ConfMode\"",
")",
")",
"with",
"self",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | read_pixel_register | The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register.
Pixels without any data are masked.
Parameters
----------
pix_regs : iterable, string
List of pixel register to read (e.g. Enable, C_High, ...).
... | pybar/fei4/register_utils.py | def read_pixel_register(self, pix_regs=None, dcs=range(40), overwrite_config=False):
'''The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register.
Pixels without any data are masked.
Parameters
----------
pix_regs ... | def read_pixel_register(self, pix_regs=None, dcs=range(40), overwrite_config=False):
'''The function reads the pixel register, interprets the data and returns a masked numpy arrays with the data for the chosen pixel register.
Pixels without any data are masked.
Parameters
----------
pix_regs ... | [
"The",
"function",
"reads",
"the",
"pixel",
"register",
"interprets",
"the",
"data",
"and",
"returns",
"a",
"masked",
"numpy",
"arrays",
"with",
"the",
"data",
"for",
"the",
"chosen",
"pixel",
"register",
".",
"Pixels",
"without",
"any",
"data",
"are",
"mask... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L598-L633 | [
"def",
"read_pixel_register",
"(",
"self",
",",
"pix_regs",
"=",
"None",
",",
"dcs",
"=",
"range",
"(",
"40",
")",
",",
"overwrite_config",
"=",
"False",
")",
":",
"if",
"pix_regs",
"is",
"None",
":",
"pix_regs",
"=",
"[",
"\"EnableDigInj\"",
",",
"\"Imo... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | is_fe_ready | Get FEI4 status of module.
If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state.
Returns
-------
value : bool
True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready. | pybar/fei4/register_utils.py | def is_fe_ready(self):
'''Get FEI4 status of module.
If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state.
Returns
-------
value : bool
True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready.
'''
with... | def is_fe_ready(self):
'''Get FEI4 status of module.
If FEI4 is not ready, resetting service records is necessary to bring the FEI4 to a defined state.
Returns
-------
value : bool
True if FEI4 is ready, False if the FEI4 was powered up recently and is not ready.
'''
with... | [
"Get",
"FEI4",
"status",
"of",
"module",
".",
"If",
"FEI4",
"is",
"not",
"ready",
"resetting",
"service",
"records",
"is",
"necessary",
"to",
"bring",
"the",
"FEI4",
"to",
"a",
"defined",
"state",
".",
"Returns",
"-------",
"value",
":",
"bool",
"True",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L636-L657 | [
"def",
"is_fe_ready",
"(",
"self",
")",
":",
"with",
"self",
".",
"readout",
"(",
"fill_buffer",
"=",
"True",
",",
"callback",
"=",
"None",
",",
"errback",
"=",
"None",
")",
":",
"commands",
"=",
"[",
"]",
"commands",
".",
"extend",
"(",
"self",
".",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | invert_pixel_mask | Invert pixel mask (0->1, 1(and greater)->0).
Parameters
----------
mask : array-like
Mask.
Returns
-------
inverted_mask : array-like
Inverted Mask. | pybar/fei4/register_utils.py | def invert_pixel_mask(mask):
'''Invert pixel mask (0->1, 1(and greater)->0).
Parameters
----------
mask : array-like
Mask.
Returns
-------
inverted_mask : array-like
Inverted Mask.
'''
inverted_mask = np.ones(shape=(80, 336), dtype=np.dtype('>u1'))
... | def invert_pixel_mask(mask):
'''Invert pixel mask (0->1, 1(and greater)->0).
Parameters
----------
mask : array-like
Mask.
Returns
-------
inverted_mask : array-like
Inverted Mask.
'''
inverted_mask = np.ones(shape=(80, 336), dtype=np.dtype('>u1'))
... | [
"Invert",
"pixel",
"mask",
"(",
"0",
"-",
">",
"1",
"1",
"(",
"and",
"greater",
")",
"-",
">",
"0",
")",
".",
"Parameters",
"----------",
"mask",
":",
"array",
"-",
"like",
"Mask",
".",
"Returns",
"-------",
"inverted_mask",
":",
"array",
"-",
"like"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L660-L675 | [
"def",
"invert_pixel_mask",
"(",
"mask",
")",
":",
"inverted_mask",
"=",
"np",
".",
"ones",
"(",
"shape",
"=",
"(",
"80",
",",
"336",
")",
",",
"dtype",
"=",
"np",
".",
"dtype",
"(",
"'>u1'",
")",
")",
"inverted_mask",
"[",
"mask",
">=",
"1",
"]",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | make_pixel_mask | Generate pixel mask.
Parameters
----------
steps : int
Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column).
shift : int
Shift mask by given value to the bottom (towards higher row numbers). F... | pybar/fei4/register_utils.py | def make_pixel_mask(steps, shift, default=0, value=1, enable_columns=None, mask=None):
'''Generate pixel mask.
Parameters
----------
steps : int
Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column).
... | def make_pixel_mask(steps, shift, default=0, value=1, enable_columns=None, mask=None):
'''Generate pixel mask.
Parameters
----------
steps : int
Number of mask steps, e.g. steps=3 (every third pixel is enabled), steps=336 (one pixel per column), steps=672 (one pixel per double column).
... | [
"Generate",
"pixel",
"mask",
".",
"Parameters",
"----------",
"steps",
":",
"int",
"Number",
"of",
"mask",
"steps",
"e",
".",
"g",
".",
"steps",
"=",
"3",
"(",
"every",
"third",
"pixel",
"is",
"enabled",
")",
"steps",
"=",
"336",
"(",
"one",
"pixel",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L678-L738 | [
"def",
"make_pixel_mask",
"(",
"steps",
",",
"shift",
",",
"default",
"=",
"0",
",",
"value",
"=",
"1",
",",
"enable_columns",
"=",
"None",
",",
"mask",
"=",
"None",
")",
":",
"shape",
"=",
"(",
"80",
",",
"336",
")",
"# value = np.zeros(dimension, dtype... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | make_pixel_mask_from_col_row | Generate mask from column and row lists
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of row values.
default : int
Value of pixels that are not selected by the mask.
value : int
Value of pixels that are se... | pybar/fei4/register_utils.py | def make_pixel_mask_from_col_row(column, row, default=0, value=1):
'''Generate mask from column and row lists
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of row values.
default : int
Value of pixels that are not ... | def make_pixel_mask_from_col_row(column, row, default=0, value=1):
'''Generate mask from column and row lists
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of row values.
default : int
Value of pixels that are not ... | [
"Generate",
"mask",
"from",
"column",
"and",
"row",
"lists",
"Parameters",
"----------",
"column",
":",
"iterable",
"int",
"List",
"of",
"colums",
"values",
".",
"row",
":",
"iterable",
"int",
"List",
"of",
"row",
"values",
".",
"default",
":",
"int",
"Val... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L741-L767 | [
"def",
"make_pixel_mask_from_col_row",
"(",
"column",
",",
"row",
",",
"default",
"=",
"0",
",",
"value",
"=",
"1",
")",
":",
"# FE columns and rows start from 1\r",
"col_array",
"=",
"np",
".",
"array",
"(",
"column",
")",
"-",
"1",
"row_array",
"=",
"np",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | make_box_pixel_mask_from_col_row | Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list.
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of row values.
default : int
Value of pixels that are not selected by... | pybar/fei4/register_utils.py | def make_box_pixel_mask_from_col_row(column, row, default=0, value=1):
'''Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list.
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of r... | def make_box_pixel_mask_from_col_row(column, row, default=0, value=1):
'''Generate box shaped mask from column and row lists. Takes the minimum and maximum value from each list.
Parameters
----------
column : iterable, int
List of colums values.
row : iterable, int
List of r... | [
"Generate",
"box",
"shaped",
"mask",
"from",
"column",
"and",
"row",
"lists",
".",
"Takes",
"the",
"minimum",
"and",
"maximum",
"value",
"from",
"each",
"list",
".",
"Parameters",
"----------",
"column",
":",
"iterable",
"int",
"List",
"of",
"colums",
"value... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L770-L797 | [
"def",
"make_box_pixel_mask_from_col_row",
"(",
"column",
",",
"row",
",",
"default",
"=",
"0",
",",
"value",
"=",
"1",
")",
":",
"# FE columns and rows start from 1\r",
"col_array",
"=",
"np",
".",
"array",
"(",
"column",
")",
"-",
"1",
"row_array",
"=",
"n... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | make_xtalk_mask | Generate xtalk mask (row - 1, row + 1) from pixel mask.
Parameters
----------
mask : ndarray
Pixel mask.
Returns
-------
ndarray
Xtalk mask.
Example
-------
Input:
[[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 1 ... 0 1 ... | pybar/fei4/register_utils.py | def make_xtalk_mask(mask):
"""
Generate xtalk mask (row - 1, row + 1) from pixel mask.
Parameters
----------
mask : ndarray
Pixel mask.
Returns
-------
ndarray
Xtalk mask.
Example
-------
Input:
[[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0... | def make_xtalk_mask(mask):
"""
Generate xtalk mask (row - 1, row + 1) from pixel mask.
Parameters
----------
mask : ndarray
Pixel mask.
Returns
-------
ndarray
Xtalk mask.
Example
-------
Input:
[[1 0 0 0 0 0 1 0 0 0 ... 0 0 0 0 1 0 0 0... | [
"Generate",
"xtalk",
"mask",
"(",
"row",
"-",
"1",
"row",
"+",
"1",
")",
"from",
"pixel",
"mask",
".",
"Parameters",
"----------",
"mask",
":",
"ndarray",
"Pixel",
"mask",
".",
"Returns",
"-------",
"ndarray",
"Xtalk",
"mask",
".",
"Example",
"-------",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L800-L841 | [
"def",
"make_xtalk_mask",
"(",
"mask",
")",
":",
"col",
",",
"row",
"=",
"mask",
".",
"nonzero",
"(",
")",
"row_plus_one",
"=",
"row",
"+",
"1",
"del_index",
"=",
"np",
".",
"where",
"(",
"row_plus_one",
">",
"335",
")",
"row_plus_one",
"=",
"np",
".... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | make_checkerboard_mask | Generate chessboard/checkerboard mask.
Parameters
----------
column_distance : int
Column distance of the enabled pixels.
row_distance : int
Row distance of the enabled pixels.
column_offset : int
Additional column offset which shifts the columns by the given amount... | pybar/fei4/register_utils.py | def make_checkerboard_mask(column_distance, row_distance, column_offset=0, row_offset=0, default=0, value=1):
"""
Generate chessboard/checkerboard mask.
Parameters
----------
column_distance : int
Column distance of the enabled pixels.
row_distance : int
Row distance of... | def make_checkerboard_mask(column_distance, row_distance, column_offset=0, row_offset=0, default=0, value=1):
"""
Generate chessboard/checkerboard mask.
Parameters
----------
column_distance : int
Column distance of the enabled pixels.
row_distance : int
Row distance of... | [
"Generate",
"chessboard",
"/",
"checkerboard",
"mask",
".",
"Parameters",
"----------",
"column_distance",
":",
"int",
"Column",
"distance",
"of",
"the",
"enabled",
"pixels",
".",
"row_distance",
":",
"int",
"Row",
"distance",
"of",
"the",
"enabled",
"pixels",
"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L844-L886 | [
"def",
"make_checkerboard_mask",
"(",
"column_distance",
",",
"row_distance",
",",
"column_offset",
"=",
"0",
",",
"row_offset",
"=",
"0",
",",
"default",
"=",
"0",
",",
"value",
"=",
"1",
")",
":",
"col_shape",
"=",
"(",
"336",
",",
")",
"col",
"=",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | scan_loop | Implementation of the scan loops (mask shifting, loop over double columns, repeatedly sending any arbitrary command).
Parameters
----------
command : BitVector
(FEI4) command that will be sent out serially.
repeat_command : int
The number of repetitions command will be sent out e... | pybar/fei4/register_utils.py | def scan_loop(self, command, repeat_command=100, use_delay=True, additional_delay=0, mask_steps=3, enable_mask_steps=None, enable_double_columns=None, same_mask_for_all_dc=False, fast_dc_loop=True, bol_function=None, eol_function=None, digital_injection=False, enable_shift_masks=None, disable_shift_masks=None, restore_... | def scan_loop(self, command, repeat_command=100, use_delay=True, additional_delay=0, mask_steps=3, enable_mask_steps=None, enable_double_columns=None, same_mask_for_all_dc=False, fast_dc_loop=True, bol_function=None, eol_function=None, digital_injection=False, enable_shift_masks=None, disable_shift_masks=None, restore_... | [
"Implementation",
"of",
"the",
"scan",
"loops",
"(",
"mask",
"shifting",
"loop",
"over",
"double",
"columns",
"repeatedly",
"sending",
"any",
"arbitrary",
"command",
")",
".",
"Parameters",
"----------",
"command",
":",
"BitVector",
"(",
"FEI4",
")",
"command",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L913-L1252 | [
"def",
"scan_loop",
"(",
"self",
",",
"command",
",",
"repeat_command",
"=",
"100",
",",
"use_delay",
"=",
"True",
",",
"additional_delay",
"=",
"0",
",",
"mask_steps",
"=",
"3",
",",
"enable_mask_steps",
"=",
"None",
",",
"enable_double_columns",
"=",
"None... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | FEI4RegisterUtils.reset_service_records | Resetting Service Records
This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode).
This should be only issued after power up and in the case of a stuck FIFO, otherwise the BCID counter starts jumping. | pybar/fei4/register_utils.py | def reset_service_records(self):
'''Resetting Service Records
This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode).
This should be only issued after power up and in the case of a stuck FIFO, other... | def reset_service_records(self):
'''Resetting Service Records
This will reset Service Record counters. This will also bring back alive some FE where the output FIFO is stuck (no data is coming out in run mode).
This should be only issued after power up and in the case of a stuck FIFO, other... | [
"Resetting",
"Service",
"Records",
"This",
"will",
"reset",
"Service",
"Record",
"counters",
".",
"This",
"will",
"also",
"bring",
"back",
"alive",
"some",
"FE",
"where",
"the",
"output",
"FIFO",
"is",
"stuck",
"(",
"no",
"data",
"is",
"coming",
"out",
"in... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L164-L180 | [
"def",
"reset_service_records",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Resetting Service Records'",
")",
"commands",
"=",
"[",
"]",
"commands",
".",
"extend",
"(",
"self",
".",
"register",
".",
"get_commands",
"(",
"\"ConfMode\"",
")",
")",
"s... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | FEI4RegisterUtils.reset_bunch_counter | Resetting Bunch Counter | pybar/fei4/register_utils.py | def reset_bunch_counter(self):
'''Resetting Bunch Counter
'''
logging.info('Resetting Bunch Counter')
commands = []
commands.extend(self.register.get_commands("RunMode"))
commands.extend(self.register.get_commands("BCR"))
self.send_commands(commands)
... | def reset_bunch_counter(self):
'''Resetting Bunch Counter
'''
logging.info('Resetting Bunch Counter')
commands = []
commands.extend(self.register.get_commands("RunMode"))
commands.extend(self.register.get_commands("BCR"))
self.send_commands(commands)
... | [
"Resetting",
"Bunch",
"Counter"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register_utils.py#L182-L193 | [
"def",
"reset_bunch_counter",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Resetting Bunch Counter'",
")",
"commands",
"=",
"[",
"]",
"commands",
".",
"extend",
"(",
"self",
".",
"register",
".",
"get_commands",
"(",
"\"RunMode\"",
")",
")",
"comman... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | generate_threshold_mask | Masking array elements when equal 0.0 or greater than 10 times the median
Parameters
----------
hist : array_like
Input data.
Returns
-------
masked array
Returns copy of the array with masked elements. | pybar/analysis/analysis_utils.py | def generate_threshold_mask(hist):
'''Masking array elements when equal 0.0 or greater than 10 times the median
Parameters
----------
hist : array_like
Input data.
Returns
-------
masked array
Returns copy of the array with masked elements.
'''
masked_array = np.ma.... | def generate_threshold_mask(hist):
'''Masking array elements when equal 0.0 or greater than 10 times the median
Parameters
----------
hist : array_like
Input data.
Returns
-------
masked array
Returns copy of the array with masked elements.
'''
masked_array = np.ma.... | [
"Masking",
"array",
"elements",
"when",
"equal",
"0",
".",
"0",
"or",
"greater",
"than",
"10",
"times",
"the",
"median"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L50-L66 | [
"def",
"generate_threshold_mask",
"(",
"hist",
")",
":",
"masked_array",
"=",
"np",
".",
"ma",
".",
"masked_values",
"(",
"hist",
",",
"0",
")",
"masked_array",
"=",
"np",
".",
"ma",
".",
"masked_greater",
"(",
"masked_array",
",",
"10",
"*",
"np",
".",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | unique_row | Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row.
The returned array can have all columns of the original array or only the columns defined in use_columns.
Parameters
----------
array : numpy.ndarray
use_colu... | pybar/analysis/analysis_utils.py | def unique_row(array, use_columns=None, selected_columns_only=False):
'''Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row.
The returned array can have all columns of the original array or only the columns defined in use_... | def unique_row(array, use_columns=None, selected_columns_only=False):
'''Takes a numpy array and returns the array reduced to unique rows. If columns are defined only these columns are taken to define a unique row.
The returned array can have all columns of the original array or only the columns defined in use_... | [
"Takes",
"a",
"numpy",
"array",
"and",
"returns",
"the",
"array",
"reduced",
"to",
"unique",
"rows",
".",
"If",
"columns",
"are",
"defined",
"only",
"these",
"columns",
"are",
"taken",
"to",
"define",
"a",
"unique",
"row",
".",
"The",
"returned",
"array",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L69-L108 | [
"def",
"unique_row",
"(",
"array",
",",
"use_columns",
"=",
"None",
",",
"selected_columns_only",
"=",
"False",
")",
":",
"if",
"array",
".",
"dtype",
".",
"names",
"is",
"None",
":",
"# normal array has no named dtype",
"if",
"use_columns",
"is",
"not",
"None... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_ranges_from_array | Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length.
Parameters
----------
arr : array like
append_last: bool
If True, append item with a pair of last array item and None.
Returns
-------
numpy.array
The array formed by pai... | pybar/analysis/analysis_utils.py | def get_ranges_from_array(arr, append_last=True):
'''Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length.
Parameters
----------
arr : array like
append_last: bool
If True, append item with a pair of last array item and None.
Returns
... | def get_ranges_from_array(arr, append_last=True):
'''Takes an array and calculates ranges [start, stop[. The last range end is none to keep the same length.
Parameters
----------
arr : array like
append_last: bool
If True, append item with a pair of last array item and None.
Returns
... | [
"Takes",
"an",
"array",
"and",
"calculates",
"ranges",
"[",
"start",
"stop",
"[",
".",
"The",
"last",
"range",
"end",
"is",
"none",
"to",
"keep",
"the",
"same",
"length",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L111-L144 | [
"def",
"get_ranges_from_array",
"(",
"arr",
",",
"append_last",
"=",
"True",
")",
":",
"right",
"=",
"arr",
"[",
"1",
":",
"]",
"if",
"append_last",
":",
"left",
"=",
"arr",
"[",
":",
"]",
"right",
"=",
"np",
".",
"append",
"(",
"right",
",",
"None... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | in1d_sorted | Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster. | pybar/analysis/analysis_utils.py | def in1d_sorted(ar1, ar2):
"""
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster.
"""
if ar1.shape[0] == 0 or ar2.shape[0] == 0: # check for empty arrays to avoid crash
return []
inds = ar2.searchsorted(ar1)
inds[inds == len(ar2)] = 0
... | def in1d_sorted(ar1, ar2):
"""
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster.
"""
if ar1.shape[0] == 0 or ar2.shape[0] == 0: # check for empty arrays to avoid crash
return []
inds = ar2.searchsorted(ar1)
inds[inds == len(ar2)] = 0
... | [
"Does",
"the",
"same",
"than",
"np",
".",
"in1d",
"but",
"uses",
"the",
"fact",
"that",
"ar1",
"and",
"ar2",
"are",
"sorted",
".",
"Is",
"therefore",
"much",
"faster",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L159-L168 | [
"def",
"in1d_sorted",
"(",
"ar1",
",",
"ar2",
")",
":",
"if",
"ar1",
".",
"shape",
"[",
"0",
"]",
"==",
"0",
"or",
"ar2",
".",
"shape",
"[",
"0",
"]",
"==",
"0",
":",
"# check for empty arrays to avoid crash",
"return",
"[",
"]",
"inds",
"=",
"ar2",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | central_difference | Returns the dy/dx(x) via central difference method
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like | pybar/analysis/analysis_utils.py | def central_difference(x, y):
'''Returns the dy/dx(x) via central difference method
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like
'''
if (len(x) != len(y)):
raise ValueError("x, y must have the same length")
z1 = np.hstack((y... | def central_difference(x, y):
'''Returns the dy/dx(x) via central difference method
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like
'''
if (len(x) != len(y)):
raise ValueError("x, y must have the same length")
z1 = np.hstack((y... | [
"Returns",
"the",
"dy",
"/",
"dx",
"(",
"x",
")",
"via",
"central",
"difference",
"method"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L171-L189 | [
"def",
"central_difference",
"(",
"x",
",",
"y",
")",
":",
"if",
"(",
"len",
"(",
"x",
")",
"!=",
"len",
"(",
"y",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"x, y must have the same length\"",
")",
"z1",
"=",
"np",
".",
"hstack",
"(",
"(",
"y",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_profile_histogram | Takes 2D point data (x,y) and creates a profile histogram similar to the TProfile in ROOT. It calculates
the y mean for every bin at the bin center and gives the y mean error as error bars.
Parameters
----------
x : array like
data x positions
y : array like
data y positions
n_b... | pybar/analysis/analysis_utils.py | def get_profile_histogram(x, y, n_bins=100):
'''Takes 2D point data (x,y) and creates a profile histogram similar to the TProfile in ROOT. It calculates
the y mean for every bin at the bin center and gives the y mean error as error bars.
Parameters
----------
x : array like
data x positions... | def get_profile_histogram(x, y, n_bins=100):
'''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... | [
"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"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L192-L217 | [
"def",
"get_profile_histogram",
"(",
"x",
",",
"y",
",",
"n_bins",
"=",
"100",
")",
":",
"if",
"len",
"(",
"x",
")",
"!=",
"len",
"(",
"y",
")",
":",
"raise",
"ValueError",
"(",
"'x and y dimensions have to be the same'",
")",
"y",
"=",
"y",
".",
"asty... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_rate_normalization | Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter)
and returns an array with a normalization factor. This normalization factor has the length of the number of different parameters.
If a cluster_file is specified also the number of clu... | pybar/analysis/analysis_utils.py | def get_rate_normalization(hit_file, parameter, reference='event', cluster_file=None, plot=False, chunk_size=500000):
''' Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter)
and returns an array with a normalization factor. This normal... | def get_rate_normalization(hit_file, parameter, reference='event', cluster_file=None, plot=False, chunk_size=500000):
''' Takes different hit files (hit_files), extracts the number of events or the scan time (reference) per scan parameter (parameter)
and returns an array with a normalization factor. This normal... | [
"Takes",
"different",
"hit",
"files",
"(",
"hit_files",
")",
"extracts",
"the",
"number",
"of",
"events",
"or",
"the",
"scan",
"time",
"(",
"reference",
")",
"per",
"scan",
"parameter",
"(",
"parameter",
")",
"and",
"returns",
"an",
"array",
"with",
"a",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L220-L300 | [
"def",
"get_rate_normalization",
"(",
"hit_file",
",",
"parameter",
",",
"reference",
"=",
"'event'",
",",
"cluster_file",
"=",
"None",
",",
"plot",
"=",
"False",
",",
"chunk_size",
"=",
"500000",
")",
":",
"logging",
".",
"info",
"(",
"'Calculate the rate nor... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_parameter_value_from_file_names | Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name
in the first dimension and the corresponding parameter value in the second.
The file names can be sorted by the parameter value, otherwise the order is kept. If unique is true every parameter is... | pybar/analysis/analysis_utils.py | def get_parameter_value_from_file_names(files, parameters=None, unique=False, sort=True):
"""
Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name
in the first dimension and the corresponding parameter value in the second.
The file names c... | def get_parameter_value_from_file_names(files, parameters=None, unique=False, sort=True):
"""
Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name
in the first dimension and the corresponding parameter value in the second.
The file names c... | [
"Takes",
"a",
"list",
"of",
"files",
"searches",
"for",
"the",
"parameter",
"name",
"in",
"the",
"file",
"name",
"and",
"returns",
"a",
"ordered",
"dict",
"with",
"the",
"file",
"name",
"in",
"the",
"first",
"dimension",
"and",
"the",
"corresponding",
"par... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L361-L404 | [
"def",
"get_parameter_value_from_file_names",
"(",
"files",
",",
"parameters",
"=",
"None",
",",
"unique",
"=",
"False",
",",
"sort",
"=",
"True",
")",
":",
"# unique=False",
"logging",
".",
"debug",
"(",
"'Get the parameter: '",
"+",
"str",
"(",
"parameters... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_data_file_names_from_scan_base | Generate a list of .h5 files which have a similar file name.
Parameters
----------
scan_base : list, string
List of string or string of the scan base names. The scan_base will be used to search for files containing the string. The .h5 file extension will be added automatically.
filter : list, s... | pybar/analysis/analysis_utils.py | def get_data_file_names_from_scan_base(scan_base, filter_str=['_analyzed.h5', '_interpreted.h5', '_cut.h5', '_result.h5', '_hists.h5'], sort_by_time=True, meta_data_v2=True):
"""
Generate a list of .h5 files which have a similar file name.
Parameters
----------
scan_base : list, string
List... | def get_data_file_names_from_scan_base(scan_base, filter_str=['_analyzed.h5', '_interpreted.h5', '_cut.h5', '_result.h5', '_hists.h5'], sort_by_time=True, meta_data_v2=True):
"""
Generate a list of .h5 files which have a similar file name.
Parameters
----------
scan_base : list, string
List... | [
"Generate",
"a",
"list",
"of",
".",
"h5",
"files",
"which",
"have",
"a",
"similar",
"file",
"name",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L407-L462 | [
"def",
"get_data_file_names_from_scan_base",
"(",
"scan_base",
",",
"filter_str",
"=",
"[",
"'_analyzed.h5'",
",",
"'_interpreted.h5'",
",",
"'_cut.h5'",
",",
"'_result.h5'",
",",
"'_hists.h5'",
"]",
",",
"sort_by_time",
"=",
"True",
",",
"meta_data_v2",
"=",
"True"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_parameter_from_files | Takes a list of files, searches for the parameter name in the file name and in the file.
Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second.
If a scan parameter appears in the file name and in the file the first parameter setting has to be in th... | pybar/analysis/analysis_utils.py | def get_parameter_from_files(files, parameters=None, unique=False, sort=True):
''' Takes a list of files, searches for the parameter name in the file name and in the file.
Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second.
If a scan paramet... | def get_parameter_from_files(files, parameters=None, unique=False, sort=True):
''' Takes a list of files, searches for the parameter name in the file name and in the file.
Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second.
If a scan paramet... | [
"Takes",
"a",
"list",
"of",
"files",
"searches",
"for",
"the",
"parameter",
"name",
"in",
"the",
"file",
"name",
"and",
"in",
"the",
"file",
".",
"Returns",
"a",
"ordered",
"dict",
"with",
"the",
"file",
"name",
"in",
"the",
"first",
"dimension",
"and",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L480-L555 | [
"def",
"get_parameter_from_files",
"(",
"files",
",",
"parameters",
"=",
"None",
",",
"unique",
"=",
"False",
",",
"sort",
"=",
"True",
")",
":",
"logging",
".",
"debug",
"(",
"'Get the parameter '",
"+",
"str",
"(",
"parameters",
")",
"+",
"' values from '"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | check_parameter_similarity | Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input. | pybar/analysis/analysis_utils.py | def check_parameter_similarity(files_dict):
"""
Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input.
"""
try:
parameter_names = files_dict.itervalues().next().keys() # get the parameter names of the first file, to check if ... | def check_parameter_similarity(files_dict):
"""
Checks if the parameter names of all files are similar. Takes the dictionary from get_parameter_from_files output as input.
"""
try:
parameter_names = files_dict.itervalues().next().keys() # get the parameter names of the first file, to check if ... | [
"Checks",
"if",
"the",
"parameter",
"names",
"of",
"all",
"files",
"are",
"similar",
".",
"Takes",
"the",
"dictionary",
"from",
"get_parameter_from_files",
"output",
"as",
"input",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L558-L572 | [
"def",
"check_parameter_similarity",
"(",
"files_dict",
")",
":",
"try",
":",
"parameter_names",
"=",
"files_dict",
".",
"itervalues",
"(",
")",
".",
"next",
"(",
")",
".",
"keys",
"(",
")",
"# get the parameter names of the first file, to check if these are the same in... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | combine_meta_data | Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array.
Parameters
----------
meta_data_v2 : bool
True for new (v2) meta data format, False for the old (v1) format. | pybar/analysis/analysis_utils.py | def combine_meta_data(files_dict, meta_data_v2=True):
"""
Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array.
Parameters
----------
meta_data_v2 : bool
True for new (v2) meta data format, False for the old (v1) format.
"""
if len(files_d... | def combine_meta_data(files_dict, meta_data_v2=True):
"""
Takes the dict of hdf5 files and combines their meta data tables into one new numpy record array.
Parameters
----------
meta_data_v2 : bool
True for new (v2) meta data format, False for the old (v1) format.
"""
if len(files_d... | [
"Takes",
"the",
"dict",
"of",
"hdf5",
"files",
"and",
"combines",
"their",
"meta",
"data",
"tables",
"into",
"one",
"new",
"numpy",
"record",
"array",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L575-L624 | [
"def",
"combine_meta_data",
"(",
"files_dict",
",",
"meta_data_v2",
"=",
"True",
")",
":",
"if",
"len",
"(",
"files_dict",
")",
">",
"10",
":",
"logging",
".",
"info",
"(",
"\"Combine the meta data from %d files\"",
",",
"len",
"(",
"files_dict",
")",
")",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | smooth_differentiation | Returns the dy/dx(x) with the fit and differentiation of a spline curve
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like | pybar/analysis/analysis_utils.py | def smooth_differentiation(x, y, weigths=None, order=5, smoothness=3, derivation=1):
'''Returns the dy/dx(x) with the fit and differentiation of a spline curve
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like
'''
if (len(x) != len(y)):
... | def smooth_differentiation(x, y, weigths=None, order=5, smoothness=3, derivation=1):
'''Returns the dy/dx(x) with the fit and differentiation of a spline curve
Parameters
----------
x : array like
y : array like
Returns
-------
dy/dx : array like
'''
if (len(x) != len(y)):
... | [
"Returns",
"the",
"dy",
"/",
"dx",
"(",
"x",
")",
"with",
"the",
"fit",
"and",
"differentiation",
"of",
"a",
"spline",
"curve"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L627-L642 | [
"def",
"smooth_differentiation",
"(",
"x",
",",
"y",
",",
"weigths",
"=",
"None",
",",
"order",
"=",
"5",
",",
"smoothness",
"=",
"3",
",",
"derivation",
"=",
"1",
")",
":",
"if",
"(",
"len",
"(",
"x",
")",
"!=",
"len",
"(",
"y",
")",
")",
":",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | reduce_sorted_to_intersect | Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1.
Parameters
----------
ar1 : (M,) array_like
Input array.
ar2 : array_like
Input array.
Returns
-------
ar1, ar1 : ndarray, ndarray
The intersection values. | pybar/analysis/analysis_utils.py | def reduce_sorted_to_intersect(ar1, ar2):
"""
Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1.
Parameters
----------
ar1 : (M,) array_like
Input array.
ar2 : array_like
Input array.
Returns
-------
ar1, ar1 : ndarray, ndarray
The ... | def reduce_sorted_to_intersect(ar1, ar2):
"""
Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1.
Parameters
----------
ar1 : (M,) array_like
Input array.
ar2 : array_like
Input array.
Returns
-------
ar1, ar1 : ndarray, ndarray
The ... | [
"Takes",
"two",
"sorted",
"arrays",
"and",
"return",
"the",
"intersection",
"ar1",
"in",
"ar2",
"ar2",
"in",
"ar1",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L645-L691 | [
"def",
"reduce_sorted_to_intersect",
"(",
"ar1",
",",
"ar2",
")",
":",
"# Ravel both arrays, behavior for the first array could be different",
"ar1",
"=",
"np",
".",
"asarray",
"(",
"ar1",
")",
".",
"ravel",
"(",
")",
"ar2",
"=",
"np",
".",
"asarray",
"(",
"ar2"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_not_unique_values | Returns the values that appear at least twice in array.
Parameters
----------
array : array like
Returns
-------
numpy.array | pybar/analysis/analysis_utils.py | def get_not_unique_values(array):
'''Returns the values that appear at least twice in array.
Parameters
----------
array : array like
Returns
-------
numpy.array
'''
s = np.sort(array, axis=None)
s = s[s[1:] == s[:-1]]
return np.unique(s) | def get_not_unique_values(array):
'''Returns the values that appear at least twice in array.
Parameters
----------
array : array like
Returns
-------
numpy.array
'''
s = np.sort(array, axis=None)
s = s[s[1:] == s[:-1]]
return np.unique(s) | [
"Returns",
"the",
"values",
"that",
"appear",
"at",
"least",
"twice",
"in",
"array",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L694-L707 | [
"def",
"get_not_unique_values",
"(",
"array",
")",
":",
"s",
"=",
"np",
".",
"sort",
"(",
"array",
",",
"axis",
"=",
"None",
")",
"s",
"=",
"s",
"[",
"s",
"[",
"1",
":",
"]",
"==",
"s",
"[",
":",
"-",
"1",
"]",
"]",
"return",
"np",
".",
"un... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_meta_data_index_at_scan_parameter | Takes the analyzed meta_data table and returns the indices where the scan parameter changes
Parameters
----------
meta_data_array : numpy.recordarray
scan_parameter_name : string
Returns
-------
numpy.ndarray:
first dimension: scan parameter value
second dimension: index wh... | pybar/analysis/analysis_utils.py | def get_meta_data_index_at_scan_parameter(meta_data_array, scan_parameter_name):
'''Takes the analyzed meta_data table and returns the indices where the scan parameter changes
Parameters
----------
meta_data_array : numpy.recordarray
scan_parameter_name : string
Returns
-------
numpy.n... | def get_meta_data_index_at_scan_parameter(meta_data_array, scan_parameter_name):
'''Takes the analyzed meta_data table and returns the indices where the scan parameter changes
Parameters
----------
meta_data_array : numpy.recordarray
scan_parameter_name : string
Returns
-------
numpy.n... | [
"Takes",
"the",
"analyzed",
"meta_data",
"table",
"and",
"returns",
"the",
"indices",
"where",
"the",
"scan",
"parameter",
"changes"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L710-L730 | [
"def",
"get_meta_data_index_at_scan_parameter",
"(",
"meta_data_array",
",",
"scan_parameter_name",
")",
":",
"scan_parameter_values",
"=",
"meta_data_array",
"[",
"scan_parameter_name",
"]",
"diff",
"=",
"np",
".",
"concatenate",
"(",
"(",
"[",
"1",
"]",
",",
"np",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | select_hits | Selects the hits with condition.
E.g.: condition = 'rel_BCID == 7 & event_number < 1000'
Parameters
----------
hits_array : numpy.array
condition : string
A condition that is applied to the hits in numexpr. Only if the expression evaluates to True the hit is taken.
Returns
-------
... | pybar/analysis/analysis_utils.py | def select_hits(hits_array, condition=None):
'''Selects the hits with condition.
E.g.: condition = 'rel_BCID == 7 & event_number < 1000'
Parameters
----------
hits_array : numpy.array
condition : string
A condition that is applied to the hits in numexpr. Only if the expression evaluates... | def select_hits(hits_array, condition=None):
'''Selects the hits with condition.
E.g.: condition = 'rel_BCID == 7 & event_number < 1000'
Parameters
----------
hits_array : numpy.array
condition : string
A condition that is applied to the hits in numexpr. Only if the expression evaluates... | [
"Selects",
"the",
"hits",
"with",
"condition",
".",
"E",
".",
"g",
".",
":",
"condition",
"=",
"rel_BCID",
"==",
"7",
"&",
"event_number",
"<",
"1000"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L749-L770 | [
"def",
"select_hits",
"(",
"hits_array",
",",
"condition",
"=",
"None",
")",
":",
"if",
"condition",
"is",
"None",
":",
"return",
"hits_array",
"for",
"variable",
"in",
"set",
"(",
"re",
".",
"findall",
"(",
"r'[a-zA-Z_]+'",
",",
"condition",
")",
")",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_hits_in_events | Selects the hits that occurred in events and optional selection criterion.
If a event range can be defined use the get_data_in_event_range function. It is much faster.
Parameters
----------
hits_array : numpy.array
events : array
assume_sorted : bool
Is true if the events to select ... | pybar/analysis/analysis_utils.py | def get_hits_in_events(hits_array, events, assume_sorted=True, condition=None):
'''Selects the hits that occurred in events and optional selection criterion.
If a event range can be defined use the get_data_in_event_range function. It is much faster.
Parameters
----------
hits_array : numpy.arr... | def get_hits_in_events(hits_array, events, assume_sorted=True, condition=None):
'''Selects the hits that occurred in events and optional selection criterion.
If a event range can be defined use the get_data_in_event_range function. It is much faster.
Parameters
----------
hits_array : numpy.arr... | [
"Selects",
"the",
"hits",
"that",
"occurred",
"in",
"events",
"and",
"optional",
"selection",
"criterion",
".",
"If",
"a",
"event",
"range",
"can",
"be",
"defined",
"use",
"the",
"get_data_in_event_range",
"function",
".",
"It",
"is",
"much",
"faster",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L773-L814 | [
"def",
"get_hits_in_events",
"(",
"hits_array",
",",
"events",
",",
"assume_sorted",
"=",
"True",
",",
"condition",
"=",
"None",
")",
":",
"logging",
".",
"debug",
"(",
"\"Calculate hits that exists in the given %d events.\"",
"%",
"len",
"(",
"events",
")",
")",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_hits_of_scan_parameter | Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters.
Yields the hits in chunks, since they usually do not fit into memory.
Parameters
----------
input_file_hits : pytable hdf5 file
Has to include a hits node
scan_parameters : iterable... | pybar/analysis/analysis_utils.py | def get_hits_of_scan_parameter(input_file_hits, scan_parameters=None, try_speedup=False, chunk_size=10000000):
'''Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters.
Yields the hits in chunks, since they usually do not fit into memory.
Parameters
... | def get_hits_of_scan_parameter(input_file_hits, scan_parameters=None, try_speedup=False, chunk_size=10000000):
'''Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters.
Yields the hits in chunks, since they usually do not fit into memory.
Parameters
... | [
"Takes",
"the",
"hit",
"table",
"of",
"a",
"hdf5",
"file",
"and",
"returns",
"hits",
"in",
"chunks",
"for",
"each",
"unique",
"combination",
"of",
"scan_parameters",
".",
"Yields",
"the",
"hits",
"in",
"chunks",
"since",
"they",
"usually",
"do",
"not",
"fi... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L817-L859 | [
"def",
"get_hits_of_scan_parameter",
"(",
"input_file_hits",
",",
"scan_parameters",
"=",
"None",
",",
"try_speedup",
"=",
"False",
",",
"chunk_size",
"=",
"10000000",
")",
":",
"with",
"tb",
".",
"open_file",
"(",
"input_file_hits",
",",
"mode",
"=",
"\"r+\"",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_data_in_event_range | Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[
Parameters
----------
array : numpy.array
event_start : int, None
event_stop : int, None
assume_sorted : bool
Set to true if the hits are sorted by the event_number. Increases speed.
... | pybar/analysis/analysis_utils.py | def get_data_in_event_range(array, event_start=None, event_stop=None, assume_sorted=True):
'''Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[
Parameters
----------
array : numpy.array
event_start : int, None
event_stop : int, None
assume_s... | def get_data_in_event_range(array, event_start=None, event_stop=None, assume_sorted=True):
'''Selects the data (rows of a table) that occurred in the given event range [event_start, event_stop[
Parameters
----------
array : numpy.array
event_start : int, None
event_stop : int, None
assume_s... | [
"Selects",
"the",
"data",
"(",
"rows",
"of",
"a",
"table",
")",
"that",
"occurred",
"in",
"the",
"given",
"event",
"range",
"[",
"event_start",
"event_stop",
"["
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L862-L903 | [
"def",
"get_data_in_event_range",
"(",
"array",
",",
"event_start",
"=",
"None",
",",
"event_stop",
"=",
"None",
",",
"assume_sorted",
"=",
"True",
")",
":",
"logging",
".",
"debug",
"(",
"\"Calculate data of the the given event range [\"",
"+",
"str",
"(",
"event... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | write_hits_in_events | Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be
used if the get_hits_in_events function raises a memory error. Also a condition can be set to select hits.
Parameters
----------
hit_table_in : pytable.table
hit_table_ou... | pybar/analysis/analysis_utils.py | def write_hits_in_events(hit_table_in, hit_table_out, events, start_hit_word=0, chunk_size=5000000, condition=None):
'''Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be
used if the get_hits_in_events function raises a memory error. ... | def write_hits_in_events(hit_table_in, hit_table_out, events, start_hit_word=0, chunk_size=5000000, condition=None):
'''Selects the hits that occurred in events and writes them to a pytable. This function reduces the in RAM operations and has to be
used if the get_hits_in_events function raises a memory error. ... | [
"Selects",
"the",
"hits",
"that",
"occurred",
"in",
"events",
"and",
"writes",
"them",
"to",
"a",
"pytable",
".",
"This",
"function",
"reduces",
"the",
"in",
"RAM",
"operations",
"and",
"has",
"to",
"be",
"used",
"if",
"the",
"get_hits_in_events",
"function"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L906-L941 | [
"def",
"write_hits_in_events",
"(",
"hit_table_in",
",",
"hit_table_out",
",",
"events",
",",
"start_hit_word",
"=",
"0",
",",
"chunk_size",
"=",
"5000000",
",",
"condition",
"=",
"None",
")",
":",
"if",
"len",
"(",
"events",
")",
">",
"0",
":",
"# needed ... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | write_hits_in_event_range | Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM
operations and has to be used if the get_data_in_event_range function raises a memory error. Also a condition can be set to select hits.
Parameters
----------
h... | pybar/analysis/analysis_utils.py | def write_hits_in_event_range(hit_table_in, hit_table_out, event_start=None, event_stop=None, start_hit_word=0, chunk_size=5000000, condition=None):
'''Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM
operations and ha... | def write_hits_in_event_range(hit_table_in, hit_table_out, event_start=None, event_stop=None, start_hit_word=0, chunk_size=5000000, condition=None):
'''Selects the hits that occurred in given event range [event_start, event_stop[ and write them to a pytable. This function reduces the in RAM
operations and ha... | [
"Selects",
"the",
"hits",
"that",
"occurred",
"in",
"given",
"event",
"range",
"[",
"event_start",
"event_stop",
"[",
"and",
"write",
"them",
"to",
"a",
"pytable",
".",
"This",
"function",
"reduces",
"the",
"in",
"RAM",
"operations",
"and",
"has",
"to",
"b... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L944-L979 | [
"def",
"write_hits_in_event_range",
"(",
"hit_table_in",
",",
"hit_table_out",
",",
"event_start",
"=",
"None",
",",
"event_stop",
"=",
"None",
",",
"start_hit_word",
"=",
"0",
",",
"chunk_size",
"=",
"5000000",
",",
"condition",
"=",
"None",
")",
":",
"loggin... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_events_with_n_cluster | Selects the events with a certain number of cluster.
Parameters
----------
event_number : numpy.array
Returns
-------
numpy.array | pybar/analysis/analysis_utils.py | def get_events_with_n_cluster(event_number, condition='n_cluster==1'):
'''Selects the events with a certain number of cluster.
Parameters
----------
event_number : numpy.array
Returns
-------
numpy.array
'''
logging.debug("Calculate events with clusters where " + condition)
n_... | def get_events_with_n_cluster(event_number, condition='n_cluster==1'):
'''Selects the events with a certain number of cluster.
Parameters
----------
event_number : numpy.array
Returns
-------
numpy.array
'''
logging.debug("Calculate events with clusters where " + condition)
n_... | [
"Selects",
"the",
"events",
"with",
"a",
"certain",
"number",
"of",
"cluster",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L982-L998 | [
"def",
"get_events_with_n_cluster",
"(",
"event_number",
",",
"condition",
"=",
"'n_cluster==1'",
")",
":",
"logging",
".",
"debug",
"(",
"\"Calculate events with clusters where \"",
"+",
"condition",
")",
"n_cluster_in_events",
"=",
"analysis_utils",
".",
"get_n_cluster_... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_events_with_cluster_size | Selects the events with cluster of a given cluster size.
Parameters
----------
event_number : numpy.array
cluster_size : numpy.array
condition : string
Returns
-------
numpy.array | pybar/analysis/analysis_utils.py | def get_events_with_cluster_size(event_number, cluster_size, condition='cluster_size==1'):
'''Selects the events with cluster of a given cluster size.
Parameters
----------
event_number : numpy.array
cluster_size : numpy.array
condition : string
Returns
-------
numpy.array
'''
... | def get_events_with_cluster_size(event_number, cluster_size, condition='cluster_size==1'):
'''Selects the events with cluster of a given cluster size.
Parameters
----------
event_number : numpy.array
cluster_size : numpy.array
condition : string
Returns
-------
numpy.array
'''
... | [
"Selects",
"the",
"events",
"with",
"cluster",
"of",
"a",
"given",
"cluster",
"size",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1001-L1016 | [
"def",
"get_events_with_cluster_size",
"(",
"event_number",
",",
"cluster_size",
",",
"condition",
"=",
"'cluster_size==1'",
")",
":",
"logging",
".",
"debug",
"(",
"\"Calculate events with clusters with \"",
"+",
"condition",
")",
"return",
"np",
".",
"unique",
"(",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_events_with_error_code | Selects the events with a certain error code.
Parameters
----------
event_number : numpy.array
event_status : numpy.array
select_mask : int
The mask that selects the event error code to check.
condition : int
The value the selected event error code should have.
Returns
... | pybar/analysis/analysis_utils.py | def get_events_with_error_code(event_number, event_status, select_mask=0b1111111111111111, condition=0b0000000000000000):
'''Selects the events with a certain error code.
Parameters
----------
event_number : numpy.array
event_status : numpy.array
select_mask : int
The mask that selects ... | def get_events_with_error_code(event_number, event_status, select_mask=0b1111111111111111, condition=0b0000000000000000):
'''Selects the events with a certain error code.
Parameters
----------
event_number : numpy.array
event_status : numpy.array
select_mask : int
The mask that selects ... | [
"Selects",
"the",
"events",
"with",
"a",
"certain",
"error",
"code",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1019-L1037 | [
"def",
"get_events_with_error_code",
"(",
"event_number",
",",
"event_status",
",",
"select_mask",
"=",
"0b1111111111111111",
",",
"condition",
"=",
"0b0000000000000000",
")",
":",
"logging",
".",
"debug",
"(",
"\"Calculate events with certain error code\"",
")",
"return"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_scan_parameter | Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary
Parameters
----------
meta_data_array : numpy.ndarray
unique: boolean
If true only unique values for each scan parameter are returned
Returns
-------
python.dict{s... | pybar/analysis/analysis_utils.py | def get_scan_parameter(meta_data_array, unique=True):
'''Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary
Parameters
----------
meta_data_array : numpy.ndarray
unique: boolean
If true only unique values for each scan para... | def get_scan_parameter(meta_data_array, unique=True):
'''Takes the numpy meta data array and returns the different scan parameter settings and the name aligned in a dictionary
Parameters
----------
meta_data_array : numpy.ndarray
unique: boolean
If true only unique values for each scan para... | [
"Takes",
"the",
"numpy",
"meta",
"data",
"array",
"and",
"returns",
"the",
"different",
"scan",
"parameter",
"settings",
"and",
"the",
"name",
"aligned",
"in",
"a",
"dictionary"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1040-L1064 | [
"def",
"get_scan_parameter",
"(",
"meta_data_array",
",",
"unique",
"=",
"True",
")",
":",
"try",
":",
"last_not_parameter_column",
"=",
"meta_data_array",
".",
"dtype",
".",
"names",
".",
"index",
"(",
"'error_code'",
")",
"# for interpreted meta_data",
"except",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_scan_parameters_table_from_meta_data | Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data .
Parameters
----------
meta_data_array : numpy.ndarray
The array with the scan parameters.
scan_parameters : list of strings
The name of the scan parameters to t... | pybar/analysis/analysis_utils.py | def get_scan_parameters_table_from_meta_data(meta_data_array, scan_parameters=None):
'''Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data .
Parameters
----------
meta_data_array : numpy.ndarray
The array with the scan pa... | def get_scan_parameters_table_from_meta_data(meta_data_array, scan_parameters=None):
'''Takes the meta data array and returns the scan parameter values as a view of a numpy array only containing the parameter data .
Parameters
----------
meta_data_array : numpy.ndarray
The array with the scan pa... | [
"Takes",
"the",
"meta",
"data",
"array",
"and",
"returns",
"the",
"scan",
"parameter",
"values",
"as",
"a",
"view",
"of",
"a",
"numpy",
"array",
"only",
"containing",
"the",
"parameter",
"data",
".",
"Parameters",
"----------",
"meta_data_array",
":",
"numpy",... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1067-L1095 | [
"def",
"get_scan_parameters_table_from_meta_data",
"(",
"meta_data_array",
",",
"scan_parameters",
"=",
"None",
")",
":",
"if",
"scan_parameters",
"is",
"None",
":",
"try",
":",
"last_not_parameter_column",
"=",
"meta_data_array",
".",
"dtype",
".",
"names",
".",
"i... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_scan_parameters_index | Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations.
Parameters
----------
scan_parameter : numpy.ndarray
The table with the scan parameters.
Returns
-------
numpy.Histogram | pybar/analysis/analysis_utils.py | def get_scan_parameters_index(scan_parameter):
'''Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations.
Parameters
----------
scan_parameter : numpy.ndarray
The table with the scan parameters.
Returns
-------
numpy.Histogr... | def get_scan_parameters_index(scan_parameter):
'''Takes the scan parameter array and creates a scan parameter index labeling the unique scan parameter combinations.
Parameters
----------
scan_parameter : numpy.ndarray
The table with the scan parameters.
Returns
-------
numpy.Histogr... | [
"Takes",
"the",
"scan",
"parameter",
"array",
"and",
"creates",
"a",
"scan",
"parameter",
"index",
"labeling",
"the",
"unique",
"scan",
"parameter",
"combinations",
".",
"Parameters",
"----------",
"scan_parameter",
":",
"numpy",
".",
"ndarray",
"The",
"table",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1098-L1114 | [
"def",
"get_scan_parameters_index",
"(",
"scan_parameter",
")",
":",
"_",
",",
"index",
"=",
"np",
".",
"unique",
"(",
"scan_parameter",
",",
"return_index",
"=",
"True",
")",
"index",
"=",
"np",
".",
"sort",
"(",
"index",
")",
"values",
"=",
"np",
".",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_unique_scan_parameter_combinations | Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters.
If selected columns only is true, the returned histogram only contains the selected columns.
Parameters
----------
meta_data_array : numpy.ndarray
... | pybar/analysis/analysis_utils.py | def get_unique_scan_parameter_combinations(meta_data_array, scan_parameters=None, scan_parameter_columns_only=False):
'''Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters.
If selected columns only is true, the ... | def get_unique_scan_parameter_combinations(meta_data_array, scan_parameters=None, scan_parameter_columns_only=False):
'''Takes the numpy meta data array and returns the first rows with unique combinations of different scan parameter values for selected scan parameters.
If selected columns only is true, the ... | [
"Takes",
"the",
"numpy",
"meta",
"data",
"array",
"and",
"returns",
"the",
"first",
"rows",
"with",
"unique",
"combinations",
"of",
"different",
"scan",
"parameter",
"values",
"for",
"selected",
"scan",
"parameters",
".",
"If",
"selected",
"columns",
"only",
"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1117-L1149 | [
"def",
"get_unique_scan_parameter_combinations",
"(",
"meta_data_array",
",",
"scan_parameters",
"=",
"None",
",",
"scan_parameter_columns_only",
"=",
"False",
")",
":",
"try",
":",
"last_not_parameter_column",
"=",
"meta_data_array",
".",
"dtype",
".",
"names",
".",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | data_aligned_at_events | Takes the table with a event_number column and returns chunks with the size up to chunk_size. The chunks are chosen in a way that the events are not splitted.
Additional parameters can be set to increase the readout speed. Events between a certain range can be selected.
Also the start and the stop indices limit... | pybar/analysis/analysis_utils.py | def data_aligned_at_events(table, start_event_number=None, stop_event_number=None, start_index=None, stop_index=None, chunk_size=10000000, try_speedup=False, first_event_aligned=True, fail_on_missing_events=True):
'''Takes the table with a event_number column and returns chunks with the size up to chunk_size. The c... | def data_aligned_at_events(table, start_event_number=None, stop_event_number=None, start_index=None, stop_index=None, chunk_size=10000000, try_speedup=False, first_event_aligned=True, fail_on_missing_events=True):
'''Takes the table with a event_number column and returns chunks with the size up to chunk_size. The c... | [
"Takes",
"the",
"table",
"with",
"a",
"event_number",
"column",
"and",
"returns",
"chunks",
"with",
"the",
"size",
"up",
"to",
"chunk_size",
".",
"The",
"chunks",
"are",
"chosen",
"in",
"a",
"way",
"that",
"the",
"events",
"are",
"not",
"splitted",
".",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1160-L1320 | [
"def",
"data_aligned_at_events",
"(",
"table",
",",
"start_event_number",
"=",
"None",
",",
"stop_event_number",
"=",
"None",
",",
"start_index",
"=",
"None",
",",
"stop_index",
"=",
"None",
",",
"chunk_size",
"=",
"10000000",
",",
"try_speedup",
"=",
"False",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | select_good_pixel_region | Takes the hit array and masks all pixels with a certain occupancy.
Parameters
----------
hits : array like
If dim > 2 the additional dimensions are summed up.
min_cut_threshold : float
A number to specify the minimum threshold, which pixel to take. Pixels are masked if
occupancy... | pybar/analysis/analysis_utils.py | def select_good_pixel_region(hits, col_span, row_span, min_cut_threshold=0.2, max_cut_threshold=2.0):
'''Takes the hit array and masks all pixels with a certain occupancy.
Parameters
----------
hits : array like
If dim > 2 the additional dimensions are summed up.
min_cut_threshold : float
... | def select_good_pixel_region(hits, col_span, row_span, min_cut_threshold=0.2, max_cut_threshold=2.0):
'''Takes the hit array and masks all pixels with a certain occupancy.
Parameters
----------
hits : array like
If dim > 2 the additional dimensions are summed up.
min_cut_threshold : float
... | [
"Takes",
"the",
"hit",
"array",
"and",
"masks",
"all",
"pixels",
"with",
"a",
"certain",
"occupancy",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1323-L1353 | [
"def",
"select_good_pixel_region",
"(",
"hits",
",",
"col_span",
",",
"row_span",
",",
"min_cut_threshold",
"=",
"0.2",
",",
"max_cut_threshold",
"=",
"2.0",
")",
":",
"hits",
"=",
"np",
".",
"sum",
"(",
"hits",
",",
"axis",
"=",
"(",
"-",
"1",
")",
")... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_hit_rate_correction | 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... | pybar/analysis/analysis_utils.py | 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):
'''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... | [
"Calculates",
"a",
"correction",
"factor",
"for",
"single",
"hit",
"clusters",
"at",
"the",
"given",
"GDACs",
"from",
"the",
"cluster_size_histogram",
"via",
"cubic",
"interpolation",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1356-L1385 | [
"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",
")",
")",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_mean_threshold_from_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 : array like
The GDAC settings where the threshold should be determined from th... | pybar/analysis/analysis_utils.py | 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):
'''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... | [
"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",... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1388-L1405 | [
"def",
"get_mean_threshold_from_calibration",
"(",
"gdac",
",",
"mean_threshold_calibration",
")",
":",
"interpolation",
"=",
"interp1d",
"(",
"mean_threshold_calibration",
"[",
"'parameter_value'",
"]",
",",
"mean_threshold_calibration",
"[",
"'mean_threshold'",
"]",
",",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_pixel_thresholds_from_calibration_array | 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... | pybar/analysis/analysis_utils.py | 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):
'''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... | [
"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",... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1408-L1428 | [
"def",
"get_pixel_thresholds_from_calibration_array",
"(",
"gdacs",
",",
"calibration_gdacs",
",",
"threshold_calibration_array",
",",
"bounds_error",
"=",
"True",
")",
":",
"if",
"len",
"(",
"calibration_gdacs",
")",
"!=",
"threshold_calibration_array",
".",
"shape",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_n_cluster_per_event_hist | Calculates the number of cluster in every event.
Parameters
----------
cluster_table : pytables.table
Returns
-------
numpy.Histogram | pybar/analysis/analysis_utils.py | 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):
'''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... | [
"Calculates",
"the",
"number",
"of",
"cluster",
"in",
"every",
"event",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1470-L1483 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_data_statistics | Quick and dirty function to give as redmine compatible iverview table | pybar/analysis/analysis_utils.py | 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):
'''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... | [
"Quick",
"and",
"dirty",
"function",
"to",
"give",
"as",
"redmine",
"compatible",
"iverview",
"table"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1486-L1503 | [
"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"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | contiguous_regions | 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 | pybar/analysis/analysis_utils.py | 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):
"""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... | [
"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... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1519-L1543 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | check_bad_data | Checking FEI4 raw data array for corrupted data. | pybar/analysis/analysis_utils.py | 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):
"""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) ... | [
"Checking",
"FEI4",
"raw",
"data",
"array",
"for",
"corrupted",
"data",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1546-L1605 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | consecutive | 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 | pybar/analysis/analysis_utils.py | 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):
"""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) | [
"Converts",
"array",
"into",
"chunks",
"with",
"consecutive",
"elements",
"of",
"given",
"step",
"size",
".",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"7352684",
"/",
"how",
"-",
"to",
"-",
"find",
"-",
"the",
"-",
"groups",... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1608-L1612 | [
"def",
"consecutive",
"(",
"data",
",",
"stepsize",
"=",
"1",
")",
":",
"return",
"np",
".",
"split",
"(",
"data",
",",
"np",
".",
"where",
"(",
"np",
".",
"diff",
"(",
"data",
")",
"!=",
"stepsize",
")",
"[",
"0",
"]",
"+",
"1",
")"
] | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | print_raw_data_file | Printing FEI4 data from raw data file for debugging. | pybar/analysis/analysis_utils.py | 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=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:
... | [
"Printing",
"FEI4",
"data",
"from",
"raw",
"data",
"file",
"for",
"debugging",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1615-L1632 | [
"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",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | print_raw_data | Printing FEI4 raw data array for debugging. | pybar/analysis/analysis_utils.py | 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=0):
"""Printing FEI4 raw data array for debugging.
"""
if not select:
select = ['DH', 'TW', "AR", "VR", "SR", "DR", 'TDC', 'UNKNOWN FE WORD', 'UNKNOWN WORD']
... | [
"Printing",
"FEI4",
"raw",
"data",
"array",
"for",
"debugging",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1635-L1648 | [
"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",
"=",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | ETA.update | Updates the widget to show the ETA or total time when finished. | pybar/analysis/analysis_utils.py | 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):
'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... | [
"Updates",
"the",
"widget",
"to",
"show",
"the",
"ETA",
"or",
"total",
"time",
"when",
"finished",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/analysis_utils.py#L1442-L1467 | [
"def",
"update",
"(",
"self",
",",
"pbar",
")",
":",
"self",
".",
"n_refresh",
"+=",
"1",
"if",
"pbar",
".",
"currval",
"==",
"0",
":",
"return",
"'ETA: --:--:--'",
"elif",
"pbar",
".",
"finished",
":",
"return",
"'Time: %s'",
"%",
"self",
".",
"forma... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | plot_result | 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 | pybar/scans/analyze_source_scan_gdac_data.py | 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):
''' 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... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_source_scan_gdac_data.py#L77-L106 | [
"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",
".... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | create_hitor_calibration | 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... | pybar/scans/calibrate_hit_or.py | 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):
'''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 :... | [
"Generating",
"HitOr",
"calibration",
"file",
"(",
"_calibration",
".",
"h5",
")",
"from",
"raw",
"data",
"file",
"and",
"plotting",
"of",
"calibration",
"data",
".",
"Parameters",
"----------",
"output_filename",
":",
"string",
"Input",
"raw",
"data",
"file",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/calibrate_hit_or.py#L20-L148 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | interval_timed | Interval timer decorator.
Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256 | pybar/fei4_run_base.py | 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):
'''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... | [
"Interval",
"timer",
"decorator",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1423-L1442 | [
"def",
"interval_timed",
"(",
"interval",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"stopped",
"=",
"Event",
"(",
")",
"def",
"loop",
"(",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | interval_timer | Interval timer function.
Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708 | pybar/fei4_run_base.py | 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):
'''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
... | [
"Interval",
"timer",
"function",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1445-L1457 | [
"def",
"interval_timer",
"(",
"interval",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"stopped",
"=",
"Event",
"(",
")",
"def",
"loop",
"(",
")",
":",
"while",
"not",
"stopped",
".",
"wait",
"(",
"interval",
")",
":",
"# the f... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | send_mail | Sends a run status mail with the traceback to a specified E-Mail address if a run crashes. | pybar/fei4_run_base.py | 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):
''' 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"... | [
"Sends",
"a",
"run",
"status",
"mail",
"with",
"the",
"traceback",
"to",
"a",
"specified",
"E",
"-",
"Mail",
"address",
"if",
"a",
"run",
"crashes",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1493-L1507 | [
"def",
"send_mail",
"(",
"subject",
",",
"body",
",",
"smtp_server",
",",
"user",
",",
"password",
",",
"from_addr",
",",
"to_addrs",
")",
":",
"logging",
".",
"info",
"(",
"'Send status E-Mail ('",
"+",
"subject",
"+",
"')'",
")",
"content",
"=",
"string"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase._parse_module_cfgs | Extracts the configuration of the modules. | pybar/fei4_run_base.py | 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):
''' 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._... | [
"Extracts",
"the",
"configuration",
"of",
"the",
"modules",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L175-L219 | [
"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 \"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase._set_default_cfg | Sets the default parameters if they are not specified. | pybar/fei4_run_base.py | 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):
''' 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_... | [
"Sets",
"the",
"default",
"parameters",
"if",
"they",
"are",
"not",
"specified",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L265-L323 | [
"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",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.init_modules | Initialize all modules consecutively | pybar/fei4_run_base.py | 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):
''' 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... | [
"Initialize",
"all",
"modules",
"consecutively"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L466-L563 | [
"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"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.do_run | Start runs on all modules sequentially.
Sets properties to access current module properties. | pybar/fei4_run_base.py | 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):
''' 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:
# ... | [
"Start",
"runs",
"on",
"all",
"modules",
"sequentially",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L660-L830 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.close | Releasing hardware resources. | pybar/fei4_run_base.py | 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):
'''Releasing hardware resources.
'''
try:
self.dut.close()
except Exception:
logging.warning('Closing DUT was not successful')
else:
logging.debug('Closed DUT') | [
"Releasing",
"hardware",
"resources",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L858-L866 | [
"def",
"close",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"dut",
".",
"close",
"(",
")",
"except",
"Exception",
":",
"logging",
".",
"warning",
"(",
"'Closing DUT was not successful'",
")",
"else",
":",
"logging",
".",
"debug",
"(",
"'Closed DUT'",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.handle_data | Handling of the data.
Parameters
----------
data : list, tuple
Data tuple of the format (data (np.array), last_time (float), curr_time (float), status (int)) | pybar/fei4_run_base.py | 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):
'''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... | [
"Handling",
"of",
"the",
"data",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L868-L879 | [
"def",
"handle_data",
"(",
"self",
",",
"data",
",",
"new_file",
"=",
"False",
",",
"flush",
"=",
"True",
")",
":",
"for",
"i",
",",
"module_id",
"in",
"enumerate",
"(",
"self",
".",
"_selected_modules",
")",
":",
"if",
"data",
"[",
"i",
"]",
"is",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.handle_err | 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(). | pybar/fei4_run_base.py | 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):
'''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... | [
"Handling",
"of",
"Exceptions",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L881-L897 | [
"def",
"handle_err",
"(",
"self",
",",
"exc",
")",
":",
"if",
"self",
".",
"reset_rx_on_error",
"and",
"isinstance",
"(",
"exc",
"[",
"1",
"]",
",",
"(",
"RxSyncError",
",",
"EightbTenbError",
")",
")",
":",
"self",
".",
"fifo_readout",
".",
"print_reado... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.get_configuration | 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. | pybar/fei4_run_base.py | 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):
''' 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",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L904-L938 | [
"def",
"get_configuration",
"(",
"self",
",",
"module_id",
",",
"run_number",
"=",
"None",
")",
":",
"def",
"find_file",
"(",
"run_number",
")",
":",
"module_path",
"=",
"self",
".",
"get_module_path",
"(",
"module_id",
")",
"for",
"root",
",",
"_",
",",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.select_module | Select module and give access to the module. | pybar/fei4_run_base.py | 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):
''' 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.... | [
"Select",
"module",
"and",
"give",
"access",
"to",
"the",
"module",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1014-L1077 | [
"def",
"select_module",
"(",
"self",
",",
"module_id",
")",
":",
"if",
"not",
"isinstance",
"(",
"module_id",
",",
"basestring",
")",
"and",
"isinstance",
"(",
"module_id",
",",
"Iterable",
")",
"and",
"set",
"(",
"module_id",
")",
"-",
"set",
"(",
"self... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.deselect_module | Deselect module and cleanup. | pybar/fei4_run_base.py | 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):
''' 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... | [
"Deselect",
"module",
"and",
"cleanup",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1079-L1089 | [
"def",
"deselect_module",
"(",
"self",
")",
":",
"self",
".",
"_enabled_fe_channels",
"=",
"[",
"]",
"# ignore any RX sync errors",
"self",
".",
"_readout_fifos",
"=",
"[",
"]",
"self",
".",
"_filter",
"=",
"[",
"]",
"self",
".",
"_converter",
"=",
"[",
"]... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.enter_sync | Waiting for all threads to appear, then continue. | pybar/fei4_run_base.py | 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):
''' 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... | [
"Waiting",
"for",
"all",
"threads",
"to",
"appear",
"then",
"continue",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1169-L1184 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.exit_sync | Waiting for all threads to appear, then continue. | pybar/fei4_run_base.py | 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):
''' 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_... | [
"Waiting",
"for",
"all",
"threads",
"to",
"appear",
"then",
"continue",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1186-L1201 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.readout | Running the FIFO readout while executing other statements.
Starting and stopping of the FIFO readout is synchronized between the threads. | pybar/fei4_run_base.py | 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):
''' 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:
... | [
"Running",
"the",
"FIFO",
"readout",
"while",
"executing",
"other",
"statements",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1204-L1222 | [
"def",
"readout",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"timeout",
"=",
"kwargs",
".",
"pop",
"(",
"'timeout'",
",",
"10.0",
")",
"self",
".",
"start_readout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"try",
":"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.start_readout | 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. | pybar/fei4_run_base.py | 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):
''' 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
... | [
"Starting",
"the",
"FIFO",
"readout",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1224-L1254 | [
"def",
"start_readout",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Pop parameters for fifo_readout.start",
"callback",
"=",
"kwargs",
".",
"pop",
"(",
"'callback'",
",",
"self",
".",
"handle_data",
")",
"errback",
"=",
"kwargs",
"."... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4RunBase.stop_readout | 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. | pybar/fei4_run_base.py | 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):
''' 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... | [
"Stopping",
"the",
"FIFO",
"readout",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1256-L1274 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_charge | Interpolatet the TDC calibration for each pixel from 0 to max_tdc | pybar/scans/analyze_timewalk.py | 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
''' 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... | [
"Interpolatet",
"the",
"TDC",
"calibration",
"for",
"each",
"pixel",
"from",
"0",
"to",
"max_tdc"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_timewalk.py#L21-L33 | [
"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",
")",
")",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | get_charge_calibration | Open the hit or calibration file and return the calibration per pixel | pybar/scans/analyze_timewalk.py | 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):
''' 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... | [
"Open",
"the",
"hit",
"or",
"calibration",
"file",
"and",
"return",
"the",
"calibration",
"per",
"pixel"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/analyze_timewalk.py#L36-L41 | [
"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",
".",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | pyBarPlugin.addEntry | Add the `Plot pyBAR data`. entry to `Dataset` menu. | pybar/ViTablesPlugin/pybar_plugin.py | 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):
"""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... | [
"Add",
"the",
"Plot",
"pyBAR",
"data",
".",
"entry",
"to",
"Dataset",
"menu",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L145-L172 | [
"def",
"addEntry",
"(",
"self",
")",
":",
"export_icon",
"=",
"QtGui",
".",
"QIcon",
"(",
")",
"pixmap",
"=",
"QtGui",
".",
"QPixmap",
"(",
"os",
".",
"path",
".",
"join",
"(",
"PLUGINSDIR",
",",
"'csv/icons/document-export.png'",
")",
")",
"export_icon",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | pyBarPlugin.updateDatasetMenu | Update the `export` QAction when the Dataset menu is pulled down.
This method is a slot. See class ctor for details. | pybar/ViTablesPlugin/pybar_plugin.py | 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):
"""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... | [
"Update",
"the",
"export",
"QAction",
"when",
"the",
"Dataset",
"menu",
"is",
"pulled",
"down",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L174-L186 | [
"def",
"updateDatasetMenu",
"(",
"self",
")",
":",
"enabled",
"=",
"True",
"current",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_view",
".",
"currentIndex",
"(",
")",
"if",
"current",
":",
"leaf",
"=",
"self",
".",
"vtgui",
".",
"dbs_tree_model",
".",
"no... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | pyBarPlugin.plot | 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. | pybar/ViTablesPlugin/pybar_plugin.py | 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):
"""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... | [
"Export",
"a",
"given",
"dataset",
"to",
"a",
"CSV",
"file",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L188-L214 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | pyBarPlugin.helpAbout | Brief description of the plugin. | pybar/ViTablesPlugin/pybar_plugin.py | 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):
"""Brief description of the plugin.
"""
# Text to be displayed
about_text = translate('pyBarPlugin',
"""<qt>
<p>Data plotting plug-in for pyBAR.
</qt>""",
'About')
descr =... | [
"Brief",
"description",
"of",
"the",
"plugin",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/ViTablesPlugin/pybar_plugin.py#L216-L234 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | send_meta_data | 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. | pybar/daq/fei4_raw_data.py | 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):
'''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... | [
"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",
"."
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L13-L23 | [
"def",
"send_meta_data",
"(",
"socket",
",",
"conf",
",",
"name",
")",
":",
"meta_data",
"=",
"dict",
"(",
"name",
"=",
"name",
",",
"conf",
"=",
"conf",
")",
"try",
":",
"socket",
".",
"send_json",
"(",
"meta_data",
",",
"flags",
"=",
"zmq",
".",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | send_data | Sends the data of every read out (raw data and meta data) via ZeroMQ to a specified socket | pybar/daq/fei4_raw_data.py | 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'):
'''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),
... | [
"Sends",
"the",
"data",
"of",
"every",
"read",
"out",
"(",
"raw",
"data",
"and",
"meta",
"data",
")",
"via",
"ZeroMQ",
"to",
"a",
"specified",
"socket"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L26-L44 | [
"def",
"send_data",
"(",
"socket",
",",
"data",
",",
"scan_parameters",
"=",
"{",
"}",
",",
"name",
"=",
"'ReadoutData'",
")",
":",
"if",
"not",
"scan_parameters",
":",
"scan_parameters",
"=",
"{",
"}",
"data_meta_data",
"=",
"dict",
"(",
"name",
"=",
"n... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | open_raw_data_file | 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... | pybar/daq/fei4_raw_data.py | 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):
'''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... | [
"Mimics",
"pytables",
".",
"open_file",
"()",
"and",
"stores",
"the",
"configuration",
"and",
"run",
"configuration"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L47-L58 | [
"def",
"open_raw_data_file",
"(",
"filename",
",",
"mode",
"=",
"\"w\"",
",",
"title",
"=",
"\"\"",
",",
"scan_parameters",
"=",
"None",
",",
"socket_address",
"=",
"None",
")",
":",
"return",
"RawDataFile",
"(",
"filename",
"=",
"filename",
",",
"mode",
"... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | save_raw_data_from_data_queue | 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. | pybar/daq/fei4_raw_data.py | 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" to append data, if raw_data_file_h5 does not exist it is created
'''Writing raw data file from data queue
If you ne... | [
"Writing",
"raw",
"data",
"file",
"from",
"data",
"queue"
] | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fei4_raw_data.py#L240-L248 | [
"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\" ... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | Fei4Tuning.scan | 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
... | pybar/scans/tune_fei4.py | 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):
'''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.
... | [
"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",
".",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/scans/tune_fei4.py#L92-L184 | [
"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",... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | plot_linear_relation | 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... | pybar/analysis/plotting/plotting.py | 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=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 ... | [
"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",
"--------... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L52-L121 | [
"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",
"=",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | plot_profile_histogram | 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... | pybar/analysis/plotting/plotting.py | 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):
'''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.
... | [
"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"... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L241-L284 | [
"def",
"plot_profile_histogram",
"(",
"x",
",",
"y",
",",
"n_bins",
"=",
"100",
",",
"title",
"=",
"None",
",",
"x_label",
"=",
"None",
",",
"y_label",
"=",
"None",
",",
"log_y",
"=",
"False",
",",
"filename",
"=",
"None",
")",
":",
"if",
"len",
"(... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | round_to_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... | pybar/analysis/plotting/plotting.py | 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):
'''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
... | [
"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... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L352-L374 | [
"def",
"round_to_multiple",
"(",
"number",
",",
"multiple",
")",
":",
"multiple",
"=",
"int",
"(",
"multiple",
")",
"if",
"multiple",
"==",
"0",
":",
"multiple",
"=",
"1",
"ceil_mod_number",
"=",
"number",
"-",
"number",
"%",
"(",
"-",
"multiple",
")",
... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
train | hist_quantiles | 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... | pybar/analysis/plotting/plotting.py | 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):
'''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 ... | [
"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",
":",
... | SiLab-Bonn/pyBAR | python | https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L831-L879 | [
"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... | 5ad95bbcd41cd358825823fb78f396cfce23593e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.