Commit 7f1dacfb authored by Pilar Cossio's avatar Pilar Cossio

Correction to Normalization

parent a6fe49c6
......@@ -433,6 +433,8 @@ int bioem_param::CalculateRefCTF()
delete[] CtfParam;
CtfParam = new myfloat3_t[getCtfParamCount()];
myfloat_t normctf;
for (int iamp = 0; iamp < numberGridPointsCTF_amp ; iamp++) //Loop over amplitud
{
amp = (myfloat_t) iamp * gridCTF_amp + startGridCTF_amp;
......@@ -447,13 +449,26 @@ int bioem_param::CalculateRefCTF()
memset(localCTF, 0, param_device.NumberPixels * param_device.NumberPixels * sizeof(myfloat_t));
normctf = 0.0;
for(int i = 0; i < nctfmax; i++)
{
for(int j = 0; j < nctfmax; j++)
{
radsq = (myfloat_t) (i * i + j * j) * pixelSize * pixelSize;
ctf = exp(-radsq * env / 2.0) * (amp * cos(radsq * phase / 2.0) - sqrt((1 - amp * amp)) * sin(radsq * phase / 2.0)) ;
normctf += 4.0 * (myfloat_t) ctf ;
}
}
//Assigning CTF values
for(int i = 0; i < nctfmax; i++)
{
for(int j = 0; j < nctfmax; j++)
{
radsq = (myfloat_t) (i * i + j * j) * pixelSize * pixelSize;
ctf = exp(-radsq * env / 2.0) * (amp * cos(radsq * phase / 2.0) - sqrt((1 - amp * amp)) * sin(radsq * phase / 2.0));
ctf = exp(-radsq * env / 2.0) * (amp * cos(radsq * phase / 2.0) - sqrt((1 - amp * amp)) * sin(radsq * phase / 2.0)) / normctf ;
localCTF[i * param_device.NumberPixels + j] = (myfloat_t) ctf;
localCTF[i * param_device.NumberPixels + param_device.NumberPixels - j - 1] = (myfloat_t) ctf;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment