IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2019, 4:23:48 PM (7 years ago)
Author:
eugene
Message:

fix some fitting details (slit tilt interpolation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/mana/deimos_getobj.c

    r40642 r40659  
    6363
    6464  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  }
    6571
    6672  // Input parameters:
     
    194200  float dxMax = 0; // maximum distance between sky regions
    195201
     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
    196219  // loop over the y positions
    197220  for (int iy = 0; iy < Ny; iy++) {
     
    211234    dxMax = MAX (dxMax, skyX_rt[iy] - skyX_lf[iy]); // this is a constant value unless we ignore some of the pixels
    212235    // 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    }
    213251  }
    214252
     
    253291    float Xtrace = Xref - Xpsf + dXtrace;
    254292   
     293    // include the PSF trace and restrict the fit below to portions where the profile is > 0.95
     294
    255295    // now I need to find the limits of the PSF in the buffer at this iy location
    256296    for (int ipsf = 0; ipsf < Npsf; ipsf ++) {
     
    267307    float S1 = 0.0, S2 = 0.0;
    268308    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      }
    269312      S1 += tmpv[ipsf]*psfV[ipsf]; // if we have an errorbar, include / SQ(sigv[i])
    270313      S2 += psfV[ipsf]*psfV[ipsf]; // if we have an errorbar, include / SQ(sigv[i])
Note: See TracChangeset for help on using the changeset viewer.