Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Data conversion with "empty" files is not robust #31

Open
BenMoon opened this issue Dec 8, 2021 · 0 comments
Open

Data conversion with "empty" files is not robust #31

BenMoon opened this issue Dec 8, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@BenMoon
Copy link
Contributor

BenMoon commented Dec 8, 2021

If quasi empty files get converted to hdf5, the centroiding process crashes:

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/cfelcmi/timepix/pymepix-viewer/pymepixviewer/dialogs/postprocessing.py", line 200, in run_post_processing_threaded
    progress_callback=self.updateProgressBar,
  File "/home/cfelcmi/timepix/pymepix/pymepix/post_processing.py", line 14, in run_post_processing
    file_sampler.run()
  File "/home/cfelcmi/timepix/pymepix/pymepix/processing/rawfilesampler.py", line 268, in run
    self.push_data()
  File "/home/cfelcmi/timepix/pymepix/pymepix/processing/rawfilesampler.py", line 153, in push_data
    self.__calculate_and_save_centroids(*result)
  File "/home/cfelcmi/timepix/pymepix/pymepix/processing/rawfilesampler.py", line 163, in __calculate_and_save_centroids
    centroids = self.centroid_calculator.process(event_data)
  File "/home/cfelcmi/timepix/pymepix/pymepix/processing/logic/centroid_calculator.py", line 120, in process
    return self.__centroid_chunks_to_centroids(centroids_in_chunks)
  File "/home/cfelcmi/timepix/pymepix/pymepix/processing/logic/centroid_calculator.py", line 169, in __centroid_chunks_to_centroids
    return np.concatenate(list(chunks), axis=1)
ValueError: zero-dimensional arrays cannot be concatenated

Add a check with if len(chunks) >0
to __centroid_chunks_to_centroids in centroid_calculator.py probably already solves the problem.

@BenMoon BenMoon added the bug Something isn't working label Dec 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant