yongrenjie / penguins

A Python 3 package for analysing and plotting NMR spectra.
https://yongrenjie.github.io/penguins
MIT License
5 stars 2 forks source link

Empty the PHA anyway if mkplot() errors out #6

Closed yongrenjie closed 4 years ago

yongrenjie commented 4 years ago

For a script this isn't a problem because any errors will stop execution immediately, but doing this avoids issues with the state of the PHA persisting between different cells of jupyter notebook (thus producing weird errors when a cell failed to plot a 1D spectrum, and the next cell tries to stage a 2D spectrum).

Just use try/finally code inside mkplot().