IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39185


Ignore:
Timestamp:
Nov 23, 2015, 6:07:54 PM (11 years ago)
Author:
eugene
Message:

added cmd-line options to set 2mass and tycho weights per loop

Location:
branches/eam_branches/ipp-20151113/Ohana/src/relastro
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20151113/Ohana/src/relastro/include/relastro.h

    r38986 r39185  
    323323PhotCode     *DCR_RED_PHOTCODE_POS, *DCR_RED_PHOTCODE_NEG;
    324324int           DCR_RED_NSEC_POS,      DCR_RED_NSEC_NEG;
     325
     326float *LoopWeight2MASS;
     327float *LoopWeightTycho;
    325328
    326329int ImagSelect;
  • branches/eam_branches/ipp-20151113/Ohana/src/relastro/src/GetAstromError.c

    r38986 r39185  
    7373  int has2MASS = USE_GALAXY_MODEL &&  isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS);
    7474
    75   // serious hack: if the object has 2MASS, we set this internal bit and adjust the
     75  // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the
    7676  // weight to ensure the image is tied down to the 2mass frame
    7777
    78   if (has2MASS) {
    79     switch (Nloop) {
    80       case 0:
    81         dPtotal = dPtotal / 1000.0;
    82         break;
    83       case 1:
    84         dPtotal = dPtotal / 300.0;
    85         break;
    86       case 2:
    87         dPtotal = dPtotal / 100.0;
    88         break;
    89       case 3:
    90         dPtotal = dPtotal / 30.0;
    91         break;
    92       case 4:
    93         dPtotal = dPtotal / 10.0;
    94         break;
    95       case 5:
    96         dPtotal = dPtotal / 10.0;
    97         break;
    98       default:
    99         break;
    100     }
     78  if (has2MASS && LoopWeight2MASS) {
     79    dPtotal = dPtotal / LoopWeight2MASS[Nloop];
    10180  }
    102   if (is2MASS) {
    103     switch (Nloop) {
    104       case 0:
    105         dPtotal = dPtotal / 1000.0;
    106         break;
    107       case 1:
    108         dPtotal = dPtotal / 300.0;
    109         break;
    110       case 2:
    111         dPtotal = dPtotal / 100.0;
    112         break;
    113       case 3:
    114         dPtotal = dPtotal / 30.0;
    115         break;
    116       case 4:
    117         dPtotal = dPtotal / 10.0;
    118         break;
    119       case 5:
    120         dPtotal = dPtotal / 10.0;
    121         break;
    122       default:
    123         break;
    124     }
     81  if (is2MASS && LoopWeight2MASS) {
     82    dPtotal = dPtotal / LoopWeight2MASS[Nloop];
    12583  }
    126   if (isTycho) {
    127     switch (Nloop) {
    128       case 0:
    129       case 1:
    130         dPtotal = dPtotal / 200.0;
    131         break;
    132       case 2:
    133       case 3:
    134         dPtotal = dPtotal / 100.0;
    135         break;
    136       case 4:
    137       case 5:
    138         dPtotal = dPtotal / 50.0;
    139         break;
    140       default:
    141         break;
    142     }
     84  if (isTycho && LoopWeightTycho) {
     85    dPtotal = dPtotal / LoopWeightTycho[Nloop];
    14386  }
    144 
    14587  return (dPtotal);
    14688}
     
    197139
    198140  dPtotal = MAX (dPtotal, MIN_ERROR);
     141
     142  // early on, we want 2MASS and Tycho to have a very high weight.  This will force images
     143  // to match the 2MASS / Tycho / ICRS reference frame.  As Nloop gets higher, the weight
     144  // needs to drop to allow the ps1 measurements to drive the solution
     145  int is2MASS  = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013);
     146  int isTycho  = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021);
     147  int has2MASS = USE_GALAXY_MODEL &&  isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS);
     148
     149  // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the
     150  // weight to ensure the image is tied down to the 2mass frame
     151
     152  if (has2MASS && LoopWeight2MASS) {
     153    dPtotal = dPtotal / LoopWeight2MASS[Nloop];
     154  }
     155  if (is2MASS && LoopWeight2MASS) {
     156    dPtotal = dPtotal / LoopWeight2MASS[Nloop];
     157  }
     158  if (isTycho && LoopWeightTycho) {
     159    dPtotal = dPtotal / LoopWeightTycho[Nloop];
     160  }
     161
    199162  return (dPtotal);
    200163}
    201164
    202 /* for a long time, psphot was either not reported position errors, or was reporting
     165/* for a long time, psphot was either not reporting position errors, or was reporting
    203166 * completely wrong astrometry errors.  This function lets us handle, in the
    204167 * configuration, different strategies to generating a position error
  • branches/eam_branches/ipp-20151113/Ohana/src/relastro/src/args.c

    r38986 r39185  
    44void usage_merge_source (void);
    55void usage_merge_source_id (char *name);
     6float *ParseLoopWeights (char *rawlist);
    67
    78int args (int argc, char **argv) {
     
    529530    remove_argument (N, &argc, argv);
    530531    NLOOP = atof (argv[N]);
     532    remove_argument (N, &argc, argv);
     533  }
     534
     535  // e.g., -loop-weights-2mass 1000,300,300,200,200,100
     536  // NOTE: this must come after -nloop above
     537  LoopWeight2MASS = NULL;
     538  if ((N = get_argument (argc, argv, "-loop-weights-2mass"))) {
     539    remove_argument (N, &argc, argv);
     540    LoopWeight2MASS = ParseLoopWeights (argv[N]);
     541    remove_argument (N, &argc, argv);
     542  }
     543  LoopWeightTycho = NULL;
     544  if ((N = get_argument (argc, argv, "-loop-weights-tycho"))) {
     545    remove_argument (N, &argc, argv);
     546    LoopWeightTycho = ParseLoopWeights (argv[N]);
    531547    remove_argument (N, &argc, argv);
    532548  }
     
    9991015}
    10001016
     1017float *ParseLoopWeights (char *rawlist) {
     1018
     1019  float *weights = NULL;
     1020  ALLOCATE (weights, float, NLOOP);
     1021
     1022  int Nloop = 0;
     1023
     1024  /* parse the comma-separated list of photcodes */
     1025  char *myList = strcreate(rawlist);
     1026  char *list = myList;
     1027  char *entry = NULL;
     1028  char *ptr = NULL;
     1029  while ((Nloop < NLOOP) && ((entry = strtok_r (list, ",", &ptr)) != NULL)) {
     1030    list = NULL; // pass NULL on successive strtok_r calls
     1031
     1032    weights[Nloop] = atof(entry);
     1033    Nloop ++;
     1034  }
     1035  free (myList);
     1036
     1037  if (Nloop == 0) {
     1038    fprintf (stderr, "syntax error parsing weights: %s\n", rawlist);
     1039    exit (3);
     1040  }
     1041
     1042  while (Nloop < NLOOP) {
     1043    weights[Nloop] = weights[Nloop - 1];
     1044    Nloop ++;
     1045  }
     1046  return weights;
     1047}
  • branches/eam_branches/ipp-20151113/Ohana/src/relastro/src/launch_region_hosts.c

    r38986 r39185  
    134134    if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset  %f", MaxMeanOffset);
    135135
     136    if (LoopWeight2MASS) {
     137      char *weightline = NULL;
     138      for (i = 0; i < NLOOP; i++) {
     139        strextend (&weightline, "%f,", LoopWeight2MASS[i]);
     140      }
     141      strextend (&command, "-loop-weights-2mass %s", weightline);
     142      free (weightline);
     143    }
     144    if (LoopWeightTycho) {
     145      char *weightline = NULL;
     146      for (i = 0; i < NLOOP; i++) {
     147        strextend (&weightline, "%f,", LoopWeightTycho[i]);
     148      }
     149      strextend (&command, "-loop-weights-tycho %s", weightline);
     150      free (weightline);
     151    }
     152
    136153    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
    137154    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
Note: See TracChangeset for help on using the changeset viewer.