errors during calibration
Added by Anonymous over 16 years ago
Achieved basic functionality after updating the mag table and went on to calibrations. Following chronicles a series of errors. But first, let me say that I tested all the methods in the CM class within CM.py and they seem to be working properly except for the following:
getFilmExposureNumber, which returns an error.
getFilmExposureType, returns "automatic" when in fact EM is set to "manual"
getVacuumStatus, returns 'unknown', which I don't understand because the code indicates that it should return 'N/A for CM'
OK, on to errors obtained upon running Leginon:
Upon initialization of Calibrations application:
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|dimension|x None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|dimension|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|offset|x None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|offset|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|binning|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|binning|x None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|dimension|x None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|dimension|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|offset|x None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|offset|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|binning|y None <type 'NoneType'>
subSQLColumns failed <class 'leginondata.CameraSettingsData'> SUBD|binning|x None <type 'NoneType'>
model <ctypes.c_char_Array_33 object at 0x03A5DA30>
version <ctypes.c_char_Array_33 object at 0x03A5DA80>
CM Model: 'CM200 ' Version: '00142 '
from getMagnificationsInitialized
from setMagnifications
get preset from instrument: LM 380x after from getIntensity -> error
Preset from instrument failed, unable to get TEM parameters: unsupported operand type(s) for /: 'float' and 'NoneType'
workaround was to define preset in SA mode, and then edit mag and intensity
However, when setting "sq" preset, get same error. Sometimes EM seems to be set correctly, othertimes not
Upon further investigation:
Whenever EM is in LM mode
When trying to acquire an image:
Acquisition failed: unsupported operand type(s) for /: 'float' and 'Nonetype'
Raw images are acquired without problem.
Dark ref, Gain ref both show 3 images acquired and error appears after program checks EM status - only in LM mode - SA mode works fine
In Dose node, when trying to "acquire image" for dose calibration (in SA with preset override). Error message and failure to get image:
from setMainScreenPositions
Exception in thread Thread-68:
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
self.run()
File "C:\Python25\lib\threading.py", line 446, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Python25\Lib\site-packages\Leginon\dosecalibrator.py", line 89, in acquireImage
self.instrument.tem.MainScreenPosition = 'up'
File "C:\Python25\Lib\site-packages\Leginon\remotecall.py", line 235, in setattr
return self._objectservice._call(*args)
File "C:\Python25\Lib\site-packages\Leginon\remotecall.py", line 354, in _call
return self.clients[node].send(request)
File "C:\Python25\Lib\site-packages\Leginon\datatransport.py", line 61, in send
raise result
NotImplementedError
(Seems that it is checking screen position which is not implemented for CM)
Also, in dose node, when trying to "calibrate" after entering known sensitivity
Exception in thread Thread-13:
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
self.run()
File "C:\Python25\lib\threading.py", line 446, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Python25\Lib\site-packages\Leginon\dosecalibrator.py", line 94, in uiCalibrateCamera
imdata = self.acquireImage()
File "C:\Python25\Lib\site-packages\Leginon\dosecalibrator.py", line 89, in acquireImage
self.instrument.tem.MainScreenPosition = 'up'
File "C:\Python25\Lib\site-packages\Leginon\remotecall.py", line 235, in setattr
return self._objectservice._call(*args)
File "C:\Python25\Lib\site-packages\Leginon\remotecall.py", line 354, in _call
return self.clients[node].send(request)
File "C:\Python25\Lib\site-packages\Leginon\datatransport.py", line 61, in send
raise result
NotImplementedError
Looks like line 89 in Leginon\dosecalibrator.py is requesting that the screen be raised, which fails for CM
Replies (8)
- Added by Jim Pulokas over 16 years ago
I made a change in Leginon in the dose calibrator node to catch and ignore exceptions from screen up/down. It will just report that screen up/down failed and continue. As long as you put the screen down before measuring screen current and up before acquiring the image, the functions should complete without exception now.
This has been checked into leginon svn.
The other problem is because the getImageShift function is actually not implemented for the LM mags. Here is what it looks like right now:
def getImageShift(self): if Debug == True: print 'from getImageShift' value = {'x': None, 'y': None} CMvar = self.CMLIB.GetCMVar() i = self._emcGetMagPosition(CMvar.Magn, CMvar.MainScrn) # locate Mag index if i > 15: value['x'] = float(CMvar.ImageShiftX)/CMCal.imgshiftpix[i]['x'] value['y'] = float(CMvar.ImageShiftY)/CMCal.imgshiftpix[i]['y'] else: value['x'] = float(cmlib.imageshift_LM['x'])/CMCal.imgshiftpix[i]['x'] value['y'] = float(cmlib.imageshift_LM['y'])/CMCal.imgshiftpix[i]['y'] return valueThe error is from these lines:
value['x'] = float(cmlib.imageshift_LM['x'])/CMCal.imgshiftpix[i]['x'] value['y'] = float(cmlib.imageshift_LM['y'])/CMCal.imgshiftpix[i]['y']The actual exception is that CMCal.py defines imgshiftpix to be None for the first 15 mags. The more serious issue is that for the first 15 mags, instead of getting the image shift from the scope, it is using a constant defined in cmlib.py. When I was working with Scott on this, we never figured out a way to get the image shift from the TEM for the LM range.
- Added by Anonymous over 16 years ago
I downloaded the current leginon-trunk using svn and replaced all the files in the python25/Lib/site-packages/Leginon directory with the new ones. When attempting to acquire an image in the dosecalibrator node, I get the following error (did I do something wrong?):
from setMainScreenPositions
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
self.run()
File "C:\Python25\lib\threading.py", line 446, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Python25\Lib\site-packages\Leginon\dosecalibrator.py", line 79, in acquireImage
self.info('screen up failed (may be unsupported)')
AttributeError: 'DoseCalibrator' object has no attribute 'info'
Regarding the image shift, when I use python command line to test getImageShift(), it returns {'y': 0.0, 'x': 0.0} regardless of the state of the EM (SA mode, LM mode, zeroed img shift, nonzero img shift). I suppose this is because calibration of img shift have not been done?
What are the implications of the problem you report with LM mode img shifts? Should I give up on LM mode calibration and imaging (i.e. the montage feature I was looking forward to)? Is there a workaround?
- Added by Jim Pulokas over 16 years ago
Sorry, I have a bad habit of commiting my changes before testing them.
I added the missing piece in dosecalibrator.py and commited to svn.
- Added by Scott Stagg over 16 years ago
Hi David,
You can still get a montage (we call them an atlas) even though you can't control image shift. On the scope, just make sure that your image shift between SA and LM is pretty close. In leginon, make sure that you have a good matrix calibration for stage movement, then acquire the atlas. I have acquired several atlases on the CM300, and everything works out fine.
- Added by Anonymous over 16 years ago
OK, I was able to figure this out (had to change some of the entries in CMcal.py for the mags that I want to use). Stage Matrix calibration is underway.
However, I have a complaint. Each image takes a long time to acquire because the EM status is polled each time (from getMagnification to getFilmDateType - about 20 functions). Is there any way to speed this up? Does the slowness have to do with having debug on and thus echoing to the stdout window? Or is this just innate to the serial port communication?
PS. the M/LM img alignment doesn't seem trivial. I followed the alignment procedure twice and still had a sizeable offset. I tried deliberately compensating for this offset during the alignment procedure, and it is better, but not at all perfect. I will consult with FEI, but wonder if there is a trick here. I know that our FEI is bang on and users are very happy about that.
- Added by Jim Pulokas over 16 years ago
I remember long ago, we had a special lens series from FEI imported to our CM so that you could use a low mag like 550 in the M mode. Has anyone else heard of this? I'll try to find more info.
- Added by Scott Stagg over 16 years ago
Regarding the long time it takes to take images, the reason it takes so long is the extremely slow communication rate between the CM and the computer controlling it. On the Tecnai, this communication happens almost instantaneously. On our instruments, I mostly use the Manual application because of the slowness. That way, you still get the benifits of the database. Jim started working on a work around to speed things up for the CM, and I believe Min Su is currently working on a solution.
Scott
- Added by Jim Pulokas over 16 years ago
There are several places in leginon where we ask for the complete state of the scope, which includes every parameter that is in the ScopeEMData object. This is a lot of parameters, and on the Tecnai, this is super fast. On the CM, many of these parameters are individual calls the the scope that take up to one second each. One of the changes I started working during my visit with Scott was to reduce the number of times we grab the full set of parameters. It happens a lot whenever we acquire an image. I have already fixed the image acquisition in manual focusing, so it can be faster. Also in manual acquisition this has been fixed. It still needs to be done for calibrations and a few other places.
Instead of grabbing the whole set of parameters in ScopeEMData, I figure out what parameters are really necessary and create a subset of ScopeEMData. For instance, manual acquisition uses a class called ManualAcquisitonScopeEMData, which only has eight parameters.