fact-project / photon_stream

Explore the novel photon stream, based on the single photon extractor
6 stars 2 forks source link

Plotting crashes when no photon in stream #65

Open relleums opened 6 years ago

relleums commented 6 years ago

When there is no photon in the stream, the 3D point cloud plotting fails.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-5a25295627ec> in <module>()
      1 for e in run:
----> 2     ps_plot.event(e)
      3     plt.show()
      4 

~/Desktop/phd/FACT/single_photons/photon_stream/photon_stream/plot.py in event(event, mask)
     17     fig = plt.figure()
     18     ax = fig.gca(projection='3d')
---> 19     add_event_2_ax(event=event, ax=ax, mask=mask)
     20 
     21 

~/Desktop/phd/FACT/single_photons/photon_stream/photon_stream/plot.py in add_event_2_ax(event, ax, mask, color)
     30         fov_radius=fov_radius,
     31         ax=ax,
---> 32         color=color
     33     )
     34 

~/Desktop/phd/FACT/single_photons/photon_stream/photon_stream/plot.py in add_point_cloud_2_ax(point_cloud, ax, fov_radius, color)
     52     pcl[:, 2] *= 1e9 # to nano seconds
     53 
---> 54     min_time = pcl[:, 2].min()
     55     max_time = pcl[:, 2].max()
     56 

~/anaconda3/lib/python3.5/site-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims)
     27 
     28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29     return umr_minimum(a, axis, None, out, keepdims)
     30 
     31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):

ValueError: zero-size array to reduction operation minimum which has no identity