TDC clustering
Changes:
- BUG: fix crash in TDC clustering (see below)
- BUG: fix cluster dtype
- ENH: add TDC status plot for each HitOr line
- TST: add unittest for TDC analysis
When using the clustering with analyze_tdc = True
and hitor_calib_file = None
, the clustering crashes.
This is now fixed with this MR.
2019-09-30 11:17:07,395 - [Analysis ] - ERROR Exception during in analysis
Traceback (most recent call last):
File "bdaq53_converter.py", line 23, in analyze_raw_data
analyze_raw_data.analyze_data()
File "/home/silab/git/bdaq53/bdaq53/analysis/analysis.py", line 469, in analyze_data
_, cluster = self.clz.cluster_hits(hits[:n_hits])
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/clusterizer.py", line 372, in cluster_hits
disabled_pixels=disabled_pixels)
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/dispatcher.py", line 348, in _compile_for_args
error_rewrite(e, 'typing')
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/dispatcher.py", line 315, in error_rewrite
reraise(type(e), e, None)
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/six.py", line 658, in reraise
raise value.with_traceback(tb)
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'start_column': cannot determine Numba type of <class 'numba.ir.UndefinedType'>
File "analysis.py", line 300:
def end_of_cluster_function_tdc(hits, clusters, cluster_size,
<source elided>
if lookup_table is not None: # Check if hitor calibration is provided
if tdc_value < lookup_table.shape[-1] and (start_column <= col <= stop_column) and (start_row <= row <= stop_row): # Only take TDC values for which lookup values exist
^
[1] During: resolving callee type: type(CPUDispatcher(<function Analysis._setup_clusterizer.<locals>.end_of_cluster_function_tdc at 0x7fc629c16510>))
[2] During: typing of call at /home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py (77)
File "../../../../miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py", line 77:
def _finish_cluster(hits, clusters, cluster_size, cluster_hit_indices, cluster_index, cluster_id, charge_correction, noisy_pixels, disabled_pixels):
<source elided>
disabled_pixels=disabled_pixels,
seed_hit_index=seed_hit_index)
^
[1] During: resolving callee type: type(CPUDispatcher(<function _finish_cluster at 0x7fc629bab378>))
[2] During: typing of call at /home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py (272)
File "../../../../miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py", line 272:
def _cluster_hits(hits, clusters, assigned_hit_array, cluster_hit_indices, column_cluster_distance, row_cluster_distance, frame_cluster_distance, min_hit_charge, max_hit_charge, ignore_same_hits, noisy_pixels, disabled_pixels):
<source elided>
noisy_pixels=noisy_pixels,
disabled_pixels=disabled_pixels)
^
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/dev/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html
For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile
If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new
Traceback (most recent call last):
File "bdaq53_converter.py", line 207, in <module>
process_raw_data(raw_data_file=raw_data_file, align_method=1, analyze_tdc=True, correct_offset=False)
File "bdaq53_converter.py", line 179, in process_raw_data
chunk_size=chunk_size)
File "bdaq53_converter.py", line 23, in analyze_raw_data
analyze_raw_data.analyze_data()
File "/home/silab/git/bdaq53/bdaq53/analysis/analysis.py", line 469, in analyze_data
_, cluster = self.clz.cluster_hits(hits[:n_hits])
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/clusterizer.py", line 372, in cluster_hits
disabled_pixels=disabled_pixels)
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/dispatcher.py", line 348, in _compile_for_args
error_rewrite(e, 'typing')
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/dispatcher.py", line 315, in error_rewrite
reraise(type(e), e, None)
File "/home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/numba/six.py", line 658, in reraise
raise value.with_traceback(tb)
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'start_column': cannot determine Numba type of <class 'numba.ir.UndefinedType'>
File "analysis.py", line 300:
def end_of_cluster_function_tdc(hits, clusters, cluster_size,
<source elided>
if lookup_table is not None: # Check if hitor calibration is provided
if tdc_value < lookup_table.shape[-1] and (start_column <= col <= stop_column) and (start_row <= row <= stop_row): # Only take TDC values for which lookup values exist
^
[1] During: resolving callee type: type(CPUDispatcher(<function Analysis._setup_clusterizer.<locals>.end_of_cluster_function_tdc at 0x7fc629c16510>))
[2] During: typing of call at /home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py (77)
File "../../../../miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py", line 77:
def _finish_cluster(hits, clusters, cluster_size, cluster_hit_indices, cluster_index, cluster_id, charge_correction, noisy_pixels, disabled_pixels):
<source elided>
disabled_pixels=disabled_pixels,
seed_hit_index=seed_hit_index)
^
[1] During: resolving callee type: type(CPUDispatcher(<function _finish_cluster at 0x7fc629bab378>))
[2] During: typing of call at /home/silab/miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py (272)
File "../../../../miniconda2/envs/py3/lib/python3.7/site-packages/pixel_clusterizer-3.1.4-py3.7.egg/pixel_clusterizer/cluster_functions.py", line 272:
def _cluster_hits(hits, clusters, assigned_hit_array, cluster_hit_indices, column_cluster_distance, row_cluster_distance, frame_cluster_distance, min_hit_charge, max_hit_charge, ignore_same_hits, noisy_pixels, disabled_pixels):
<source elided>
noisy_pixels=noisy_pixels,
disabled_pixels=disabled_pixels)
^
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/dev/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html
For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile
If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new
Edited by Yannick Manuel Dieter