Leginon cannot locate bright/dark references
Added by Rui Zhang almost 12 years ago
Hi, we have problem finding the bright/dark references in Leginon (database?). We can see the reference image right after collecting new bright/dark references under "Correction" node. However, if we click the "Display Normalization Image" for Channel 0 or 1, we get this error message (see attachment). And when we try to take an image in Navigation node, it says "Cannot find references, image will not be normalized".
B.T.W. our setting is titan microscope and K2 camera.
Any suggestion is greatly appreciated !
correction.png (63.7 KB) correction.png | 1 | ||
correction.png (63.7 KB) correction.png |
Replies (3)
RE: Leginon cannot locate bright/dark references - Added by Anchi Cheng almost 12 years ago
It may be a problem of matching what the database says the file is and what the file system need the file path to be. As we have said before, no one used Windows PC as the main Leginon computer for a long time. It may just not work any more. You really want to run Leginon on Windows?
You will need to do some test to find out if the path is translated right. Also first check where the files are really saved to.
reference files will be saved in a special session with name like 13feb14_ref_a
Run this python script. Get help on running python script if you need to:
#!/usr/bin/env python import os from leginon import leginondata cam = leginondata.InstrumentData(name='GatanK2Counting').query(results=1)[0] camem = leginondata.CameraEMData(ccdcamera=cam) refpath = None norm = leginondata.NormImageData(camera=camem).query(results=1) if norm: # If norm image is indeed saved as a database entry, then database would know where it is saved refpath = norm[0]['session']['image path'] print 'norm image path', refpath print 'file can be found', os.path.isfile(os.path.join(refpath,norm[0]['filename']+'.mrc')) else: print 'norm image never saved in the database. Looking for bright...' bright = leginondata.BrightImageData(camera=camem).query(results=1) if bright: refpath = bright[0]['session']['image path'] print 'bright image path', refpath print 'file can be found', os.path.isfile(os.path.join(refpath,bright[0]['filename']+'.mrc')) else: print 'No reference ever saved'
RE: Leginon cannot locate bright/dark references - Added by Tom Houweling almost 12 years ago
We ran the script on our Windows installation and it did not find the reference mrcs.
The issue is that the path is not constructed correctly on Windows due to the "Drive Mapping".
Examining the leginon code I modified the script tno a universally working version by include the mapping functions:
#!/usr/bin/env python import os import sys from leginon import leginondata import leginon.leginonconfig cam = leginondata.InstrumentData(name='GatanK2Counting').query(results=1)[0] camem = leginondata.CameraEMData(ccdcamera=cam) print 'platform is ',sys.platform refpath = None norm = leginondata.NormImageData(camera=camem).query(results=1) if norm: # If norm image is indeed saved as a database entry, then database would know where it is saved refpath = norm[0]['session']['image path'] print 'norm image path', refpath print 'norm image win path',leginon.leginonconfig.mapPath(refpath) print 'file can be found', os.path.isfile(os.path.join(leginon.leginonconfig.mapPath(refpath),norm[0]['filename']+'.mrc').replace('\\','/')) else: print 'norm image never saved in the database. Looking for bright...' bright = leginondata.BrightImageData(camera=camem).query(results=1) if bright: refpath = bright[0]['session']['image path'] print 'bright image path', refpath print 'file can be found', os.path.isfile(os.path.join(leginon.leginonconfig.mapPath(refpath),bright[0]['filename']+'.mrc').replace('\\','/')) else: print 'No reference ever saved'
This revised version does find the reference files.
I think that the leginon.leginonconfig.mapPath(path)
was omitted at a few places in the leginon code and this was not noticed as it does nothing when running on Unix.
RE: Leginon cannot locate bright/dark references - Added by Anchi Cheng almost 12 years ago
I found an old implementation that might help:
If you add the drive mapping in sinedon.cfg on the Windows PC like this, it will map the path of the files when it needs to read a file through file reference.
[Windows Drives]
z: /your linux equivalent path
This will not change the path print from my test script but should allow the image to be read by Leginon on Windows. Give it a try.