Bug #1048
closed
GIF switches to EFTEM mode, has different magnifications
Added by Jim Pulokas about 14 years ago.
Updated almost 7 years ago.
Category:
Leginon subsystem
Estimated time:
(Total: 0.00 h)
Affected Version:
Appion/Leginon 2.1.0
Description
Leginon stores the list of magnifications available on each instrument in the database. pyscope uses that list to get/set magnification by index. That way the correct mag is get/set if the screen is up or down. GIF switches to EFTEM mode, which has a different list of magnifications. We need to find a way to have get/set magnification to work in any mode, even if the magnification list is different.
The MagnificationsData table is not able to handle different modes. It stores one list of mags for each TEM. One row contains the entire list of mags. This table should be normalized to a table with one row per mag. Columns would be: instrument, mag, index, mode, etc. The index that pyscope and tecnai scripting needs could be queried regardless of what mode the scope is in.
Files
I want to comment on a work around that Jim suggested to get our Titan working with both our GIF and and the non-filtered camera. In order to do this, I needed to create a new instrument class and a new camera class. The steps I took are below:
- In pyscope edited gatan.py
copied Gatan class to new GatanGIF class
changed the value for the "name" variable from Gatan to GatanGIF
- In pyscope edit tecnai.py
copied Tecnai class to new TecnaiEFTEM class
changed the value for the "name" variable from Tecnai to TecnaiEFTEM
- added GatanGIF and TecnaiEFTEM to instrument.cfg
- added GatanGIF and TecnaiEFTEM to database
- because TecnaiEFTEM has completely different mags, it must be completely calibrated
- in order for it to work, the GIF has to be selected in the Tecnai interface, and EFTEM mode must be activated. Then the instrument and camera have to be properly set in the presets.
- Assignee changed from Jim Pulokas to Scott Stagg
Scott, if you add your special pyscope classes to the trunk, then I will think about the best way forward. It may turn out that we add mode switching and multiple mag tables to the main Tecnai class, but at least we have something to start with in your solution.
Jim, I was hesitant to commit my stuff to the trunk. I am attaching them here instead. I just want to make sure that it won't break anything. Please take a look, and commit if you think it won't mess anyone else up.
- Assignee changed from Scott Stagg to Anchi Cheng
Anchi, here is the thread we were trying to find yesterday regarding issue #777. Anyway, it was my error that was initially the problem. As you suggested, I should have renamed the class as well as the camera. I did that, and unfortunately, I'm still having a problem. Now the launcher will come up without error, but when Leginon connects to the instrument, it is not querying the cameras. If I go to Navigator, for instance, it will let me select Tecnai but "None" is my only available option for Digital Camera.
I uploaded my current config file for completeness
OK. More information on this. On the microscope computer, I tried:
from pyScope import gatan
myccd = gatan.Gatan()
and it yielded the following exception:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
ccd=gatan.Gatan()
File "c:\python25\Lib\site-packages\pyscope\loggedmethods.py", line 24, in new_f
if mylock._RLock__count == 1 and args[0].logged_methods_on:
File "c:\python25\Lib\site-packages\pyscope\loggedmethods.py", line 27, in new_f
result = f(*args, **kwargs)
File "c:\python25\lib\site-packages\pyscope\gatan.py", line 69, in __getattribute__
if attr_name in object.__getattribute__(self, 'unsupported'):
AttributeError: 'Gatan' object has no attribute 'unsupported'
Any ideas as to how to fix this? Jim, feel free to weigh in.
Jim is on the road.
See if the test used in #1469 will help you finding out what is actually registered and what is called.
Creating instance with ccd = gatan.Gatan() does not work any more. Need
from pyscope import registry
ccd = registry.getClass('Gatan')
OK, I'm not exactly sure what to look for. I tried the following, and I don't know what to make of it:
>>> ccd=registry.getClass('Gatan')
>>> ccd.getBinning()
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
ccd.getBinning()
TypeError: unbound method new_f() must be called with Gatan instance as first argument (got nothing instead)
>>> dir(registry)
['__builtins__', '__doc__', '__file__', '__name__', 'c', 'ccdcameraorder', 'ccdcameras', 'config', 'getClass', 'getClasses', 'temorder', 'tems']
>>> registry.ccdcameras
{'Gatan': <class 'pyscope.gatan.Gatan'>, 'GatanGIF': <class 'pyscope.gatan.GatanGIF'>}
>>> registry.tems
{'Tecnai': <class 'pyscope.tecnai.Tecnai'>, 'TecnaiEFTEM': <class 'pyscope.tecnai.TecnaiEFTEM'>}
Sorry, my bad,
you need to use
ccd = registry.getClass('Gatan')()
to get an instance of the class.
OK, I did ccd = registry.getClass('Gatan')(), and it gave the original exception:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
ccd=registry.getClass('Gatan')()
File "c:\python25\Lib\site-packages\pyscope\loggedmethods.py", line 24, in new_f
if mylock._RLock__count == 1 and args[0].logged_methods_on:
File "c:\python25\Lib\site-packages\pyscope\loggedmethods.py", line 27, in new_f
result = f(*args, **kwargs)
File "c:\python25\lib\site-packages\pyscope\gatan.py", line 69, in __getattribute__
if attr_name in object.__getattribute__(self, 'unsupported'):
AttributeError: 'Gatan' object has no attribute 'unsupported'
Almost out of idea. You don't have two separate computer, one for TEM and one for camera, do you? and DM is on? And if you only have one of the two camera registered, it still works?
I've updated branch 2.2 with that and another change which I think might help you that didn't make it into the branch in pyscope.
- Status changed from Assigned to Closed
Also available in: Atom
PDF