CTFFIND4 with --amplitude_spectrum_input --filtered_amplitude_spectrum_input

Hi all,

I am trying to use CTFFind 4.0.16 where I provide the input Fourier amplitudes (with background subtraction already performed). However there is some bug that renders the input into garbage and so the fitting fails.

The command line is as follows:

ctffind --amplitude_spectrum_input --filtered_amplitude_spectrum_input << STOP_PARSING
CTF4Input_cb580c2647bb8a66.mrc
CTF4Result_cb580c2647bb8a66.mrc
1.326
300.0
2.7
0.1
512
50.0
4.0
5000.0
35000.0
500.0
100.0
no
STOP_PARSING

Here is the input that I pass in as an MRC file (as float32):

https://drive.google.com/file/d/0B23Il6NoQDNZQnV0cmZON0hiczg/view?usp=s…

Looking at image_headers.f90 I am using the same mode=2 flag to write the file.

and just to illustrate, here is the rotational average of the input:

https://drive.google.com/file/d/0B23Il6NoQDNZTlYyNGpqMVBTd2s/view?usp=s…

Here is the diagnostic output MRC file:

https://drive.google.com/file/d/0B23Il6NoQDNZajFtYTNrcXI1VXM/view?usp=s…

As you can see, the underlying data is nothing like the input. Looking through ctffind.f90 I don't really see what might cause this. There is one code block starting at line 457:

if (amplitude_spectrum_input .or. filtered_amplitude_spectrum_input) then
call current_power_spectrum%ReadFromDisk(input_file,current_micrograph_number)
call current_power_spectrum%ForwardFFT()
call average_spectrum%Allocate(dims=[box_size%value,box_size%value,1],in_real_space=.false.)
call current_power_spectrum%ClipInto(average_spectrum)
call average_spectrum%BackwardFFT()
else

This is resizing the input image I think, although they are both 512x512 in this case, so the code should not have any effect aside from wasting a few CPU cycles.

Can I turn on debug mode without re-compiling the code?

Robert McLeod
robert.mcleod@unibas.ch

Robert,
I've started looking into this, but it may take me a while to get to the bottom of this as I am out of the office for the next few weeks.
Regarding debug mode - this is something that requires recompilation. You should be able to build ctffind4 using recent versions of gfortran.
Thanks for the bug report - I'll update this thread with any progress.
Alexis

Hi Robert,

Well it took me a while, but I figured it out...
The command line options are --amplitude-spectrum-input and --filtered-amplitude-spectrum-input, not with underscores like you had them. So your command line options were being ignored by ctffind and the input image was being processed as though it were a normal micrograph.

Was this a simple typo on your part, or did you see those command line options with underscores somewhere in the documentation perhaps? If so I'll need to fix that.

Hope this fixes it for you as well
Alexis

In reply to by Alexis

Alexis,
Related to this new input option, do you know any tools other than 'PW'(SPIDER) that calculate the amplitude spectrum of an image?
According to the documentation, CTFFind4 uses amplitude to fit the CTF model, while CTFFind3 uses intensity. Does amplitude-based fitting have any advantages? Does the amplitude value oscillate between plus and minus signs?

In reply to by s.wu

I'm sure every package has an implementation of this. Imagic certainly does, and I'm sure EMAN also. You may have to compute the power and then take the square root, I guess...

In CTFFIND4, I switched to using amplitudes rather than power because I noticed that the extra squaring (to go from amplitude to power) led image artefacts (strong features in the FT) to be amplified relative to the signal and occasionally cause problems.

Amplitudes are always positive by definition (sqrt(real^2+imaginary^2))

In reply to by Alexis

Yes this was my error I think, thanks. I would suggest changing the logic there to if ... else if ... else where else prints out the argument if it's not recognized.

As for ifort, we have that on our cluster apparently, so if I need to recompile it I will do it there. I tried getting g95 working because it is remotely competitive speed-wise to ifort but didn't have a lot of luck.