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

Plots don't update after error #25

Open
philipstarkey opened this issue Jun 20, 2017 · 9 comments
Open

Plots don't update after error #25

philipstarkey opened this issue Jun 20, 2017 · 9 comments
Labels
bug Something isn't working major

Comments

@philipstarkey
Copy link
Member

Original report (archived issue) by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


When there was a error in a script the plots belonging to the script won't update on subsequent runs of the script (where there is no error). To get them to update again one needs to remove the script and add it again.

@philipstarkey
Copy link
Member Author

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Thanks for the report. This is surprising! I'll see if I can reproduce the problem.

@philipstarkey
Copy link
Member Author

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


I'm not 100% certain this is the cause of the problem but we encounter this quite often after a error that plots won't update from then until you remove and ad the script again.

@philipstarkey
Copy link
Member Author

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


It could be related to runmanager issue #42 (labscript-suite/runmanager#42), I think that would cause problems - not necessarily after an error in the script.

Basically we have code (labscript_utils.modulewatcher, used by both runmanager and lyse) that unloads Python modules so that changes in those modules will be reflected when they are next imported. And it looks like it is being a bit too overzealous unloading modules. It might be unloading things required for plotting.

@philipstarkey
Copy link
Member Author

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


I'm not able to reproduce this, unfortunately.

I can run this script:

#!python

import lyse
import numpy as np

run = lyse.Run(lyse.path)
run.save_result('x', 5)

import matplotlib.pyplot as plt

x = np.linspace(0,10,100)
plt.plot(x, np.sin(x)*np.random.rand())

assert False

plt.show()


repeatedly, unpausing analysis each time it pauses due to the assert False, and I get plots updating (visibly different because of the rand() each time) regardless of whether the AssertionError is before or after the call to plt.show().

Could you provide a minimal example that demonstrates the problem?

@philipstarkey
Copy link
Member Author

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


I will try to create one and/or wait till it happens in the lab again and then post here.
But it definitely only happens after errors.

@philipstarkey
Copy link
Member Author

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Right, but not after all errors?

It makes sense that if something lyse-related crashes instead of your analysis code, that this will break the analysis subprocess until it is restarted. If that's the case, it's a bug and whatever is crashing should be fixed. Even if it is your code that is causing the error prior to the plots not updating, I'd be interested to see the traceback, as it might help me narrow down the cause.

@philipstarkey
Copy link
Member Author

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


That I haven't checkt till now it but your example shows that it doesn't seem to be all errors. It happened a few times now and thats why I reported it. I'll take a look at the lyse.log tomorrow when I'm in the lab and look for the traceback (we had one of those 'no more plots' errors just this afternoon)

@philipstarkey
Copy link
Member Author

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Sounds good.

I'll be going on holiday soon so I may not see updates here, but will look at things when I get back if they have not already been resolved.

@philipstarkey
Copy link
Member Author

Original comment by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


Ok so I was finally able to reproduce the bug and narrowed it down a bit.
It occurs, when a new multishot script is added to lyse and during it's first execution a new runfile gets aded (by BLACS). Plots will not appear on subsequent executions of the script even if there are no errors.
If we however paused BLACS, and then add the multishot script and then unpaused BLACS it ran just fine.
The error I got was:

#!

Traceback (most recent call last):
File "C:\labscript_suite\userlib\analysislib\Einzelatom\Multishot_Umpumper_Pulslaengenscan.py", line 10, in <module>
atoms0 = df['Atoms', 'Atom0']
File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\frame.py", line 2057, in __getitem__
return self._getitem_multilevel(key)
File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\frame.py", line 2101, in _getitem_multilevel
loc = self.columns.get_loc(key)
File "C:\ProgramData\Anaconda2\lib\site-packages\pandas\indexes\multi.py", line 1663, in get_loc
return self._engine.get_loc(key)
File "pandas\index.pyx", line 132, in pandas.index.IndexEngine.get_loc (pandas\index.c:4433)
File "pandas\index.pyx", line 154, in pandas.index.IndexEngine.get_loc (pandas\index.c:4279)
File "pandas\src\hashtable_class_helper.pxi", line 732, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:13742)
File "pandas\src\hashtable_class_helper.pxi", line 740, in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:13696)
KeyError: ('Atoms', 'Atom0')

For context Atoms is a single shot script and Atom0 a result of it

@philipstarkey philipstarkey added major bug Something isn't working labels Apr 5, 2020
Loki27182 pushed a commit to Loki27182/lyse that referenced this issue Oct 9, 2023
Labconfig

Approved-by: Chris Billington <chrisjbillington@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant