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

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

@BenMoon

Description

@BenMoon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions