make sure rho text file exactly matches no. clusters

This commit is contained in:
Sarod Yatawatta 2018-07-30 16:16:03 +02:00
parent 84b813da3f
commit d11e1653fd
2 changed files with 7 additions and 4 deletions

View File

@ -34,7 +34,7 @@ using namespace Data;
void
print_copyright(void) {
cout<<"SAGECal-MPI 0.5.0 (C) 2011-2018 Sarod Yatawatta"<<endl;
cout<<"SAGECal-MPI 0.5.1 (C) 2011-2018 Sarod Yatawatta"<<endl;
}
@ -67,7 +67,7 @@ print_help(void) {
cout << "-P consensus polynomial terms: default " <<Data::Npoly<< endl;
cout << "-Q consensus polynomial type (0,1,2,3): default " <<Data::PolyType<< endl;
cout << "-r regularization factor: default " <<Data::admm_rho<< endl;
cout << "-G regularization factor of each cluster (text file instead of -r, has to match exactly the cluster file first 2 columns): default : None" << endl;
cout << "-G regularization factor of each cluster (text file instead of -r, has to match _exactly_ the cluster file's first 2 columns): default : None" << endl;
cout << "-C if >0, adaptive update of regularization factor: default "<<Data::aadmm<< endl;
cout << "-x exclude baselines length (lambda) lower than this in calibration : default "<<Data::min_uvcut << endl;
cout << "-y exclude baselines length (lambda) higher than this in calibration : default "<<Data::max_uvcut << endl;

View File

@ -777,8 +777,10 @@ read_arho_fromfile(const char *admm_rho_file,int Mt,double *arho, int M, double
c=skip_lines(cfp);
ci=0; /* store it in reverse order */
cj=0;
while(c>=0) {
//printf("Mt=%d M=%d\n",Mt,M);
while(c>=0 && cj<M) {
c=fscanf(cfp,"%d %d %lf",&cluster_id,&hybrid,&admm_rho);
//printf("c=%d ci=%d cj=%d\n",c,ci,cj);
/* add this value to arho array */
if (c!=EOF && c>0) {
/* found a valid line */
@ -804,8 +806,9 @@ read_arho_fromfile(const char *admm_rho_file,int Mt,double *arho, int M, double
c=skip_restof_line(cfp);
c=skip_lines(cfp);
}
//printf("c=%d ci=%d cj=%d\n",c,ci,cj);
/* report any errors */
if (!(c==EOF && ci==Mt-1)) {
if (!(c==EOF && ci==Mt-1 && cj=M)) {
fprintf(stderr,"%s: %d: Error: cluster numbers in cluster file and regularization file do not match up.\n",__FILE__,__LINE__);
exit(1);
}