IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41367


Ignore:
Timestamp:
May 27, 2020, 2:21:31 PM (6 years ago)
Author:
tdeboer
Message:

gpc1 dynamic masks set up

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/gpc1/ghost.model.mdc

    r33850 r41367  
    1 # Original center models
    2 # GHOST.CENTER.X METADATA
    3 #   NORDER_X S32 3
    4 #   NORDER_Y S32 3
    5 #   VAL_X00_Y00  F64 -4.421024e+01
    6 #   VAL_X01_Y00  F64 1.216270e-02
    7 #   VAL_X02_Y00  F64 -9.721643e-08
    8 #   VAL_X03_Y00  F64 9.976554e-11
    9 #   VAL_X00_Y01  F64 -1.762476e-03
    10 #   VAL_X01_Y01  F64 1.247212e-07
    11 #   VAL_X02_Y01  F64 3.629557e-11
    12 #   VAL_X00_Y02  F64 -1.040174e-07
    13 #   VAL_X01_Y02  F64 1.074674e-10
    14 #   VAL_X00_Y03  F64 1.564112e-11
    15 #   NELEMENTS  S32 10
    16 # END
     1# TdB20200522 ghost model fit for gpc1
     2#Inner radii are left from the default gpc1 values
    173
    18 # GHOST.CENTER.Y METADATA
    19 #   NORDER_X S32 3
    20 #   NORDER_Y S32 3
    21 #   VAL_X00_Y00  F64 -2.189470e+00
    22 #   VAL_X01_Y00  F64 -4.186514e-03
    23 #   VAL_X02_Y00  F64 1.131554e-07
    24 #   VAL_X03_Y00  F64 1.415192e-11
    25 #   VAL_X00_Y01  F64 1.569104e-02
    26 #   VAL_X01_Y01  F64 -1.782801e-07
    27 #   VAL_X02_Y01  F64 8.179602e-11
    28 #   VAL_X00_Y02  F64 2.577055e-07
    29 #   VAL_X01_Y02  F64 8.879423e-11
    30 #   VAL_X00_Y03  F64 5.767429e-11
    31 #   NELEMENTS  S32 10
    32 # END
     4GHOST.MIRROR.RAD METADATA
     5  NORDER_X S32 1
     6  VAL_X00  F64 -329.27244159
     7  VAL_X01  F64 2.0664288
     8  NELEMENTS  S32 2
     9END
    3310
    34 # Updated models of 2012-05-07
    35 # Corrected(?) parity
    36 # GHOST.CENTER.X METADATA
    37 #   NORDER_X S32 3
    38 #   NORDER_Y S32 3
    39 #   VAL_X00_Y00  F64  3.314569e+01
    40 #   VAL_X01_Y00  F64  1.110664e-02
    41 #   VAL_X02_Y00  F64 -1.904158e-07
    42 #   VAL_X03_Y00  F64  8.470224e-11
    43 #   VAL_X00_Y01  F64 -1.616877e-03
    44 #   VAL_X01_Y01  F64  1.646508e-07
    45 #   VAL_X02_Y01  F64  5.623381e-11
    46 #   VAL_X00_Y02  F64 -2.342888e-07
    47 #   VAL_X01_Y02  F64  1.023761e-10
    48 #   VAL_X00_Y03  F64  2.836980e-11
    49 #   NELEMENTS  S32 10
    50 # END
    51 
    52 # GHOST.CENTER.Y METADATA
    53 #   NORDER_X S32 3
    54 #   NORDER_Y S32 3
    55 #   VAL_X00_Y00  F64 -2.860068e+01
    56 #   VAL_X01_Y00  F64 -8.790076e-03
    57 #   VAL_X02_Y00  F64  2.456534e-07
    58 #   VAL_X03_Y00  F64  2.947749e-11
    59 #   VAL_X00_Y01  F64  1.948855e-02
    60 #   VAL_X01_Y01  F64 -2.639927e-07
    61 #   VAL_X02_Y01  F64  4.951474e-11
    62 #   VAL_X00_Y02  F64  4.341716e-07
    63 #   VAL_X01_Y02  F64  1.643046e-10
    64 #   VAL_X00_Y03  F64 -1.737983e-12
    65 #   NELEMENTS  S32 10
    66 # END
    67 
    68 # Switched order
    6911GHOST.CENTER.X METADATA
    7012  NORDER_X S32 3
    7113  NORDER_Y S32 3
    72   VAL_X00_Y00  F64 -1.215661e+02
    73   VAL_X01_Y00  F64  1.321875e-02
    74   VAL_X02_Y00  F64 -4.017026e-09
    75   VAL_X03_Y00  F64  1.148288e-10
    76   VAL_X00_Y01  F64 -1.908074e-03
    77   VAL_X01_Y01  F64  8.479150e-08
    78   VAL_X02_Y01  F64  1.635732e-11
    79   VAL_X00_Y02  F64  2.625405e-08
    80   VAL_X01_Y02  F64  1.125586e-10
    81   VAL_X00_Y03  F64  2.912432e-12
     14  VAL_X00_Y00  F64 -1.67627557e+01
     15  VAL_X01_Y00  F64 -1.15377631e-02
     16  VAL_X02_Y00  F64 -9.88483348e-08
     17  VAL_X03_Y00  F64  4.14561887e-11
     18  VAL_X00_Y01  F64 -9.13131313e-05
     19  VAL_X01_Y01  F64  1.40192992e-08
     20  VAL_X02_Y01  F64  9.78192800e-12
     21  VAL_X00_Y02  F64 -9.82584386e-09
     22  VAL_X01_Y02  F64  5.48708364e-11
     23  VAL_X00_Y03  F64  5.09109210e-13
    8224  NELEMENTS  S32 10
    8325END
     
    8628  NORDER_X S32 3
    8729  NORDER_Y S32 3
    88   VAL_X00_Y00  F64  2.422174e+01
    89   VAL_X01_Y00  F64  4.170486e-04
    90   VAL_X02_Y00  F64 -1.934260e-08
    91   VAL_X03_Y00  F64 -1.173657e-12
    92   VAL_X00_Y01  F64  1.189352e-02
    93   VAL_X01_Y01  F64 -9.256748e-08
    94   VAL_X02_Y01  F64  1.140772e-10
    95   VAL_X00_Y02  F64  8.123932e-08
    96   VAL_X01_Y02  F64  1.328378e-11
    97   VAL_X00_Y03  F64  1.170865e-10
     30  VAL_X00_Y00  F64  3.44511879e+00
     31  VAL_X01_Y00  F64 -1.08538420e-03
     32  VAL_X02_Y00  F64 -3.17872409e-08
     33  VAL_X03_Y00  F64  5.29317184e-12
     34  VAL_X00_Y01  F64 -1.22162715e-02
     35  VAL_X01_Y01  F64 -2.30510155e-08
     36  VAL_X02_Y01  F64  4.75814089e-11
     37  VAL_X00_Y02  F64 -1.28748715e-07
     38  VAL_X01_Y02  F64  5.78808885e-12
     39  VAL_X00_Y03  F64  5.11500780e-11
    9840  NELEMENTS  S32 10
    9941END
    10042
    101 
    102 
    103 # These are semi-major/minor axes
    104 # These are my (CZW) quadratic solutions
    105 # GHOST.INNER.MAJOR METADATA
    106 #   NORDER_X S32 2
    107 #   VAL_X00  F64 2.2622e+01
    108 #   VAL_X01  F64 1.3822e-02
    109 #   VAL_X02  F64 -3.7005e-07
    110 #   NELEMENTS  S32 3
    111 # END
    112 
    113 # GHOST.INNER.MINOR METADATA
    114 #   NORDER_X S32 2
    115 #   VAL_X00  F64 4.9626e+01
    116 #   VAL_X01  F64 -2.4257e-04
    117 #   VAL_X02  F64 -1.2007e-07
    118 #   NELEMENTS  S32 3
    119 # END
    120 
    121 # GHOST.OUTER.MAJOR METADATA
    122 #   NORDER_X S32 2
    123 #   VAL_X00  F64 9.6490e+01
    124 #   VAL_X01  F64 9.4250e-03
    125 #   VAL_X02  F64 6.5680e-07
    126 #   NELEMENTS  S32 3
    127 # END
    128 
    129 # GHOST.OUTER.MINOR METADATA
    130 #   NORDER_X S32 2
    131 #   VAL_X00  F64 9.5450e+01
    132 #   VAL_X01  F64 2.8775e-03
    133 #   VAL_X02  F64 -3.1409e-07
    134 #   NELEMENTS  S32 3
    135 # END
    136 
    137 # These are the original linear solutions
    13843GHOST.INNER.MAJOR METADATA
    13944  NORDER_X S32 1
     
    15156
    15257GHOST.OUTER.MAJOR METADATA
    153   NORDER_X S32 1
    154   VAL_X00  F64 7.928722e+01
    155   VAL_X01  F64 1.722181e-02
    156   NELEMENTS  S32 2
     58  NORDER_X S32 2
     59  VAL_X00  F64 8.99331326e+01
     60  VAL_X01  F64 1.17511553e-02
     61  VAL_X02  F64 6.21923231e-07
     62  NELEMENTS  S32 3
    15763END
    15864
    15965GHOST.OUTER.MINOR METADATA
    16066  NORDER_X S32 1
    161   VAL_X00  F64 1.314265e+02
    162   VAL_X01  F64 -2.627153e-03
     67  VAL_X00  F64 1.36523263e+02
     68  VAL_X01  F64 -3.5025434e-03
    16369  NELEMENTS  S32 2
    16470END
  • trunk/ippconfig/gpc1/psastro.config

    r40875 r41367  
    129129DVO.GETSTAR.PHOTCODE        STR      i
    130130DVO.GETSTAR.MAX.RHO         F32      10000.0
    131 DVO.GETSTAR.MIN.MAG         F32      12.0
    132 DVO.GETSTAR.MIN.MAG.INST    F32     -25.0
     131DVO.GETSTAR.MIN.MAG         F32      2.0
     132DVO.GETSTAR.MIN.MAG.INST    F32     -35.0
    133133
    134134# rather than mean, use specified EDGE:
     
    144144  PHOTCODE STR g
    145145  GHOST_MAX_MAG                   F32 -16.5
     146  GLINT_MAX_MAG                   F32 -23.0
    146147END
    147148PHOTCODE.DATA METADATA
     
    150151  PHOTCODE STR r
    151152  GHOST_MAX_MAG                   F32 -20.0
     153  GLINT_MAX_MAG                   F32 -23.0
    152154END
    153155PHOTCODE.DATA METADATA
     
    155157  ZEROPT   F32 24.611
    156158  PHOTCODE STR i
    157   GHOST_MAX_MAG                   F32 -25.0
     159  GHOST_MAX_MAG                   F32 -22.0
     160  GLINT_MAX_MAG                   F32 -23.4
    158161END
    159162PHOTCODE.DATA METADATA
     
    161164  ZEROPT   F32 24.250
    162165  PHOTCODE STR z
    163   GHOST_MAX_MAG                   F32 -25.0
     166  GHOST_MAX_MAG                   F32 -22.0
     167  GLINT_MAX_MAG                   F32 -23.4
    164168END
    165169PHOTCODE.DATA METADATA
     
    167171  ZEROPT   F32 23.320
    168172  PHOTCODE STR y
    169   GHOST_MAX_MAG                   F32 -25.0
     173  GHOST_MAX_MAG                   F32 -21.5
     174  GLINT_MAX_MAG                   F32 -23.0
    170175END
    171176PHOTCODE.DATA METADATA
     
    173178  ZEROPT   F32 26.3
    174179  PHOTCODE STR r
    175   GHOST_MAX_MAG                   F32 -20.0
     180  GHOST_MAX_MAG                   F32 -20.4
     181  GLINT_MAX_MAG                   F32 -24.4
    176182END
    177183
     
    180186REFSTAR_MASK_SATSTAR_MAG_MAX    F32 -15.0
    181187REFSTAR_MASK_SATSTAR_MAG_SLOPE  F32  10.15
    182 # CZW: Original 2010-02-08 position angle offset
    183 REFSTAR_MASK_SATSTAR_POS_ZERO   F32  -0.798
    184 # CZW: Updated 2011-02-18 position angle offset. As above, offset 0.5 degree.
    185 # REFSTAR_MASK_SATSTAR_POS_ZERO   F32  -0.78927
    186 #REFSTAR_MASK_SATSTAR_POS_ZERO   F32  -0.80237
    187 #REFSTAR_MASK_SATSTAR_POS_ZERO   F32  -0.81109
    188 # Length = 10**(SLOPE*(MAG_MAX - InstMag)) - OFFSET
     188
     189# TdB20200430: Updated satspike position angle offset
     190REFSTAR_MASK_SATSTAR_POS_ZERO   F32  -0.79451
     191PSASTRO.MODEL.ROT.PARITY      S32     1
     192
     193#TdB20200229: The size of saturated star circles should be an exponential for gpc2
     194#rad(mag) = REFSTAR_MASK_SATSTAR_RAD_OFFSET + REFSTAR_MASK_SATSTAR_EXP**(REFSTAR_MASK_SATSTAR_MAG_MAX-mag)
     195REFSTAR_MASK_SATSTAR_MAG_MAX    F32 -11.363
     196REFSTAR_MASK_SATSTAR_RAD_OFFSET F32  17.631
     197REFSTAR_MASK_SATSTAR_EXP        F32   1.493
    189198
    190199REFSTAR_MASK_SATSPIKE_MAG_SLOPE F32  0.096
     
    203212
    204213
    205 
    206 
    207214REFSTAR_MASK_BLEED              BOOL FALSE
    208215REFSTAR_MASK_BLEED_MAG_MAX      F32 -15.0
     
    218225# GHOST_MAX_MAG                   F32 -20.0
    219226
    220 GLINT_LENGTH_MAG_SLOPE          F32 2500.0
    221 GLINT_LENGTH_MAG_ZERO           F32 -20.0
    222 GLINT_WIDTH                     F32  150.0
    223227REFSTAR_COUNT_GHOSTS            BOOL TRUE
    224228REFSTAR_MASK_GHOST              BOOL TRUE
    225 
    226 # GHOST_CENTER_X_0              F32   66.2
    227 # GHOST_CENTER_X_SLOPE          F32   -0.02454
    228 # GHOST_CENTER_Y_0              F32   16.6
    229 # GHOST_CENTER_Y_SLOPE          F32   +0.01565
    230 #
    231 # GHOST_INNER_MAJOR_0           F32   32.9
    232 # GHOST_INNER_MAJOR_SLOPE         F32   +0.00612
    233 # GHOST_INNER_MINOR_0           F32   58.7
    234 # GHOST_INNER_MINOR_SLOPE         F32   -0.00258
    235 #
    236 # GHOST_OUTER_MAJOR_0           F32   90.6
    237 # GHOST_OUTER_MAJOR_SLOPE         F32   +0.01548
    238 # GHOST_OUTER_MINOR_0           F32  133.9
    239 # GHOST_OUTER_MINOR_SLOPE         F32   -0.00288
     229PSASTRO.SAVE.GHOSTS             BOOL TRUE  # save ghost positions as table in output smf file
     230
     231#TdB20200305: The length of glints as function of mag is recomputed for gpc2
     232#glint_length(mag) = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO-mag)
     233GLINT_LENGTH_MAG_SLOPE          F32 1901.0
     234GLINT_LENGTH_MAG_ZERO           F32 -16.8
     235#TdB20200308: The length of glints also depends on position off the focal plane (perpendicular to pixel FPA), out to GLINT_LENGTH_POS_CUT
     236#glint_length(pos) = GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF-pos)
     237GLINT_LENGTH_POS_SLOPE          F32 0.00019
     238GLINT_LENGTH_POS_REF            F32 33821.
     239GLINT_LENGTH_POS_CUT            F32 30700.
     240GLINT_LENGTH_MIN_FPA            F32 1500.0
     241#TdB20200312: The angle that glints have depends on position along the focal plane (parallel to pixel FPA)
     242#glint_angle(pos) = GLINT_ANGLE_SLOPE*(GLINT_ANGLE_POS_REF-(pos/1000))
     243GLINT_ANGLE_POS_SLOPE           F32  0.07903 
     244GLINT_ANGLE_POS_REF             F32 -575.5
     245GLINT_WIDTH                     F32  80.0
     246
     247# save glint positions?
     248PSASTRO.SAVE.GLINTS             BOOL TRUE  # save glint positions as table in output smf file
     249
    240250
    241251PR_RECIPE METADATA
     
    244254
    245255REFSTAR_MASK_GLINTS             BOOL  TRUE
    246 GLINT_MAX_MAG                   F32 -21.0
     256GLINT_MAX_MAG                   F32 -21.
    247257GLINT.REGION                    MULTI
    248258
     259#TdB20200514: GPC1 does not show any glints coming from the left or right, at all, after searching thousands of images. So, shrinking the bounding boxes to zero.
    249260GLINT.REGION                    METADATA
    250   REGION                        STR  [-38000:-24000,-20000:+20000]
     261  REGION                        STR  [-38000:-38000,-20000:+20000]
    251262  GLINT.TYPE                    STR  LEFT
    252263END
    253264
    254265GLINT.REGION                    METADATA
    255   REGION                        STR  [+24000:+38000,-20000:+20000]
     266  REGION                        STR  [+38000:+38000,-20000:+20000]
    256267  GLINT.TYPE                    STR  RIGHT
    257268END
  • trunk/ippconfig/gpc2/ghost.model.mdc

    r41348 r41367  
    11# TdB20200327 ghost model fit for gpc2
    22
    3 # These are the original linear solutions for gpc1
    43GHOST.MIRROR.RAD METADATA
    54  NORDER_X S32 1
     
    4140END
    4241
    43 # These are the original linear solutions for gpc1
    4442GHOST.INNER.MAJOR METADATA
    4543  NORDER_X S32 1
  • trunk/ippconfig/gpc2/psastro.config

    r41350 r41367  
    145145  PHOTCODE STR g
    146146  GHOST_MAX_MAG                   F32 -16.5
     147  GLINT_MAX_MAG                   F32 -23.0
    147148END
    148149PHOTCODE.DATA METADATA
     
    151152  PHOTCODE STR r
    152153  GHOST_MAX_MAG                   F32 -20.0
     154  GLINT_MAX_MAG                   F32 -23.0
    153155END
    154156PHOTCODE.DATA METADATA
     
    157159  PHOTCODE STR i
    158160  GHOST_MAX_MAG                   F32 -23.5
     161  GLINT_MAX_MAG                   F32 -21.0
    159162END
    160163PHOTCODE.DATA METADATA
     
    163166  PHOTCODE STR z
    164167  GHOST_MAX_MAG                   F32 -25.0
     168  GLINT_MAX_MAG                   F32 -23.0
    165169END
    166170PHOTCODE.DATA METADATA
     
    169173  PHOTCODE STR y
    170174  GHOST_MAX_MAG                   F32 -25.0
     175  GLINT_MAX_MAG                   F32 -23.0
    171176END
    172177PHOTCODE.DATA METADATA
     
    175180  PHOTCODE STR r
    176181  GHOST_MAX_MAG                   F32 -23.5
     182  GLINT_MAX_MAG                   F32 -21.0
    177183END
    178184
     
    229235GLINT_LENGTH_MAG_SLOPE          F32 1901.0
    230236GLINT_LENGTH_MAG_ZERO           F32 -16.8
    231 #TdB20200308: The length of glints also depends on position off the focal plane (perpendicular to pixel FPA)
     237#TdB20200308: The length of glints also depends on position off the focal plane (perpendicular to pixel FPA), out to GLINT_LENGTH_POS_CUT
    232238#glint_length(pos) = GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF-pos)
    233239GLINT_LENGTH_POS_SLOPE          F32 0.00019
    234 GLINT_LENGTH_POS_REF            F32 33821
     240GLINT_LENGTH_POS_REF            F32 33821.
     241GLINT_LENGTH_POS_CUT            F32 30000.
     242GLINT_LENGTH_MIN_FPA            F32 1500.0
    235243#TdB20200312: The angle that glints have depends on position along the focal plane (parallel to pixel FPA)
    236244#glint_angle(pos) = GLINT_ANGLE_SLOPE*(GLINT_ANGLE_POS_REF-(pos/1000))
  • trunk/ippconfig/recipes/psastro.config

    r41338 r41367  
    190190GLINT_LENGTH_POS_SLOPE          F32 0.0
    191191GLINT_LENGTH_POS_REF            F32 0.0
     192GLINT_LENGTH_POS_CUT            F32 0.0
     193GLINT_LENGTH_MIN_FPA            F32 0.0
    192194GLINT_ANGLE_POS_SLOPE           F32 0.0
    193195GLINT_ANGLE_POS_REF             F32 0.0
  • trunk/psModules/src/objects/pmSourceIO.h

    r41348 r41367  
    9191bool pmSourceIO_ReadMatchedRefs (psFits *fits, pmFPA *fpa, const pmConfig *config);
    9292
     93bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe);
    9394bool pmSourceIO_WriteGlints (psFits *fits, pmFPA *fpa, pmConfig *config);
    9495bool pmSourceIO_WriteGhosts (psFits *fits, pmFPA *fpa, pmConfig *config);
  • trunk/psModules/src/objects/pmSourceIO_Ghosts.c

    r41348 r41367  
    135135    pmFPAview *view = pmFPAviewAlloc (0);
    136136
    137     GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     137    //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
     138    float mirCheck = 0;
     139    md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD");
     140    if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); }
     141    if (md) {
     142        GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     143        mirCheck = 1;
     144    } 
     145
    138146    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    139147    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    143151    GET_1D_POLY ("GHOST.INNER.MAJOR", innerMajor);
    144152    GET_1D_POLY ("GHOST.INNER.MINOR", innerMinor);
     153
    145154
    146155    // select the input astrometry data (also carries the refstars)
     
    153162
    154163    // really error-out here?  or just skip?
    155     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa_ast, recipe)) {
     164    if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
    156165        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    157166        goto escape;
     
    201210                        double theta0 = atan2(ref->FP->y,ref->FP->x);
    202211
    203                         double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
    204                         double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
    205                         double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
    206 
    207                         // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
    208                         ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    209                         ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     212                        if(mirCheck) {
     213                            //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
     214                            double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     215                            double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
     216                            double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
     217
     218                            // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
     219                            ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     220                            ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     221                        } 
     222                        if(!mirCheck) {
     223                            //Use the old-style ghost position determination
     224                            ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
     225                            ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y);
     226                        }
    210227
    211228                        ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    503520  return true;
    504521}
     522
     523
  • trunk/psModules/src/objects/pmSourceIO_Glints.c

    r41349 r41367  
    7878    if (!REFSTAR_MASK_GLINTS) return true;
    7979
    80     // select the limiting magnitude
     80    // select relevant keywords
    8181    double GLINT_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GLINT_MAX_MAG");
    8282    double GLINT_LENGTH_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_SLOPE");
    8383    double GLINT_LENGTH_MAG_ZERO = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_ZERO");
     84    double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
     85
     86    //we will use one of the new keywords to differentiate between an old and new style glint treatment
     87    float glintCheck = 0;
    8488    double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE");
     89    if (!status) { glintCheck = 1; }
    8590    double GLINT_LENGTH_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_REF");
     91    double GLINT_LENGTH_POS_CUT = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_CUT");
    8692    double GLINT_ANGLE_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_SLOPE");
    8793    double GLINT_ANGLE_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_REF");
    88     double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
     94
    8995    bool GLINT_OUTPUT = psMetadataLookupBool(&status, recipe, "PSASTRO.SAVE.GLINTS");
    9096    if (!GLINT_OUTPUT) return true;
     
    111117    // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
    112118    pmFPA *fpa_ast = astrom->fpa;
    113     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa_ast, recipe)) {
     119    if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, NULL,&GLINT_MAX_MAG, fpa_ast, recipe)) {
    114120        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    115121        return false;
     
    167173                }
    168174
     175                double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);
    169176                double glintAngle = 0;
    170                 //compute the angle of the glint, which depends on position parallel to the FPX
    171                 if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){
    172                   glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.));
    173                 }
    174                 if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) {
    175                   glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.));
    176                 }
    177 
    178                 double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);
    179                 //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than 30k pixels     
    180                 if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < 30000 ){
    181                   glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));
    182 
    183                 }
    184                 if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < 30000 ) {
    185                   glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x));
     177
     178                //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than about 30k pixels
     179                if(glintCheck) {
     180                    if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < GLINT_LENGTH_POS_CUT ){
     181                      glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));
     182                    }
     183                    if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < GLINT_LENGTH_POS_CUT ) {
     184                      glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x));
     185                    }
     186                    //also compute the angle of the glint, which depends on position parallel to the FPX
     187                    if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){
     188                      glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.));
     189                    }
     190                    if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) {
     191                      glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.));
     192                    }
    186193                }
    187194
     
    230237}
    231238
    232 
    233 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe) {
     239bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) {
    234240
    235241    bool status;
     
    279285            psLogMsg ("psastro", PS_LOG_INFO, "found GHOST_MAX_MAG %f",*ghostMaxMag);
    280286        }
     287        if (glintMaxMag) {
     288            float MaxMag = psMetadataLookupF32 (&status, refItem->data.md, "GLINT_MAX_MAG");
     289            if (status) {
     290                *glintMaxMag = MaxMag ;
     291                //MEH null is a pain.. so only log if set
     292                psLogMsg ("psastro", PS_LOG_INFO, "found GLINT_MAX_MAG %f",*glintMaxMag);
     293            }
     294        }
     295
    281296        //MEH what zpt is set to
    282297        psLogMsg ("psastro", PS_LOG_INFO, "found ZEROPT  %f",*zeropt);
  • trunk/psastro/src/psastro.h

    r41290 r41367  
    156156psVector         *psastroZeroPointReadoutAccum(psVector *dMag, pmReadout *readout, float exptime, float refminMag, float refmaxMag);
    157157bool              psastroZeroPointAnalysis (psMetadata *header, psVector *dMag, float zeropt, psMetadata *recipe);
    158 bool              psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe);
     158bool              psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe);
    159159bool              psastroZeroPointRefMagLimitFromRecipe (float *refminMag, float *refmaxMag, pmFPA *fpa, psMetadata *recipe);
    160160
  • trunk/psastro/src/psastroChooseGlintStars.c

    r24645 r41367  
    3737
    3838    // really error-out here?  or just skip?
    39     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     39    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    4040        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    4141        return false;
  • trunk/psastro/src/psastroConvert.c

    r39926 r41367  
    6565
    6666      // really error-out here?  or just skip?
    67       if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     67      if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    6868        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    6969        zeropt = 0.0;
  • trunk/psastro/src/psastroExtractGhosts.c

    r24648 r41367  
    5353
    5454    // really error-out here?  or just skip?
    55     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     55    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    5656        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    5757        return false;
  • trunk/psastro/src/psastroExtractStars.c

    r24648 r41367  
    6565
    6666    // really error-out here?  or just skip?
    67     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     67    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    6868        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    6969        return false;
  • trunk/psastro/src/psastroLoadCrosstalk.c

    r36837 r41367  
    9494
    9595  // really error-out here?  or just skip?
    96   if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {
     96  if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, NULL, fpa, recipe)) {
    9797    psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    9898    goto escape;
  • trunk/psastro/src/psastroLoadGhosts.c

    r41348 r41367  
    113113    pmFPAview *view = pmFPAviewAlloc (0);
    114114
    115     GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     115    //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
     116    float mirCheck = 0;
     117    md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD");
     118    if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); }
     119    if (md) {
     120        GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad);
     121        mirCheck = 1;
     122    }
     123
    116124    GET_2D_POLY ("GHOST.CENTER.X", centerX);
    117125    GET_2D_POLY ("GHOST.CENTER.Y", centerY);
     
    131139
    132140    // raise an error if the config is broken
    133     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {
     141    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, NULL, fpa, recipe)) {
    134142        psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe");
    135143        goto escape;
     
    179187                    ghost->srcFP->y = ref->FP->y;
    180188
    181                     //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
    182189                    double rSrc = hypot (ref->FP->x, ref->FP->y);
    183190                    double theta0 = atan2(ref->FP->y,ref->FP->x);
    184191
    185                     double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
    186                     double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
    187                     double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
    188 
    189                     // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
    190                     ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    191                     ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     192                    if(mirCheck) {
     193                         //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
     194                        double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     195                        double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad));
     196                        double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad));
     197
     198                        // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords
     199                        ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     200                        ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
     201                    } 
     202                    if(!mirCheck) {
     203                        //Use the old-style ghost position determination
     204                        ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
     205                        ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y);
     206                    }
    192207
    193208                    ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc);
     
    210225                    ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
    211226                    // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y);
     227
    212228
    213229                    if (ghostChip) {
     
    356372 
    357373  // if a filter is defined, but the recipe elements are missing, the config is broken.
    358   if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) {
     374  if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, NULL, fpa, recipe)) {
    359375        psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe");
    360376        goto escape;
  • trunk/psastro/src/psastroLoadGlints.c

    r41348 r41367  
    2626    bool status;
    2727    float zeropt, exptime;
     28    psVector *x_glint = psVectorAlloc(2,PS_TYPE_F32);
     29    psVector *y_glint = psVectorAlloc(2,PS_TYPE_F32);
    2830
    2931    psLogMsg ("psastro", PS_LOG_INFO, "determine glint positions");
     
    3941    if (!REFSTAR_MASK_GLINTS) return true;
    4042
    41     // select the limiting magnitude
     43    // select relevant keywords
    4244    double GLINT_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GLINT_MAX_MAG");
    4345    double GLINT_LENGTH_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_SLOPE");
    4446    double GLINT_LENGTH_MAG_ZERO = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_ZERO");
     47    double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
     48    double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE");
     49
     50    //we will use one of the new keywords to differentiate between an old and new style glint treatment
     51    float glintCheck = 0;
    4552    double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE");
     53    if (!status) {
     54        psLogMsg ("psastro", PS_LOG_INFO, "Assuming old-style glint masking, given the recipe keywords");
     55        glintCheck = 1;
     56    }
    4657    double GLINT_LENGTH_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_REF");
     58    double GLINT_LENGTH_POS_CUT = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_CUT");
     59    double GLINT_LENGTH_MIN_FPA = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MIN_FPA");
     60    if (!status) GLINT_LENGTH_MIN_FPA=1000.;
    4761    double GLINT_ANGLE_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_SLOPE");
    4862    double GLINT_ANGLE_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_REF");
    49     double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
    50     double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE");
     63
    5164
    5265    // select the set of glint regions (GLINT.REGION is a MULTI of METADATA items)
     
    7083
    7184    // really error-out here?  or just skip?
    72     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     85    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, &GLINT_MAX_MAG, fpa, recipe)) {
    7386        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    7487        return false;
     
    7992    float MagOffset = zeropt + 2.5*log10(exptime);
    8093    GLINT_MAX_MAG += MagOffset;
    81     GLINT_LENGTH_MAG_ZERO += MagOffset;
     94    //GLINT_LENGTH_MAG_ZERO += MagOffset;
    8295
    8396    // select the raw objects for this readout (loaded in psastroExtract.c)
     
    91104    psastroChipBounds (fpa);
    92105
    93 
    94106    // find the possible glint stars, and convert the position to FPA coordinates.
    95107    // search for stars within the glint regions
     
    97109
    98110        pmAstromObj *star = glintStars->data[i];
    99         if (star->Mag > GLINT_MAX_MAG) continue; // XXX should not be needed...
     111        if (star->Mag > GLINT_MAX_MAG) continue;
    100112
    101113        // project glint star to the focal-plane
    102114        psProject (star->TP, star->sky, fpa->toSky);
    103115        psPlaneTransformApply (star->FP, fpa->fromTPA, star->TP);
    104         fprintf (stderr, "glint: %7.2f @ %8.1f, %8.1f (%f %f) %8.1f %8.1f\n", star->Mag, star->FP->x, star->FP->y, star->sky->r * PS_DEG_RAD, star->sky->d * PS_DEG_RAD, star->TP->x,star->TP->y);
     116        //fprintf (stderr, "glint: %7.2f @ %8.1f, %8.1f (%f %f) %8.1f %8.1f\n", star->Mag, star->FP->x, star->FP->y, star->sky->r * PS_DEG_RAD, star->sky->d * PS_DEG_RAD, star->TP->x,star->TP->y);
    105117
    106118        // find the GLINT.REGION this star lands in (if any)
     
    132144            }
    133145
    134             double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);
     146            //double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);
     147            //glint length should depend on the brightness on image, i.e. in instrumental mag. The same instrumental mag in different filters should likely give the same glint length.
     148            double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - (star->Mag-MagOffset));
    135149            double glintAngle = 0;
    136150
    137             //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than 30k pixels     
    138             if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < 30000 ){
    139               glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));
    140 
    141             }
    142             if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < 30000 ) {
    143               glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x));
    144             }
    145             //also compute the angle of the glint, which depends on position parallel to the FPX
    146             if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){
    147               glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.));
    148 
    149             }
    150             if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) {
    151               glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.));
     151            //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than about 30k pixels
     152            if(glintCheck) {
     153                if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < GLINT_LENGTH_POS_CUT ){
     154                  glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));
     155                }
     156                if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < GLINT_LENGTH_POS_CUT ) {
     157                  glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x));
     158                }
     159                //also compute the angle of the glint, which depends on position parallel to the FPX
     160                if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){
     161                  glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.));
     162                }
     163                if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) {
     164                  glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.));
     165                }
    152166            }
    153167
     
    157171            if (!strcasecmp(glintType, "LEFT")   && ((star->FP->x + glintLength) < -20000.))  continue;
    158172            if (!strcasecmp(glintType, "RIGHT")  && ((star->FP->x - glintLength) > 20000.))  continue;
    159 
    160             psVector *x_glint = psVectorAlloc(2,PS_TYPE_F32);
    161             psVector *y_glint = psVectorAlloc(2,PS_TYPE_F32);
    162173
    163174            if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) {
     
    220231                    yFPA1 = yFPA0 + glintLength*cos(glintAngle);
    221232                }
     233
     234                if(glintLength < GLINT_LENGTH_MIN_FPA) continue;
    222235
    223236                x_glint->data.F32[0] = xFPA0;
     
    294307                          psFree (glints);
    295308                        }
    296                        
    297                         fprintf (stderr, "glint %s : %d %f,%f to %f,%f (%f %f %f)\n", glintType, nChip, xChip0, yChip0, xChip1, yChip1, glint_length, glintWidth, chip_angle);
    298                         psVector *glint = psVectorAlloc(5,PS_TYPE_F32);
     309                                                psVector *glint = psVectorAlloc(5,PS_TYPE_F32);
    299310                        glint->data.F32[0] = xChip0;
    300311                        glint->data.F32[1] = yChip0;
     
    369380                    yFPA1 = yFPA0 + glintLength*sin(glintAngle*-1.);
    370381                }
     382
     383                if(glintLength < GLINT_LENGTH_MIN_FPA) continue;
    371384
    372385                x_glint->data.F32[0] = xFPA0;
     
    441454                        }
    442455                       
    443                         fprintf (stderr, "glint %s : %d %f,%f to %f,%f (%f %f %f)\n", glintType, nChip, xChip0, yChip0, xChip1, yChip1, glint_length, glintWidth, chip_angle);
    444 
    445456                        psVector *glint = psVectorAlloc(5,PS_TYPE_F32);
    446457                        glint->data.F32[0] = xChip0;
  • trunk/psastro/src/psastroMaskUpdates.Mosaic.c

    r21183 r41367  
    5656
    5757    // really error-out here?  or just skip?
    58     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {
     58    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    5959        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    6060        return false;
  • trunk/psastro/src/psastroMaskUpdates.c

    r41348 r41367  
    184184
    185185    // really error-out here?  or just skip?
    186     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &GHOST_MAX_MAG, fpa, recipe)) {
     186    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &GHOST_MAX_MAG, NULL, fpa, recipe)) {
    187187        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    188188        return false;
     
    443443                        //psLogMsg ("psastro", 3, "glint: %f %f %f %f\n", glint->x0, glint->y0, glint->x1, glint->y1);
    444444                        //psastroMaskRectangle (readoutMask->mask, glintMaskValue, glint->x0, glint->y0, glint->x1, glint->y1);
    445 
    446                         psLogMsg ("psastro", 3, "glint: %d %f %f %f %f %f\n",i, glint->data.F32[0], glint->data.F32[1],glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
    447445                        psastroMaskBox (readoutMask->mask, glintMaskValue, glint->data.F32[0], glint->data.F32[1],
    448446                                    glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
  • trunk/psastro/src/psastroZeroPoint.c

    r37552 r41367  
    5555
    5656    // really error-out here?  or just skip?
    57     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) {
     57    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, NULL, fpa, recipe)) {
    5858        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    5959        return false;
     
    480480  return false; }
    481481
    482 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe) {
     482bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) {
    483483
    484484    bool status;
     
    527527            //MEH null is a pain.. so only log if set
    528528            psLogMsg ("psastro", PS_LOG_INFO, "found GHOST_MAX_MAG %f",*ghostMaxMag);
     529        }
     530        if (glintMaxMag) {
     531            float MaxMag = psMetadataLookupF32 (&status, refItem->data.md, "GLINT_MAX_MAG");
     532            if (status) {
     533                *glintMaxMag = MaxMag ;
     534                //MEH null is a pain.. so only log if set
     535                psLogMsg ("psastro", PS_LOG_INFO, "found GLINT_MAX_MAG %f",*glintMaxMag);
     536            }
    529537        }
    530538        //MEH what zpt is set to
Note: See TracChangeset for help on using the changeset viewer.