Communication problem when setting beam intensity
Added by Matthias Brunner about 14 years ago
Hi there...again me with weird problems that have suddenly appeared (again, not aware of any changes).
I imported presets that work fine (and have been working fine for months) and now encounter the following problem:
Whenever I do a full cycle through the mags (e.g., re-selecting fa when already in fa) the beam intensity is set incorrectly.
So instead of 63.99% C2 current is 57.4838% (actually left instead of right from crossover, very small beam spread) in the Tecnai UI- consistently the same value.
fa -> fa: C2 = 57.4838%
gr -> fa: C2 = 57.4838%
fa -> preexp -> fa: C2 = 63.99%
fa -> en -> fa: C2 = 63.99%
Interestingly, the Instrument Node still displays the correct absolute intensity value after refresh. When I change the C2 current to the correct one (63.99%) on the console by turning the intensity knob and save that value for fa, the following happens:
fa -> fa: C2 = 63.99%
gr -> fa: C2 = 63.99%
fa -> preexp -> fa: C2 = 70.49%
fa -> en -> fa: C2 = 70.49%
It almost looks like Leginon (or Tecnai Library) is in two units of measurement states - one metric and the other one non-SI, and changing back and forth, depending on whether cycling takes place - leading to an offset in C2 current. All other settings (defocus, beamshift, ...) are fine.
Restart, creating new session, using other presets, turning on mag-only cycling, changing cycle wait time does not help.
The only thing that actually helps as a workaround is introducing a dummy preset at 39kx between hl (4.7k) and fa (59kx) that is always cycled through when switching. Of course, this slows things down a bit.
Does anyone know what is causing this - the only thing we haven't tried yet is restarting the microscope PC (and a complete reinstall of Leginon).
And is there an easy way to debug Leginon or get it to Log every command it sends to the Tecnai Library?
Thanks so much!
Matthias
Replies (10)
RE: Communication problem when setting beam intensity - Added by Anchi Cheng about 14 years ago
Is there any upgrade on the Tecnai side? They change the unit for the same property call once a while, rather annoying but we can see why some times. Let us know what version of TUI and Tecnai ( or TEM scripting is installed, it may tell us more.
RE: Communication problem when setting beam intensity - Added by Matthias Brunner about 14 years ago
Anchi Cheng wrote:
Is there any upgrade on the Tecnai side? They change the unit for the same property call once a while, rather annoying but we can see why some times. Let us know what version of TUI and Tecnai ( or TEM scripting is installed, it may tell us more.
Hi Anchi,
thanks for the reply!
No upgrades on the Tecnai side - I am not aware of any changes at all.
A complete restart of microscope/microscope PC did not help.
The current workaround with the additional dummy mag (39kx) is ok - but I would still like to know what's going on...as soon is a turn on "skip when cycling" in this dummy mag, it ends up at that weird beam intensity again in fa.
Is there any way to log all Tecnai Scripting calls issued by the Leginon Client?
RE: Communication problem when setting beam intensity - Added by Anchi Cheng about 14 years ago
You may want to try some direct pyScope command on the microscope PC
1. open python command line window under the Programs pull-out for python2.5
2. type in the following script:
from pyScope import tecnai t = tecnai.Tecnai() t.getIntensity() t.setIntensity(0.5) t.getIntensity()
At least for our scopes, 0.5 is close to cross-over. You should pick a number close to what you get from the output of t.getIntensity() so that it does not go out of range. The value you get from second time the intensity is obtained from tecnai should be the same as what you enter for t.setIntensity().
We don't have a log for all Tecnai Scripting calls. You may try to find these two functions in pyScope/tecnai.py and make them print every time they are used.
Interesting point about adding dummy mags. Where do you add these? are these real magnification of the scope? Could there be a normalization option on Tecnai that you did/didn't turned on before?
You may want to observe the preset change while it cycles by leaving the main screen down. You might see whether any normalization step done by Tecnai is not completed before Leginon move on to the next preset magnification when you skip the dummy mag.
RE: Communication problem when setting beam intensity - Added by Matthias Brunner about 14 years ago
Anchi Cheng wrote:
Interesting point about adding dummy mags. Where do you add these? are these real magnification of the scope? Could there be a normalization option on Tecnai that you did/didn't turned on before?
Thanks! I will try the other suggestions as soon as I can use the microscope again.
For clarification:
The dummy mag is an actual magnification (39k), added between hl (4.7k) and fc (59k):
gr -> sq -> hl -> dummy -> fc -> fa -> en -> ef
As soon as "skip when cycling" is on for dummy, the problem re-appears.
RE: Communication problem when setting beam intensity - Added by Anchi Cheng almost 14 years ago
Is hl in SA or M mode? If it is in M mode, there might be a between-mode normalization on Tecnai that was not activated before. I assume fc, fa, en and ef are all in SA mode, correct?
Do you have problem if you are sending fa while the scope is at hl?
RE: Communication problem when setting beam intensity - Added by Jim Pulokas almost 14 years ago
Expanding on Anchi's test script above, try also my script below. Instead of doing it in a python command line, save it in a file like "mytest.py" on your desktop so that the functions can be called as fast as possible in sequence. That is how it would happen in leginon, with no pauses between setting mag and setting intensity. Maybe we need more pause in between those functions.
from pyscope import tecnai
t = tecnai.Tecnai()
print 'setting mag 4700'
t.setMagnification(4700)
print 'setting intensity 0.5'
t.setIntensity(0.5)
print 'setting mag 59000'
t.setMagnification(59000)
print 'setting intensity 0.6'
t.setIntensity(0.6)
print 'get intensity', t.getIntensity()
raw_input('press enter to quit')
It should give you a final intensity of 0.6. If the mag change is happening slower than the return from the setMagnification function, then the intensity change may happen prematurely. From a command line, you may want to just observe the behavior of t.setMagnification(...). When you run this function, the TEM should be done changing mag and doing any normalization before the function returns and you get your prompt back.
RE: Communication problem when setting beam intensity - Added by Matthias Brunner almost 14 years ago
Thanks for your input!
Anchi's script behaves as expected (intensity stays the same) - but Jim's causes an MagnificationUnitialized (or something of that kind) exception at the first setMagnification call. Any command that should be inserted before the first setMag?
hl is already SA mode but I have to test whether it causes weird intensities...
On a more general level, I would like to point out again that the intensity readings in the Instrument node always appear to be ok - it's only the C2 current as percentage in the Tecnai UI that is wrong (and the actual beam, of course :).
Any suggestions how I should change the script in order to get setMagnification working?
RE: Communication problem when setting beam intensity - Added by Anchi Cheng almost 14 years ago
add this line before you setMagnification
t.getMagnification()
RE: Communication problem when setting beam intensity - Added by Jim Pulokas almost 14 years ago
Sorry, I never bothered to test my own script. Before you setMagnification, you have to initialize the list of magnifications like this:t.findMagnifications()
That will cycle through every magnification and store the resulting list. This is stored in memory only, not to a file, so it has to be done every time the script runs. The script could be modified to store the list to a file to be reused.
RE: Communication problem when setting beam intensity - Added by Matthias Brunner almost 14 years ago
Jim Pulokas wrote:
Sorry, I never bothered to test my own script. Before you setMagnification, you have to initialize the list of magnifications like this:
t.findMagnifications()
That will cycle through every magnification and store the resulting list. This is stored in memory only, not to a file, so it has to be done every time the script runs. The script could be modified to store the list to a file to be reused.
Thanks, I will try that as soon as I can! (Just this moment I wanted to post in reply to Anchi that calling getMagnification is not enough.)
Cheers
Matthias