Project

General

Profile

Actions

Feature #2254

closed

Support Falcon camera

Added by Anchi Cheng about 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
02/19/2013
Due date:
% Done:

0%

Estimated time:
Deliverable:

Description

Support Falcon camera in Leginon

Requirements

1. Acquiring image through TIA (probably work?)
2. Insert camera when it is about to acquire images.
3. Retract camera when other camera needs to acquire images.
4. Compatible with the protector program.


Files

FalconOnTIACmd_comarray.JPG (46.1 KB) FalconOnTIACmd_comarray.JPG Jian Shi, 02/19/2013 10:46 PM
FalconOnTIAOutput.JPG (446 KB) FalconOnTIAOutput.JPG Jian Shi, 02/19/2013 10:46 PM
FalconLeginonOnPC.JPG (66.1 KB) FalconLeginonOnPC.JPG Jian Shi, 02/19/2013 10:46 PM
falconLeginonOnLinux.png (38.8 KB) falconLeginonOnLinux.png Jian Shi, 02/19/2013 10:46 PM
numpyError.JPG (12.8 KB) numpyError.JPG Jian Shi, 03/20/2013 03:13 AM
LinuxFalconBin2_noProblem.png (500 KB) LinuxFalconBin2_noProblem.png Jian Shi, 04/23/2013 07:25 PM
TIA_Falcon_LinuxError.png (101 KB) TIA_Falcon_LinuxError.png Jian Shi, 04/23/2013 07:25 PM
post15Error.png (121 KB) post15Error.png Jian Shi, 04/29/2013 06:42 PM
socketStreamError.JPG (65 KB) socketStreamError.JPG Jian Shi, 05/08/2013 10:20 PM
Titan_TCP_netstatA_leginonP3.JPG (282 KB) Titan_TCP_netstatA_leginonP3.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_netstatA_leginonP4.JPG (240 KB) Titan_TCP_netstatA_leginonP4.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_connection.JPG (197 KB) Titan_TCP_connection.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_stat.JPG (167 KB) Titan_TCP_stat.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_netstatB.JPG (167 KB) Titan_TCP_netstatB.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_netstatA_leginonP1.JPG (267 KB) Titan_TCP_netstatA_leginonP1.JPG Jian Shi, 05/20/2013 12:54 AM
Titan_TCP_netstatA_leginonP2.JPG (281 KB) Titan_TCP_netstatA_leginonP2.JPG Jian Shi, 05/20/2013 12:54 AM
NewPyScopeError.JPG (125 KB) NewPyScopeError.JPG Jian Shi, 06/03/2013 10:51 PM
NewPyscopeErr_linux.png (66.9 KB) NewPyscopeErr_linux.png Jian Shi, 06/03/2013 10:51 PM
NewPyScopeErrCmd.JPG (85.5 KB) NewPyScopeErrCmd.JPG Jian Shi, 06/09/2013 07:31 PM
tecnai.py (32.1 KB) tecnai.py Jian Shi, 06/09/2013 10:18 PM
BeamComaErr.png (858 KB) BeamComaErr.png Jian Shi, 06/11/2013 03:15 AM
MagStageModelErr.png (827 KB) MagStageModelErr.png Jian Shi, 06/11/2013 03:15 AM
AlignFalconPresetErr.JPG (48.1 KB) AlignFalconPresetErr.JPG Jian Shi, 06/13/2013 12:49 AM
appLoadingErr17652.png (143 KB) appLoadingErr17652.png Jian Shi, 06/14/2013 02:23 AM
EfilterUpdateErr.png (121 KB) EfilterUpdateErr.png Jian Shi, 06/14/2013 02:23 AM
FalconThroughTia.JPG (82.7 KB) FalconThroughTia.JPG Jian Shi, 08/16/2013 10:43 PM
Beam_protector.JPG (50.1 KB) Beam_protector.JPG Jian Shi, 08/19/2013 12:26 AM
FalconThrTiaCommand.JPG (73.1 KB) FalconThrTiaCommand.JPG Jian Shi, 08/19/2013 12:26 AM
tia.py (7.08 KB) tia.py Anchi Cheng, 08/19/2013 11:10 PM
Coma_CTF_err.png (814 KB) Coma_CTF_err.png Jian Shi, 08/27/2013 07:50 PM
Falcon_corrector512bin8_err.JPG (33.5 KB) Falcon_corrector512bin8_err.JPG Jian Shi, 08/27/2013 07:50 PM
Corrrector_Falcon512bin1.png (292 KB) Corrrector_Falcon512bin1.png Jian Shi, 08/27/2013 07:50 PM
13sep13a_HCRSV_Gr_00072gr_00006sq_v02_00005hl.mrc (4 MB) 13sep13a_HCRSV_Gr_00072gr_00006sq_v02_00005hl.mrc Jian Shi, 09/15/2013 10:04 PM
13sep13a_HCRSV_Gr_00075gr_00008sq_v02_00008hl.mrc (4 MB) 13sep13a_HCRSV_Gr_00075gr_00008sq_v02_00008hl.mrc Jian Shi, 09/15/2013 10:04 PM
13sep13a_HCRSV_Gr_00075gr_00008sq_v02.mrc (4 MB) 13sep13a_HCRSV_Gr_00075gr_00008sq_v02.mrc Jian Shi, 09/15/2013 10:04 PM
13sep13a_HCRSV_Gr_00075gr_00008sq_v01.mrc (4 MB) 13sep13a_HCRSV_Gr_00075gr_00008sq_v01.mrc Jian Shi, 09/15/2013 10:04 PM
Coma_CTF_err.png (814 KB) Coma_CTF_err.png Jian Shi, 09/16/2013 02:05 AM
kriosIceHole.mrc (106 KB) kriosIceHole.mrc Jian Shi, 09/16/2013 02:09 AM
kriosEmptyHole.mrc (151 KB) kriosEmptyHole.mrc Jian Shi, 09/16/2013 02:09 AM
Actions #1

Updated by Anchi Cheng about 11 years ago

  • Status changed from New to Assigned
  • Assignee set to Jian Shi

Jian,

Please start by checking if the first item works. We've already have TIA support for Eagle camera. We hope it works for Falcon, too, once it is inserted with valid dose.

Add to instruments.cfg on Falcon computer
[falcon]
tia.TIA
zplane: something at the the high end
height: 4096 # Or according to Falcon
width: 4096 # Or according to Falcon

Try this python script to load the camera and get an image

from pyscope import tia
f=tia.TIA()
f.getImage()

If a numpy array is returned it worked.

Jim,
Does Special_Instructions_for_FEI_Eagle_Camera still apply?

Updated by Jian Shi about 11 years ago

I install comarrary for TIA on microscope PC and I manually insert the Falcon in TUI. Then I did following tests:
1) The command line works fine in terminal, an array is returned and image is shown in TIA, pyscope tab. See attached pictures

2) Start Leginon main on microscope PC, and acquire an image in Manual node. Correct image is shown in TIA but not in Leginon. Error message shows in terminal.

3) Start Leginon main on Linux, and acquire an image in Manual node. Also Correct image is shown in TIA but not in Leginon. An error message shows in manual node.

Thanks,
Jian

Actions #3

Updated by Anchi Cheng about 11 years ago

numextension.allstats missing problem on Windows PC is caused by the numextension for py2.5 is older than the trunk requires. Jim will need to recompile this.

Error sending request error is not very specific, could you print the request in leginon/datatransport.py in the function _send before it raises TransportError in the last line of the function?

Actions #4

Updated by Jian Shi about 11 years ago

Please find the Request object was causing error

Origin: Manual
Node: Instrument
Name: TIA
Attributename: Image
Type: r
args:
()
kwargs: {}

Actions #5

Updated by Anchi Cheng about 11 years ago

Jian,

I just convinced Jim to work on this immediately. We have two possible route. One, use SerialEM plugin directly which you said works already, Two, compile the new version of numextension in python2.5 that you have. Each has pros and cons. Jim is sure the current problem you have is just numextension version. but we've lost the computer where we had the old visual studio for it, so we will have to recreate it. The SerialEM plugin would be good for the future because we don't have support that part, but there is more rewriting code which we can't test ourselves.

For the short term, we will try option two.
Could you give us specific on your Windows PC that Falcon and TIA is run from?
1. Windows version (including 32 or 64-bit version specification).
2. Python version

Actions #6

Updated by Jim Pulokas about 11 years ago

new numextension (current svn revision) for python 2.5 is now available. click "files" tab to find it.

Actions #7

Updated by Jian Shi about 11 years ago

Hi Jim,

I installed the new numpy-extension and got attached error while try to start leginon-client or leginon-main.

Jian

Actions #8

Updated by Jian Shi about 11 years ago

Hi Jim,

I updated numpy to 1.7 on Windows PC, and start Leginon main and was able to take images from Falcon camera without problem. Great! Thanks,

But when I try Leginon main from Linux PC, I got following errors. It looks it is due to old scipy version. But I can't find right rpm for python2.6.6 since I am runing CentOS 6. I saw you generate an install package for Ubuntu, can you create a rpm of scipy 0.10.1 for CentOS 6 as well. Otherwise I think I have to wipe the CentOS and move to fedora.

********Error Message*********************************
[cbis@LeginonCBIS Jian]$ start-leginon.py
/usr/lib/python2.6/site-packages/pyami/tifffile.py:903: UserWarning: Failed to import _tifffile.decodepackbits
warnings.warn("Failed to import %s" % module_function)
/usr/lib/python2.6/site-packages/pyami/tifffile.py:903: UserWarning: Failed to import _tifffile.decodelzw
warnings.warn("Failed to import %s" % module_function)
Leginon version: pre3.0
Origin: Manual
Node: Instrument
Name: TIA
Attributename: Image
Type: r
args:
()
kwargs: {}

Actions #9

Updated by Anchi Cheng about 11 years ago

The error message is exactly what it said. tifffile module does not have what it needs to decode the said compression. However, since tifffile is needed only for reading tiff raw frame from DE series camera which is not compressed, the error message has no impact on any Leginon/Appion operation. You don't have to do anything about it. CentOS 6 default numpy scipy should work fine.

Actions #10

Updated by Jian Shi about 11 years ago

Anchi,

But I still got "Error acquring image: Error sending request" message same as attached falconLeginonOnLinux.png in this thread. And no image is displayed in Leginon-Main window. I don't have any problem while running Leginon-Main on Windows PC.

Jian

Actions #11

Updated by Jim Pulokas about 11 years ago

Before when you had the "error sending request", it was also showing the error about numextension on the Windows client. With the current "error sending request" is there a corresponding error on windows? Also, can you try some other functions, such as getting and setting presets in one of the other applications (calibrations or MSI). I wonder if it is only image acquisition that is having problems, or other functions as well.
Jim

Actions #12

Updated by Jian Shi about 11 years ago

Well, as I can remember according to post 2 in this thread, the windows error and Linux error are not related, I was running leginon main on either OS respectively. So I think you have solved issue 2 I listed in post #2, and now we down to issue 3 in post 2. I also managed to print out the request object in datatransport.py._send(), in post 4 as Anchi suggested. Please suggest more test I can run for diagnosis. I will try other application, but I thought image acquisition is shared by all applications.

Actions #13

Updated by Anchi Cheng about 11 years ago

Jim and I are writing this together. He thinks that it may be a network problem since it works on PC (I assume it means that you get an image through Leginon and it displays in its gui).

Linux tests:

1. Confirm that you can acquire images from other camera from Linux.
  • This will rule out general installation problem.
2. Send a preset that uses Falcon camera to scope/camera and then get it back
  • If there is a problem communicating, it may show an error at this stage.
3. Try with Falcon the smallest image that you can do through Leginon.
  • This is to see if the size is too big to transfer over.

If none works, run leginon/syscheck.py and give us the output that shows the
version of the packages, and check the numextension that you installed. It should
have allstats function. If in doubt, just reinstall it with setup.py.

If all work, there is something about the image gotten from Falcon makes it not
transferable. Please save an image through Leginon on the Windows PC and attach that here.

Updated by Jian Shi about 11 years ago

1. Confirm that you can acquire images from other camera from Linux.
Other two Gatan CCDs works fine

2. Send a preset that uses Falcon camera to scope/camera and then get it back
Preset can read/set microscope info correctly, but not be able to insert/retract different cameras, as expected.

3. Try with Falcon the smallest image that you can do through Leginon.
On microscope Windows PC, Leginon-MSI corrector has no problem to take any size of image from Falcon and display in Leginon window.
On Linux PC, Leginon-MSI corrector can take 1K-bin4, 2K-bin2 images out of Falcon and display without error. But the "request" error comes up while taking with 4k-bin1 images. The 4K image in fact has been taken and appears in TIA-pyscope window, but not show up in Leginon window.

Actions #15

Updated by Jim Pulokas about 11 years ago

So it seems to be something about the size of the image. It seems to be cutting off the data stream before it sends the whole image over the network.
Next thing to try on the linux side, make an edit to leginon/socketstreamtransport.py:

At line 167 there is a try/except block:

    try:
      result = pickle.load(sfile)
    except Exception, e:
      raise TransportError('error unpickling response, %s' % e)
Let's try viewing the original pickle exception, so comment out the "raise TransportError..." and make it a simple "raise", so it looks like this:
    try:
      result = pickle.load(sfile)
    except Exception, e:
      raise
      #raise TransportError('error unpickling response, %s' % e)

I hope it will now display a pickle error instead of TransportError.

Actions #16

Updated by Jim Pulokas about 11 years ago

Jian,
In addition to the debugging in the previous post, I have one more question and one more debug test.

As I mentioned above,I thought it was the image size that causes the problem, but are you able to get a 4k x 4k image from a Gatan camera? (assuming your Gatan camera is 4kx4k, right?) If you can get 4k image from Gatan, but not from Falcon, then there is something else particular about the Falcon image. My next guess is that it is a combination of the size and the type of the image. Can you make a modification in your pyscope installation on the Falcon Windows PC. I want to have it print the type of the image array. In pyscope/tia.py, line 178, the original code looks like:

      arr = comarray.prop(self.im.Data, 'Array')
      arr = numpy.flipud(arr)
so insert a line to print the type:
      arr = comarray.prop(self.im.Data, 'Array')
      print arr.dtype
      arr = numpy.flipud(arr)
Maybe it will show that it is a 32 bit per pixel image instead of the usual 16 bit.

Jim

Actions #17

Updated by Jian Shi about 11 years ago

Jim, you are right, Falcon image IS 32bit, the counts can be way over 65000.
I will try your debug code next week. Thanks,

Actions #18

Updated by Jim Pulokas about 11 years ago

I just want to summarize the information I need to understand the problem, so can you fill in the following when you have time:

1. the error that shows up from the test in post 15 above (probably a pickle error)
2. The data type that is printed from the test in post 16 above (32 bit int or float?)
3. exact Windows version (XP, Vista, 7, etc...), and I assume 32 bit, but want to make sure.
4. exact version of Python you have on Windows: 2.5.? (need the minor number)
5. exact version of Python on linux. I saw 2.6.6 in post 8 above, but want to make sure this has not changed.

I was able to do a simulation here with a 32 bit 4kx4k image and did not have the problem you are having, so with all of the above information you provide, I should be able to simulate this more accurately.

Actions #19

Updated by Jian Shi about 11 years ago

1. the error that shows up from the test in post 15 above (probably a pickle error)
EOFError
see attached image
2. The data type that is printed from the test in post 16 above (32 bit int or float?)
int32

3. exact Windows version (XP, Vista, 7, etc...), and I assume 32 bit, but want to make sure.
Windows XP Professional Version 2002 service pack3

4. exact version of Python you have on Windows: 2.5.? (need the minor number)
Python 2.5.4 <r254:67916, Dec 23 2008, 15:10:54> [MSC v.1310 32 bit <Intel>] on win32

