Skip to content

Commit

Permalink
Bugfix: norm_type was not being saved to file (#212)
Browse files Browse the repository at this point in the history
* norm_type now saved properly
  • Loading branch information
damonge authored Sep 22, 2024
1 parent 7321e98 commit 6f859fe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static void nmt_workspace_info_tohdus(fitsfile *fptr,
fits_write_key(fptr,TINT,"LMAX_MASK",&(w->lmax_mask),NULL,status);
fits_write_key(fptr,TINT,"IS_TEB",&(w->is_teb),NULL,status);
fits_write_key(fptr,TINT,"NCLS",&(w->ncls),NULL,status);
fits_write_key(fptr,TINT,"NORM_TYPE",&(w->norm_type),NULL,status);
for(ii=0;ii<n_el;ii++) {
fpixel[1]=ii+1;
fits_write_pix(fptr,TDOUBLE,fpixel,n_el,w->coupling_matrix_unbinned[ii],status);
Expand All @@ -28,12 +29,19 @@ static void nmt_workspace_info_fromhdus(fitsfile *fptr,
int w_unbinned,
int *status)
{
int status_pre;
fits_movnam_hdu(fptr,IMAGE_HDU,"WSP_PRIMARY",0,status);
fits_read_key(fptr,TINT,"LMAX",&(w->lmax),NULL,status);
fits_read_key(fptr,TINT,"LMAX_FIELDS",&(w->lmax_fields),NULL,status);
fits_read_key(fptr,TINT,"LMAX_MASK",&(w->lmax_mask),NULL,status);
fits_read_key(fptr,TINT,"IS_TEB",&(w->is_teb),NULL,status);
fits_read_key(fptr,TINT,"NCLS",&(w->ncls),NULL,status);
status_pre = *status;
fits_read_key(fptr,TINT,"NORM_TYPE",&(w->norm_type),NULL,status);
if(*status) {// maybe used old format
w->norm_type=0;
*status=status_pre;
}
long ii;
long n_el=w->ncls*(w->lmax+1);
long fpixel[2]={1,1};
Expand Down

0 comments on commit 6f859fe

Please sign in to comment.