leginon-org / leginon-redmine-archive

1 stars 0 forks source link

ctffind4 hard to control defocus range #3547

Open leginonbot opened 8 months ago

leginonbot commented 8 months ago

Author Name: William Rice (@wjrice) Original Redmine Issue: 3547, https://emg.nysbc.org/redmine/issues/3547 Original Date: 2015-09-10 Original Assignee: Anchi Cheng


Ctffind4 seems unable to find the right defocus if it is far from the "nominal" defocus. I tried adding a large range (100 steps of 0.1 um) but this had is search a very small range.

From the log: Starting image 1 ( skip:0, remain:50 ) id:294181, file: 15sep01d_02en-a ... Pixel size: 1.47 [CTF run] method: unknown | runname ctffind4run2 [CTF param] def1: 1.93e-06 | def2: 1.95e-06 | angle: 48.5 | ampcontr 0.07 | defratio 1.011 [CTF stats] conf_30-10: -0.07 | conf_5peak: 0.007 | res_0.8: 100.0A | res_0.5 100.0A Defocus search range: 19276 A to 19296 A (1.93 to 1.93 um) ... running ctf estimation at Thu Sep 10 07:48:42 2015 input = 15sep01d_02en-a.mrc output = 15sep01d_02en-a-pow.mrc apix = 1.47 kv = 200.0 cs = 2.0 ampcontrast = 0.07 fieldsize = 1024 resmin = 50.0 resmax = 7.0 defmin = 19276.6 defmax = 19296.6 defstep = 1000.0 expect_astig = 500.0 phase = no newline =

leginonbot commented 8 months ago

Original Redmine Comment Author Name: William Rice (@wjrice) Original Date: 2015-09-10T11:54:30Z


sample sessions over carbon to check: 15sep01d - yACOB gOMEZ HOLDER TEST 15sep09k - test drift after OL flow adjustment and zeolite cycle

leginonbot commented 8 months ago

Original Redmine Comment Author Name: Anchi Cheng (@anchi2c) Original Date: 2015-09-10T14:49:59Z


Defocus input to ctffind4 is in angstroms. Fixed in r19140

leginonbot commented 8 months ago

Original Redmine Comment Author Name: William Rice (@wjrice) Original Date: 2015-09-10T15:03:37Z


Program seems to want defocus step in um. Entering 1000 as the step results in following error:

... Committing data to database Traceback (most recent call last): File "/opt/myamisnap/bin/ctffind4.py", line 325, in
imgLoop = ctfEstimateLoop() File "/opt/myamisnap/lib/appionlib/appionLoop2.py", line 27, in init appionScript.AppionScript.init(self) File "/opt/myamisnap/lib/appionlib/appionScript.py", line 83, in init self.checkConflicts() File "/opt/myamisnap/bin/ctffind4.py", line 63, in checkConflicts apDisplay.printError("Please keep the defstep between 0.0001 & 2 microns") File "/opt/myamisnap/lib/appionlib/apDisplay.py", line 65, in printError raise Exception, colorString("\n FATAL ERROR \n"+text+"\n\a","red") Exception:
FATAL ERROR Please keep the defstep between 0.0001 & 2 microns

leginonbot commented 8 months ago

Original Redmine Comment Author Name: Anchi Cheng (@anchi2c) Original Date: 2015-09-10T15:47:43Z


Bill,

Sorry, I meant that in the code the gui value was supposed to convert to Angstrom before it calculates the range to input to ctffind4 program but the old code did not do that, which is why it gave tiny range when you put in the proper value in micron in gui.

The change will become live tomorrow.

leginonbot commented 8 months ago

Original Redmine Comment Author Name: William Rice (@wjrice) Original Date: 2015-09-14T00:26:48Z


Ctffind4 still seems to fail when actual defocus is far from nominal. It seems to convert properly from um to the expected A (see log below) but defocus it found is obviously wrong (see attached screenshot). Looking at the logs it seems to often have strange values for resmax (here 37A; should be 6 as entered) and expected astig (here 83.7; should be 300 as entered)

Defocus search range: 1000 A to 59408 A (0.10 to 5.94 um) ... running ctf estimation at Sun Sep 13 20:10:05 2015 input = 15sep09k_013sq_01hl_04en-a.mrc output = 15sep09k_013sq_01hl_04en-a-pow.mrc apix = 1.47 kv = 200.0 cs = 2.0 ampcontrast = 0.07 fieldsize = 1024 resmin = 50.0 resmax = 37.03 defmin = 1000.0 defmax = 59408.9 defstep = 1000.0 expect_astig = 83.7 phase = no newline =

/usr/local/bin/ctffind4 15sep09k_013sq_01hl_04en-a.mrc 15sep09k_013sq_01hl_04en-a-pow.mrc 1.47 200.0 2.0 0.07 1024 50.0 37.03 1000.0 59408.9 1000.0 83.7 no

leginonbot commented 8 months ago

Original Redmine Comment Author Name: Neil Voss (@vosslab) Original Date: 2015-09-14T13:47:37Z


ResMax and astig are auto-assigned if using 'Use best values from Database' is checked to help get a better fit. If you want only you value uncheck the box. For some reason the pop up help is not working the CTFFIND4 page, but it does specify as such on the CTFFIND3 page.

I forgot to include user resmax, so should be better now, so we should have a smarter resmax setting in r19149.

      if ctfvalue is not None and self.params['bestdb'] is True:
         ### set res max from resolution_80_percent
         gmean = (ctfvalue['resolution_80_percent']*ctfvalue['resolution_50_percent']*self.params['resmin'])**(1/3.)
         if gmean < self.params['resmin']:
            # replace only if valid Issue #3291
            self.params['resmax'] = round(gmean,2)
            apDisplay.printColor("Setting resmax to the geometric mean of resolution values", "purple")
leginonbot commented 8 months ago

Original Redmine Comment Author Name: Anchi Cheng (@anchi2c) Original Date: 2015-09-15T15:48:06Z


The code change in ctfestimate.py probably has wrong indentation. gmean is not defined if self.params['bestdb'] is False. Therefore if gmean < self.params['resmin'] will crash the program.

leginonbot commented 8 months ago

Original Redmine Comment Author Name: Anchi Cheng (@anchi2c) Original Date: 2015-09-15T16:07:57Z


Also, resmin is at very low resolution, so why replace resmax with a value that depends on it ?

leginonbot commented 8 months ago

Original Redmine Comment Author Name: Neil Voss (@vosslab) Original Date: 2015-09-15T19:43:05Z


Thanks for checking Anchi, should be better now.