Changeset 37623
- Timestamp:
- Nov 18, 2014, 9:30:22 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/relastro/src
- Files:
-
- 2 edited
-
FrameCorrection.c (modified) (9 diffs)
-
bcatalog.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrection.c
r37622 r37623 40 40 for (i = 0; i < frame->Ndec; i++) { 41 41 double D = i * scale - 89.0; 42 if (D > 90.0) { 43 frame->dR[i] = 0.0; 44 frame->Nra[i] = 0; 45 frame->Roff[i] = NULL; 46 frame->Doff[i] = NULL; 47 continue; 48 } 42 49 frame->dR[i] = scale / cos(RAD_DEG*D); 43 frame->Nra[i] = 360.0 / frame->dR[i];50 frame->Nra[i] = MAX (0, 360.0 / frame->dR[i]); 44 51 if (frame->Nra[i] * frame->dR[i] < 360.0) frame->Nra[i] ++; 45 52 46 53 ALLOCATE (frame->Roff[i], double, frame->Nra[i]); 47 54 ALLOCATE (frame->Doff[i], double, frame->Nra[i]); 55 // ohana_memcheck_func (TRUE); 56 // fprintf (stderr, "alloc : %d : %lx %lx\n", i, (long unsigned int)(size_t *) frame->Roff[i], (long unsigned int) (size_t *) frame->Doff[i]); 48 57 } 49 58 return frame; … … 61 70 } 62 71 72 if (frame->dR) free (frame->dR); 63 73 if (frame->Nra) free (frame->Nra); 64 74 if (frame->Roff) free (frame->Roff); … … 138 148 SHterms *dDc = SHtermsInit (Lmax); 139 149 150 INITTIME; 151 140 152 FrameCorrectionFitSH (catalog, Ncatalog, dRc, dDc); 153 MARKTIME ("done with FitSH: %f sec\n", dtime); 141 154 142 155 double pltscale = 0.5; // degrees per pixel … … 144 157 145 158 FrameCorrectionFromSH (frame, dRc, dDc); 159 MARKTIME ("done with FromSH: %f sec\n", dtime); 146 160 147 161 // XXX write out an image to represent the correction … … 172 186 fprintf (stderr, "start Fit %d SH l-modes for %d QSOs\n", dRc->lmax, Nicrf); 173 187 188 FILE *f = fopen ("sh.dat", "w"); 189 myAssert (f, "oops"); 190 174 191 int i, j; 175 192 for (i = 0; i < Nicrf; i++) { 176 193 177 194 int cat, meas, ave; 178 ICRFdata (i, &cat, & meas, &ave);195 ICRFdata (i, &cat, &ave, &meas); 179 196 180 197 // I need to generate a collection of values dR,dD(R,D), where dR = average.R - ICRF.R, etc. … … 189 206 // record these in arcsec or degree? 190 207 // correct for cos(D) or not? 191 double dR = average->R - measure->R; 192 double dD = average->D - measure->D; 193 208 double dR = 3600.0*(average->R - measure->R); 209 double dD = 3600.0*(average->D - measure->D); 210 211 fprintf (f, "%12.8f %12.8f %7.3f %7.3f\n", average->R, average->D, dR, dD); 194 212 if (isnan(dR)) continue; 195 213 if (isnan(dD)) continue; … … 205 223 dDc->Fi[j] += dD * SH->Fi[j]; 206 224 } 207 } 225 } 226 fclose (f); 208 227 209 228 for (j = 0; j < SH->Nterms; j++) { 210 dRc->Fr[j] *= 4.0*M_PI/ Nicrf;211 dRc->Fi[j] *= 4.0*M_PI/ Nicrf;212 dDc->Fr[j] *= 4.0*M_PI/ Nicrf;213 dDc->Fi[j] *= 4.0*M_PI/ Nicrf;229 dRc->Fr[j] *= 4.0*M_PI/(float)Nicrf; 230 dRc->Fi[j] *= 4.0*M_PI/(float)Nicrf; 231 dDc->Fr[j] *= 4.0*M_PI/(float)Nicrf; 232 dDc->Fi[j] *= 4.0*M_PI/(float)Nicrf; 214 233 } 215 234 SHtermsFree (SH); … … 283 302 if (!status) continue; 284 303 304 R = ohana_normalize_angle (R); 305 285 306 int iD = (D + 89.0) / frame->scale; 307 if (iD < 0) continue; 308 if (iD >= frame->Ndec) continue; 286 309 int iR = R / frame->dR[iD]; 310 if (iR < 0) continue; 311 if (iR >= frame->Nra[iD]) continue; 312 287 313 288 314 float value = NAN; … … 507 533 508 534 int iD = (D + 89.0) / frame->scale; 535 if (iD < 0) continue; 536 if (iD >= frame->Ndec) continue; 537 509 538 int iR = R / frame->dR[iD]; 539 if (iR < 0) continue; 540 if (iR >= frame->Nra[iD]) continue; 510 541 511 542 double dR = frame->Roff[iD][iR]; 512 543 double dD = frame->Doff[iD][iR]; 513 average->R -= dR ;514 average->D -= dD ;544 average->R -= dR / 3600.0; 545 average->D -= dD / 3600.0; 515 546 } 516 547 } -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/bcatalog.c
r37622 r37623 85 85 if (USE_ICRF_CORRECT && (subcatalog[0].average[Naverage].flags & ID_ICRF_QSO)) { 86 86 Nm = 0; 87 int savedICRF = FALSE; 87 88 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 88 89 … … 100 101 // we need to save the location of the ICRF QSOs in the database 101 102 if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_ICRF_QSO) { 102 ICRFsave (Nsubcatalog, Naverage, Nmeasure); 103 fprintf (f, "%d %d %d : %f %f : %f %f\n", (int) Nsubcatalog, (int) Naverage, (int) Nmeasure, 104 catalog[0].average[i].R, catalog[0].average[i].D, 105 catalog[0].measure[offset].R, catalog[0].measure[offset].D); 106 Nicrf ++; 103 if (!savedICRF) { 104 ICRFsave (Nsubcatalog, Naverage, Nmeasure); 105 fprintf (f, "%d %d %d : %f %f : %f %f\n", (int) Nsubcatalog, (int) Naverage, (int) Nmeasure, 106 catalog[0].average[i].R, catalog[0].average[i].D, 107 catalog[0].measure[offset].R, catalog[0].measure[offset].D); 108 Nicrf ++; 109 savedICRF = TRUE; 110 } 107 111 } 108 112
Note:
See TracChangeset
for help on using the changeset viewer.
