Project

General

Profile

Actions

Bug #4994

open

CTFdisplayTool error

Added by Gabriel Lander over 7 years ago. Updated over 7 years ago.

Status:
Assigned
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
05/31/2017
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 3.2
Show in known bugs:
No
Workaround:

Description

We get this error when we run CTFfind4.py on our K2 images. None of the previous stats & images are saved, we just have the output from CTFfind4.

==== Committing data to database ====
... Committing ctf parameters for 17may30d_021gr_02sq_01hl_02ed-a to database
... Reading image...
[CTF param] def1: 1.635 um | def2: 1.677 um | angle: 76.9 | ampcontr 0.07 | defratio 1.026
[CTF param] additional phase shift: 0.0 degrees
Final params: def1: 1.635 um | def2: 1.677 um | angle: 76.9 | defratio 1.03
... Defocus Astig Percent Diff 1.29 -- 1.635, 1.677 um
Computing power spectra in 2048x2048 blocks........
... Compute PSD with 8 subfields and fieldsize 2048 complete in 10.3 sec
!!! WARNING: Logging images failing CtfdisplayTool to /gpfs/group/em/appion/glander/17may30d/ctf/ctffind4runtest/failed_ctfdisplay_images.txt


Files

17may11c_00008gr_00002sq_00073hl_00002ex.orig.mrc (256 MB) 17may11c_00008gr_00002sq_00073hl_00002ex.orig.mrc Scott Stagg, 06/19/2017 02:50 PM
2d_ace.png (1.66 MB) 2d_ace.png Neil Voss, 06/20/2017 11:44 AM
1d_ace.png (296 KB) 1d_ace.png Neil Voss, 06/20/2017 11:44 AM

Related issues 1 (0 open1 closed)

Related to Appion - Bug #5044: as of last night can no longer create stack using myami/3.2Closed06/23/2017

Actions
Actions #1

Updated by Neil Voss over 7 years ago

I wonder if it is a out of memory error. Do all images fail or just some of them?

Actions #2

Updated by Gabriel Lander over 7 years ago

every image, on the CCD data too. Don't think it can be memory, we're running on the exact same systems as before, only change was the myami/trunk update.

Actions #3

Updated by Neil Voss over 7 years ago

Nothing has really changed in the apCtf folder (at least by me) since June 2016. Phase shifting does not work, or I have never tested it.

Actions #4

Updated by Gabriel Lander over 7 years ago

okay it's nothing with the code, it seems to have something to do with the python finagling we did to get the K2 webserver display stuff working. what a mess.

Actions #5

Updated by Scott Stagg over 7 years ago

I'm having this problem too. We just updated our Python, numpy, scipy. Can y'all post what versions of those things y'all have? Here's my stuff.
[sstagg@krios-0-1 ctffind4run4]$ python
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import scipy
scipy.__version__

'0.18.0'

import numpy
numpy.__version__

'1.12.0'

Actions #6

Updated by Neil Voss over 7 years ago

Scott, I think it may be a problem with matplotlib, but I don't know. These are my test environments:

CentOS 6 has:

scipy-0.7.2-8.el6.x86_64.rpm
numpy-1.4.1-9.el6.x86_64.rpm
python-matplotlib-0.99.1.2-1.el6.x86_64.rpm

CentOS 7 has:

numpy-1.7.1-11.el7.x86_64.rpm
scipy-0.12.1-3.el7.x86_64.rpm
python-matplotlib-1.2.0-15.el7.x86_64.rpm

Debian 8.8 has:

>>> numpy.__version__
'1.8.2'
>>> scipy.__version__
'0.14.0'
>>> matplotlib.__version__
'1.4.2'

Actions #7

Updated by Neil Voss over 7 years ago

Wow, your versions are quite new. I was going to test Debian 9 when it comes out next week, but I do not want to install from sources it gets messy too quick. Maybe there is a problem with the latest versions of the code, perhaps related to python3 compatibility.

Actions #8

Updated by Scott Stagg over 7 years ago

Ugh. Our HPC just updated to CentOS 7. I have matplotlib 1.2.0. If I posted an 8K image here, could you test it on one of your systems? I can downgrade in a virtualenv if we can figure out a set of libraries that work.

Actions #9

Updated by Neil Voss over 7 years ago

Hi Scott, yes I can test it on my CentOS 7 system. I have my docker setup that is pretty portable too.

Actions #11

Updated by Neil Voss over 7 years ago

  • Status changed from New to Assigned

Hi Scott, I need the Cs, pixel size, and voltage.

Actions #12

Updated by Scott Stagg over 7 years ago

Oh, yeah. 300 keV, 2.7 mm, 1.29 apix.

Updated by Neil Voss over 7 years ago

Worked for me. Using Docker installed CentOS 7 on my Mac Book Pro, numpy/scipy versions above:

uploadImages.py -n scott1 -d 'scott test image' -p 1 -C --mpix 1.29e-10 --mag=60000 --kv 300 \
 --cs 2.7 --image-dir=/emg/sw/myami/appion/scott/ --defocus=-1.6e-6 --type=normal

run 1:

Total execution time : 42 seconds
2017-06-20 15:27:29  : CTFFind finished cleanly.
...
Computing power spectra in 4096x4096 blocks.........
 ... Compute PSD with 16 subfields and fieldsize 4096 complete in 37.87 sec
Using 9 of 9 subfields in final power spectra
...
[CTF param] def1: 3.100 um | def2: 3.117 um | angle: 83.1 | ampcontr 0.07 | defratio 1.006
[CTF stats] conf_30-10: 0.928 | conf_5peak: 0.939 | res_0.8: 8.4A | res_0.5 6.7A

run 2:

Total execution time : 3 minutes and 25 seconds
2017-06-20 15:34:42  : CTFFind finished cleanly.
...
 ... Compute PSD with 16 subfields and fieldsize 4096 complete in 35.0 sec
Using 9 of 9 subfields in final power spectra
...
[CTF param] def1: 3.101 um | def2: 3.111 um | angle: -73.1 | ampcontr 0.07 | defratio 1.003
[CTF stats] conf_30-10: 0.928 | conf_5peak: 0.938 | res_0.8: 7.9A | res_0.5 6.7A

run 3: changed field size to 2048 to match Scott's situation

Total execution time : 3 minutes and 18 seconds
2017-06-20 15:40:33  : CTFFind finished cleanly.
...
Computing power spectra in 2048x2048 blocks.................................................
 ... Compute PSD with 64 subfields and fieldsize 2048 complete in 43.85 sec
Using 48 of 49 subfields in final power spectra
...
[CTF param] def1: 3.098 um | def2: 3.108 um | angle: -76.1 | ampcontr 0.07 | defratio 1.003
[CTF stats] conf_30-10: 0.984 | conf_5peak: 0.985 | res_0.8: 6.8A | res_0.5 6.6A

Scott are you using trunk or version 3.2?

Actions #14

Updated by Scott Stagg over 7 years ago

Trunk. I didn't update the field size, though. How did you do that?

Actions #15

Updated by Neil Voss over 7 years ago

We talked about this earlier, I thought:

appion/appionlib/apCtf/ctfpower.py, line 35:

old version:

twopowerint = int(math.floor(twopowerfloat))
fieldsize = 2**twopowerint

new version:

twopowerint = int(math.floor(twopowerfloat))-1
fieldsize = 2**twopowerint

alternative version:

twopowerint = 0 #override in next step
fieldsize = 2048

Actions #16

Updated by Scott Stagg over 7 years ago

Sorry, you told me about it, but I hadn't gotten around to trying it. I'll try it now, and see if that fixes it.

Actions #17

Updated by Scott Stagg over 7 years ago

Still didn't work. Any other suggestions? I just updated trunk, and I'm using python 2.7.5 and

scipy.__version__

'0.18.0'

numpy.__version__

'1.12.0'

matplotlib.__version__

'1.2.0'

... ctf estimation completed in 20.11 sec
 ... reading 17may11c_07gr_04sq_044hl_02ex-pow.txt
 ... reading MRC: 17may11c_07gr_04sq_044hl_02ex-pow.mrc size:(1024, 1024) dtype:float32
 ... writing JPEG: 17may11c_07gr_04sq_044hl_02ex-pow.jpg
 ==== Committing data to database ==== 
 ... Committing ctf parameters for 17may11c_07gr_04sq_044hl_02ex to database
 ... Reading image...
[CTF param] def1: 2.904 um | def2: 2.911 um | angle: -67.7 | ampcontr 0.07 | defratio 1.003
[CTF param]   additional phase shift: 0.0 degrees 
Final params: def1: 2.904 um | def2: 2.911 um | angle: -67.7 | defratio 1.00
 ... Defocus Astig Percent Diff 0.13 -- 2.904, 2.911 um
Computing power spectra in 2048x2048 blocks................................................
 ... Compute PSD with 48 subfields and fieldsize 2048 complete in 60.92 sec
