51 groupbyLabels.clear();
91 if (
XX(freq)>=0 &&
XX(freq)<0.5)
129 double iTm=1.0/CTF1.
Tm;
150 for (
int i=0;
i<(int)yDim; ++
i)
154 for (
int j=0;
j<(int)xDim; ++
j)
159 if (_freq < minFreq || _freq > maxFreq)
177 img1.
write(
"/tmp/img1.spi");
178 img2.
write(
"/tmp/img2.spi");
179 img3.
write(
"/tmp/img3.spi");
200 std::cerr <<
"DEBUG_ROB: CTF1.DeltaU: " << CTF1.
DeltafU << std::endl;
201 std::cerr <<
"DEBUG_ROB: CTF1.DeltaV: " << CTF1.
DeltafV << std::endl;
202 std::cerr <<
"DEBUG_ROB: var: " << phaseRad/(CTF1.
K1*
abs(CTF1.
DeltafU - CTF1.
DeltafV)) << std::endl;
234 double iTm=1.0/CTF1.
Tm;
261 for (
int i=0;
i<(int)yDim; ++
i)
265 for (
int j=0;
j<(int)xDim; ++
j)
275 if (fabs(b-a) < phaseRad)
291 double areaLessHalfPIPixels = counter;
292 double totalArePixels =
PI*Xdim*Xdim/4.0;
293 double maxFreqA = 1./(2.*CTF1.
Tm);
294 double resolutionA_1 = 0;
295 if (areaLessHalfPIPixels > totalArePixels)
296 resolutionA_1 = maxFreqA;
298 resolutionA_1 = areaLessHalfPIPixels * maxFreqA / totalArePixels;
299 double resolutionA = 1./ resolutionA_1;
306 aux.
write(
"/tmp/arg1.spi");
308 aux.
write(
"/tmp/arg2.spi");
310 aux.
write(
"/tmp/argDiff.spi");
312 aux.
write(
"/tmp/ctf1.spi");
314 aux.
write(
"/tmp/ctf2.spi");
316 aux.
write(
"/tmp/ctfMDiff.spi");
318 std::cerr <<
"DEBUG_ROB: counter: " << counter << std::endl;
319 std::cerr <<
"DEBUG_ROB: counterAux: " << counterAux << std::endl;
320 std::cerr <<
"DEBUG_ROB: res in pixels: " <<
sqrt (counter/
PI) << std::endl;
322 std::cerr <<
"DEBUG_ROB: resolutionA_1: " << resolutionA_1 << std::endl;
323 std::cerr <<
"DEBUG_ROB: resolutionA: " << resolutionA << std::endl;
350 if (
XX(freq)>=0 &&
XX(freq)<0.5)
393 ctfparam.
read(fnctf);
397 if (
K == 0 && disable_if_not_K)
423 std::unique_ptr<const MDRow> row = md.
getRow(
id);
499 program->
addParamsLine(
" [--ctf_similar_to++ <ctfFile>] : ctfparam file");
501 program->
addParamsLine(
" : overriden by the parameters in the command line");
502 program->
addParamsLine(
" [--sampling_rate <Tm>] : Angstroms/pixel. Ex: 1.4");
503 program->
addParamsLine(
" : This parameter is compulsory if a CTF is needed.");
504 program->
addParamsLine(
" [--voltage <kV>] : Accelerating voltage (kV). Ex: 200");
505 program->
addParamsLine(
" : This parameter is compulsory if a CTF is needed.");
507 program->
addParamsLine(
" [--spherical_aberration <Cs>] : Milimiters. Ex: 5.6");
508 program->
addParamsLine(
" : This parameter is compulsory if a CTF is needed.");
510 program->
addParamsLine(
" [--defocusU <Defocus>] : Defocus in Angstroms (Ex: 2000)");
511 program->
addParamsLine(
" [--chromatic_aberration++ <Ca=0>] : Milimiters. Ex: 2");
512 program->
addParamsLine(
" [--energy_loss++ <espr=0>] : eV. Ex: 1");
513 program->
addParamsLine(
" [--lens_stability++ <ispr=0>] : ppm. Ex: 1");
514 program->
addParamsLine(
" [--convergence_cone++ <alpha=0>] : mrad. Ex: 0.5");
515 program->
addParamsLine(
" [--longitudinal_displace++ <DeltaF=0>]: Angstrom. Ex: 100");
516 program->
addParamsLine(
" [--transversal_displace++ <DeltaR=0>] : Angstrom. Ex: 3");
517 program->
addParamsLine(
" [--Q0++ <Q0=0>] : Percentage of cosine (Q0>0)");
519 program->
addParamsLine(
" [--phase_shift++ <phase_shift>] : VPP phase shift");
520 program->
addParamsLine(
" [--VPP_radius++ <VPP_radius>] : phase plate radius");
537 if (program->
checkParam(
"--spherical_aberration"))
569 <<
"sampling_rate= " << ctf.
Tm << std::endl
570 <<
"voltage= " << ctf.
kV << std::endl
571 <<
"defocusU= " << ctf.
Defocus << std::endl
572 <<
"spherical_aberration= " << ctf.
Cs << std::endl
573 <<
"chromatic_aberration= " << ctf.
Ca << std::endl
574 <<
"energy_loss= " << ctf.
espr << std::endl
575 <<
"lens_stability= " << ctf.
ispr << std::endl
576 <<
"convergence_cone= " << ctf.
alpha << std::endl
577 <<
"longitudinal_displace=" << ctf.
DeltaF << std::endl
578 <<
"transversal_displace= " << ctf.
DeltaR << std::endl
579 <<
"envR0= " << ctf.
envR0 << std::endl
580 <<
"envR1= " << ctf.
envR1 << std::endl
581 <<
"envR2= " << ctf.
envR2 << std::endl
582 <<
"Q0= " << ctf.
Q0 << std::endl
583 <<
"K= " << ctf.
K << std::endl
589 <<
"gaussian_K= " << ctf.
gaussian_K << std::endl
590 <<
"sigma1= " << ctf.
sigma1 << std::endl
591 <<
"Gc1= " << ctf.
Gc1 << std::endl
592 <<
"sqrt_K= " << ctf.
sqrt_K << std::endl
593 <<
"sq= " << ctf.
sq << std::endl
594 <<
"bg1= " << ctf.
bgR1 << std::endl
595 <<
"bg2= " << ctf.
bgR2 << std::endl
596 <<
"bg3= " << ctf.
bgR3 << std::endl
597 <<
"base_line= " << ctf.
base_line << std::endl
599 <<
"sigma2= " << ctf.
sigma2 << std::endl
600 <<
"Gc2= " << ctf.
Gc2 << std::endl
602 <<
"VPP_radius= " << ctf.
VPP_radius << std::endl
648 double local_Cs =
Cs * 1e7;
649 double local_Ca =
Ca * 1e7;
650 double local_kV =
kV * 1e3;
651 double local_ispr =
ispr * 1e6;
653 lambda=12.2643247/
sqrt(local_kV*(1.+0.978466e-6*local_kV));
660 K2 =
PI / 2 * local_Cs * lambda * lambda *
lambda;
673 K3 = pow(0.25 *
PI * local_Ca * lambda * (
espr /
kV + 2 * local_ispr), 2) /
log(2.0);
703 double wmax = 1 / (2 *
Tm);
704 double wstep = wmax / 300;
720 if (
SGN(ctf) !=
SGN(last_ctf))
777 std::cout << n <<
" zero: w=" << w <<
" (" << wmax <<
") freq=" 779 <<
" last_ctf=" << last_ctf <<
" ctf=" << ctf <<
" ";
785 w += ctf * wstep / (last_ctf - ctf);
793 std::cout <<
" final w= " << w <<
" final freq=" << freq.
transpose() << std::endl;
804 if (
ZSIZE(FFTI) > 1 )
836 if (
ZSIZE(FFTI) > 1 )
866 double step = fmax / nsamples;
874 for (i = 0, f = 0; i <
YSIZE(profiles); i++, f += step)
897 double step = fmax / nsamples;
900 for (
int angle=0; angle < 360; angle++)
902 double angle2 = float(angle);
903 double cosinus = cos(angle2);
906 for (i = 0, f = 0; i <
YSIZE(profiles); i++, f += step)
908 double fx = f * cosinus;
937 kV >= 50 &&
kV <= 1000 &&
940 Cs >= 0 &&
Cs <= 20 &&
941 Ca >= 0 &&
Ca <= 7 &&
945 Q0 >= 0 &&
Q0 <= 0.40 &&
951 std::cout << *
this << std::endl;
952 std::cout <<
"K>=0 && base_line>=0 " << (
K >= 0 &&
base_line >= 0) << std::endl
953 <<
"kV>=50 && kV<=1000 " << (
kV >= 50 &&
kV <= 1000) << std::endl
954 <<
"espr>=0 && espr<=20 " << (
espr >= 0 && espr <= 20) << std::endl
955 <<
"ispr>=0 && ispr<=20 " << (
ispr >= 0 &&
ispr <= 20) << std::endl
956 <<
"Cs>=0 && Cs<=20 " << (
Cs >= 0 && Cs <= 20) << std::endl
957 <<
"Ca>=0 && Ca<=3 " << (
Ca >= 0 &&
Ca <= 3) << std::endl
958 <<
"alpha>=0 && alpha<=5 " << (
alpha >= 0 && alpha <= 5) << std::endl
959 <<
"DeltaF>=0 && DeltaF<=1000 " << (
DeltaF >= 0 &&
DeltaF <= 1000) << std::endl
960 <<
"DeltaR>=0 && DeltaR<=100 " << (
DeltaR >= 0 && DeltaR <= 100) << std::endl
961 <<
"Q0>=0 && Q0<=0.4 " << (
Q0 >= 0 &&
Q0 <= 0.4) << std::endl
962 <<
"Defocus>=0 " << (DeltafU >= 0 << std::endl
963 <<
"getValueAt(0,0)>=0 " << (
getValueAt() >= 0) << std::endl
965 std::cout <<
"getValueAt(0,0)=" <<
getValueAt(
true) << std::endl;
995 retval2 = retval2 &&
sigma1 / min_sigma <= 3;
997 retval2 = retval2 && Gc1 / min_c <= 3;
999 retval2 = retval2 && (Gc1 *
Tm >= 0.01);
1001 retval2 = retval2 &&
sigma2 / min_sigma2 <= 3;
1003 retval2 = retval2 && Gc2 / min_c2 <= 3;
1005 retval2 = retval2 && (Gc2 * Tm >= 0.01);
1009 if (retval2 ==
false)
1011 std::cout << *
this << std::endl;
1012 std::cout <<
"base_line>=0 && " << (
base_line >= 0) << std::endl
1013 <<
"gaussian_K>=0 && " << (
gaussian_K >= 0) << std::endl
1014 <<
"sigmaU>=0 && sigmaV>=0 " << (sigmaU >= 0 && sigmaV >= 0) << std::endl
1015 <<
"sigmaU<=100e3 && sigmaV<=100e3 " << (sigmaU <= 100e3 && sigmaV <= 100e3) << std::endl
1016 <<
"cU>=0 && cV>=0 " << (cU >= 0 && cV >= 0) << std::endl
1017 <<
"sqU>=0 && sqV>=0 " << (sqU >= 0 && sqV >= 0) << std::endl
1018 <<
"sqrt_K>=0 && " << (
sqrt_K >= 0) << std::endl
1019 <<
"gaussian_K2>=0 && " << (
gaussian_K2 >= 0) << std::endl
1020 <<
"sigmaU2>=0 && sigmaV2>=0 " << (sigmaU2 >= 0 && sigmaV2 >= 0) << std::endl
1021 <<
"sigmaU2<=100e3 && sigmaV2<=100e3 " << (sigmaU2 <= 100e3 && sigmaV2 <= 100e3) << std::endl
1022 <<
"cU2>=0 && cV2>=0 " << (cU2 >= 0 && cV2 >= 0) << std::endl
1023 <<
"gaussian_angle>=0 && gaussian_angle<=90 " << (gaussian_angle >= 0 && gaussian_angle <= 90) << std::endl
1024 <<
"sqrt_angle>=0 && sqrt_angle<=90 " << (sqrt_angle >= 0 && sqrt_angle <= 90) << std::endl
1025 <<
"gaussian_angle2>=0 && gaussian_angle2<=90 " << (gaussian_angle2 >= 0 && gaussian_angle2 <= 90) << std::endl
1028 std::cout <<
"ABS(sigmaU-sigmaV)/min_sigma<=3 " << (
ABS(sigmaU - sigmaV) / min_sigma <= 3) << std::endl;
1030 std::cout <<
"ABS(cU-cV)/min_c<=3 " << (
ABS(cU - cV) / min_c <= 3) << std::endl;
1032 std::cout <<
"(cU*Tm>=0.01) && (cV*Tm>=0.01) " << ((cU*Tm >= 0.01) && (cV*Tm >= 0.01)) << std::endl;
1034 std::cout <<
"ABS(sigmaU2-sigmaV2)/min_sigma2<=3 " << (
ABS(sigmaU2 - sigmaV2) / min_sigma2 <= 3) << std::endl;
1036 std::cout <<
"ABS(cU2-cV2)/min_c2<=3 " << (
ABS(cU2 - cV2) / min_c2 <= 3) << std::endl;
1038 std::cout <<
"(cU2*Tm>=0.01) && (cV2*Tm>=0.01) " << ((cU2*Tm >= 0.01) && (cV2*Tm >= 0.01)) << std::endl;
1039 std::cout << cV2*Tm << std::endl;
1050 return retval && retval2;
1132 if (
sigma1 / min_sigma > 3)
1137 if (
Gc1 / min_c > 3)
1147 if (
sigma2 / min_sigma2 > 3)
1152 if (
Gc2 / min_c2 > 3)
1191 ctfparam.
read(fnctf);
1216 std::unique_ptr<const MDRow> row = md.
getRow(
id);
1291 program->
addParamsLine(
" [--defocusV++ <DeltafV>] : If astigmatic");
1292 program->
addParamsLine(
" [--azimuthal_angle++ <ang=0>] : Angle between X and U (degrees)");
1315 <<
"sampling_rate= " << ctf.
Tm << std::endl
1316 <<
"voltage= " << ctf.
kV << std::endl
1317 <<
"defocusU= " << ctf.
DeltafU << std::endl
1318 <<
"defocusV= " << ctf.
DeltafV << std::endl
1320 <<
"spherical_aberration= " << ctf.
Cs << std::endl
1321 <<
"chromatic_aberration= " << ctf.
Ca << std::endl
1322 <<
"energy_loss= " << ctf.
espr << std::endl
1323 <<
"lens_stability= " << ctf.
ispr << std::endl
1324 <<
"convergence_cone= " << ctf.
alpha << std::endl
1325 <<
"longitudinal_displace=" << ctf.
DeltaF << std::endl
1326 <<
"transversal_displace= " << ctf.
DeltaR << std::endl
1327 <<
"envR0= " << ctf.
envR0 << std::endl
1328 <<
"envR1= " << ctf.
envR1 << std::endl
1329 <<
"envR2= " << ctf.
envR2 << std::endl
1330 <<
"Q0= " << ctf.
Q0 << std::endl
1331 <<
"K= " << ctf.
K << std::endl
1337 <<
"gaussian_K= " << ctf.
gaussian_K << std::endl
1338 <<
"sigmaU= " << ctf.
sigmaU << std::endl
1339 <<
"sigmaV= " << ctf.
sigmaV << std::endl
1340 <<
"cU= " << ctf.
cU << std::endl
1341 <<
"cV= " << ctf.
cV << std::endl
1343 <<
"sqrt_K= " << ctf.
sqrt_K << std::endl
1344 <<
"sqU= " << ctf.
sqU << std::endl
1345 <<
"sqV= " << ctf.
sqV << std::endl
1346 <<
"sqrt_angle= " << ctf.
sqrt_angle << std::endl
1347 <<
"bg1= " << ctf.
bgR1 << std::endl
1348 <<
"bg2= " << ctf.
bgR2 << std::endl
1349 <<
"bg3= " << ctf.
bgR3 << std::endl
1350 <<
"base_line= " << ctf.
base_line << std::endl
1351 <<
"gaussian_K2= " << ctf.
gaussian_K2 << std::endl
1352 <<
"sigmaU2= " << ctf.
sigmaU2 << std::endl
1353 <<
"sigmaV2= " << ctf.
sigmaV2 << std::endl
1354 <<
"cU2= " << ctf.
cU2 << std::endl
1355 <<
"cV2= " << ctf.
cV2 << std::endl
1357 <<
"phase_shift= " << ctf.
phase_shift << std::endl
1358 <<
"VPP_radius= " << ctf.
VPP_radius << std::endl
1376 cU = cV = sigmaU = sigmaV = gaussian_angle =
gaussian_K = 0;
1377 sqU = sqV =
sqrt_K = sqrt_angle = 0;
1378 cU2 = cV2 = sigmaU2 = sigmaV2 = gaussian_angle2 =
gaussian_K2 = 0;
1387 DeltafU = DeltafV = azimuthal_angle = 0;
1396 rad_azimuth =
DEG2RAD(azimuthal_angle);
1397 rad_gaussian =
DEG2RAD(gaussian_angle);
1398 rad_gaussian2 =
DEG2RAD(gaussian_angle2);
1399 rad_sqrt =
DEG2RAD(sqrt_angle);
1400 defocus_average = -(DeltafU + DeltafV) * 0.5;
1401 defocus_deviation = -(DeltafU - DeltafV) * 0.5;
1430 double wmax = 1 / (2 *
Tm);
1431 double wstep = wmax / 300;
1433 double last_ctf = getValuePureNoDampingNoPrecomputedAt(0,0);
1440 ctf = getValuePureNoDampingNoPrecomputedAt(
XX(freq),
YY(freq));
1444 if (
SGN(ctf) !=
SGN(last_ctf))
1498 std::cout << n <<
" zero: w=" << w <<
" (" << wmax <<
") freq=" 1500 <<
" last_ctf=" << last_ctf <<
" ctf=" << ctf <<
" ";
1506 w += ctf * wstep / (last_ctf - ctf);
1514 std::cout <<
" final w= " << w <<
" final freq=" << freq.
transpose() << std::endl;
1525 if (
ZSIZE(FFTI) > 1 )
1557 if (
ZSIZE(FFTI) > 1 )
1587 double step = fmax / nsamples;
1590 double sinus = sin(angle);
1591 double cosinus = cos(angle);
1595 for (i = 0, f = 0; i <
YSIZE(profiles); i++, f += step)
1597 double fx = f * cosinus;
1598 double fy = f * sinus;
1619 double step = fmax / nsamples;
1622 for(
int angle=0; angle < 360; angle++)
1624 double angle2 = float(angle);
1625 double sinus = sin(angle2);
1626 double cosinus = cos(angle2);
1629 for (i = 0, f = 0; i <
YSIZE(profiles); i++, f += step)
1631 double fx = f * cosinus;
1632 double fy = f * sinus;
1661 kV >= 50 &&
kV <= 1000 &&
1664 Cs >= 0 &&
Cs <= 20 &&
1665 Ca >= 0 &&
Ca <= 7 &&
1669 Q0 >= 0 &&
Q0 <= 0.40 &&
1670 DeltafU >= 0 && DeltafV >= 0 &&
1674 if (retval ==
false)
1676 std::cout << *
this << std::endl;
1677 std::cout <<
"K>=0 && base_line>=0 " << (
K >= 0 &&
base_line >= 0) << std::endl
1678 <<
"kV>=50 && kV<=1000 " << (
kV >= 50 &&
kV <= 1000) << std::endl
1679 <<
"espr>=0 && espr<=20 " << (
espr >= 0 && espr <= 20) << std::endl
1680 <<
"ispr>=0 && ispr<=20 " << (
ispr >= 0 &&
ispr <= 20) << std::endl
1681 <<
"Cs>=0 && Cs<=20 " << (
Cs >= 0 && Cs <= 20) << std::endl
1682 <<
"Ca>=0 && Ca<=3 " << (
Ca >= 0 &&
Ca <= 7) << std::endl
1683 <<
"alpha>=0 && alpha<=5 " << (
alpha >= 0 && alpha <= 5) << std::endl
1684 <<
"DeltaF>=0 && DeltaF<=1000 " << (
DeltaF >= 0 &&
DeltaF <= 1000) << std::endl
1685 <<
"DeltaR>=0 && DeltaR<=100 " << (
DeltaR >= 0 && DeltaR <= 100) << std::endl
1686 <<
"Q0>=0 && Q0<=0.4 " << (
Q0 >= 0 &&
Q0 <= 0.4) << std::endl
1687 <<
"DeltafU>=0 && DeltafV>=0 " << (DeltafU >= 0 && DeltafV >= 0) << std::endl
1688 <<
"getValueAt(0,0)>=0 " << (
getValueAt() >= 0) << std::endl
1690 std::cout <<
"getValueAt(0,0)=" <<
getValueAt(
true) << std::endl;
1700 double min_sigma =
XMIPP_MIN(sigmaU, sigmaV);
1702 double min_sigma2 =
XMIPP_MIN(sigmaU2, sigmaV2);
1707 sigmaU >= 0 && sigmaV >= 0 &&
1708 sigmaU <= 100e3 && sigmaV <= 100e3 &&
1709 cU >= 0 && cV >= 0 &&
1710 sqU >= 0 && sqV >= 0 &&
1713 sigmaU2 >= 0 && sigmaV2 >= 0 &&
1714 sigmaU2 <= 100e3 && sigmaV2 <= 100e3 &&
1715 cU2 >= 0 && cV2 >= 0 &&
1716 gaussian_angle >= 0 && gaussian_angle <= 90 &&
1717 sqrt_angle >= 0 && sqrt_angle <= 90 &&
1718 gaussian_angle2 >= 0 && gaussian_angle2 <= 90 &&
1722 retval2 = retval2 &&
ABS(sigmaU - sigmaV) / min_sigma <= 3;
1724 retval2 = retval2 &&
ABS(cU - cV) / min_c <= 3;
1726 retval2 = retval2 && (cU *
Tm >= 0.01) && (cV * Tm >= 0.01);
1728 retval2 = retval2 &&
ABS(sigmaU2 - sigmaV2) / min_sigma2 <= 3;
1730 retval2 = retval2 &&
ABS(cU2 - cV2) / min_c2 <= 3;
1732 retval2 = retval2 && (cU2 * Tm >= 0.01) && (cV2 * Tm >= 0.01);
1735 if (retval2 ==
false)
1737 std::cout << *
this << std::endl;
1738 std::cout <<
"base_line>=0 && " << (
base_line >= 0) << std::endl
1739 <<
"gaussian_K>=0 && " << (
gaussian_K >= 0) << std::endl
1740 <<
"sigmaU>=0 && sigmaV>=0 " << (sigmaU >= 0 && sigmaV >= 0) << std::endl
1741 <<
"sigmaU<=100e3 && sigmaV<=100e3 " << (sigmaU <= 100e3 && sigmaV <= 100e3) << std::endl
1742 <<
"cU>=0 && cV>=0 " << (cU >= 0 && cV >= 0) << std::endl
1743 <<
"sqU>=0 && sqV>=0 " << (sqU >= 0 && sqV >= 0) << std::endl
1744 <<
"sqrt_K>=0 && " << (
sqrt_K >= 0) << std::endl
1745 <<
"gaussian_K2>=0 && " << (
gaussian_K2 >= 0) << std::endl
1746 <<
"sigmaU2>=0 && sigmaV2>=0 " << (sigmaU2 >= 0 && sigmaV2 >= 0) << std::endl
1747 <<
"sigmaU2<=100e3 && sigmaV2<=100e3 " << (sigmaU2 <= 100e3 && sigmaV2 <= 100e3) << std::endl
1748 <<
"cU2>=0 && cV2>=0 " << (cU2 >= 0 && cV2 >= 0) << std::endl
1749 <<
"gaussian_angle>=0 && gaussian_angle<=90 " << (gaussian_angle >= 0 && gaussian_angle <= 90) << std::endl
1750 <<
"sqrt_angle>=0 && sqrt_angle<=90 " << (sqrt_angle >= 0 && sqrt_angle <= 90) << std::endl
1751 <<
"gaussian_angle2>=0 && gaussian_angle2<=90 " << (gaussian_angle2 >= 0 && gaussian_angle2 <= 90) << std::endl
1754 std::cout <<
"ABS(sigmaU-sigmaV)/min_sigma<=3 " << (
ABS(sigmaU - sigmaV) / min_sigma <= 3) << std::endl;
1756 std::cout <<
"ABS(cU-cV)/min_c<=3 " << (
ABS(cU - cV) / min_c <= 3) << std::endl;
1758 std::cout <<
"(cU*Tm>=0.01) && (cV*Tm>=0.01) " << ((cU*Tm >= 0.01) && (cV*Tm >= 0.01)) << std::endl;
1760 std::cout <<
"ABS(sigmaU2-sigmaV2)/min_sigma2<=3 " << (
ABS(sigmaU2 - sigmaV2) / min_sigma2 <= 3) << std::endl;
1762 std::cout <<
"ABS(cU2-cV2)/min_c2<=3 " << (
ABS(cU2 - cV2) / min_c2 <= 3) << std::endl;
1764 std::cout <<
"(cU2*Tm>=0.01) && (cV2*Tm>=0.01) " << ((cU2*Tm >= 0.01) && (cV2*Tm >= 0.01)) << std::endl;
1765 std::cout << cV2*Tm << std::endl;
1776 return retval && retval2;
1793 double min_sigma =
XMIPP_MIN(sigmaU, sigmaV);
1795 double min_sigma2 =
XMIPP_MIN(sigmaU2, sigmaV2);
1825 if (sigmaU2 > 100e3)
1827 if (sigmaV2 > 100e3)
1833 if (gaussian_angle < 0)
1835 if (gaussian_angle > 90)
1836 gaussian_angle = 90;
1839 if (sqrt_angle > 90)
1841 if (gaussian_angle2 < 0)
1842 gaussian_angle2 = 0;
1843 if (gaussian_angle2 > 90)
1844 gaussian_angle2 = 90;
1846 if (
ABS(sigmaU - sigmaV) / min_sigma > 3)
1848 if (sigmaU < sigmaV)
1849 sigmaV = 3.9 * sigmaU;
1851 sigmaU = 3.9 * sigmaV;
1854 if (
ABS(cU - cV) / min_c > 3)
1869 if (
ABS(sigmaU2 - sigmaV2) / min_sigma2 > 3)
1871 if (sigmaU2 < sigmaV2)
1872 sigmaV2 = 3.9 * sigmaU2;
1874 sigmaU2 = 3.9 * sigmaV2;
1877 if (
ABS(cU2 - cV2) / min_c2 > 3)
double sigmaU
Spherical aberration (in milimeters). Typical value 5.6.
#define VECTOR_R2(v, x, y)
void write(const FileName &fn)
#define A2D_ELEM(v, i, j)
const MDLabel CTF_ALL_LABELS[]
double getDoubleParam(const char *param, int arg=0)
double gaussian_angle2
Second Gaussian angle.
#define REPORT_ERROR(nerr, ErrormMsg)
void lookFor(int n, const Matrix1D< double > &u, Matrix1D< double > &freq, int iwhat=0)
double getValueAt(bool show=false) const
Compute CTF at (U,V). Continuous frequencies.
void resizeNoCopy(const MultidimArray< T1 > &v)
void precomputeValues(double X)
Precompute values for a given frequency.
void sqrt(Image< double > &op)
void generatePSDCTFImage(MultidimArray< double > &img, const MetaData &MD)
void getProfile(double angle, double fmax, int nsamples, MultidimArray< double > &profiles)
double DeltafV
Defocus in V (in Angstroms). Negative values are underfocused.
void groupCTFMetaData(const MetaDataDb &imgMd, MetaDataDb &ctfMd, std::vector< MDLabel > &groupbyLabels)
void setRow(MDRow &row) const
#define DIRECT_A2D_ELEM(v, i, j)
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
void write(const FileName &fn)
void rangeAdjust(T minF, T maxF)
double cU2
Second Gaussian center for U.
void getAverageProfile(double fmax, int nsamples, MultidimArray< double > &profiles)
double cU
Gaussian center for U.
bool containsCTFBasicLabels(const MetaData &md)
void abs(Image< double > &op)
Matrix2D< T > transpose() const
double getValueNoiseAt(bool show=false) const
Compute noise at (X,Y). Continuous frequencies, notice it is squared.
double gaussian_K
Gain for the gaussian term.
void FFT_idx2digfreq(T &v, const Matrix1D< int > &idx, Matrix1D< double > &freq)
double errorMaxFreqCTFs2D(MetaData &MD1, MetaData &MD2, size_t Xdim, double phaseRad)
const MDLabel CTF_BASIC_LABELS[]
double DeltaF
Longitudinal mechanical displacement (ansgtrom). Typical value 100.
double sqrt_angle
Sqrt angle.
static void defineParams(XmippProgram *program)
Define parameters in the command line.
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
Matrix1D< T > transpose() const
void read(const FileName &fn, bool disable_if_not_K=true)
double DeltafU
Global gain. By default, 1.
bool enable_CTF
Enable CTF part.
void CenterFFT(MultidimArray< T > &v, bool forward)
double azimuthal_angle
Azimuthal angle (between X and U) in degrees.
void clearNoise()
Clear noise.
double Gc2
Second Gaussian center.
double sigma2
Second Gaussian width.
const int CTF_BASIC_LABELS_SIZE
double getValueArgument(bool show=false) const
Compute pure CTF without damping at (U,V). Continuous frequencies.
double base_line
Global base_line.
void readFromMetadataRow(const MetaData &MD, size_t id, bool disable_if_not_K=true)
double sqU
Gain for the square root term.
T & getValue(MDLabel label)
void log(Image< double > &op)
double Gc1
Gaussian center.
void generateCTFImageWith2CTFs(const MetaData &MD1, const MetaData &MD2, int Xdim, MultidimArray< double > &imgOut)
const char * getParam(const char *param, int arg=0)
void applyCTF(MultidimArray< std::complex< double > > &FFTI, const MultidimArray< double > &I, double Ts, bool absPhase=false)
Apply CTF to an image.
double getValueAt(bool show=false) const
Compute CTF at (U,V). Continuous frequencies.
void transpose(double *array, int size)
void correctPhase(MultidimArray< std::complex< double > > &FFTI, const MultidimArray< double > &I, double Ts)
Correct phase flip of an image.
double gaussian_K2
Gain for the second Gaussian term.
void readFromMetadataRow(const MetaData &MD, size_t id, bool disable_if_not_K=true)
double getValuePureNoPrecomputedAt(double X, bool show=false) const
Compute CTF pure at (U,V). Continuous frequencies.
#define XMIPP_EQUAL_ACCURACY
double errorBetween2CTFs(MetaData &MD1, MetaData &MD2, size_t Xdim, double minFreq, double maxFreq)
void readParams(XmippProgram *program)
Read parameters from the command line.
const int CTF_ALL_LABELS_SIZE
double ispr
Objective lens stability (deltaI/I) (ppm). Typical value 1.
double Tm
Sampling rate (A/pixel)
static void defineParams(XmippProgram *program)
Define parameters in the command line.
bool hasPhysicalMeaning()
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
void precomputeValues(double X, double Y)
Precompute values for a given frequency.
void log10(Image< double > &op)
double getValueDampingAt(bool show=false) const
Compute CTF damping at (U,V). Continuous frequencies.
double Cs
Spherical aberration (in milimeters). Typical value 5.6.
double DeltaR
Transversal mechanical displacement (ansgtrom). Typical value 3.
double sigmaV
Gaussian width V.
double getValuePureWithoutDampingAt(bool show=false) const
Compute pure CTF without damping at (U,V). Continuous frequencies.
__device__ float FFT_IDX2DIGFREQ(int idx, int size)
void forcePhysicalMeaning()
void correctPhase(MultidimArray< std::complex< double > > &FFTI, const MultidimArray< double > &I, double Ts)
Correct phase flip of an image.
double errorMaxFreqCTFs(MetaData &MD1, double phaseRad)
double getValuePureNoKAt() const
Compute CTF pure at (U,V). Continuous frequencies.
double Defocus
Defocus (in Angstroms). Negative values are underfocused.
const T & getValueOrDefault(MDLabel label, const T &def) const
void applyCTF(MultidimArray< std::complex< double > > &FFTI, const MultidimArray< double > &I, double Ts, bool absPhase=false)
Apply CTF to an image.
double K
Global gain. By default, 1.
double gaussian_angle
Gaussian angle.
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
void read(const FileName &fn, bool disable_if_not_K=true)
void setValue(MDLabel label, const T &d, bool addLabel=true)
bool isLocalCTF
Local CTF determination.
bool isMetaData(bool failIfNotExists=true) const
void clearPureCtf()
Clear pure CTF.
virtual bool containsLabel(MDLabel label) const =0
std::vector< PrecomputedForCTF > precomputedImage
void clearPureCtf()
Clear pure CTF.
double Ca
Chromatic aberration (in milimeters). Typical value 2.
void lookFor(int n, const Matrix1D< double > &u, Matrix1D< double > &freq, int iwhat=0)
void produceSideInfo()
Produce Side information.
void forcePhysicalMeaning()
double alpha
Convergence cone semiangle (in mrad). Typical value 0.5.
#define V2_BY_CT(a, b, k)
#define realWRAP(x, x0, xF)
double y0
In the case of local CTF determination x0,xF,y0,yF determines the region where the CTF is determined...
bool checkParam(const char *param)
double Q0
Factor for the importance of the Amplitude contrast.
double x0
In the case of local CTF determination x0,xF,y0,yF determines the region where the CTF is determined...
Incorrect MultidimArray dimensions.
friend std::ostream & operator<<(std::ostream &out, const CTFDescription1D &ctf)
Show.
double kV
Accelerating Voltage (in KiloVolts)
void initZeros(const MultidimArray< T1 > &op)
double cV2
Second Gaussian center for V.
void getProfile(double fmax, int nsamples, MultidimArray< double > &profiles)
bool enable_CTFnoise
Enable CTFnoise part.
void clearNoise()
Clear noise.
double xF
In the case of local CTF determination x0,xF,y0,yF determines the region where the CTF is determined...
double getValuePureAt(bool show=false) const
Compute CTF pure at (U,V). Continuous frequencies.
double sigma1
Gaussian width.
double sqrt_K
Gain for the square root term.
PrecomputedForCTF precomputed
double yF
In the case of local CTF determination x0,xF,y0,yF determines the region where the CTF is determined...
void produceSideInfo()
Produce Side information.
bool hasPhysicalMeaning()
double sigmaU2
Second Gaussian width U.
void addParamsLine(const String &line)
void digfreq2contfreq(const Matrix1D< double > &digfreq, Matrix1D< double > &contfreq, double pixel_size)
void setRow(MDRow &row) const
double sigmaV2
Second Gaussian width V.
double cV
Gaussian center for V.
void readParams(XmippProgram *program)
Read parameters from the command line.
void getAverageProfile(double fmax, int nsamples, MultidimArray< double > &profiles)