Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silcamgui crashes when trying to export a summary figure with no particles #148

Open
davidrwilliamson opened this issue Sep 15, 2021 · 3 comments
Assignees
Labels
bug Something isn't working size: 1 estimate less than half-day

Comments

@davidrwilliamson
Copy link
Collaborator

Describe the bug
If you try to export a summary montage and load a -STATS.csv file that has no particles, you get the following errorL

0it [00:00, ?it/s]
/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py:124: RuntimeWarning: invalid value encountered in true_divide
vd = tpvol / sv # micro-litres / litre
/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py:140: RuntimeWarning: invalid value encountered in double_scalars
nc = np.sum(count) / sv
/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py:696: RuntimeWarning: invalid value encountered in true_divide
nd = np.float64(nd) / sample_volume # nc per size bin per litre
/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py:701: RuntimeWarning: invalid value encountered in less
nd[nd<0] = np.nan # and nan impossible values!
/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py:198: RuntimeWarning: invalid value encountered in greater
ind = np.argwhere(nd>0)
Traceback (most recent call last):
File "/home/dave/PycharmProjects/PySilCam/pysilcam/silcamgui/silcamgui.py", line 458, in export_summary_figure
self.configfile, monitor=False)
File "/home/dave/PycharmProjects/PySilCam/pysilcam/plotting.py", line 281, in summarise_fancy_stats
settings.PostProcess, oilgas=oilgas)
File "/home/dave/PycharmProjects/PySilCam/pysilcam/postprocess.py", line 199, in nc_vc_from_stats
nd[ind[0]] = np.nan
IndexError: index 0 is out of bounds for axis 0 with size 0

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Pysilcam will quit or freeze after this error.

To Reproduce
Use the attached file to try exporting a summary figure from.
run_D20210829T100138-STATS.csv

Expected behavior
Should probably present a message saying that the loaded stats file has no particles, and continue without crashing.

Additional context
Exporting a summary time series works OK and exports an empty time series.

@davidrwilliamson davidrwilliamson self-assigned this Sep 15, 2021
@davidrwilliamson davidrwilliamson added bug Something isn't working size: 1 estimate less than half-day labels Sep 15, 2021
@davidrwilliamson
Copy link
Collaborator Author

Low priority bug, you should rarely load a stats file with no particles. I'll submit a pull request to fix it by adding a 0-length check when I get around to it.

@emlynjdavies
Copy link
Contributor

emlynjdavies commented Sep 28, 2021

what would you like the behavior to be in this case? if there are no particles, there is anyway nothing to plot.

a warning message and error catching so you don't have to reload the GUI is smart but what is supposed to happen afterwards?

@davidrwilliamson
Copy link
Collaborator Author

Yes, I think exactly that would be good. It can just warn that there are no particles, not create a plot and return you to the interface so you can continue. I believe it currently creates empty oil and gas plots and then freezes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size: 1 estimate less than half-day
Projects
None yet
Development

No branches or pull requests

2 participants