IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39225


Ignore:
Timestamp:
Dec 3, 2015, 4:16:29 PM (11 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20151113

Location:
trunk
Files:
41 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Ohana

  • trunk/Ohana/src/addstar/Makefile

    r38986 r39225  
    3939# programs in 'SERVER' use the client-server concept and are out of date
    4040
    41 INSTALL = addstar sedstar loadgalphot loadstarpar loadstarpar_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadsupercos
    42 SERVER  = addstar_client addstarc addstard addstart
     41INSTALL = addstar addstar_client sedstar loadgalphot loadstarpar loadstarpar_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadsupercos
     42SERVER  = addstarc addstard addstart
    4343
    4444all: $(INSTALL)
  • trunk/Ohana/src/dvomerge/Makefile

    r38986 r39225  
    125125$(SRC)/dvorepairFixCPT.$(ARCH).o \
    126126$(SRC)/dvorepairFixWarpIDs.$(ARCH).o \
     127$(SRC)/dvorepairFixStackIDs.$(ARCH).o \
    127128$(SRC)/dvorepairImagesVsMeasures.$(ARCH).o \
    128129$(SRC)/dvorepairDeleteImageList.$(ARCH).o \
     
    171172$(SRC)/SetSignals.$(ARCH).o \
    172173$(SRC)/Shutdown.$(ARCH).o \
     174$(SRC)/LoadImages.$(ARCH).o \
    173175$(SRC)/dvoutils.$(ARCH).o \
    174176$(SRC)/dvoutils_args.$(ARCH).o \
    175177$(SRC)/dvoutils_uniq_images.$(ARCH).o \
     178$(SRC)/dvoutils_check_images.$(ARCH).o \
    176179$(SRC)/dvoutils_load_image_index.$(ARCH).o
    177180
  • trunk/Ohana/src/dvomerge/include/dvomerge.h

    r39142 r39225  
    252252int dvorepair_by_objID (int argc, char **argv);
    253253int dvorepairFixWarpIDs (int argc, char **argv);
    254 
     254int dvorepairFixStackIDs (int argc, char **argv);
     255
  • trunk/Ohana/src/dvomerge/include/dvoutils.h

    r38986 r39225  
    2020  DVOUTILS_NONE,
    2121  DVOUTILS_UNIQ_IMAGES,
     22  DVOUTILS_CHECK_IMAGES,
    2223} DVOUTILS_OP_TYPE;
    2324
     
    3233
    3334char *IMAGES_LIST;
     35char *CATDIR;
     36char *EXTERN_ID_LIST;
    3437
    3538int main (int argc, char **argv);
    3639int dvoutils_args (int *argc, char **argv);
    3740int dvoutils_uniq_images (char *filename);
     41int dvoutils_check_images (void);
    3842
    3943ImageData *dvoutils_load_image_index (char *filename);
  • trunk/Ohana/src/dvomerge/src/dvorepair.c

    r38986 r39225  
    1111 
    1212  if (!strcmp(argv[1], "-fix-warp-ids")) dvorepairFixWarpIDs(argc, argv);
     13  if (!strcmp(argv[1], "-fix-stack-ids")) dvorepairFixStackIDs(argc, argv);
    1314
    1415  if (!strcmp(argv[1], "-fix-cpt")) dvorepairFixCPT(argc, argv);
  • trunk/Ohana/src/dvomerge/src/dvoutils.c

    r38986 r39225  
    1313      exit (0);
    1414
     15    case DVOUTILS_CHECK_IMAGES:
     16      dvoutils_check_images();
     17      exit (0);
     18
    1519    default:
    1620      fprintf (stderr, "ERROR: unknown option\n");
  • trunk/Ohana/src/dvomerge/src/dvoutils_args.c

    r37807 r39225  
    2222    remove_argument (N, argc, argv);
    2323  }
     24  if ((N = get_argument (*argc, argv, "-check-images"))) {
     25    DVOUTILS_OP = DVOUTILS_CHECK_IMAGES;
     26    remove_argument (N, argc, argv);
     27    CATDIR = strcreate (argv[N]);
     28    remove_argument (N, argc, argv);
     29    EXTERN_ID_LIST = strcreate (argv[N]);
     30    remove_argument (N, argc, argv);
     31  }
     32
     33  if (*argc != 1) {
     34    fprintf (stderr, "USAGE: dvoutils -uniq-images (filename) [-v,-verbose]\n\n");
     35    fprintf (stderr, "USAGE: dvoutils -check-images (catdir) (externIDs) [-v,-verbose]\n\n");
     36    fprintf (stderr, "  -v : VERBOSE\n");
     37    exit (2);
     38  }
    2439
    2540  if (DVOUTILS_OP == DVOUTILS_NONE) {
     
    2843  }
    2944
    30   if (*argc != 1) {
    31     fprintf (stderr, "USAGE: dvoutils -uniq-images (filename) [-v,-verbose]\n\n");
    32     fprintf (stderr, "  -v : VERBOSE\n");
    33     exit (2);
    34   }
    35 
    3645  return TRUE;
    3746}
  • trunk/Ohana/src/dvomerge/src/help.c

    r38986 r39225  
    172172
    173173  fprintf (stderr, "USAGE\n");
    174   fprintf (stderr, "  dvorepair -fix-warp-ids (catdir) (idfile) - regenerate images.dat warp_skyfile_ids (EXTERN_ID) values\n");
     174  fprintf (stderr, "  dvorepair -fix-warp-ids (catdir.list) (idfile) - regenerate images.dat warp_skyfile_ids (EXTERN_ID) values\n");
     175  fprintf (stderr, "  dvorepair -fix-stack-ids (catdir.list) - regenerate images.dat stackID (EXTERN_ID) values\n");
    175176  fprintf (stderr, "  dvorepair -fix-cpt (images) (rootlist) - regenerate cpt & cps files from the cpm files\n");
    176177  fprintf (stderr, "  dvorepair -images-vs-measures (catdir) (Ntol) - find images with too many missing detections\n");
  • trunk/Ohana/src/kapa2/include/constants.h

    r37807 r39225  
    1111
    1212# define NCHANNELS 10
    13 # define NPIXELS_DYNAMIC 128
    14 
    15 // XXX for the moment, this is set to match the values in SetColorScale3D_CC
    16 # define NPIXELS_STATIC 128
    17 // # define NPIXELS_STATIC 4600 -- if we want fullcolor to work, need this
    1813
    1914# define PAD1  3
  • trunk/Ohana/src/kapa2/include/globals.h

    r35106 r39225  
    1111int   NAN_GREEN;
    1212int   NAN_BLUE;
     13
     14int   NPIXELS_DYNAMIC;
     15int   NPIXELS_STATIC;
    1316
    1417/* these should be absorbed into KapaImageWidget
  • trunk/Ohana/src/kapa2/src/CheckVisual.c

    r35237 r39225  
    131131  }
    132132
     133  Npixels = NPIXELS_STATIC;
    133134  if (graphic[0].dynamicColors) {
    134135    Npixels = NPIXELS_DYNAMIC;
    135     if ((N = get_argument (*argc, argv, "-ncolors"))) {
    136       remove_argument(N, argc, argv);
    137       Npixels = atoi (argv[N]);
    138       remove_argument(N, argc, argv);
    139     }
    140136
    141137    /* allocate color cells */
     
    181177    }
    182178  } else {
    183     Npixels = NPIXELS_STATIC;
    184     if ((N = get_argument (*argc, argv, "-ncolors"))) {
    185       remove_argument(N, argc, argv);
    186       Npixels = atoi (argv[N]);
    187       remove_argument(N, argc, argv);
    188     }
    189 
    190179    // XXX allocate the unsigned long *pixels here and above
    191180    ALLOCATE (graphic[0].pixels, unsigned long, Npixels);
  • trunk/Ohana/src/kapa2/src/args.c

    r35106 r39225  
    11# include "Ximage.h"
     2
     3void help(void);
    24
    35int args (int *argc, char **argv) {
    46
    57  int N;
     8
     9  if ((N = get_argument (*argc, argv, "-h"))) help();
     10  if ((N = get_argument (*argc, argv, "-help"))) help();
     11  if ((N = get_argument (*argc, argv, "--h"))) help();
     12  if ((N = get_argument (*argc, argv, "--help"))) help();
    613
    714  MAP_WINDOW = TRUE;
     
    3744  }
    3845
     46  NPIXELS_DYNAMIC = 128;
     47  NPIXELS_STATIC = 128;
     48  if ((N = get_argument (*argc, argv, "-ncolors"))) {
     49    remove_argument(N, argc, argv);
     50    NPIXELS_DYNAMIC = atoi (argv[N]);
     51    NPIXELS_STATIC = NPIXELS_DYNAMIC;
     52    remove_argument(N, argc, argv);
     53  }
     54
    3955  NAN_RED   = 0;
    4056  NAN_GREEN = 0xffff;
     
    5672  return (TRUE);
    5773}
     74
     75void help (void) {
     76
     77  fprintf (stderr, "USAGE: kapa [options]\n");
     78  fprintf (stderr, "OPTIONS: \n");
     79  fprintf (stderr, "-h, -help, --h, --help : this listing\n");
     80  fprintf (stderr, "-nomap : use X but do not generate a window\n");
     81  fprintf (stderr, "-name : name for the X window bar\n");
     82  fprintf (stderr, "-noX : do not use an X window\n");
     83  fprintf (stderr, "-debug : report debug info\n");
     84  fprintf (stderr, "-fg : define the foreground color (X color style)\n");
     85  fprintf (stderr, "-ncolors : set the number of colors (pixels) available (128 default)\n");
     86  fprintf (stderr, "-nan (red) (green) (blue) : set NaN pixels to this color (hex values)\n");
     87  exit (2);
     88}
  • trunk/Ohana/src/libautocode/def/measure.d

    r38986 r39225  
    4545# XXX I can deprecate these as I am going to apply the correct uR,uD offset
    4646# XXX not sure how to use this yet...
     47# XXX replace RoffGall with Moff -> static component of the zpt correction
    4748FIELD RoffGAL,        R_OFF_GAL,     float,          RA offset from correction,    arcsec
    4849FIELD DoffGAL,        D_OFF_GAL,     float,          DEC offset from correction,   arcsec
  • trunk/Ohana/src/libdvo/src/coordops.c

    r38553 r39225  
    990990
    991991OhanaProjection GetProjection (char *ctype) {
    992   if (!strcmp(&ctype[4], "-ZEA")) return PROJ_ZEA;
    993   if (!strcmp(&ctype[4], "-ZPL")) return PROJ_ZPL;
    994   if (!strcmp(&ctype[4], "-ZPN")) return PROJ_ZPN;
    995   if (!strcmp(&ctype[4], "-ARC")) return PROJ_ARC;
    996   if (!strcmp(&ctype[4], "-STG")) return PROJ_STG;
    997   if (!strcmp(&ctype[4], "-SIN")) return PROJ_SIN;
    998   if (!strcmp(&ctype[0], "MM"))   return PROJ_SIN; // note ctype[0]
    999   if (!strcmp(&ctype[4], "-TAN")) return PROJ_TAN;
    1000   if (!strcmp(&ctype[4], "-TNX")) return PROJ_TNX;
    1001   if (!strcmp(&ctype[4], "-DIS")) return PROJ_DIS;
    1002   if (!strcmp(&ctype[4], "-LIN")) return PROJ_LIN;
    1003   if (!strcmp(&ctype[0], "GENE")) return PROJ_LIN; // note ctype[0]
    1004   if (!strcmp(&ctype[4], "-PLY")) return PROJ_PLY;
    1005   if (!strcmp(&ctype[4], "-WRP")) return PROJ_WRP;
    1006   if (!strcmp(&ctype[4], "-AIT")) return PROJ_AIT;
    1007   if (!strcmp(&ctype[4], "-GLS")) return PROJ_GLS;
    1008   if (!strcmp(&ctype[4], "-PAR")) return PROJ_PAR;
     992  if (!strncmp(&ctype[4], "-ZEA", 4)) return PROJ_ZEA;
     993  if (!strncmp(&ctype[4], "-ZPL", 4)) return PROJ_ZPL;
     994  if (!strncmp(&ctype[4], "-ZPN", 4)) return PROJ_ZPN;
     995  if (!strncmp(&ctype[4], "-ARC", 4)) return PROJ_ARC;
     996  if (!strncmp(&ctype[4], "-STG", 4)) return PROJ_STG;
     997  if (!strncmp(&ctype[4], "-SIN", 4)) return PROJ_SIN;
     998  if (!strncmp(&ctype[0], "MM", 2))   return PROJ_SIN; // note ctype[0]
     999  if (!strncmp(&ctype[4], "-TAN", 4)) return PROJ_TAN;
     1000  if (!strncmp(&ctype[4], "-TNX", 4)) return PROJ_TNX;
     1001  if (!strncmp(&ctype[4], "-DIS", 4)) return PROJ_DIS;
     1002  if (!strncmp(&ctype[4], "-LIN", 4)) return PROJ_LIN;
     1003  if (!strncmp(&ctype[0], "GENE", 4)) return PROJ_LIN; // note ctype[0]
     1004  if (!strncmp(&ctype[4], "-PLY", 4)) return PROJ_PLY;
     1005  if (!strncmp(&ctype[4], "-WRP", 4)) return PROJ_WRP;
     1006  if (!strncmp(&ctype[4], "-AIT", 4)) return PROJ_AIT;
     1007  if (!strncmp(&ctype[4], "-GLS", 4)) return PROJ_GLS;
     1008  if (!strncmp(&ctype[4], "-PAR", 4)) return PROJ_PAR;
    10091009  return PROJ_NONE;
    10101010}
  • trunk/Ohana/src/libkapa/src/KapaOpen.c

    r37042 r39225  
    22
    33// kapa connection timeout is N_RETRY * 10000 usec
    4 # define N_RETRY 2000
     4# define N_RETRY 5000
    55
    66# define MY_PORT 2500
  • trunk/Ohana/src/opihi/cmd.astro

  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r39169 r39225  
    2323$(SRC)/cdot.$(ARCH).o              \
    2424$(SRC)/cline.$(ARCH).o             \
     25$(SRC)/cneedles.$(ARCH).o                  \
    2526$(SRC)/cplot.$(ARCH).o             \
    2627$(SRC)/csystem.$(ARCH).o           \
     
    7677$(SRC)/vshimage.$(ARCH).o         \
    7778$(SRC)/shimage.$(ARCH).o         \
     79$(SRC)/wcs.$(ARCH).o         \
    7880$(SRC)/imsub.$(ARCH).o             \
    7981$(SRC)/imfit.$(ARCH).o             \
  • trunk/Ohana/src/opihi/cmd.astro/drizzle.c

    r19823 r39225  
    141141
    142142          if (Vmk && Vmk[Ni]) continue;
     143          if (!isfinite(Vin[Ni])) continue;
     144
    143145          Vout[No] += Vin[Ni];
    144146          Vwt[No] ++;
     
    195197
    196198          if (Vmk && Vmk[Ni]) continue;
     199          if (!isfinite(Vin[Ni])) continue;
    197200          Vout[No] += Vin[Ni];
    198201          Vwt[No] ++;
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r39169 r39225  
    77int cdot                    PROTO((int, char **));
    88int cline                   PROTO((int, char **));
     9int cneedles                PROTO((int, char **));
    910int cplot                   PROTO((int, char **));
    1011int csystem                 PROTO((int, char **));
     
    6667int vshimage                PROTO((int, char **));
    6768int shimage                 PROTO((int, char **));
     69int wcs                     PROTO((int, char **));
    6870
    6971static Command cmds[] = { 
     
    7476  {1, "cdot",        cdot,         "plot point in sky coordinates"},
    7577  {1, "cline",       cline,        "plot line connecting two sky coordinates"},
     78  {1, "cneedles",    cneedles,     "plot vectors in sky coordinates"},
    7679  {1, "cplot",       cplot,        "plot vectors in sky coordinates"},
    7780  {1, "csystem",     csystem,      "convert between coordinate systems"},
     
    131134  {1, "vshimage",    vshimage,     "generate images for vector spherical harmonic terms"},
    132135  {1, "shimage",     shimage,      "generate images for spherical harmonic terms"},
     136  {1, "wcs",         wcs,          "set the wcs for the given image"},
    133137};
    134138
  • trunk/Ohana/src/opihi/cmd.astro/region.c

    r37807 r39225  
    7474  }
    7575
     76  float Angle = 0.0;
     77  if ((N = get_argument (argc, argv, "-angle"))) {
     78    remove_argument (N, &argc, argv);
     79    Angle = atof(argv[N]);
     80    remove_argument (N, &argc, argv);
     81  }
     82
    7683  if ((argc != 4) && (argc != 5)) {
    7784    gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n");
    78     gprint (GP_ERR, "  [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear]\n");
     85    gprint (GP_ERR, "  [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear] [-angle theta]\n");
    7986    gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n",
    8087             graphmode.coords.crval1, graphmode.coords.crval2,
     
    111118  graphmode.coords.crval2 = Dec;
    112119
    113   graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1;
    114   graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1;
     120  float pc1_1 = (graphmode.flipeast)  ? -1 : 1;
     121  float pc2_2 = (graphmode.flipnorth) ? -1 : 1;
     122
     123  graphmode.coords.pc1_1 =  cos(Angle*RAD_DEG)*pc1_1;
     124  graphmode.coords.pc1_2 =  sin(Angle*RAD_DEG)*pc2_2;
     125  graphmode.coords.pc2_1 = -sin(Angle*RAD_DEG)*pc1_1;
     126  graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
    115127
    116128  /* ask kapa for coordinate limits, to get the right aspect ratio */
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r38463 r39225  
    9797$(SRC)/medimage_commands.$(ARCH).o \
    9898$(SRC)/mset.$(ARCH).o           \
     99$(SRC)/needles.$(ARCH).o                \
    99100$(SRC)/peak.$(ARCH).o           \
    100101$(SRC)/periodogram.$(ARCH).o    \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r38463 r39225  
    8686int medimage_command PROTO((int, char **));
    8787int mset             PROTO((int, char **));
     88int needles          PROTO((int, char **));
    8889int peak             PROTO((int, char **));
    8990int periodogram      PROTO((int, char **));
     
    261262  {1, "mset",         mset,             "insert a vector in an image"},
    262263  {1, "imset",        mset,             "insert a vector in an image"},
     264  {1, "needles",      needles,          "plot vectors needles"},
    263265  {1, "parity",       parity,           "set image parity"},
    264266  {1, "peak",         peak,             "find vector peak in range"},
  • trunk/Ohana/src/opihi/dvo/avmatch.c

    r38601 r39225  
    328328  gprint (GP_ERR, "USAGE: avmatch (RA) (DEC) (RADIUS) field[,field,field...]\n");
    329329  gprint (GP_ERR, "   OR: avmatch -coords (filename.fits) (RADIUS) field[,field,field...]\n");
     330  gprint (GP_ERR, "   RADIUS is in arcseconds\n");
    330331
    331332  if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) {
  • trunk/Ohana/src/opihi/dvo/imlist.c

    r37807 r39225  
    2121  }
    2222
     23  int VERBOSE = TRUE;
     24  if ((N = get_argument (argc, argv, "-quiet"))) {
     25    VERBOSE = FALSE;
     26    remove_argument (N, &argc, argv);
     27  }
     28  if ((N = get_argument (argc, argv, "-q"))) {
     29    VERBOSE = FALSE;
     30    remove_argument (N, &argc, argv);
     31  }
     32
    2333  TimeSelect = FALSE;
    2434  if ((N = get_argument (argc, argv, "-time"))) {
     
    3545    remove_argument (N, &argc, argv);
    3646    TimeSelect = TRUE;
    37     gprint (GP_ERR, "plotting in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);
     47    if (VERBOSE) gprint (GP_ERR, "plotting in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);
    3848  }
    3949
     
    8898  GetTimeFormat (&TimeReference, &TimeFormat);
    8999
     100  int Nfound = 0;
     101
    90102  for (j = 0; j < MAX_LIST; j++) {
    91103    i = subset[j];
     
    104116      XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    105117    }
    106     gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",
    107             (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);
     118    if (VERBOSE) gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",
     119                         (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);
     120
     121    char name[80];
     122    sprintf (name, "imlist:%d", Nfound);
     123    set_str_variable (name, image[i].name);
     124    Nfound ++;
    108125  }
     126  set_int_variable ("imlist:n", Nfound);
    109127
    110128  FreeImagesDVO(image);
  • trunk/Ohana/src/opihi/include/dvomath.h

    r38441 r39225  
    147147Vector       *InitVector            PROTO((void));
    148148void          FreeVectorArray       PROTO((Vector **vec, int Nvec));
     149void          FreeVector            PROTO((Vector *vec));
    149150int           CopyVector            PROTO((Vector *out, Vector *in));
    150151int           ResetVector           PROTO((Vector *vec, char type, int Nelements));
  • trunk/Ohana/src/opihi/lib.shell/VectorOps.c

    r33662 r39225  
    1515
    1616// this function is NOT thread protected : it is only used in startup and/or shutdown
     17void FreeVector (Vector *vec) {
     18
     19  if (!vec) return;
     20  if (vec->elements.Int) {
     21    free (vec->elements.Int);
     22  }
     23  free (vec);
     24}
     25
     26// this function is NOT thread protected : it is only used in startup and/or shutdown
    1727void FreeVectorArray (Vector **vec, int Nvec) {
    1828
     
    2131  if (!vec) return;
    2232  for (i = 0; i < Nvec; i++) {
    23     if (!vec[i]) continue;
    24     if (vec[i]->elements.Int) {
    25       free (vec[i]->elements.Int);
    26     }
    27     free (vec[i]);
     33    FreeVector (vec[i]);
    2834  }
    2935  free (vec);
  • trunk/Ohana/src/relastro/include/relastro.h

    r38986 r39225  
    254254int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored
    255255double MIN_ERROR;
     256
     257double MIN_DISTANCE_MOD; 
     258double MAX_DISTANCE_MOD; 
     259double MAX_DISTANCE_MOD_ERR;
    256260
    257261int    IMFIT_TOO_FEW; // need more than this number of stars to fit an image
     
    323327PhotCode     *DCR_RED_PHOTCODE_POS, *DCR_RED_PHOTCODE_NEG;
    324328int           DCR_RED_NSEC_POS,      DCR_RED_NSEC_NEG;
     329
     330float *LoopWeight2MASS;
     331float *LoopWeightTycho;
    325332
    326333int ImagSelect;
  • trunk/Ohana/src/relastro/src/BrightCatalog.c

    r38553 r39225  
    159159    GET_COLUMN(uR,             "U_RA",           float);
    160160    GET_COLUMN(uD,             "U_DEC",          float);
    161     GET_COLUMN(duR,            "V_RA_ERR",       float);
    162     GET_COLUMN(duD,            "V_DEC_ERR",      float);
     161    GET_COLUMN(duR,            "U_RA_ERR",       float);
     162    GET_COLUMN(duD,            "U_DEC_ERR",      float);
     163    GET_COLUMN(uRgal,          "U_RA_GAL",       float);
     164    GET_COLUMN(uDgal,          "U_DEC_GAL",      float);
    163165    GET_COLUMN(P,              "PAR",            float);
    164166    GET_COLUMN(dP,             "PAR_ERR",        float);
     
    189191    ALLOCATE (average, Average, Nrow);
    190192    for (i = 0; i < Nrow; i++) {
     193      dvo_average_init (&average[i]);
    191194      average[i].R               = R[i]               ;
    192195      average[i].D               = D[i]               ;
     
    197200      average[i].duR             = duR[i]             ;
    198201      average[i].duD             = duD[i]             ;
     202      average[i].uRgal           = uRgal[i]           ;
     203      average[i].uDgal           = uDgal[i]           ;
    199204      average[i].P               = P[i]               ;
    200205      average[i].dP              = dP[i]              ;
     
    230235    free (duR);
    231236    free (duD);
     237    free (uRgal);
     238    free (uDgal);
    232239    free (P);
    233240    free (dP);
     
    489496    gfits_define_bintable_column (&theader, "E", "U_RA",           "RA*cos(D) proper-motion",                             "", 1.0, 0.0);
    490497    gfits_define_bintable_column (&theader, "E", "U_DEC",          "DEC proper-motion",                                   "", 1.0, 0.0);
    491     gfits_define_bintable_column (&theader, "E", "V_RA_ERR",       "RA*cos(D) p-m error",                                 "", 1.0, 0.0);
    492     gfits_define_bintable_column (&theader, "E", "V_DEC_ERR",      "DEC p-m error",                                       "", 1.0, 0.0);
     498    gfits_define_bintable_column (&theader, "E", "U_RA_ERR",       "RA*cos(D) p-m error",                                 "", 1.0, 0.0);
     499    gfits_define_bintable_column (&theader, "E", "U_DEC_ERR",      "DEC p-m error",                                       "", 1.0, 0.0);
     500    gfits_define_bintable_column (&theader, "E", "U_RA_GAL",       "RA*cos(D) p-m error",                                 "", 1.0, 0.0);
     501    gfits_define_bintable_column (&theader, "E", "U_DEC_GAL",      "DEC p-m error",                                       "", 1.0, 0.0);
    493502    gfits_define_bintable_column (&theader, "E", "PAR",            "parallax",                                            "", 1.0, 0.0);
    494503    gfits_define_bintable_column (&theader, "E", "PAR_ERR",        "parallax error",                                      "", 1.0, 0.0);
     
    526535    float    *duR           ; ALLOCATE (duR           , float   , catalog->Naverage);
    527536    float    *duD           ; ALLOCATE (duD           , float   , catalog->Naverage);
     537    float    *uRgal         ; ALLOCATE (uRgal         , float   , catalog->Naverage);
     538    float    *uDgal         ; ALLOCATE (uDgal         , float   , catalog->Naverage);
    528539    float    *P             ; ALLOCATE (P             , float   , catalog->Naverage);
    529540    float    *dP            ; ALLOCATE (dP            , float   , catalog->Naverage);
     
    560571      duR[i]             = average[i].duR             ;
    561572      duD[i]             = average[i].duD             ;
     573      uRgal[i]           = average[i].uRgal           ;
     574      uDgal[i]           = average[i].uDgal           ;
    562575      P[i]               = average[i].P               ;
    563576      dP[i]              = average[i].dP              ;
     
    591604    gfits_set_bintable_column (&theader, &ftable, "U_RA",           uR,              catalog->Naverage);
    592605    gfits_set_bintable_column (&theader, &ftable, "U_DEC",          uD,              catalog->Naverage);
    593     gfits_set_bintable_column (&theader, &ftable, "V_RA_ERR",       duR,             catalog->Naverage);
    594     gfits_set_bintable_column (&theader, &ftable, "V_DEC_ERR",      duD,             catalog->Naverage);
     606    gfits_set_bintable_column (&theader, &ftable, "U_RA_ERR",       duR,             catalog->Naverage);
     607    gfits_set_bintable_column (&theader, &ftable, "U_DEC_ERR",      duD,             catalog->Naverage);
     608    gfits_set_bintable_column (&theader, &ftable, "U_RA_GAL",       uRgal,           catalog->Naverage);
     609    gfits_set_bintable_column (&theader, &ftable, "U_DEC_GAL",      uDgal,           catalog->Naverage);
    595610    gfits_set_bintable_column (&theader, &ftable, "PAR",            P,               catalog->Naverage);
    596611    gfits_set_bintable_column (&theader, &ftable, "PAR_ERR",        dP,              catalog->Naverage);
     
    604619    gfits_set_bintable_column (&theader, &ftable, "NMEASURE",       Nmeasure,        catalog->Naverage);
    605620    gfits_set_bintable_column (&theader, &ftable, "NMISSING",       Nmissing,        catalog->Naverage);
    606     gfits_set_bintable_column (&theader, &ftable, "NGALPHOT",      Ngalphot,       catalog->Naverage);
     621    gfits_set_bintable_column (&theader, &ftable, "NGALPHOT",       Ngalphot,        catalog->Naverage);
    607622    gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE",    measureOffset,   catalog->Naverage);
    608623    gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING",    missingOffset,   catalog->Naverage);
     
    624639    free (duR);
    625640    free (duD);
     641    free (uRgal);
     642    free (uDgal);
    626643    free (P);
    627644    free (dP);
  • trunk/Ohana/src/relastro/src/ConfigInit.c

    r37807 r39225  
    3535  if (!ScanConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX))         DPOS_MAX = 6.0;   
    3636  if (!ScanConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS))   ADDSTAR_RADIUS = 1.0;
     37
     38  if (!ScanConfig (config, "RELASTRO_MIN_DISTANCE_MOD",     "%lf", 0, &MIN_DISTANCE_MOD))     MIN_DISTANCE_MOD     =  7.5;
     39  if (!ScanConfig (config, "RELASTRO_MAX_DISTANCE_MOD",     "%lf", 0, &MAX_DISTANCE_MOD))     MAX_DISTANCE_MOD     = 15.0;
     40  if (!ScanConfig (config, "RELASTRO_MAX_DISTANCE_MOD_ERR", "%lf", 0, &MAX_DISTANCE_MOD_ERR)) MAX_DISTANCE_MOD_ERR =  1.0;
    3741
    3842  if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS))  USE_FIXED_PIXCOORDS = FALSE;
  • trunk/Ohana/src/relastro/src/GetAstromError.c

    r38986 r39225  
    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
  • trunk/Ohana/src/relastro/src/args.c

    r38986 r39225  
    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}
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r38986 r39225  
    117117      if (!isfinite(catalog[0].average[i].uRgal)) continue;
    118118      if (!isfinite(catalog[0].average[i].uDgal)) continue;
     119     
     120      // filter stars which are not well-handled by the galactic motion model
     121      int mStarpar = catalog[0].average[i].starparOffset;
     122      myAssert (mStarpar < catalog[0].Nstarpar, "oops");
     123     
     124      StarPar *starpar = &catalog[0].starpar[mStarpar];
     125      if (starpar->DistMag  < MIN_DISTANCE_MOD) continue;
     126      if (starpar->DistMag  > MAX_DISTANCE_MOD) continue;
     127      if (starpar->dDistMag > MAX_DISTANCE_MOD_ERR) continue;
    119128    }
    120129
  • trunk/Ohana/src/relastro/src/launch_region_hosts.c

    r38986 r39225  
    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);
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r38986 r39225  
    4444    pcatalog->catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; // don't need to load all data at this point
    4545    pcatalog->Nsecfilt  = GetPhotcodeNsecfilt ();
     46
     47    if (USE_GALAXY_MODEL) {
     48      pcatalog->catflags = pcatalog->catflags | DVO_LOAD_STARPAR;
     49    }
    4650
    4751    // loads Average, Measure, SecFilt
     
    171175    strextend (&command, " -minerror %f", MIN_ERROR);
    172176    strextend (&command, " -D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
     177    strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f",     MIN_DISTANCE_MOD);
     178    strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f",     MAX_DISTANCE_MOD);
     179    strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR);
    173180
    174181    if (FIT_MODE == FIT_PM_ONLY)         strextend (&command, "-pm");
  • trunk/Ohana/src/uniphot/src/initialize_setgalmodel.c

    r37807 r39225  
    4545
    4646  // XXX add to config?
    47   if (!InitGalaxyModel ("ROESER")) {
     47  if (!InitGalaxyModel ("FEAST-HIPPARCOS")) {
    4848    fprintf (stderr, "failed to init galaxy model\n");
    4949    exit (2);
  • trunk/Ohana/src/uniphot/src/setgalmodel.c

    r38986 r39225  
    1111  status = update_dvo_setgalmodel ();
    1212
    13   if (!status) exit (1);
     13  if (!status) {
     14    fprintf (stderr, "ERROR: problem running setgalmodel\n");
     15    exit (1);
     16  }
     17  fprintf (stderr, "SUCCESS running setgalmodel\n");
    1418  exit (0);
    1519}
  • trunk/Ohana/src/uniphot/src/setgalmodel_client.c

    r38986 r39225  
    1717
    1818  update_dvo_setgalmodel ();
     19  fprintf (stderr, "SUCCESS running setgalmodel_client\n");
    1920
    2021  exit (0);
  • trunk/Ohana/src/uniphot/src/update_catalog_setgalmodel.c

    r38986 r39225  
    2828    if (fabs(starpar->FeH) > 99.0) continue;
    2929
    30     double distance = pow(10.0, 0.2*(starpar->DistMag + 5.0));
     30    // NOTE: distance is in kiloparsec
     31    double distance = pow(10.0, 0.2*(starpar->DistMag + 5.0)) / 1000.0;
    3132
    3233    double Lrad = starpar->galLon * RAD_DEG;
  • trunk/Ohana/src/uniphot/src/update_dvo_setgalmodel.c

    r38986 r39225  
    3737    dvo_catalog_init (&catalog, TRUE);
    3838    catalog.filename  = HOST_ID ? localFilename : skylist[0].filename[i];
    39     catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_STARPAR;
     39    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_STARPAR;
    4040    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    4141
Note: See TracChangeset for help on using the changeset viewer.