handle -ve sources
This commit is contained in:
parent
ce633cd499
commit
741a38eae1
|
@ -328,7 +328,12 @@ read_sky_cluster(const char *skymodel, const char *clusterfile, clus_source_t **
|
|||
fratio=log(freq0/f0);
|
||||
fratio1=fratio*fratio;
|
||||
fratio2=fratio1*fratio;
|
||||
source->sI=exp(log(sI)+spec_idx*fratio+spec_idx1*fratio1+spec_idx2*fratio2);
|
||||
/* catch -ve sI */
|
||||
if (sI>0.0) {
|
||||
source->sI=exp(log(sI)+spec_idx*fratio+spec_idx1*fratio1+spec_idx2*fratio2);
|
||||
} else {
|
||||
source->sI=-exp(log(-sI)+spec_idx*fratio+spec_idx1*fratio1+spec_idx2*fratio2);
|
||||
}
|
||||
} else {
|
||||
source->sI=sI;
|
||||
}
|
||||
|
|
|
@ -573,7 +573,12 @@ residual_threadfn_onefreq(void *data) {
|
|||
fratio=log(freq0/t->carr[cm].f0[cn]);
|
||||
fratio1=fratio*fratio;
|
||||
fratio2=fratio1*fratio;
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
/* catch -ve sI */
|
||||
if (t->carr[cm].sI0[cn]>0.0) {
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
} else {
|
||||
prodterm=-exp(log(-t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
} else {
|
||||
prodterm=t->carr[cm].sI[cn]*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
|
@ -841,7 +846,12 @@ residual_threadfn_multifreq(void *data) {
|
|||
fratio=log(freq0/t->carr[cm].f0[cn]);
|
||||
fratio1=fratio*fratio;
|
||||
fratio2=fratio1*fratio;
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
/* catch -ve sI */
|
||||
if (t->carr[cm].sI0[cn]>0.0) {
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
} else {
|
||||
prodterm=-exp(log(-t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
} else {
|
||||
prodterm=t->carr[cm].sI[cn]*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
|
@ -1077,7 +1087,12 @@ visibilities_threadfn_multifreq(void *data) {
|
|||
fratio=log(freq0/t->carr[cm].f0[cn]);
|
||||
fratio1=fratio*fratio;
|
||||
fratio2=fratio1*fratio;
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
/* catch -ve sI */
|
||||
if (t->carr[cm].sI0[cn]>0.0) {
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
} else {
|
||||
prodterm=-exp(log(-t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
} else {
|
||||
prodterm=t->carr[cm].sI[cn]*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
|
@ -1288,7 +1303,12 @@ predictwithgain_threadfn_multifreq(void *data) {
|
|||
fratio=log(freq0/t->carr[cm].f0[cn]);
|
||||
fratio1=fratio*fratio;
|
||||
fratio2=fratio1*fratio;
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
/* catch -ve sI */
|
||||
if (t->carr[cm].sI0[cn]>0.0) {
|
||||
prodterm=exp(log(t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
} else {
|
||||
prodterm=-exp(log(-t->carr[cm].sI0[cn])+t->carr[cm].spec_idx[cn]*fratio+t->carr[cm].spec_idx1[cn]*fratio1+t->carr[cm].spec_idx2[cn]*fratio2)*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
} else {
|
||||
prodterm=t->carr[cm].sI[cn]*(cosph+_Complex_I*sinph);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue