Changeset 40659
- Timestamp:
- Mar 29, 2019, 4:23:48 PM (7 years ago)
- Location:
- trunk/Ohana/src/opihi/mana
- Files:
-
- 5 edited
-
deimos_fitslit.c (modified) (1 diff)
-
deimos_getobj.c (modified) (5 diffs)
-
deimos_mkmodel.c (modified) (1 diff)
-
deimos_mkobj.c (modified) (3 diffs)
-
deimos_mkslit.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/mana/deimos_fitslit.c
r40622 r40659 32 32 int Ny = wind[0].matrix.Naxis[1]; 33 33 34 if (Nx != slit[0].matrix.Naxis[0]) return FALSE;35 if (Ny != slit[0].matrix.Naxis[1]) return FALSE;34 if (Nx != slit[0].matrix.Naxis[0]) { gprint (GP_ERR, "size mismatch in fitslit for window and slit\n"); return FALSE; } 35 if (Ny != slit[0].matrix.Naxis[1]) { gprint (GP_ERR, "size mismatch in fitslit for window and slit\n"); return FALSE; } 36 36 37 37 ResetVector (flux, OPIHI_FLT, Ny); -
trunk/Ohana/src/opihi/mana/deimos_getobj.c
r40642 r40659 63 63 64 64 float stilt = 0.0; // angle of the slit 65 66 int SaveSegments = FALSE; 67 if ((N = get_argument (argc, argv, "-save-segments"))) { 68 remove_argument (N, &argc, argv); 69 SaveSegments = TRUE; 70 } 65 71 66 72 // Input parameters: … … 194 200 float dxMax = 0; // maximum distance between sky regions 195 201 202 Vector *skyLsV = NULL, *skyLeV = NULL, *skyLfV = NULL, *skyRsV = NULL, *skyReV = NULL, *skyRfV = NULL; 203 Vector *bckLsV = NULL, *bckLeV = NULL, *bckLfV = NULL, *bckRsV = NULL, *bckReV = NULL, *bckRfV = NULL; 204 if (SaveSegments) { 205 skyLsV = SelectVector ("skyLs", ANYVECTOR, TRUE); ResetVector (skyLsV, OPIHI_FLT, Ny); 206 skyLeV = SelectVector ("skyLe", ANYVECTOR, TRUE); ResetVector (skyLeV, OPIHI_FLT, Ny); 207 skyLfV = SelectVector ("skyLf", ANYVECTOR, TRUE); ResetVector (skyLfV, OPIHI_FLT, Ny); 208 skyRsV = SelectVector ("skyRs", ANYVECTOR, TRUE); ResetVector (skyRsV, OPIHI_FLT, Ny); 209 skyReV = SelectVector ("skyRe", ANYVECTOR, TRUE); ResetVector (skyReV, OPIHI_FLT, Ny); 210 skyRfV = SelectVector ("skyRf", ANYVECTOR, TRUE); ResetVector (skyRfV, OPIHI_FLT, Ny); 211 bckLsV = SelectVector ("bckLs", ANYVECTOR, TRUE); ResetVector (bckLsV, OPIHI_FLT, Ny); 212 bckLeV = SelectVector ("bckLe", ANYVECTOR, TRUE); ResetVector (bckLeV, OPIHI_FLT, Ny); 213 bckLfV = SelectVector ("bckLf", ANYVECTOR, TRUE); ResetVector (bckLfV, OPIHI_FLT, Ny); 214 bckRsV = SelectVector ("bckRs", ANYVECTOR, TRUE); ResetVector (bckRsV, OPIHI_FLT, Ny); 215 bckReV = SelectVector ("bckRe", ANYVECTOR, TRUE); ResetVector (bckReV, OPIHI_FLT, Ny); 216 bckRfV = SelectVector ("bckRf", ANYVECTOR, TRUE); ResetVector (bckRfV, OPIHI_FLT, Ny); 217 } 218 196 219 // loop over the y positions 197 220 for (int iy = 0; iy < Ny; iy++) { … … 211 234 dxMax = MAX (dxMax, skyX_rt[iy] - skyX_lf[iy]); // this is a constant value unless we ignore some of the pixels 212 235 // assert skyX_rt > skyX_lf ? 236 237 if (SaveSegments) { 238 skyLsV->elements.Flt[iy] = S_s_l + Xtrace; 239 skyLeV->elements.Flt[iy] = S_e_l + Xtrace; 240 skyLfV->elements.Flt[iy] = skyF_lf[iy]; 241 skyRsV->elements.Flt[iy] = S_s_r + Xtrace; 242 skyReV->elements.Flt[iy] = S_e_r + Xtrace; 243 skyRfV->elements.Flt[iy] = skyF_rt[iy]; 244 bckLsV->elements.Flt[iy] = B_s_l + Xtrace; 245 bckLeV->elements.Flt[iy] = B_e_l + Xtrace; 246 bckLfV->elements.Flt[iy] = bckF_lf[iy]; 247 bckRsV->elements.Flt[iy] = B_s_r + Xtrace; 248 bckReV->elements.Flt[iy] = B_e_r + Xtrace; 249 bckRfV->elements.Flt[iy] = bckF_rt[iy]; 250 } 213 251 } 214 252 … … 253 291 float Xtrace = Xref - Xpsf + dXtrace; 254 292 293 // include the PSF trace and restrict the fit below to portions where the profile is > 0.95 294 255 295 // now I need to find the limits of the PSF in the buffer at this iy location 256 296 for (int ipsf = 0; ipsf < Npsf; ipsf ++) { … … 267 307 float S1 = 0.0, S2 = 0.0; 268 308 for (int ipsf = 0; ipsf < Npsf; ipsf++) { 309 if (iy == 6000) { 310 fprintf (stderr, "%d : %f %f : %f\n", ipsf, tmpv[ipsf], psfV[ipsf], tmpv[ipsf]*psfV[ipsf]); 311 } 269 312 S1 += tmpv[ipsf]*psfV[ipsf]; // if we have an errorbar, include / SQ(sigv[i]) 270 313 S2 += psfV[ipsf]*psfV[ipsf]; // if we have an errorbar, include / SQ(sigv[i]) -
trunk/Ohana/src/opihi/mana/deimos_mkmodel.c
r40655 r40659 164 164 opihi_flt g = 0.0, s = 0.0; 165 165 for (int n = -Nkernel_y2; n <= Nkernel_y2; n++) { 166 if (iy +n < 0) continue; // bottom edge of full image167 if (iy +n >= Ny) continue; // top edge of full image166 if (iy - n < 0) continue; // bottom edge of full image 167 if (iy - n >= Ny) continue; // top edge of full image 168 168 int pix = ix + (n + Nkernel_y2)*Nx; 169 169 myAssert (pix < Nkernel_pix, "oops (apply_tilt)"); 170 s += kernel[pix]*input[ix + (iy +n)*Nx];170 s += kernel[pix]*input[ix + (iy - n)*Nx]; 171 171 g += kernel[pix]; // optimization: save g[ix], all should be the same 172 172 } -
trunk/Ohana/src/opihi/mana/deimos_mkobj.c
r40655 r40659 208 208 209 209 float sin_stilt = sin(stilt*RAD_DEG); 210 int Nyk = ceil(Nx * fabs(sin_stilt)) ;210 int Nyk = ceil(Nx * fabs(sin_stilt)) + 1; // one extra pixel buffer 211 211 if (Nyk < 3) Nyk = 3; // minimum of 3 pixels (or kernel assumption below fails) 212 212 Nyk += NlsfFull; … … 260 260 myAssert (Nkpix_i < Nkpix, "oops"); 261 261 kernel[Nkpix_i] = dyf; 262 //fprintf (stderr, "%d, %d: %f %f\n", ix, (dyi + Nyk2), kernel[ix + (dyi + Nyk2 + 0)*Nx], kernel[ix + (dyi + Nyk2 + 1)*Nx]);262 fprintf (stderr, "%d, %d: %f %f\n", ix, (dyi + Nyk2), kernel[ix + (dyi + Nyk2 + 0)*Nx], kernel[ix + (dyi + Nyk2 + 1)*Nx]); 263 263 } 264 264 } … … 280 280 opihi_flt g = 0.0, s = 0.0; 281 281 for (int n = -Nyk2; n <= Nyk2; n++) { 282 if (iy +n < 0) continue; // bottom edge of full image283 if (iy +n >= Ny) continue; // top edge of full image282 if (iy - n < 0) continue; // bottom edge of full image 283 if (iy - n >= Ny) continue; // top edge of full image 284 284 int Nkpix_i = ix + (n + Nyk2)*Nx; 285 285 myAssert (Nkpix_i < Nkpix, "oops"); 286 s += kernel[Nkpix_i]*s1[ix + (iy +n)*Nx];286 s += kernel[Nkpix_i]*s1[ix + (iy - n)*Nx]; 287 287 g += kernel[Nkpix_i]; 288 288 } -
trunk/Ohana/src/opihi/mana/deimos_mkslit.c
r40622 r40659 56 56 57 57 // define the output window 58 int Nx = 2*profile[0].Nelements ;58 int Nx = 2*profile[0].Nelements + 1; 59 59 int Ny = flux ? flux[0].Nelements : fluxbins; 60 60
Note:
See TracChangeset
for help on using the changeset viewer.
