IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3609


Ignore:
Timestamp:
Mar 31, 2005, 4:57:00 PM (21 years ago)
Author:
eugene
Message:

moving to autocode on imregister

Location:
trunk/Ohana/src
Files:
1 added
12 edited

Legend:

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

    r3593 r3609  
    2929# remember to add entries here to libohana/Makefile:AOBJ as well
    3030LIBOBJ = \
     31$(SRC)/regimage.$(ARCH).o \
    3132$(SRC)/detreg.$(ARCH).o \
    3233$(SRC)/photreg.$(ARCH).o \
     
    3738
    3839LIBINC = \
     40$(INC)/regimage.h \
    3941$(INC)/detreg.h \
    4042$(INC)/photreg.h \
     
    4446$(INC)/spectrum-ascii.h
    4547
    46 COMINC = \
    47 $(DEF)/common.h
    48 
    4948$(LIBOBJ): $(INC)/autocode.h
    5049
    5150$(INC)/autocode.h: $(LIBINC)
    52         cat $(COMINC) $(LIBINC) > $(INC)/autocode.h
     51        cat $(DEF)/common.h >  $(INC)/autocode.h
     52        cat $(LIBINC)       >> $(INC)/autocode.h
     53        @echo "# endif"     >> $(INC)/autocode.h
    5354        @echo done with libautocode.a:
    5455
  • trunk/Ohana/src/libautocode/def/common.h

    r3536 r3609  
    1 # include <stdio.h>
    2 # include <stdarg.h>
    3 # include <fitsio.h>
     1# include <ohana.h>
     2
     3# ifndef AUTOCODE_H
     4# define AUTOCODE_H
     5/* matched endif is added by Makefile */
    46
    57# ifndef TRUE
     
    3234
    3335# define e_time unsigned int
     36# define rawshort short
     37
     38/*** rawshort is used to handle the broken pre-autocode photreg tables
     39     fix the tables and remove this
     40***/
    3441
    3542/*** this file uses data types which must have fixed sizes regardless
  • trunk/Ohana/src/libautocode/def/photreg.d

    r3536 r3609  
    1717FIELD photcode,   PHOTCODE,   short,       photcode,                  photcode
    1818FIELD label,      LABEL,      char[64],    data label
    19 FIELD refcode,    REFCODE,    short,       photcode,                  photcode
     19FIELD refcode,    REFCODE,    rawshort,    photcode,                  photcode
    2020FIELD Ntime,      N_TIME,     int,         number of times
    2121FIELD Nmeas,      N_MEAS,     int,         number of measurements
  • trunk/Ohana/src/libautocode/generate

    r3536 r3609  
    4141        # not a simple key/value entry
    4242        if ($key eq "FIELD") {
    43             ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value);
     43            ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value, 5);
     44#           print "$element : $field : $format : $comment : $unit\n";
    4445            push @element, $element;
    4546            push @field,   $field;
     
    106107        if ($type eq "float")  { $pt1 = "E"; }
    107108        if ($type eq "double") { $pt1 = "D"; }
     109
     110        if ($type eq "rawshort") { $pt1 = "I"; }
    108111
    109112        printf FILE "  fits_define_bintable_column (header, ";
     
    130133        if ($type eq "double") { $pt1 = sprintf "F%s", $length; }
    131134
     135        if ($type eq "rawshort")  { $pt1 = sprintf "I%s", $length; }
     136
    132137        printf FILE "  fits_define_table_column (header, ";
    133138        printf FILE "\"%s\", ",   $pt1;
     
    179184            next;
    180185        }
     186        # this is a patch for old photreg tables: provide a fix for the tables
     187        if ($type eq "rawshort")  {
     188            $N +=2;
     189            next;
     190        }
    181191        if ($type eq "short")  {
    182192            $T = "BYTE";
     
    229239        if ($type eq "float")  { $Nbytes += 4; }
    230240        if ($type eq "double") { $Nbytes += 8; }
     241
     242        if ($type eq "rawshort")  { $Nbytes += 2; }
    231243    }
    232244    return ($Nbytes);
  • trunk/Ohana/src/libfits/header/F_modify.c

    r3400 r3609  
    1111
    1212  char comment[82], string[82], data[82];
    13   char *p, *q;
     13  char *p, *qs, *qe;
    1414  va_list argp;
    1515 
     
    2727  p = fits_header_field (header, field, N);
    2828  if (p == NULL)  {
    29 
    3029    /* new entry, find the END of the header */
    3130    p = fits_header_field (header, "END", 1);
     
    4544    memset (p, ' ', FT_LINE_LENGTH);
    4645  } else {
    47     q = fits_keyword_end (p);
    48     q += 3;
    49     q = MIN (p + 80, q);
    50     strncpy (comment, q, p + 80 - q);
     46    /* old entry, save the comment region (is this skipping a character for non-strings?) */
     47    qe = fits_keyword_end (p);
     48    qe += 3;
     49    qe = MIN (p + 80, qe);
     50    strncpy (comment, qe, p + 80 - qe);
    5151  }
    5252  pad_ending (comment, ' ', 82);  /* comment must contain spaces to the end */
     
    8686  /* just a comment associated with a value.  this is assumes a fixed format position for the comment */
    8787  if (!strcmp (mode, "%C")) {
    88     q = fits_keyword_end (p);
    89     strncpy (data, p + 9, MAX (MIN ((q - p - 9), 71), 0));
     88    qe = fits_keyword_end (p);
     89    qs = fits_keyword_start (p);
     90
     91    /* keep ' on ends, if there */
     92    if (qe[0]  == 0x27) qe ++;
     93    if (qs[-1] == 0x27) qs --;
     94
     95    strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));
    9096    strncpy (comment, va_arg (argp, char *), 80);
    9197    pad_ending (comment, ' ', 82);  /* comment must contain spaces to the end */
    92     snprintf (string, 81, "%-8s=%21s / %-s", field, data, comment);
     98    snprintf (string, 81, "%-8s= %s / %-s", field, data, comment);
     99    /* this will keep the original line, but truncate the comment */
    93100  }
    94101
  • trunk/Ohana/src/libohana/Makefile

    r3593 r3609  
    1313DESTMAN =       $(LMAN)
    1414
    15 INCS    =       -I$(LINC)
    16 CFLAGS  =       -Wunused -o $*.$(ARCH).o $(INCS)
    17 LFLAGS  =       -c $(INCS)
     15CFLAGS  =       -I$(LINC) -D$(ARCH)
    1816
    1917default: install
     
    2119install: $(DESTLIB)/libohana.a
    2220
    23 ohana: $(LIB)/libohana.$(ARCH).a
     21libohana: $(LIB)/libohana.$(ARCH).a
    2422
    25 HOBJ = \
     23INC1 = \
    2624$(DESTINC)/Xohana.h  \
    27 $(DESTINC)/ohana.h \
     25$(DESTINC)/ohana.h
     26
     27INC2 = \
    2828$(DESTINC)/loneos.h \
    2929$(DESTINC)/elixir.h \
     
    3131$(DESTINC)/dvo.h
    3232
    33 LOBJ = \
     33OBJ1 = \
    3434$(SRC)/version.$(ARCH).o         \
    3535$(SRC)/string.$(ARCH).o          \
     
    3737$(SRC)/glockfile.$(ARCH).o       \
    3838$(SRC)/config.$(ARCH).o          \
     39$(SRC)/Fseek.$(ARCH).o           
     40
     41OBJ2 = \
    3942$(SRC)/coordops.$(ARCH).o        \
    4043$(SRC)/Fread.$(ARCH).o           \
    41 $(SRC)/Fseek.$(ARCH).o           \
    4244$(SRC)/LoadPhotcodes.$(ARCH).o   \
    4345$(SRC)/photfits.$(ARCH).o        \
     
    4850
    4951AOBJ = \
     52$(ASRC)/regimage.$(ARCH).o \
    5053$(ASRC)/detreg.$(ARCH).o \
    5154$(ASRC)/photreg.$(ARCH).o \
     
    5558$(ASRC)/spectrum-ascii.$(ARCH).o
    5659
    57 autocode:
     60autocode: $(INC1)
    5861        cd $(AUTO) && make install
     62
     63$(OBJ1): $(INC1)
     64$(OBJ2): $(INC2)
     65$(AOBJ): autocode
    5966
    6067$(DESTLIB)/libohana.a: $(LIB)/libohana.$(ARCH).a
     
    6370        cp $(LIB)/libohana.$(ARCH).a $(DESTLIB)/libohana.a
    6471
    65 $(LIB)/libohana.$(ARCH).a: autocode $(HOBJ) $(LOBJ)
     72$(LIB)/libohana.$(ARCH).a: autocode $(OBJ1) $(AOBJ) $(OBJ2)
    6673        @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
    6774        rm -f $(LIB)/libohana.$(ARCH).a
    68         ar rcv $(LIB)/libohana.$(ARCH).a $(LOBJ) $(AOBJ)
     75        ar rcv $(LIB)/libohana.$(ARCH).a $(OBJ1) $(AOBJ) $(OBJ2)
    6976        $(RANLIB) $(LIB)/libohana.$(ARCH).a
    70 
    71 $(LOBJ): $(DESTINC)/ohana.h $(DESTINC)/loneos.h $(DESTINC)/elixir.h $(DESTINC)/panstarrs.h
    7277
    7378$(DESTINC)/%: $(INC)/%
     
    8893
    8994.c.$(ARCH).o:
    90         $(CC) $(CFLAGS) -c $<
     95        $(CC) $(CFLAGS) -c $*.c -o $@
     96        @echo done with $*.o
  • trunk/Ohana/src/libohana/include/dvo.h

    r3536 r3609  
     1# include <autocode.h>
    12
    23# ifndef DVO_H
    34# define DVO_H
    45
    5 # define ELIXIR    1
    6 # define LONEOS    0
    7 # define PANSTARRS 0
     6/*** FITS DB structure  ***/
     7typedef struct {
     8  FILE  *f;
     9  char  *filename;
     10  int    dbstate;
     11  int    lockstate;
     12  double timeout;
     13  Header header;
     14  Matrix matrix;
     15  Header theader;
     16  FTable ftable;
     17} FITS_DB;
     18
     19/* the standard astrometric coordinates structure */
     20typedef struct {
     21  double   crval1, crval2;
     22  float    crpix1, crpix2;
     23  float    cdelt1, cdelt2;
     24  float    pc1_1, pc1_2;
     25  float    pc2_1, pc2_2;
     26  float    polyterms[7][2];
     27  char     ctype[15];
     28  char     Npolyterms;
     29} Coords;  /* 120 bytes / Coords */
     30
     31/* in fits_db.c */
     32int   fits_db_init                PROTO((FITS_DB *db));
     33int   fits_db_create              PROTO((FITS_DB *db));
     34int   fits_db_lock                PROTO((FITS_DB *db, char *filename));
     35int   fits_db_load                PROTO((FITS_DB *db));
     36int   fits_db_close               PROTO((FITS_DB *db));
     37int   fits_db_free                PROTO((FITS_DB *db));
     38int   fits_db_save                PROTO((FITS_DB *db));
     39int   fits_db_update              PROTO((FITS_DB *db, VTable *vtable));
     40
     41/* in coords.c */
     42int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
     43int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
     44int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
     45int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
     46int  GetCoords (Coords *coords, Header *header);
     47int  PutCoords (Coords *coords, Header *header);
     48void RegisterMosaic (Coords *coords);
     49void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    850
    951/* image data modes in RegImage */
     
    75117*/
    76118
    77 /*** FITS DB structure  ***/
    78 typedef struct {
    79   FILE  *f;
    80   char  *filename;
    81   int    dbstate;
    82   int    lockstate;
    83   double timeout;
    84   Header header;
    85   Matrix matrix;
    86   Header theader;
    87   FTable ftable;
    88 } FITS_DB;
     119/** we are going to replace these with autocode and appropriate conversions
     120    for now, choose the appropriate table version **/
    89121
    90 /* the standard astrometric coordinates structure */
    91 typedef struct {
    92   double   crval1, crval2;
    93   float    crpix1, crpix2;
    94   float    cdelt1, cdelt2;
    95   float    pc1_1, pc1_2;
    96   float    pc2_1, pc2_2;
    97   float    polyterms[7][2];
    98   char     ctype[15];
    99   char     Npolyterms;
    100 } Coords;  /* 120 bytes / Coords */
    101 
    102 /*** FITS_DB functions ***/
    103 
    104 /* in fits_db.c */
    105 int   fits_db_init                PROTO((FITS_DB *db));
    106 int   fits_db_lock                PROTO((FITS_DB *db, char *filename));
    107 int   fits_db_load                PROTO((FITS_DB *db));
    108 int   fits_db_close               PROTO((FITS_DB *db));
    109 int   fits_db_free                PROTO((FITS_DB *db));
    110 int   fits_db_save                PROTO((FITS_DB *db));
    111 int   fits_db_update              PROTO((FITS_DB *db, VTable *vtable));
    112 
    113 /* in coords.c */
    114 int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
    115 int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
    116 int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
    117 int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
    118 int  GetCoords (Coords *coords, Header *header);
    119 int  PutCoords (Coords *coords, Header *header);
    120 void RegisterMosaic (Coords *coords);
    121 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    122 
    123 # include <autocode.h>
     122# define ELIXIR    1
     123# define LONEOS    0
     124# define PANSTARRS 0
    124125
    125126# if (LONEOS)
     
    135136# endif
    136137
    137 /* these functions refer to the DVO structures define in the includes above */
     138/* these functions refer to the DVO structures defined in the includes above
     139 *  they are being replaced with autocode entries
     140 */
     141
    138142int   Fread (void *ptr, int size, int nitems, FILE *f, char *type);
    139143int   Fwrite (void *ptr, int size, int nitems, FILE *f, char *type);
  • trunk/Ohana/src/libohana/include/elixir.h

    r3536 r3609  
    1414/************  database structures ************************************/
    1515
     16# if (0)
    1617/* structure for Image Registration Database */
    1718typedef struct {
     
    4344  e_time regtime;
    4445} RegImage;  /* 360 bytes / image */
    45 
     46# endif
     47
     48# if (0)
    4649/* Detrend Database structure */
    4750typedef struct {
     
    6164  char filename[256];
    6265} DetReg;    /* 416 bytes */
     66# endif
    6367
    6468/* average data as stored in the LONEOS database */
  • trunk/Ohana/src/libohana/include/loneos.h

    r3536 r3609  
    3434} RegImage;  /* 360 bytes / image */
    3535
     36# if (0)
    3637/* Detrend Database structure */
    3738typedef struct {
     
    5152  char filename[256];
    5253} DetReg;    /* 416 bytes */
     54# endif
    5355
    5456/* average data as stored in the LONEOS database -- must be translated on load */
  • trunk/Ohana/src/libohana/include/panstarrs.h

    r3536 r3609  
    3434} RegImage;  /* 360 bytes / image */
    3535
     36# if (0)
    3637/* Detrend Database structure */
    3738typedef struct {
     
    5152  char filename[256];
    5253} DetReg;    /* 416 bytes */
     54# endif
    5355
    5456/* average data as stored in the LONEOS database */
  • trunk/Ohana/src/libohana/src/Fread.c

    r3466 r3609  
    1 # include <stdio.h>
    2 # include <string.h>
    31# include <ohana.h>
    42# include <dvo.h>
     3
    54int   ByteSwap (char *ptr, int size, int nitems, char *type);
    65int   ConvertStruct (char *buffer, int size, int Nbytes, char *type);
  • trunk/Ohana/src/libohana/src/fits_db.c

    r3538 r3609  
    1 # include "ohana.h"
    2 # include "dvo.h"
     1# include <ohana.h>
     2# include <dvo.h>
    33
     4/* init the db structure */
    45int fits_db_init (FITS_DB *db) {
    56
     
    89  db[0].matrix.buffer = NULL;
    910  db[0].ftable.buffer = NULL;
     11  db[0].ftable.header = &db[0].theader;
     12  return (TRUE);
     13}
     14
     15/* create an empty db */
     16int fits_db_create (FITS_DB *db) {
     17  fits_init_header (&db[0].header);   
     18  db[0].header.extend = TRUE;
     19  fits_create_header (&db[0].header);
     20  fits_create_matrix (&db[0].header, &db[0].matrix);
     21  fits_print (&db[0].header, "NEXTEND", "%d", 1, 1);
    1022  db[0].ftable.header = &db[0].theader;
    1123  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.