Leginon installation routine

To cover it all, I think I miss to speak about LeginonLeginon is a system designed for automated collection of images from a transmission electron microscope. Yes, I quote. Now the truth. It’s ideal to collect automatically images from a microscope, and see them in your browser. The entitled user is on the average very happy with the system: you don’t need to sit on a dark place and wait until your grid has been deployed of points of interest. Instead, you check a little what is visible, that is, that your sample is really worthing it, mark a ROI, and start leginon. So far so good.

Unfortunately it comes with some practical issues.

First of all, the leginon server and the leginon clients (the microscope PC and the camera PC) need to be in the same network. They need to see “each other” by name, and that has been proven to be not so easy. Yes, I know, it’s easy to give an IP on the same range. It’s not easy when you don’t control the IP the computer gets, since it’s assigned by a DNS and DHCP beyond your control. And it’s not easy if the computer doesn’t connect with the IP you want whenever you want. Unfortunately, we have all the time these problems where I am.

Second, the leginon software, as a foreign software that takes over the functions of the microscope, is not seen with good eyes by the Customer Support (CS). So be aware that if you “break” something while installing leginon, you may get into troubles. There is no easy solution for this issue, but to be careful. For example, I screwed up the TEM server on the microscope PC by installing leginon. Fortunately, there was a technician around, and he’s a reasonable person, so he helped us out to bring back the system (Windows 2000) to a working state. His comment about was that the new network connection was interfering with the microscope network. And I have no idea about how that can happen, but it happens.

So my advice in this sense: be sure you have a working backup system before you start. Now our procedure. We downloaded all the necessary python packages and put them in a memory stick. The memory stick will be our software source.

1) Copy your repository, software.W32 to Windows local hard drive

2) From that folder, install, in order, accepting defaults
– Python-2.7.3.msi
– wxPython2.8-win23
– MySQL-python-1.2.4b-win32
– PIL-1.1.7.win32
– numpy-1.7.0-win32
– scipy-0.11.0-win32

3) Copy myami-3.2 (or get it from SVN tortoise) to local hard drive. We will install it later

4) Adjust all the necessary host files on Windows and Linux computers
– Linux: vi /etc/hosts, add the IP addresses and hostnames, service network restart
– Windows: Open Notepad as Administrator, Open C:\Windows\System32\drivers\etc\
File name (select all files to the right) hosts

5) Install numextension from software.W32, accepting defaults
– numextension-svn.win32

6) Install myami packages. Open a command prompt on the Windows PC, and do the next:

cd myami-3.2\leginon
c:\Python27\python.exe setup.py install
cd ..\pyami\
c:\Python27\python.exe setup.py install
cd ..\sinedon\
c:\Python27\python.exe setup.py install
cd ..\pyscope\
c:\Python27\python.exe setup.py install
cd ..\imageviewer
c:\Python27\python.exe setup.py install

7) Install comtypes, adjust the default one
– comptypes-0.6.2.win32.exe
cd C:\myami-3.2\pyscope\
copy and replace safearray.py, test that it gives you no error by importing it on a python prompt.
cp C:\myami-3.2\pyscope\safearray.py C:\Python27\Lib\site-packages\comtypes\safearray.py
>> import comtypes

8) Run CheckCom
cd C:\Python27\Lib\site-packages\pyscope\
C:\Python27\python.exe checkcom.py
—> errors in our case, but that doesn’t seem to bother so much.

9) Install DM plugins
—> skipped

10) Check configuration
cd C:\Python27\Lib\site-packages\leginon\
–> fixed the conflict by copying c.ProgramFiles.myami configuration .cfg files

11) Test that we can access to database
>> import MySQLdb
>> db = MySQLdb.connect(host=”leginon-server”, user=”usr_object”, passwd=”youknowit”)
–> OK (you must get a clean >> prompt)

12) Test launcher.py
–> OK (no serious errors displayed)

13) modify .cfg files

  • sinedon.cfg  copy to C:\Python27\Lib\site-packages\sinedon
  • modify: host: leginon-server, usr_object pwd – youknowit
  • leginon.cfg copy to C:\Python27\Lib\site-packages\leginon
  • modify: nothing for now
  • instruments.cfg copy to C:\Python27\Lib\site-packages\pyscope
  • modify according to camera and scope. For example:
class: gatan.Gatan
zplane: 50
height: 4096
width: 4096

class: tecnai.Tecnai
cs: 2.0e-3

After that, you should be ready to go. Just to be sure, run start-leginon.py on the command prompt (instead of with the script) and configcheck.py, to know where do you have all the configuration files. I hope this helped!


About bitsanddragons

A traveller, an IT professional and a casual writer
This entry was posted in bits, EM, leginon, linux, mysql, python, windows. Bookmark the permalink.

One Response to Leginon installation routine

  1. Pingback: Python test we can connect to MySQL db | Bits and Dragons

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s