5. exact version of Python on linux. I saw 2.6.6 in post 8 above, but want to make sure this has not changed.
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2

Thanks,Jian

Actions #20

Updated by Jian Shi about 11 years ago

An observation may or may not related to this issue: that once I select TIA in the camera list for the first time in imaging setting window, the correct camera size (upto 4K for Falcon) will not be initialized until I close the image setting window and reopen again.

Actions #21

Updated by Anchi Cheng about 11 years ago

That is an unfortunate known issue that has to do with gui updating. We see that with other camera as well but should not be related with the transfer.

Actions #22

Updated by Jim Pulokas almost 11 years ago

  • Assignee changed from Jian Shi to Jim Pulokas

Jian,
I think I found the problem that is causing EOFError. To confirm this, I have a test script for you to try. Just install the current svn updated leginon on both your linux and windows systems.
Then follow the following procedure:

On Windows: open python command line and "import socketpickle". This will start a little server that will wait for a connection from the linux computer.

On Linux: connect to the server by running the script directly from a shell: "python socketpickle.py yourhost 4096"
Replace yourhost with the host name of the windows computer. In this example, it will request a 4096x4096 fake image. Replace 4096 with whatever image size you are requesting. It should fail for 4096, but should work for smaller sizes, like 2048.

I ran this here and got EOFError, but in my case it was for larger images, like 8196. I also see an exception on the Windows server that explains why: "No buffer space available". You should see something similar. This means that the windows computer is running out of buffer memory while trying to transfer the larger image. This may be something that can be tuned in the network settings, but not sure how. The only solution I know is to change how Leginon sends big images across the network. I will try to modify the code to break up the image into smaller pieces to transfer across the network. I will let you known when I have something for you to try.
Jim

Actions #23

Updated by Jian Shi almost 11 years ago

Hi Jim,

I downloaded and installed the latest from trunk, version 17558. I tried the test with different size from 1024 to 8096, but no error comes out on either PC.

------On Windows PC, the terminal shows:

import socketpickle

Running Server
host: Titan52331950
port: 55555
Handling request...
Size requested: 2048
Sending result ...
Handling request...
Size requested: 4096
Sending result ...
Handling request...
Size requested: 8196
Sending result ...

------On Linux PC, the terminal shows:
python socketpickle.py Titan52331950 8196
Connecting to server...
Sending request...
Getting result...

++++But terminal won't exit without further output at this stage until ctrl+C. Then the following message show up.

^CTraceback (most recent call last):
File "socketpickle.py", line 72, in <module>
run_client()
File "socketpickle.py", line 65, in run_client
im = c.getImage(size)
File "socketpickle.py", line 47, in getImage
result = pickle.load(sfile)
File "/usr/lib64/python2.6/socket.py", line 383, in read
data = self._sock.recv(left)
KeyboardInterrupt

However, I still have the same problem when I tried get 4K image out of Falcon in Leginon MSI-T.

Jian

Actions #24

Updated by Jim Pulokas almost 11 years ago

Jian, Here is the next thing to try:
On the Windows computer, edit leginon/socketstreamtransport.py
At about line 108, there is a try/except statement. We need to make sure the exception is raised, so add an immediate raise in the except clause before it does anything else:

    try:
      pickle.dump(result, self.wfile, pickle.HIGHEST_PROTOCOL)
      self.wfile.flush()
    except Exception, e:
      raise
Now when you have the EOFError on Linux, you should see an error on Windows also. Let me know what the error says.
Jim

Actions #25

Updated by Jian Shi almost 11 years ago

Jim, please find the attached error in Windows terminal. Thanks,

Actions #26

Updated by Jian Shi almost 11 years ago

Hi Jim, Anchi

Anything else I may try? The system quite free in May, so it is good opportunity.

Jian

Actions #27

Updated by Jim Pulokas almost 11 years ago

Jian,
How much memory do you have on your Windows machine? There is a slight chance that the error is caused by system running low on memory while trying to send the image across the network. If it is easy for you, you could try adding more memory to the Windows machine. This is only a guess, and it may not help. Otherwise, I am working on a software solution that does better buffering of the data that is sent to the network. I will send you the new code when it is complete.
Jim

Actions #28

Updated by Jim Pulokas almost 11 years ago

Jian,
I just made a new version of leginon/socketstreamtransport.py (r17585). It has a parameter at line 126 called "wbufsize" which is set to a default of 0 (no buffering). Can you install this new file in leginon on your Windows machine. Then try different values for the buffer size. Each time you modify the value in the file, restart Leginon and try to acquire a 4kx4k image across the network.

First try setting it to -1, which allows lower level code to select a default value. If that does not work, try setting it to 16777216 (size of 2048x2048 image, which seems to work). Otherwise, try some smaller values to see if anything works.

Let me know if you find a value that works without giving you the "no buffer space available".
Jim

Actions #29

Updated by Jian Shi almost 11 years ago

Hi Jim,
I installed latest trunk on windows PC and tried different value of wbufsize from -1, 2kX2k,1kX1k, 512x512, 128x128, none of them worked :(
The memory of microscope PC is 3.5 GB. In fact, the microscope PC communicate with Falcon through TCP/IP protocol as well. I am wondering if it could be culprit which occupy all the buffer resources while taking 4k images. And cause no problem while Legion running on the microscope PC.

"10055 No buffer space available" seems quite common on google, I will try to dig some possible solution out.

Thanks,
Jian

Actions #30

Updated by Jim Pulokas almost 11 years ago

This makes me think that setting that buffer size in high level code is still not having an effect on the low level buffering. I may have to dig deeper into the python socket code to override buffering. We can also just create the pickle into local memory, then manually break it into small strings that we send over the socket.

Updated by Jian Shi almost 11 years ago

Jim,

I increase the maxport number for TCPIP to 65000 as some online tutorial suggested, but it doesn't solve the issue as well.

Since Krios use lots TCPIP connection to Flacon, Flucam, microscope and RAPID VNC serverm I use 'netstat' to list all the active TCP-IP connections before I start Leginon. And I find there are lots of TCP connection created but on wait after starting an application in Leginon-main and start to communicate with microscope PC.(see attached picture). Only two were really established, which are Titan:1193 to Leginon:3306 and Titan 1194 to Leginon 3306.
All of rest connection are TIME_WAIT status and gradually fade out. Hopefully this gives you guys some hints.

Jian

Actions #32

Updated by Jim Pulokas almost 11 years ago

Jian,
I determined that the parameter "wbufsize" that I had you test is not effective because it only specifies a minimum buffer size. If we send a large image, than it still tries to use a buffer that is the full size of the image. Since there is no easy way to restrict it to a maximum buffer size, I made the change to just break up the data and make each write to the socket be a smaller chunk.

Please update leginon/socketstreamtransport.py from svn on both windows and linux and try it now. There is one parameter you can set at the top of that module: CHUNK_SIZE. The default should work for you, but you can always try smaller values if necessary.
Let me know how this works.
Jim

Actions #33

Updated by Jian Shi almost 11 years ago

Yeah! It is working now!What's next

Actions #34

Updated by Jim Pulokas almost 11 years ago

That is great! There is one more thing you can test if you have a chance:

In the latest revision of pyscope (starting with r17589) there is a new tia.py module. This one is completely different because it no longer uses the comarray package. Instead it requires a different package called comtypes. If you want to try this, make a backup of your tia.py, then install the new one from svn. Then install comtypes as described here: http://emg.nysbc.org/projects/leginon/wiki/Installing_comtypes
The instructions also explain that you need to make one modification to comtypes.

Let me know how that works.
Jim

Actions #35

Updated by Anchi Cheng almost 11 years ago

And try to take some images through Leginon and its gui and let us know if we need to modify gain/dark reference requirement etc.

Anchi

Updated by Jian Shi almost 11 years ago

I tried new pyscope package from latest trunk, however the TEM instrument is not initialized properly and not appear in the instrument list, while all camera are all OK. Then I try to take images then got error message. See attached photos.

I am sure the instruments.cfg on Windows and Linux are all OK, since they are at different places now.

Actions #37

Updated by Jian Shi almost 11 years ago

In terms of gain/dark reference, Falcon manages its own references through TUI and user is supposed to take references everyday using their image condition. The final images appear on TIA is already corrected by Falcon reference image manager.
I tried to take images through Leginon as well, the result seems to me that no need to take dark/gain references in leginon since it looks same as the one in TIA, which is corrected already.

Actions #38

Updated by Anchi Cheng almost 11 years ago

Jian,

Regarding the correction, We will make a feature to turn off correction but it will take a bit of time. In the mean time, I think only a handful of places in Leginon requires correction or it would not run. Most places probably just give a warning. If you run into situation that absolutely demanded correction on Leginon side, let me know.

As for pyScope Error. I am a bit confused. NewpyScopeError.JPG on PC shows that you put all nodes on that computer. Is that how you intend to run? Or is it a test that you would normally have the main on Linux which gave you the other error.

Actions #39

Updated by Jim Pulokas almost 11 years ago

I am not sure why TEM is not showing up, but this is probably why all the other errors happen.

First try a basic pyscope test to see if you get any errors when initializing the TEM. On the TEM computer, start a python command line and try this:

import pyscope.tecnai
t = pyscope.tecnai.Tecnai()
t.getMagnification()
You can also try a basic test of each camera, such as:
import pyscope.tia
t = pyscope.tia.TIA()
t.getImage()
Or use pyscope.gatan.Gatan0, etc.

If the basic tests do not give an error message, next try Leginon again, but first edit the instruments.cfg and only configure the TEM, not the cameras. So put # in front of all the camera lines to comment them out. Then start Leginon and see if the TEM is initialized. Then try again with each camera put back into the instruments.cfg. Maybe this will determine what is causing the problem.

Jim

Actions #40

Updated by Jian Shi almost 11 years ago

Here is error message I got while initialize a Tecnai instance using new pyScope. The old pyScope works OK.

Actions #41

Updated by Jim Pulokas almost 11 years ago

Can you attach here your old tecnai.py (the one that works). I am trying to figure out how old it is.

Also, what happens if you install the new pyscope, then run the pyscope/updatecom.py script. Make sure to run the updatecom.py in the new pyscope. Maybe that makes it work right?

Actions #42

Updated by Jian Shi almost 11 years ago

Jim,

The Tecnai.py is not a very old one, I believe it is 17589. I did visually compare it with the new version and didn't find anything difference until line 57.

I did run updatecom.py after install the new pyscope, everything went fine. But the error still there.

I will try different older version. But should I just install the pyscope part or everything else, such as Leginon, sinedon, etc?

Updated by Jian Shi almost 11 years ago

I went through most of calibrations with both Gatan Orius and FEI Falcon. But I had errors on Magnification and image rotation adjustment of the Stage model and beam-tilt coma calibrations on Falcon camera. See attached pics.

Actions #44

Updated by Anchi Cheng almost 11 years ago

Jian,

I guess my ctf estimation algorithm used in beam-tilt coma calibration is still buggy. Try doing the calibration with a smaller image if Falcon allows or just skip it now. I will debug it when I get time. Please give me your numpy scipy version. I think the bug might be version dependent.

As for MagCalibrationError, you just need to do it with the "Scale and Rotation Adjustment Only" UNCHECKed to get rid of that error. At least one model is needed before you can active that option.

It looks like you've gone past pscope error. Is this r17589 or the current ? Are there remaining problem in acquiring or transferring image?

Actions #45

Updated by Jian Shi almost 11 years ago

numpy version: 1.4.1 Scipy 0.7.2-8.el6

I just realized that I only did stage model at 480x with Orius camera and Falcon is not allowed to take images in LM range, so I got the MagCalibrationError when I tried to model the stage for hl preset using Falcon.

I am still running r17589, not the new version using comtype.

Actions #46

Updated by Jian Shi almost 11 years ago

I am trying run a MSI-Raster application today with presets in LM using Orius camera and presets in SA using Falcon. There are a few issues:
In preset image shift align:
1) since we can't insert/retract Orius/Falcon through Leginon, right now there is no way to align image shift between two cameras and LM and SA.
2) In SA with Falcon, when I try to align presets, the window CMD window gives error as attached. And the beam was blanked while the image was taken suggesting there is synchronization issue. I disable all the preset cycle, but still only take blank images.

Also due to the same reason, the Z-focus and focus and target queuing step all need to be carefully designed since there is no step may cross LM and SA.

Actions #47

Updated by Jian Shi almost 11 years ago

The latest pyscope works fine now. It was my bad. I had done before but forgot this time: that is I had to copy TecnaiCCD.dll and stdscript.dll into pyscope folder before run updatecom.py. Then all instrument working now.

But there are errors in 17652 when I try to load calibration application. Pls see attached pics. Version 17624 works fine.

In addition, I am running calibration on EFCCD, but find that I can't update the energyfilter either to microscope or from microscope.

Updated by Jian Shi almost 11 years ago

_
Exception in thread Thread-535:
Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.6/threading.py", line 484, in run
self.
_target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.6/site-packages/leginon/presets.py", line 1498, in getValue
value = self._getValue(instrument_type, instrument_name, parameter)
File "/usr/lib/python2.6/site-packages/leginon/presets.py", line 1516, in getValue
raise e
AttributeError: attribute EnergyFilter not in descripition

Actions #49

Updated by Anchi Cheng over 10 years ago

  • Assignee changed from Jim Pulokas to Jian Shi

Jian,

Jim and I just found that we left you hanging here. JIm will repond about energy filter issue soon.

We have a few questions about the Krios setup:

1. We just noticed that the two functions for inserting cameras are commented out in trunk pyscope/tia.py which means that if we can insert/retract Falcon through tia commands, we would not have gotten it to work because of the inactive functions. Could you uncomment them in tia.py at Krios computer and try insert Falcon with similar commands as in http://emg.nysbc.org/issues/2201#7

from pyscope import TIA
falcon = tia.TIA()
falcon.getRetractable() # This should return True
falcon.getInserted() # This should return the current state of orius.  Retracted is False, Inserted is True
falcon.setInserted(True) # This should insert orius
falcon.setInserted(False) # This should retract orius

Let us know how it goes.

2. Can you control orius that is with Falcon from DM completely?

3. How big an an imaging area you can get with the lowest M mag with Falcon? Could you use that for sq mag? sq mag does not necessary has to cover the whole grid square. It just need to be big enough to handle possible range of target adjustment. I just need to know how many microns the image length is. My estimate is that if we have 40 um coverage, you will be able to use M mag for sq.

Actions #50

Updated by Jim Pulokas over 10 years ago

Jian,
The energy filter problem sounds similar to the same problem a few years ago in this issue: #1166
Try running the gatantest.py script that is attached to that issue to see if the energy filter functions are found in the scripting interface. Maybe the names have changed again?
Jim

Actions #51

Updated by Anchi Cheng over 10 years ago

Correction about my estimated sq image area requirement. We have used ~ 30 um in RCT sq and it is fine, too.

Actions #52

Updated by Jian Shi over 10 years ago

Anchi,

1) There is no M mag on Krios, just SA and LM. Lowest SA is 1700x, pixel size of Falcon is 14um and it covers 20.5um at 1700X.

2) After un-comment the insertion part code in tia.py, following code works great to switch Falcon and Orius and take images

>>>from pyscope import TIA
>>>detector = tia.TIA()
>>>detector.ccd.Camera
u 'EM-Falcon'
>>>detector.ccd.CameraInserted
True
>>>detector.getImage()
return an image by Falcon in TIA successfully
>>>detector.ccd.Camera = 'BM-Orius'
>>>detector.getInserted()
False
>>>detector.setInserted(True)
>>>detector.getInserted()
True
>>>detector.getImage()
return an image by Orius in TIA successfully

3) The reason I change camera names in TIA between Falcon and Orius is due to that inserting Orius through DM in fact will not be able to push Falcon out. You only can switch between Falcon and Orius through TIA or TUI. In addition, switching cameras in TIA will not be reflected on TUI.

Jian

Actions #53

Updated by Anchi Cheng over 10 years ago

Jian,

This is very encouraging.

1. I didn't know that when it was mentioned before that "Falcon could only be used in SA mode" meant that it could get down to 1700x. I thought we would be stuck at ~ 5000x. This gives us a lot more flexibility.

2. Do I understand correctly that Orius pushes Falcon out when you set the camera to Orius in your test script and then tell it to insert? If we then set the camera to Falcon, getInserted() would retrun False, right? Do each camera retract on its own? In other words, If I want to make sure both are out of the beam path when Falcon is already inserted, do I need to go through the following:

detector.ccd.Camera = 'BM-Orius'
detector.setInserted(True)
detector.setInserted(False)

or could I instead do only
detector.ccd.Camera = 'EM-Falcon'
detector.setInserted(False)

3. How did you find out the name string used for setting the camera?

4. With your success, we can safely say that it is very likely we can get Falcon to work with Orius once we find the right sequence to insert one and to retract one or both. Therefore the last remaining hurdle is the protector program. Could you describe what the issue there is? I need some help refreshing my memory about the details there. Thanks.

Updated by Jian Shi over 10 years ago

2. Do I understand correctly that Orius pushes Falcon out when you set the camera to Orius in your test script and then tell it to insert?
I think Falcon can push Orius out, but not 100% sure that Orius can push Falcon. I think it is to do with how they wire the pneumatic lines. The safe way is to retract Orius before inserting Falcon, and same for the other. Please find attached command I tested.
The Orius and Falcon definitely can be both retracted since they need to give the way to energy filter.

3. How did you find out the name string used for setting the camera?

They show up in TUI. But I didn't know which property it associated with in TIA.py until I dig a little deeper.

4.Therefore the last remaining hurdle is the protector program. Could you describe what the issue there is?
Beam protector is part of FEI-deamon in TUI that uses pre-calculated beam size/beam current information to protect Falcon from overexposing by automatic blanking. Please find attached screencopy of beam-protector interface. Two scenario are most common: 1) wrong microscope mode, such LM, EF-TEM, diffraction etc. 2) too condensed beam, that might damage the chip.
I don't think Leginon has to import that part since it will work at background on microscope PC anyway.

Actions #55

Updated by Anchi Cheng over 10 years ago

Try the attached tia.py. Replace the one on the tecnai computer with it. To use this, specify the two cameras in instruments.cfg as

[Falcon Camera]
class:tia.TIA_Falcon
zplane: 50
width: ????
height: ????

[Orius]
class:tia.TIA_Orius
zplane:49
width: ????
height: ????

I left the width and height as ???? because I don't know the correct dimension. You will have to put in the numbers as usual.
I set here Falcon at higher zplane than Orius since you said that Falcon can push Orius out from the beam path but not necessary the other way around. Leginon currently does not retract unused camera at the same zplane since the existing case where two camera are on the same zplane is the case when one camera is an off-axis camera on the same board.

With this, try acquiring an image from each camera through Leginon to see if the correct camera is used and those need to be retracted are letting the beam through.

If this does not work, search for "Zplane" in leginon/cameraclient.py. You will find where we have the condition for not retracting unused camera on the same zplane. You may then experiment with "=" added in there.

Updated by Jian Shi over 10 years ago

Good news. Everything seems working fine, but in a different way, along with few small issues.
1) After I start an application, there are two TIA cameras in Instrument node, but only one in Corrector setting and all other setting, which is initialized to Falcon.
2) Next finding is as long as TIA is retracted, Gatan(Orius) can be inserted and used to take images.
3) I can take reference images for Falcon only down to 1024*4, but failed on 512*8. See attached error traces. This cause some issues in dose measurement and preset alignment in preset manager in the future.
4) The beam-tilt coma calibration failed due to 'ctf estimation failure'. The rest calibration went well.
5) The delay between each presets need to be increase up to 5s, since the TUI auto-blanks the beam for long time while changing presets.
6) I was able to run through whole tomography application with Orius and Falcon cameras after calibration. Only gr preset is on Orius, the rest are on Falcon.
7) It would be nice that presets that can switch between micro-probe and nano-probe mode since people use nano-probe to collect final images, but micro-probe for survey on Krios.

I am leaving to Taiwan for vacation until 9th Sep and will update you later.

Actions #57

Updated by Anchi Cheng over 10 years ago

Jian,

Thanks for the update. Very good news indeed. Here are my comments.
(1) We will have to do some work with your help on this.
(3) You can set available binnings in tia.py for Falcon as follows:

class TIA_Falcon(TIA):
camera_name = 'BM-Falcon'
binning_limits = [1,2,4]

In Presets Manager Settings, you can set the size of image used for dose measurement and preset alignment under "Small image size (for dose image etc.)". Just put 1024 there.
(5) It is possible that you don't need to cycle presets on Krios to keep image shift and beam shift stable. That will save you some time.
(7) We have never dealt with nano-probe mode. Will need to learn what command to send.

Have a good time in Taiwan.

Actions #58

Updated by Jian Shi over 10 years ago

More update on testing MSI-T on quantafoil grids.

1) I can calibrate beam-tilt and done the defocus measurement well in beam-tilt node. But during the auto-run, I always got blank images in focus node so that the focus always failed. In focus simulation, I sometime got black images and sometime normal images. I think some pause is needed but not sure where yet.

2) In general, phase-correlation does not work well, such as Z-focus, hole targeting. The correlation is very smeared and hard to be found correctly. I am not sure it is due to the grids or property of falcon, but the grids seems typical to me. I can send some images for your guys to tune correlation algorithms.

3) For micro/nano-probe, it is available in stdscript.dll as
"Instrument.Illumination.Mode" "Mode of the illumination system (either nanoprobe or microprobe). (Nearly) no effect for low magnifications (LM)."
See temscripting.chm for description. It should be easy.

Thanks,
Jian

Actions #59

Updated by Anchi Cheng over 10 years ago

(1) I see that we don't have any gui chanable sleep time set for autofocus step. You will have to try to do this in the code of leginon/focuser.py for now. Change the assignment of "settle" variable in this line (currently at 0.25 second):

correction = self.btcalclient.measureDefocusStig(btilt, correct_tilt=True, correlation_type=setting['correlation type'], stig=setting['stig correction'], settle=0.25, image0=lastdriftimage)

(2) Yes, please send images.

(3) We have added nanoprobe/microprobe call in pyscope and tested it. Next is to add them to preset and database.

Actions #61

Updated by Jian Shi over 10 years ago

1) Increase the settling time solve the focus problem. Also I found I need to user image-shift instead of image-beam-shift in default setting, otherwise the beam is off-center.

2) I was also trying beam-tilt coma calibration, but it failed on ctf estimation. Please advise on the strategy.

Updated by Jian Shi over 10 years ago

And here is the hole template I created.

Actions #63

Updated by Jian Shi over 10 years ago

There is one more issue I failed to mention, say I have gr at 100x, Orius camera, sg at 1700x, falcon camera.

Because I found the sg targeting wasn't very accurate based on atlas of Orius images, I choosed to use Navigator to center for gr imaging. However the very first correction gr image out of Orius was always blank, then the second and later ones were OK. Surprisingly the Navigator still runs and most time get gr target correctly. I increases the pause everywhere on interface, but the issue still persist but only limited to the very first one.
In addition, align-preset process between sg and gr also have the same issue, maybe due to some shared code. I am not sure where I should insert some pause in the code.

Anchi, the Krios will start autofill about every 12hours, it would be nice to pause data-collection (particularly for tomography) during autofill, that takes ~10-20mins. Maybe you can open another thread for this feature. I don't know it have been done already.

Actions #64

Updated by Anchi Cheng over 10 years ago

I will see what I can repeat here on our K2/Orius combo. We are talking to orius through DM in this case, though.

Autofill pause has been asked multiple times so I created an issue already yesterday #2520

Actions #65

Updated by Anchi Cheng over 10 years ago

I played a bit with Orius/K2. Orius can only insert when K2 is not inserted. Therefore, it behaves the same as in your case, I think. I put Orius zplane smaller than K2 as in Instrumentscfg_for_22, then I have no problem in Navigation nor in Preset Alignment tool.

If you only have problem with the first image, it is possible that tia.py setInserted function returns before it is done insertion.
I committed pyscope/tia.py as r17902. You can play with the sleeptime in the function "setInserted" to see if you can give enough sleep time allow Orius to complete its insertion.

My guess for Navigation iterative move not failing on the first black image is that it would just give random error and continue with the iteration to get the next image in an attempt to improve it.

Beam tilt coma calibration needs very consistent ctf estimation and not to fail with large astigmation. 95% success rate is the minimum. I will write down my best protocol for this. We have not used the calibration much ourselves, though. And I hide the calibrations and its application in the 2.2 release because it is not reliable enough for me to teach others. Our coma-free alignment is usually done through Beam Beam Tilt Imager manually looking at Zemlin tableau. If we want to continue on this dicussion, it is best as Forum thread so others can find it easier.

Actions #66

Updated by Anchi Cheng over 10 years ago

I looked at the Falcon images you sent, they do look rather hard. Will need a bit of time on that.

Actions #67

Updated by Jian Shi over 10 years ago

Sleeptime worked. I don't have black image issue anymore in camera switching scenarios. Align-preset and Navigator all works fine now.

I think we have completed the job for the purpose of this thread. Only thing left is the cross-correlation of hl images. I can mitigate it with more dose, larger defocus and smaller tilt.

Actions #68

Updated by Anchi Cheng over 10 years ago

Jian,

Great. Give me the sleep time you finally use so that I can commit them.

Actions #69

Updated by Jian Shi over 10 years ago

I just used 5, sorry didn't test other values. I got frustrated of bad compustage today.

Actions #70

Updated by Anchi Cheng almost 10 years ago

  • Status changed from Assigned to Closed

A few of the local changes at NUS is now committed after our own experience with Falcon at NRAMM.

#2752 led to Beam tilt autofocus pause time gui in r18235
#2793 led to Transform manager reacquire pause time gui
#2758 led to a 1 pixel wide gaussian filter to the correlation image
#2691 led to insertion pause time. This is still not fully resolved Orius still sometimes not inserted after the pause.

With the issue with STEM installed Falcon image acquisition resolved in #2596 and the addition of frame saving for Falcon II #2681. This feature is now complete.

Actions #71

Updated by Anchi Cheng over 9 years ago

  • Target version set to Appion/Leginon 3.1.0
Actions

Also available in: Atom PDF