Commit a2c28842 authored by Pilar Cossio's avatar Pilar Cossio

Debug anglefile name

parent 8168bb89
......@@ -6,4 +6,3 @@
0.836000 1.369000 2.640000 0.640000
-1.375000 0.400000 3.018000 0.360000
-1.375000 0.400000 3.018000 0.360000
0.836000 1.369000 2.640000 0.640000
......@@ -16,4 +16,4 @@ DISPLACE_CENTER 10 2
####### Priors ###############
PRIOR_MODEL 0.005
PRIOR_ANGLES
#PRIOR_ANGLES
......@@ -4,7 +4,7 @@ PIXEL_SIZE 1.77
##### Quaterion grid points: #######
USE_QUATERNIONS
GRIDPOINTS_QUATERNION 5
#GRIDPOINTS_QUATERNION 5
##### Constrast transfer integration: #######
CTF_B_FACTOR 100.0 300.5 8
......
......@@ -3,11 +3,11 @@ PIXEL_SIZE 1.77
GRIDPOINTS_ALPHA 10
GRIDPOINTS_BETA 5
GRIDPOINTS_ENVELOPE 4
START_ENVELOPE 0.0002
END_ENVELOPE 0.0012
START_ENVELOPE 0.002
END_ENVELOPE 0.012
GRIDPOINTS_PSF_PHASE 4
START_PSF_PHASE 0.004
END_PSF_PHASE 0.016
END_PSF_PHASE 0.06
GRIDPOINTS_PSF_AMP 1
START_PSF_AMP 1.
END_PSF_AMP 1.
......
......@@ -266,7 +266,7 @@ int bioem::configure(int ac, char* av[])
// ********************* Reading Parameter Input ***************************
if(!param.printModel){
// Standard definition for BioEM
param.readParameters(infile.c_str(),Inputanglefile.c_str());
param.readParameters(infile.c_str());
// ********************* Reading Particle Maps Input **********************
RefMap.readRefMaps(param, mapfile.c_str());
......@@ -290,7 +290,7 @@ int bioem::configure(int ac, char* av[])
exit(1);
}
if(!param.printModel)param.CalculateGridsParam();
if(!param.printModel)param.CalculateGridsParam(Inputanglefile.c_str());
}
#ifdef WITH_MPI
if (mpi_size > 1)
......@@ -298,8 +298,7 @@ int bioem::configure(int ac, char* av[])
if (DebugOutput >= 2 && mpi_rank == 0) timer.ResetStart();
MPI_Bcast(&param, sizeof(param), MPI_BYTE, 0, MPI_COMM_WORLD);
cout << "HERE MPI" << param.nTotGridAngles << " "<< param.nTotGridAngles * sizeof(myfloat3_t*) << "\n";
//if (mpi_rank != 0)param.angles = (myfloat3_t*) mallocchk( 4 * param.nTotGridAngles * sizeof(myfloat_t*));
// cout << "HERE MPI " << param.nTotGridAngles << " " << param.nTotGridAngles * sizeof(myfloat3_t*) << "\n";
if (mpi_rank != 0)param.angles = (myfloat3_t*) mallocchk(3 * param.nTotGridAngles * sizeof (myfloat3_t*));
MPI_Bcast(param.angles, 3 * param.nTotGridAngles * sizeof (myfloat3_t*),MPI_BYTE, 0, MPI_COMM_WORLD);
......@@ -309,11 +308,11 @@ int bioem::configure(int ac, char* av[])
// param.angprior = new myfloat_t[param.NotUn_angles] ;
//
//#ifdef PILAR_DEBUG
#ifdef PILAR_DEBUG
for(int n=0;n<param.nTotGridAngles;n++){
cout << "CHECK: Angle orient " << mpi_rank << " "<< n << " " << param.angles[n].pos[0] << " " << param.angles[n].pos[1] << " " << param.angles[n].pos[2] << " " << param.angles[n].quat4 << " " << "\n";}
//
//#endif
#endif
//refCtf, CtfParam, angles automatically filled by precalculare function below
MPI_Bcast(&Model, sizeof(Model), MPI_BYTE, 0, MPI_COMM_WORLD);
......@@ -499,6 +498,9 @@ int bioem::run()
if (DebugOutput >= 1 && mpi_rank == 0) printf("\tMain Loop GridAngles %d, CTFs %d, RefMaps %d, Shifts (%d/%d)², Pixels %d², OMP Threads %d, MPI Ranks %d\n", param.nTotGridAngles, param.nTotCTFs, RefMap.ntotRefMap, 2 * param.param_device.maxDisplaceCenter + param.param_device.GridSpaceCenter, param.param_device.GridSpaceCenter, param.param_device.NumberPixels, omp_get_max_threads(), mpi_size);
if(mpi_size > param.nTotGridAngles){
cout << "EXIT: Wrong MPI setup More MPI processes than orientations\n"; exit(1);
}
const int iOrientStart = (int) ((long long int) mpi_rank * param.nTotGridAngles / mpi_size);
int iOrientEnd = (int) ((long long int) (mpi_rank + 1) * param.nTotGridAngles / mpi_size);
if (iOrientEnd > param.nTotGridAngles) iOrientEnd = param.nTotGridAngles;
......
......@@ -39,8 +39,8 @@ public:
~bioem_param();
int readParameters(const char* fileinput,const char* fileangles);
int CalculateGridsParam();
int readParameters(const char* fileinput);
int CalculateGridsParam(const char* fileangles);
int CalculateRefCTF();
int forprintBest(const char* fileinput);
void PrepareFFTs();
......@@ -85,8 +85,8 @@ public:
bool withnoise;
myfloat_t stnoise;
std::string inanglef;
std::string quatfile;
// std::string inanglef;
// std::string quatfile;
int numberGridPointsDisplaceCenter;
// Grid sampling for the convolution kernel
......
......@@ -139,7 +139,7 @@ int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
char tmpLine[512] = {0};
bool first=true;
int countpix;
int countpix=0;
while (!input.eof())
{
......@@ -221,7 +221,6 @@ int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
ntotRefMap = nummap + 1;
maps = (myfloat_t*) reallocchk(maps, refMapSize * sizeof(myfloat_t) * ntotRefMap);
cout << "Particle Maps read from Standard File: " << ntotRefMap << "\n";
}
//Dumping Maps
......
......@@ -52,7 +52,7 @@ bioem_param::bioem_param()
printModel = false;
}
int bioem_param::readParameters(const char* fileinput,const char* fileangles)
int bioem_param::readParameters(const char* fileinput)
{ // **************************************************************************************
// ***************************** Reading Input Parameters ******************************
// **************************************************************************************
......@@ -89,7 +89,7 @@ int bioem_param::readParameters(const char* fileinput,const char* fileangles)
yespriorAngles=false;
//Storing angle file name if existing.
inanglef=std::string(fileangles);
//f(notuniformangles)inanglef=std::string(fileangles);
NotUn_angles=0;
priorMod=1; //Default
......@@ -695,7 +695,7 @@ void bioem_param::releaseFFTPlans()
fft_plans_created = 0;
}
int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
int bioem_param::CalculateGridsParam(const char* fileangles) //TO DO FOR QUATERNIONS
{
// **************************************************************************************
// **************** Routine that pre-calculates Euler angle grids **********************
......@@ -731,7 +731,7 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
angles = (myfloat3_t*) mallocchk( 3 * angleGridPointsAlpha * angleGridPointsBeta * angleGridPointsAlpha * sizeof(myfloat3_t));
cout << "HERE" << sizeof(myfloat3_t) << " " << sizeof(myfloat_t) << " "<< 4 * angleGridPointsAlpha * angleGridPointsBeta * angleGridPointsAlpha * sizeof(myfloat_t*) << "\n";
for (int ialpha = 0; ialpha < angleGridPointsAlpha; ialpha ++)
{
for (int ibeta = 0; ibeta < angleGridPointsBeta; ibeta ++)
......@@ -746,23 +746,22 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
}
}
}
cout << "HERE2 "<< n <<" " << angleGridPointsAlpha * angleGridPointsBeta * angleGridPointsAlpha << "\n";
nTotGridAngles = n;
voluang= grid_alpha * grid_alpha * cos_grid_beta / (2.f * M_PI) / (2.f * M_PI) / 2.f * priorMod;
} else{
ifstream input(inanglef.c_str());
ifstream input(fileangles);
if (!input.good())
{
cout << "Euler Angle File Failed to open file " << inanglef.c_str() << " " << endl ;
cout << "Euler Angle File Failed to open file " << fileangles << " " << endl ;
exit(1);
}
char line[512] = {0};
// char saveline[512];
int n=0;
// First line tels the number of rows
......@@ -783,8 +782,7 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
// NotUn_angles=NotUn_angles+1;
//elete[] angles;
// angles = new myfloat3_t[]
angles = (myfloat3_t*) mallocchk( NotUn_angles * 3 * sizeof(myfloat3_t));
if(yespriorAngles){
......@@ -793,16 +791,48 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
}
while (!input.eof())
{
input.getline(line, 511);
if(n< NotUn_angles){
/*
myfloat_t or1,or2,or3,or4,prior;
input.getline(line, 511);
if(n< NotUn_angles){
float a,b,g,pp;
strcpy(saveline, line);
char *token = strtok(line, " ");
if (token == NULL || line[0] == '#' || strlen(token) == 0)
{
// comment or blank line
}
else if (strcmp(token, "ORIENT") == 0)
{
token = strtok(NULL, " ");
or1 = atof(token);
token = strtok(NULL, " ");
or2 = atof(token);
token = strtok(NULL, " ");
or3 = atof(token);
token = strtok(NULL, " ");
or4 = atof(token);
cout << "TT " << n << " " << or1 << " " << or2 << " " << or3 << " " << or4 << "\n ";
angles[n].pos[0] = or1;
angles[n].pos[1] = or2;
angles[n].pos[2] = or3;
angles[n].quat4 =0.0;
n++;
}*/
float a=0.,b=0.,g=0.,pp=0.;
char tmpVals[60] = {0};
strncpy (tmpVals, line, 12);
strncpy (tmpVals, line, 12);
sscanf (tmpVals, "%f", &a);
cout << tmpVals <<"\n";
strncpy (tmpVals, line + 12, 12);
sscanf (tmpVals, "%f", &b);
......@@ -815,11 +845,13 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
if(pp <0.0000001)cout << "Sure you're input is correct? Very small prior.\n";
angprior[n] = (myfloat_t) pp;
}
angles[n].pos[0] = (myfloat_t) a;
angles[n].pos[1] = (myfloat_t) b;
angles[n].pos[2] = (myfloat_t) g;
angles[n].quat4 =0.0;//just to be sure */
if(yespriorAngles) cout << "check orient: " << n << " " << angles[n].pos[0] << " " << angles[n].pos[1] << " " << angles[n].pos[2] << " prior: " << angprior[n] << "\n";
if(yespriorAngles) cout << "check orient: " << n << " " << " " << angles[n].pos[0] << " " << angles[n].pos[1] << " " << angles[n].pos[2] << " prior: " << angprior[n]<< "\n";
}
n++;
if(NotUn_angles+1 < n) {
......@@ -831,7 +863,7 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
}
nTotGridAngles = NotUn_angles;
voluang= 1./ (myfloat_t) NotUn_angles * priorMod;
input.close();
input.close();
}
} else {
......@@ -909,12 +941,12 @@ int bioem_param::CalculateGridsParam() //TO DO FOR QUATERNIONS
// ifstream input(quatfile);
ifstream input(inanglef.c_str());
ifstream input(fileangles);
// ifstream input("QUATERNION_LIST");
if (!input.good())
{
cout << "Problem with Quaterion List file " << inanglef.c_str() << " " << endl ;
cout << "Problem with Quaterion List file " << fileangles << " " << endl ;
exit(1);
}
......
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