diff --git a/README.md b/README.md index 3c5e25b..a0614d7 100644 --- a/README.md +++ b/README.md @@ -156,3 +156,8 @@ Each 8 rows of any given column represent the 8 values of a 2x2 Jones matrix. Le When a luster has a chunk size > 1, there will be more than 1 solution per given time interval. So for this cluster, there will be more than 1 column in the solution file, the exact number of columns being equal to the chunk size. + + + +### Additional Info +See [LOFAR Cookbook Chapter](https://support.astron.nl/LOFARImagingCookbook/sagecal.html). diff --git a/src/lib/Dirac/clmfit_nocuda.c b/src/lib/Dirac/clmfit_nocuda.c index edd539a..a1f1185 100644 --- a/src/lib/Dirac/clmfit_nocuda.c +++ b/src/lib/Dirac/clmfit_nocuda.c @@ -878,7 +878,7 @@ mlm_der_single( printf("Singular matrix info=%d\n",status); #endif } - } else { + } else if (solve_axb==2) { /* SVD solver *********************************/ /* U S VT = A */ status=my_dgesvd('A','A',M,M,JkTJk,M,Sd,Ud,M,VTd,M,WORK,lwork); @@ -940,7 +940,7 @@ mlm_der_single( printf("Singular matrix info=%d\n",status); #endif } - } else { + } else if (solve_axb==2) { /* SVD solver *********************************/ /* dhatk <= U^T jacTed */ my_dgemv('T',M,M,1.0,Ud,M,JkTe,1,0.0,dhatk,1); diff --git a/src/lib/Dirac/lbfgs.c b/src/lib/Dirac/lbfgs.c index d8ac3cc..2486dda 100644 --- a/src/lib/Dirac/lbfgs.c +++ b/src/lib/Dirac/lbfgs.c @@ -225,7 +225,7 @@ mult_hessian(int m, double *pk, double *gk, double *s, double *y, double *rho, i fprintf(stderr,"%s: %d: no free memory\n",__FILE__,__LINE__); exit(1); } - if ((idx=(int*)calloc((size_t)M,sizeof(double)))==0) { + if ((idx=(int*)calloc((size_t)M,sizeof(int)))==0) { fprintf(stderr,"%s: %d: no free memory\n",__FILE__,__LINE__); exit(1); } diff --git a/src/lib/Dirac/lbfgs_nocuda.c b/src/lib/Dirac/lbfgs_nocuda.c index b249024..a3c75b0 100644 --- a/src/lib/Dirac/lbfgs_nocuda.c +++ b/src/lib/Dirac/lbfgs_nocuda.c @@ -318,7 +318,7 @@ mult_hessian(int m, double *pk, double *gk, double *s, double *y, double *rho, i #endif exit(1); } - if ((idx=(int*)calloc((size_t)M,sizeof(double)))==0) { + if ((idx=(int*)calloc((size_t)M,sizeof(int)))==0) { #ifndef USE_MIC fprintf(stderr,"%s: %d: no free memory\n",__FILE__,__LINE__); #endif diff --git a/src/lib/Dirac/robust_lbfgs_nocuda.c b/src/lib/Dirac/robust_lbfgs_nocuda.c index 12b0018..78553e3 100644 --- a/src/lib/Dirac/robust_lbfgs_nocuda.c +++ b/src/lib/Dirac/robust_lbfgs_nocuda.c @@ -165,7 +165,7 @@ mult_hessian(int m, double *pk, double *gk, double *s, double *y, double *rho, i #endif exit(1); } - if ((idx=(int*)calloc((size_t)M,sizeof(double)))==0) { + if ((idx=(int*)calloc((size_t)M,sizeof(int)))==0) { #ifndef USE_MIC fprintf(stderr,"%s: %d: no free memory\n",__FILE__,__LINE__); #endif diff --git a/src/lib/Radio/readsky.c b/src/lib/Radio/readsky.c index f30553b..b340d41 100644 --- a/src/lib/Radio/readsky.c +++ b/src/lib/Radio/readsky.c @@ -686,8 +686,10 @@ printf("Nc=%d\n",Nc); memset(buf,0,buff_len); c=read_next_string(&buf,&buff_len,cfp); if (c!=1) { - /* first column is solution number (int) 1..8N */ + /* first column is solution number (int) 0..8N-1 */ sscanf(buf,"%d",&cn); + /* also do a sanity check */ + if ( cn<0 || cn>Nc ) cn=0; } #ifdef DEBUG printf("%d ",cn); diff --git a/src/lib/Radio/residual.c b/src/lib/Radio/residual.c index 1f365b4..9f17705 100644 --- a/src/lib/Radio/residual.c +++ b/src/lib/Radio/residual.c @@ -1714,6 +1714,7 @@ predict_visibilities_multifreq_withsol(double *u,double *v,double *w,double *p,d pthread_attr_destroy(&attr); + if (pinv) free(pinv); free(th_array); free(threaddata); diff --git a/src/restore/restore.c b/src/restore/restore.c index 7bd9dc7..d196ece 100644 --- a/src/restore/restore.c +++ b/src/restore/restore.c @@ -55,9 +55,10 @@ zero_image(long totalrows, long offset, long firstrow, long nrows, charp= (float *) fits_iter_get_array(&cols[0]); } - + /* NOTE: 1st element of array is the null pixel value! */ + /* Loop from 1 to nrows, not 0 to nrows - 1. */ for (ii = 1; ii <= nrows; ii++) { - charp[ii]=0.0; + charp[ii]=0.0; } return 0; @@ -1038,6 +1039,12 @@ int main(int argc, char **argv) { free(clusterfile); glist_delete(&slist); free(ignfile); + } else { + if (ffile) free(ffile); + if (slistname) free(slistname); + if (solfile) free(solfile); + if (clusterfile) free(clusterfile); + if (ignfile) free(ignfile); } return 0; }