IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 22, 2007, 7:42:46 AM (19 years ago)
Author:
eugene
Message:

finished psastroModel for boresite, created gpcModel for rough theoretical model, added useModel and fixChips options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroModelBoresite.c

    r15887 r15891  
    11# include "psastroStandAlone.h"
    22
    3 // chisq = sum ((L_obs - L_fit(t))^2 + (M_obs - M_fit(t))^2)
    4 // coord[0] = measured L or measured M
     3// the full chisq is built of two associated sums over coordinates:
     4// chisq = sum ((X_obs - X_fit(t))^2 + (Y_obs - Y_fit(t))^2)
     5// we use split this into a 2x long vector and use coord[1] to distinguish the X and Y terms:
     6// coord[0] = measured X or measured Y
    57// coord[1] =          0 or          1
    68psF32 psastroModelBoresite (psVector *deriv, const psVector *params, const psVector *coord) {
     
    1517    float sntht = sin(dtheta);
    1618
    17     // value is L
     19    // value is X
    1820    if (coord->data.F32[1] == 0) {
    1921
    20         float value = PAR[PAR_L0] + PAR[PAR_RL]*cstht*csphi + PAR[PAR_RM]*sntht*snphi;
     22        float value = PAR[PAR_X0] + PAR[PAR_RX]*cstht*csphi + PAR[PAR_RY]*sntht*snphi;
    2123
    2224        if (deriv) {
    2325            psF32 *dPAR = deriv->data.F32;
    24             dPAR[PAR_L0] = 1.0;
    25             dPAR[PAR_M0] = 0.0;
    26             dPAR[PAR_RL] = +cstht*csphi;
    27             dPAR[PAR_RM] = +sntht*snphi;
    28             dPAR[PAR_P0] = -PAR[PAR_RL]*cstht*snphi + PAR[PAR_RM]*sntht*csphi;
    29             dPAR[PAR_T0] =  PAR[PAR_RL]*sntht*csphi - PAR[PAR_RM]*cstht*snphi;
     26            dPAR[PAR_X0] = 1.0;
     27            dPAR[PAR_Y0] = 0.0;
     28            dPAR[PAR_RX] = +cstht*csphi;
     29            dPAR[PAR_RY] = +sntht*snphi;
     30            dPAR[PAR_P0] = -PAR[PAR_RX]*cstht*snphi + PAR[PAR_RY]*sntht*csphi;
     31            dPAR[PAR_T0] =  PAR[PAR_RX]*sntht*csphi - PAR[PAR_RY]*cstht*snphi;
    3032        }
    3133        return (value);
    3234    } 
    3335
    34     // value is M
     36    // value is Y
    3537    if (coord->data.F32[1] == 1) {
    36         float value = PAR[PAR_M0] + PAR[PAR_RM]*sntht*csphi - PAR[PAR_RL]*cstht*snphi;
     38        float value = PAR[PAR_Y0] + PAR[PAR_RY]*sntht*csphi - PAR[PAR_RX]*cstht*snphi;
    3739
    3840        if (deriv) {
    3941            psF32 *dPAR = deriv->data.F32;
    40             dPAR[PAR_L0]  = 0.0;
    41             dPAR[PAR_M0]  = 1.0;
    42             dPAR[PAR_RL]  = -cstht*snphi;
    43             dPAR[PAR_RM]  = +sntht*csphi;
    44             dPAR[PAR_P0]  = -PAR[PAR_RM]*sntht*snphi - PAR[PAR_RL]*cstht*csphi;
    45             dPAR[PAR_T0]  = -PAR[PAR_RM]*sntht*csphi - PAR[PAR_RL]*cstht*snphi;
     42            dPAR[PAR_X0]  = 0.0;
     43            dPAR[PAR_Y0]  = 1.0;
     44            dPAR[PAR_RX]  = -cstht*snphi;
     45            dPAR[PAR_RY]  = +sntht*csphi;
     46            dPAR[PAR_P0]  = -PAR[PAR_RY]*sntht*snphi - PAR[PAR_RX]*cstht*csphi;
     47            dPAR[PAR_T0]  = -PAR[PAR_RY]*sntht*csphi - PAR[PAR_RX]*cstht*snphi;
    4648        }
    4749        return (value);
     
    4951    psAbort ("programming error: invalid coordinate");
    5052}
    51 
    52 # undef PAR_L0
    53 # undef PAR_RL
    54 # undef PAR_PHI
    55 # define PAR_L0  0
    56 # define PAR_RL  1
    57 # define PAR_PHI 2
    58 
    59 psF32 psastroModelBoresiteL (psVector *deriv, const psVector *params, const psVector *coord) {
    60 
    61     psF32 *PAR = params->data.F32;
    62 
    63     float csphi = cos(PAR[PAR_PHI]);
    64     float snphi = sin(PAR[PAR_PHI]);
    65 
    66     float theta = coord->data.F32[0];
    67     float cstht = cos(theta);
    68     float sntht = sin(theta);
    69 
    70     float value = PAR[PAR_L0] + PAR[PAR_RL]*cstht*csphi - PAR[PAR_RL]*sntht*snphi;
    71 
    72     if (deriv) {
    73         psF32 *dPAR = deriv->data.F32;
    74         dPAR[PAR_L0]  = 1.0;
    75         dPAR[PAR_RL]  = cstht*csphi - sntht*snphi;
    76         dPAR[PAR_PHI] = -PAR[PAR_RL]*cstht*snphi - PAR[PAR_RL]*sntht*csphi;
    77     }
    78     return (value);
    79 }
    80 
    81 psF32 psastroModelBoresiteM (psVector *deriv, const psVector *params, const psVector *coord) {
    82 
    83     psF32 *PAR = params->data.F32;
    84 
    85     float csphi = cos(PAR[PAR_PHI]);
    86     float snphi = sin(PAR[PAR_PHI]);
    87 
    88     float theta = coord->data.F32[0];
    89     float cstht = cos(theta);
    90     float sntht = sin(theta);
    91 
    92     float value = PAR[PAR_L0] + PAR[PAR_RL]*sntht*csphi + PAR[PAR_RL]*cstht*snphi;
    93 
    94     if (deriv) {
    95         psF32 *dPAR = deriv->data.F32;
    96         dPAR[PAR_L0]  = 1.0;
    97         dPAR[PAR_RL]  = +sntht*csphi + cstht*snphi;
    98         dPAR[PAR_PHI] = -PAR[PAR_RL]*sntht*snphi + PAR[PAR_RL]*cstht*csphi;
    99     }
    100     return (value);
    101 }
Note: See TracChangeset for help on using the changeset viewer.