This commit is contained in:
Sarod Yatawatta 2015-12-12 14:22:47 +01:00
parent f951adfa78
commit 17b58b2a50
3 changed files with 19 additions and 5 deletions

View File

@ -121,6 +121,7 @@ fillup_pixel_hashtablef(long totalrows, long offset, long firstrow, long nrows,
d2=pt/(arr_dims.d[0]);
pt-=(arr_dims.d[0])*d2;
d1=pt;
if (d1>0 && d2+1>0){ /* make sure x,y coords are valid */
#ifdef DEBUG
printf("coords =(%ld,%ld,%ld,%ld)\n",d1,d2+1,d3,d4);
#endif
@ -176,7 +177,7 @@ fillup_pixel_hashtablef(long totalrows, long offset, long firstrow, long nrows,
} else {
free(key);
}
}
}
}
@ -1589,7 +1590,19 @@ write_world_coords_f(const char *imgfile, GHashTable *pixtable, double minpix, i
fprintf(outf,"# FAKE?? peak flux %lf times average\n",MAX(sIlow,sIhigh));
}
if (!outformat) {
fprintf(outf,"P%s%dC%d, POINT, %d:%d:%4.2lf, +%d.%d.%4.2lf, %lf, 0.0, 0.0, 0.0, %12.7lg, 0, [%5.3lf,%5.3lf,%5.3lf]\n",unistr,*key_,count,ra_h,ra_m,ra_s,dec_d,dec_m,dec_s,srcx->sI*fluxscale,ref_freq,srcx->sP,srcx->sP1,srcx->sP2);
/* do ln() to log() conversion of spectra
ln(I0)+p1*ln(f/f0)+p2*ln(f/f0)^2+... = ln(10)*(log(J0)+q1*log(f/f0)+q2*log(f/f0))^2)+...)
=ln(10)*(ln(J0)/ln(10)+q1*ln(f/f0)/ln(10)+q2*ln(f/f0)^2/ln(10)^2+...)
so
J0=I0
q1=p1
q2=p2*ln(10)
q3=p3*ln(10)^2
*/
double logsc=log(10.0);
fprintf(outf,"P%s%dC%d, POINT, %d:%d:%4.2lf, +%d.%d.%4.2lf, %lf, 0.0, 0.0, 0.0, %12.7lg, 0, [%5.3lf,%5.3lf,%5.3lf]\n",unistr,*key_,count,ra_h,ra_m,ra_s,dec_d,dec_m,dec_s,srcx->sI*fluxscale,ref_freq,srcx->sP,srcx->sP1*logsc,srcx->sP2*logsc*logsc);
} else {
fprintf(outf,"P%s%dC%d %d %d %4.3lf %d %d %4.3lf %lf 0 0 0 %lf %lf %lf 0 0 0 0 %lf\n",unistr,*key_,count,ra_h,ra_m,ra_s,dec_d,dec_m,dec_s,srcx->sI*fluxscale,srcx->sP,srcx->sP1,srcx->sP2,ref_freq);
}

View File

@ -120,7 +120,6 @@ fillup_pixel_hashtable(long totalrows, long offset, long firstrow, long nrows,
//counts[ii] = 1.;
tmpval=(int)dptr[ii];
if (tmpval> 0) {
//printf("arr =%lf\n",tmpval);
/* calculate 4D coords */
pt=firstrow+ii-1;
//printf("coord point=%ld ",pt);
@ -131,8 +130,9 @@ fillup_pixel_hashtable(long totalrows, long offset, long firstrow, long nrows,
d2=pt/(arr_dims.d[0]);
pt-=(arr_dims.d[0])*d2;
d1=pt;
if (d1>0 && d2+1>0){ /* make sure x,y coords are valid */
#ifdef DEBUG
printf("coords =(%ld,%ld,%ld,%ld)\n",d1,d2+1,d3,d4);
printf("arr=%d coords =(%ld,%ld,%ld,%ld)\n",tmpval,d1,d2+1,d3,d4);
#endif
/* find current limit */
@ -188,6 +188,7 @@ fillup_pixel_hashtable(long totalrows, long offset, long firstrow, long nrows,
}
}
}
}

View File

@ -48,7 +48,7 @@ print_help(void) {
void
print_copyright(void) {
printf("Buildsky 0.0.7 (C) 2011-2015 Sarod Yatawatta\n");
printf("Buildsky 0.0.9 (C) 2011-2016 Sarod Yatawatta\n");
}