!!! WARNING: Logging images failing CtfdisplayTool to /lustre/cryo/lustre/appiondata/17may11c/ctf/ctffind4run5/failed_ctfdisplay_images.txt
[CTF run]   method: unknown | runname ctffind4run5
[CTF param] def1: 2.904 um | def2: 2.911 um | angle: -67.7 | ampcontr 0.07 | defratio 1.003
[CTF param]   additional phase shift: 0.0 degrees 


Maybe you can suggest a way to get it to provide more info on the failure?
Actions #18

Updated by Neil Voss over 7 years ago

Anchi put it a grab all try/except, so we have to remove it to find the error.

appion/appionlib/apCtf/ctfinsert.py, line 109:

old

    try:
        ctfdisplaydict = ctfdisplay.makeCtfImages(imgdata, ctfvalues, fftpath, fftfreq)
    except:
        appendFailedImage(rundir, imgdata, ctfvalues,'makeCtfImages exception')
        return ctfvalues

move it out of the try and test

    ctfdisplaydict = ctfdisplay.makeCtfImages(imgdata, ctfvalues, fftpath, fftfreq)
    try:
        pass
    except:
        appendFailedImage(rundir, imgdata, ctfvalues,'makeCtfImages exception')
        return ctfvalues

Actions #19

Updated by Scott Stagg over 7 years ago

Traceback (most recent call last):
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/bin/ctffind4.py", line 451, in <module>
    imgLoop.run()
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/appionLoop2.py", line 95, in run
    self.loopCommitToDatabase(imgdata)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/appionLoop2.py", line 153, in loopCommitToDatabase
    return self.commitToDatabase(imgdata)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/bin/ctffind4.py", line 380, in commitToDatabase
    ctfinsert.validateAndInsertCTFData(imgdata, self.ctfvalues, self.ctfrun, self.params['rundir'])
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/ctfinsert.py", line 48, in validateAndInsertCTFData
    ctfvalues = runCTFdisplayTools(imgdata, ctfvalues, opimagedir, fftpath, fftfreq)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/ctfinsert.py", line 109, in runCTFdisplayTools
    ctfdisplaydict = ctfdisplay.makeCtfImages(imgdata, ctfvalues, fftpath, fftfreq)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/ctfdisplay.py", line 1616, in makeCtfImages
    ctfdisplaydict = a.CTFpowerspec(imgdata, ctfdata, fftpath, fftfreq, twod=twod)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/ctfdisplay.py", line 1480, in CTFpowerspec
    powerspec, self.trimfreq = self.powerSpectra(image, ctfdata)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/ctfdisplay.py", line 1385, in powerSpectra
    genctfspec = genctf.generateCTF2dFromCtfData(ctfdata, adjusted_apix, self.volts, fieldsize)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/genctf.py", line 150, in generateCTF2dFromCtfData
    return generateCTF2d(focus1, focus2, theta, shape, mpix, cs, volts, ampconst, extra_phase_shift)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/genctf.py", line 179, in generateCTF2d
    radiisq = generateRadial2d(shape, xfreq, yfreq)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/genctf.py", line 322, in generateRadial2d
    r = Radial(halfshape, xfreq, yfreq, center=False)
  File "/panfs/storage.local/imb/stagg/software/myamiss/appion/appionlib/apCtf/genctf.py", line 302, in __init__
    self.radial = numpy.fromfunction(self.distance, shape, dtype=numpy.float64)
  File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 2156, in fromfunction
    args = indices(shape, dtype=dtype)
  File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 2094, in indices
    res = empty((N,)+dimensions, dtype=dtype)
TypeError: 'numpy.float64' object cannot be interpreted as an index


I've seen this error with other matplotlib operations. I thought my HPC had downgraded numpy to fix it. I'll ping them and update if I get a solution.
Actions #20

Updated by Neil Voss over 7 years ago

It is an issue with numpy v1.12 or later. Looking into a fix.

Actions #21

Updated by Neil Voss over 7 years ago

Fixed. Stupid error when the shape dimensions are not integers, see commit commit:8ef4b475

# fix for numpy 1.12 or newer
shape = numpy.array(shape, dtype=numpy.uint16)
self.angular = numpy.fromfunction(self.arctan, shape, dtype=numpy.float64)
Actions #22

Updated by Scott Stagg over 7 years ago

That fixed it on my end.

Actions #23

Updated by Neil Voss about 7 years ago

  • Related to Bug #5044: as of last night can no longer create stack using myami/3.2 added
Actions

Also available in: Atom PDF