IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5347


Ignore:
Timestamp:
Oct 15, 2005, 1:28:40 PM (21 years ago)
Author:
eugene
Message:

added -ref and -cat to client/server, airmass quality options

Location:
trunk/Ohana/src/addstar
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r5328 r5347  
    8888$(SRC)/args_server.$(ARCH).o \
    8989$(SRC)/CheckPassword.$(ARCH).o \
    90 $(SRC)/NewImage.$(ARCH).o
     90$(SRC)/UpdateDatabase_Image.$(ARCH).o \
     91$(SRC)/UpdateDatabase_Reflist.$(ARCH).o \
     92$(SRC)/UpdateDatabase_Refcat.$(ARCH).o \
     93$(SRC)/airmass.$(ARCH).o \
     94$(SRC)/build_links.$(ARCH).o \
     95$(SRC)/calibrate.$(ARCH).o \
     96$(SRC)/find_matches.$(ARCH).o \
     97$(SRC)/find_matches_closest.$(ARCH).o \
     98$(SRC)/find_matches_refstars.$(ARCH).o \
     99$(SRC)/find_subset.$(ARCH).o \
     100$(SRC)/get2mass.$(ARCH).o \
     101$(SRC)/get2mass_as.$(ARCH).o \
     102$(SRC)/get2mass_dr2.$(ARCH).o \
     103$(SRC)/getgsc.$(ARCH).o \
     104$(SRC)/getusno.$(ARCH).o \
     105$(SRC)/greference.$(ARCH).o \
     106$(SRC)/gcatalog.$(ARCH).o \
     107$(SRC)/gimages.$(ARCH).o \
     108$(SRC)/gregion_image.$(ARCH).o \
     109$(SRC)/gregion_match.$(ARCH).o \
     110$(SRC)/gregion_patch.$(ARCH).o \
     111$(SRC)/gregion_star.$(ARCH).o \
     112$(SRC)/image-db.$(ARCH).o \
     113$(SRC)/in_image.$(ARCH).o \
     114$(SRC)/load_pt_catalog.$(ARCH).o \
     115$(SRC)/load_subpix.$(ARCH).o \
     116$(SRC)/mkcatalog.$(ARCH).o \
     117$(SRC)/RegionOps.$(ARCH).o \
     118$(SRC)/replace_match.$(ARCH).o \
     119$(SRC)/SetSignals.$(ARCH).o \
     120$(SRC)/sort_lists.$(ARCH).o \
     121$(SRC)/update_coords.$(ARCH).o \
     122$(SRC)/wcatalog.$(ARCH).o \
     123$(SRC)/Shutdown.$(ARCH).o \
     124$(SRC)/edge_check.$(ARCH).o \
     125$(SRC)/check_permissions.$(ARCH).o \
     126$(SRC)/opening_angle.$(ARCH).o \
     127$(SRC)/NewImage.$(ARCH).o \
     128$(SRC)/NewReflist.$(ARCH).o \
     129$(SRC)/NewRefcat.$(ARCH).o
    91130
    92131CLIENT = \
     
    94133$(SRC)/ConfigInit.$(ARCH).o \
    95134$(SRC)/gstars.$(ARCH).o \
     135$(SRC)/grefstars.$(ARCH).o \
    96136$(SRC)/load_subpix.$(ARCH).o \
    97137$(SRC)/rfits.$(ARCH).o \
  • trunk/Ohana/src/addstar/doc/notes.txt

    r5328 r5347  
    66  o address MOSAIC somehow
    77  o replace skyprobe mode
    8   - address the cat & ref modes in client/server
    9  
    10   * add airmass quality to options
     8  o complete server db interactions
     9  o address the cat & ref modes in client/server
     10  o add airmass quality to options
     11
    1112  * deal with Myyyy as sky value
    1213  * better way to interpret flips header info for sky?
     
    1516    with sorted measure tables; add this as a feature
    1617    of the load_catalog API?
     18
     192005.10.14
     20
     21  the current db interactions are somewhat in efficient wrt the image
     22  table.  the basic outline is as follows:
     23
     24  - load image overlaps (needs entire image table)
     25  - find detection matches (uses overlap information for missed)
     26  - save new image (needs calculated calibration value from detection
     27    matches)
     28 
     29  currently, I access the image table twice, and both times I load the
     30  entire thing.  I really only need to append in the second case.  To
     31  get to that point, I need to:
     32
     33  - split image overlaps from image db load
     34  - define image partial load (analogous with catalog LOAD_MEAS_META)
     35 
     36  for the moment, I'm being wasteful so I can defer this issue.
    1737
    18382005.10.13
  • trunk/Ohana/src/addstar/include/addstar.h

    r5328 r5347  
    9999void       TrapSignal             PROTO((int sig));
    100100float      airmass                PROTO((float secz_image, double ra, double dec, double st, double latitude));
     101void       SetAirmassQuality      PROTO((int quality));
    101102void       aregion                PROTO((GSCRegion *region, FILE *f, double ra, double dec));
    102103AddstarClientOptions args         PROTO((int argc, char **argv, AddstarClientOptions options));
     
    181182int CheckPassword (int BindSocket);
    182183int NewImage (int BindSocket);
     184int NewReflist (int BindSocket);
     185int NewRefcat (int BindSocket);
    183186
    184 int InitServerSocket (char *hostname, SockAddress *Address);
     187int InitServerSocket (SockAddress *Address);
    185188int WaitServerSocket (int InitSocket, SockAddress *Address, int *validIP, int Nvalid);
    186189int GetClientSocket (char *hostname);
    187190
     191int UpdateDatabase_Image (AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars);
     192int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, int Nstars);
     193int UpdateDatabase_Refcat (AddstarClientOptions *options, GSCRegion *UserPatch, char *refcat);
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r5322 r5347  
    113113  free (config);
    114114  free (file);
    115 
     115  return (options);
    116116}
    117117
  • trunk/Ohana/src/addstar/src/NewImage.c

    r5322 r5347  
    33int NewImage (int BindSocket) {
    44
    5   int i, Nstars, Noptions, Nimage;
     5  int N, Nstars;
    66  Stars *stars;
    77  Image *image;
     8  Coords *mosaic;
    89  AddstarClientOptions *options;
    910
    1011  /* accept incoming data set */
    11   if (!Recv_AddstarClientOptions (BindSocket, &options, &Noptions)) {
    12     close (BindSocket);
    13     return (FALSE);
     12  if (!Recv_AddstarClientOptions (BindSocket, &options, &N)) {
     13    fprintf (stderr, "error: problem receiving options\n");
     14    goto reject;
     15  }
     16  if (N != 1) {
     17    fprintf (stderr, "error: too many option sets (%d)\n", N);
     18    goto reject;
    1419  }
    1520
    16   if (!Recv_Image (BindSocket, &image, &Nimage)) {
    17     close (BindSocket);
    18     return (FALSE);
     21  if (!Recv_Image (BindSocket, &image, &N)) {
     22    fprintf (stderr, "error: problem receiving image data\n");
     23    goto reject;
     24  }
     25  if (N != 1) {
     26    fprintf (stderr, "error: invalid number of images (%d)\n", N);
     27    goto reject;
    1928  }
    2029
     30  if (options[0].mosaic) {
     31    if (!Recv_Coords (BindSocket, &mosaic, &N)) {
     32      fprintf (stderr, "error: problem receiving mosaic coordinates\n");
     33      goto reject;
     34    }
     35    if (N != 1) {
     36      fprintf (stderr, "error: invalid number of mosaic coords (%d)\n", N);
     37      goto reject;
     38    }
     39  }   
     40
    2141  if (!Recv_Stars (BindSocket, &stars, &Nstars)) {
    22     close (BindSocket);
    23     return (FALSE);
     42    fprintf (stderr, "error: problem receiving star data\n");
     43    goto reject;
    2444  }
    25   /* XXX EAM : error check : 1 option, 1 image */
     45  fprintf (stderr, "accepted %s, %d stars\n", image[0].name, Nstars);
    2646
    2747  /* add to db */
    28 
    29   fprintf (stderr, "options: %d %d %d %d\n",
    30            options[0].mode,
    31            options[0].photcode,
    32            options[0].timeref,
    33            options[0].skip_missed);
    34 
    35 //  for (i = 0; i < Nstars; i++) {
    36 //    fprintf (stderr, "R, D: %f, %f\n", stars[i].R, stars[i].D);
    37 //  }
    38 
    39   for (i = 0; i < Nimage; i++) {
    40     fprintf (stderr, "name: %s, %d stars\n", image[i].name, Nstars);
    41   }
     48  UpdateDatabase_Image (options, image, mosaic, stars, Nstars);
    4249
    4350  close (BindSocket);
    4451  return (TRUE);
     52
     53reject:
     54  close (BindSocket);
     55  return (FALSE);
    4556}
  • trunk/Ohana/src/addstar/src/SocketOps.c

    r5322 r5347  
    44# define MY_WAIT 500
    55
    6 int InitServerSocket (char *hostname, SockAddress *Address) {
    7 
    8   int i, status, InitSocket, length;
     6int InitServerSocket (SockAddress *Address) {
     7
     8  int status, InitSocket, length;
     9
     10# if (0)
    911  struct hostent  *host;
    1012  char tmpline[80], hostip[80];
    1113
    1214  host = gethostbyname (hostname);
    13   fprintf (stderr, "errno: %d\n", h_errno);
    14   fprintf (stderr, "host: %d\n", host);
    15 
    1615  bzero (hostip, 80);
    1716  for (i = 0; i < host[0].h_length; i++) {
     
    2019    if (i < host[0].h_length - 1) strcat (hostip, ".");
    2120  }
    22 
    23   // use this line to bind any address / port?
    24   // Address.sin_addr.s_addr = INADDR_ANY;
     21# endif
     22 
    2523  Address[0].sin_family = AF_INET;
    2624  Address[0].sin_port   = MY_PORT;
     25  Address[0].sin_addr.s_addr = INADDR_ANY; // use this line to bind any address / port?
     26
     27# if (0) 
    2728  status = inet_aton (hostip, &Address[0].sin_addr);
    2829  if (!status) {
     
    3031    exit (2);
    3132  }
     33# endif
    3234
    3335  length = sizeof(Address[0]);
     
    5254  }
    5355
    54   if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);
     56  // if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);
    5557  return (InitSocket);
    5658}
     
    159161  return (InitSocket);
    160162}
     163
     164int InitServerSocket_Named (char *hostname, SockAddress *Address) {
     165
     166  int i, status, InitSocket, length;
     167  struct hostent  *host;
     168  char tmpline[80], hostip[80];
     169
     170  host = gethostbyname (hostname);
     171  bzero (hostip, 80);
     172  for (i = 0; i < host[0].h_length; i++) {
     173    sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
     174    strcat (hostip, tmpline);
     175    if (i < host[0].h_length - 1) strcat (hostip, ".");
     176  }
     177 
     178  Address[0].sin_family = AF_INET;
     179  Address[0].sin_port   = MY_PORT;
     180  status = inet_aton (hostip, &Address[0].sin_addr);
     181  if (!status) {
     182    fprintf (stderr, "invalid address\n");
     183    exit (2);
     184  }
     185
     186  length = sizeof(Address[0]);
     187
     188  InitSocket = socket (PF_INET, SOCK_STREAM, 0);
     189  if (InitSocket == -1) {
     190    perror ("socket: ");
     191    exit (2);
     192  }
     193
     194  fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);
     195  status = bind (InitSocket, (struct sockaddr *) Address, length);
     196  if (status == -1) {
     197    perror ("bind: ");
     198    exit (2);
     199  }
     200
     201  status = listen (InitSocket, 10);
     202  if (status == -1) {
     203    perror ("listen: ");
     204    exit (2);
     205  }
     206
     207  if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);
     208  return (InitSocket);
     209}
     210
  • trunk/Ohana/src/addstar/src/addstarc.c

    r5328 r5347  
    33int main (int argc, char **argv) {
    44
    5   int Nstars, Nimage;
     5  int Nstars;
    66  int BindSocket;
    77  AddstarClientOptions options;
     
    1313  options = args_client (argc, argv, options);
    1414
    15   /* load data */
    16   stars = gstars (argv[1], &Nstars, MOSAIC, &image);
    17 
    1815  /* set up server connection */
    1916  BindSocket = GetClientSocket (HOSTNAME);
     
    2118
    2219  /* send new data to server */
    23   SendCommand (BindSocket, 5, "IMAGE");
    24   Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);
    25   Send_Image (BindSocket, &image, 1, FALSE);
    26   Send_Stars (BindSocket, stars, Nstars, FALSE);
     20  switch (options.mode) {
     21    case M_IMAGE:
     22      /* load data */
     23      stars = gstars (argv[1], &Nstars, options.photcode, &image);
    2724
    28   exit (0);
     25      /* send data to server */
     26      SendCommand (BindSocket, 5, "IMAGE");
     27      Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);
     28      Send_Image (BindSocket, &image, 1, FALSE);
     29      if (options.mosaic) {
     30        Send_Coords (BindSocket, MOSAIC, 1, FALSE);
     31      }
     32      Send_Stars (BindSocket, stars, Nstars, FALSE);
     33      exit (0);
     34
     35    case M_REFLIST:
     36      /* load data */
     37      stars = grefstars (argv[1], options.photcode, &Nstars);
     38     
     39      /* send data to server */
     40      SendCommand (BindSocket, 5, "REFLS");
     41      Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);
     42      Send_Stars (BindSocket, stars, Nstars, FALSE);
     43      exit (0);
     44
     45    case M_REFCAT:
     46      /* send data to server */
     47      SendCommand (BindSocket, 5, "REFCT");
     48      Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);
     49      Send_GSCRegion (BindSocket, &UserPatch, 1, TRUE);
     50      SendMessage (BindSocket, argv[1]);
     51
     52      exit (0);
     53  }
     54  exit (1);
    2955}
  • trunk/Ohana/src/addstar/src/addstard.c

    r5322 r5347  
    1414
    1515  VERBOSE = TRUE;
    16   InitSocket = InitServerSocket (argv[1], &Address);
     16  InitSocket = InitServerSocket (&Address);
    1717 
    1818  while (1) {
     
    2525    if (!CheckPassword (BindSocket)) continue;
    2626   
    27     /* accept command */
     27    /* accept command : XXX EAM : long-enough timeout? */
    2828    status = ExpectCommand (BindSocket, 5, 0.1, &message);
    2929    if (status != 0) {
     
    3636    /* message options */
    3737    if (!strcmp (message.buffer, "IMAGE")) {
    38       fprintf (stderr, "New Image\n");
     38      fprintf (stderr, "Image\n");
    3939      NewImage (BindSocket);
     40      continue;
     41    }
     42    if (!strcmp (message.buffer, "REFLS")) {
     43      fprintf (stderr, "Reflist\n");
     44      NewReflist (BindSocket);
     45      continue;
     46    }
     47    if (!strcmp (message.buffer, "REFCT")) {
     48      fprintf (stderr, "Refcat\n");
     49      NewRefcat (BindSocket);
    4050      continue;
    4151    }
  • trunk/Ohana/src/addstar/src/airmass.c

    r5328 r5347  
    11# include "addstar.h"
    22
    3 static AirmassQuality = FALSE;
     3static int AirmassQuality = FALSE;
    44
    55void SetAirmassQuality (int quality) {
  • trunk/Ohana/src/addstar/src/args_client.c

    r5328 r5347  
    55 
    66  int N;
    7   int QUALITY_AIRMASS;
    87
    98  /* check for help request */
     
    148147  /*** optional situations ***/
    149148  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
    150   QUALITY_AIRMASS = FALSE;
     149  options.quality_airmass = FALSE;
    151150  if ((N = get_argument (argc, argv, "-quality-airmass"))) {
    152151    remove_argument (N, &argc, argv);
    153     QUALITY_AIRMASS = TRUE;
     152    options.quality_airmass = TRUE;
    154153  }
    155154  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     
    162161  if ((N = get_argument (argc, argv, "-skyprobe"))) {
    163162    remove_argument (N, &argc, argv);
    164     QUALITY_AIRMASS = TRUE;
     163    options.quality_airmass = TRUE;
    165164    SUBPIX = TRUE;
    166165  }
  • trunk/Ohana/src/addstar/src/args_server.c

    r5322 r5347  
    5151  }
    5252
    53   if (argc != 2) {
    54     fprintf (stderr, "USAGE: addstard (host)\n");
     53  if (argc != 1) {
     54    fprintf (stderr, "USAGE: addstard\n");
    5555    exit (2);
    5656  }
    57   return (TRUE);
    5857}
    5958
     
    6160
    6261  fprintf (stderr, "USAGE\n");
    63   fprintf (stderr, "  addstard (host)\n");
     62  fprintf (stderr, "  addstard\n");
    6463  fprintf (stderr, "  -force                      : force read of database with inconsistent info\n");
    6564  fprintf (stderr, "  -v                          : verbose mode\n");
  • trunk/Ohana/src/addstar/src/find_matches.c

    r5328 r5347  
    1818  gettimeofday (&start, NULL);
    1919
    20   code = GetPhotcodebyCode (options.photcode);
     20  /* XXX EAM : options.photcode overridden by image.source.... */
     21  code = GetPhotcodebyCode (image[0].source);
    2122
    2223  /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
  • trunk/Ohana/src/addstar/src/gcatalog.c

    r5322 r5347  
    44 
    55  int Nsecfilt, status;
    6   char mode;
    76
    87  /* CATMODE and CATFORMAT determined from catalog */
  • trunk/Ohana/src/addstar/src/grefstars.c

    r5328 r5347  
    3535  return (stars);
    3636}
     37
     38/* stars.found is set here to FALSE.
     39   gregion_stars uses this value as a boolean to decide if the star
     40     has been associated with a region.
     41   gregion_stars resets stars.found to -1
     42   find_match_refstars uses stars.found to identify the seq number of the
     43     star which is found.  it requires an initial value of -1
     44*/
  • trunk/Ohana/src/addstar/src/gregion_star.c

    r3376 r5347  
    2525    }
    2626    Nregions ++;
    27     CHECK_REALLOCATE (regions, GSCRegion, Nregions, NREGIONS, 100);
     27    CHECK_REALLOCATE (regions, GSCRegion, NREGIONS, Nregions, 100);
    2828   
    2929  }
     30
     31  /* reset to -1 for all stars: required start for find_match_refstars */
     32  for (i = 0; i < Nstars; i++) stars[i].found = -1;
     33
    3034  *nregions = Nregions;
    3135  return (regions);
Note: See TracChangeset for help on using the changeset viewer.