IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3508


Ignore:
Timestamp:
Mar 24, 2005, 4:50:29 PM (21 years ago)
Author:
eugene
Message:

includes cleanup, adding autocode stuff, fits_db

Location:
trunk/Ohana/src/libohana
Files:
14 added
8 edited

Legend:

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

    r3466 r3508  
    66MAN     =       $(HOME)/doc
    77INC     =       $(HOME)/include
     8DVO     =       $(HOME)/dvo/src
    89DESTBIN =       $(LBIN)
    910DESTLIB =       $(LLIB)
     
    3031
    3132LOBJ = \
    32 $(SRC)/string.$(ARCH).o         $(SRC)/findexec.$(ARCH).o        \
    33 $(SRC)/config.$(ARCH).o         $(SRC)/coordops.$(ARCH).o        \
    34 $(SRC)/Fread.$(ARCH).o          $(SRC)/glockfile.$(ARCH).o       \
    35 $(SRC)/LoadPhotcodes.$(ARCH).o  $(SRC)/photfits.$(ARCH).o        \
    36 $(SRC)/phot_catalog.$(ARCH).o   $(SRC)/imreg_datatypes.$(ARCH).o \
    37 $(SRC)/mosaic_astrom.$(ARCH).o
     33$(SRC)/string.$(ARCH).o          \
     34$(SRC)/findexec.$(ARCH).o        \
     35$(SRC)/glockfile.$(ARCH).o       \
     36$(SRC)/config.$(ARCH).o          \
     37$(SRC)/coordops.$(ARCH).o        \
     38$(SRC)/Fread.$(ARCH).o           \
     39$(SRC)/Fseek.$(ARCH).o           \
     40$(SRC)/LoadPhotcodes.$(ARCH).o   \
     41$(SRC)/photfits.$(ARCH).o        \
     42$(SRC)/phot_catalog.$(ARCH).o    \
     43$(SRC)/imreg_datatypes.$(ARCH).o \
     44$(SRC)/mosaic_astrom.$(ARCH).o   \
     45$(SRC)/fits_db.$(ARCH).o         
     46
     47DOBJ = \
     48$(DVO)/spectrum.$(ARCH).o \
     49$(DVO)/spectrum-ascii.$(ARCH).o
    3850
    3951$(DESTLIB)/libohana.a: $(LIB)/libohana.$(ARCH).a
     
    4355
    4456$(LIB)/libohana.$(ARCH).a: $(HOBJ) $(LOBJ)
     57        cd dvo && make install
    4558        @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
    4659        rm -f $(LIB)/libohana.$(ARCH).a
    47         ar rcv $(LIB)/libohana.$(ARCH).a $(LOBJ)
     60        ar rcv $(LIB)/libohana.$(ARCH).a $(LOBJ) $(DOBJ)
    4861        $(RANLIB) $(LIB)/libohana.$(ARCH).a
    4962
     
    6073        rm -f */*.o
    6174        rm -f */*.a
     75        cd dvo && make clean
    6276
    6377dist: clean
  • trunk/Ohana/src/libohana/include/dvo.h

    r3473 r3508  
    33# define LONEOS    0
    44# define PANSTARRS 0
     5
     6/*** this file uses data types which must have fixed sizes regardless
     7     of the platform.  It originally used the basic C primitives:
     8       float, double, int, short int, unsigned long int, etc.
     9     this breaks under 64 bit (and probably on other systems).
     10     I should define internal data types which should be set by the
     11     use of # define statements if needed.  I will cheat for now and use
     12     the time_t to replace unsigned long int in this file
     13***/
     14
     15# define e_time unsigned int
     16
     17/* image data modes in RegImage */
     18enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE};
     19enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE};
     20
     21/* convert these to enums? */
     22/* RegImage.flag values */
     23# define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
     24
     25/* catalog values to be loaded */
     26# define LOAD_AVES 0x01
     27# define LOAD_MEAS 0x02
     28# define LOAD_MISS 0x04
     29# define LOAD_SECF 0x08
     30
     31/* invalid mag value */
     32# define NO_MAG    0x7fff
     33# define NO_ERR    0xff
     34
     35/* photometry code types */
     36# define PHOT_PRI 0x01
     37# define PHOT_SEC 0x02
     38# define PHOT_DEP 0x03
     39# define PHOT_REF 0x04
     40# define PHOT_ALT 0x05  /* never stored, only for look-ups */
     41
     42/* Image.code values.  these are codes to note bad images */
     43# define ID_IMAGE_NEW   0x0000  /* no nrphot attempted */
     44# define ID_IMAGE_NOCAL 0x0001  /* used within nrphot to mean "don't apply fit" */
     45# define ID_IMAGE_POOR  0x0002  /* relphot says image is bad */
     46# define ID_IMAGE_SKIP  0x0004  /* external information image is bad */
     47# define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
     48
     49/* Measure.flags values */
     50# define ID_MEAS_NOCAL        0x0001
     51# define ID_MEAS_POOR         0x0002
     52# define ID_MEAS_SKIP         0x0004
     53# define ID_MEAS_AREA         0x0008
     54# define BLEND_IMAGE          0x0100
     55# define BLEND_CATALOG        0x0200
     56# define BLEND_IMAGE_NEIGHBOR 0x1000
     57# define ID_MEAS_TRAIL        0x2000
     58# define ID_MEAS_GHOST        0x4000
     59
     60/* Average.code values */
     61# define ID_STAR_FEW   0x0001 /* used within relphot: skip star */
     62# define ID_STAR_POOR  0x0002 /* used within relphot: skip star */
     63# define ID_PROPER     0x0400 /* star with large proper motion */
     64# define ID_TRANSIENT  0x1000 /* is this mutually exclusive with USNO?  */
     65# define ID_VARIABLE   0x2000 /* not currently set? */
     66# define ID_ASTEROID   0x2000 /* identified with an asteroid */
     67# define ID_BAD_OBJECT 0x4000 /* if all measurements are bad, set this bit */
     68# define ID_MOVING     0x8000
     69# define ID_ROCK       0xa000 /* 0x8000 + 0x2000 */
     70# define ID_GHOST      0xc001 /* 0x8000 + 0x4000 + 0x0001 */
     71# define ID_TRAIL      0xc002 /* 0x8000 + 0x4000 + 0x0002 */
     72# define ID_BLEED      0xc003 /* 0x8000 + 0x4000 + 0x0003 */
     73# define ID_COSMIC     0xc004 /* 0x8000 + 0x4000 + 0x0004 */
     74
     75/*
     76   BLEND_IMAGE: the star on an image is matched with more
     77      than one star in the catalog (image has worse seeing than catalog)
     78   BLEND_CATALOG: the star in the catalog is matched with more
     79      than one star on the image (image has better seeing than catalog)
     80   CALIBRATED: relative photometry has been performed on this measurement
     81   BLEND_IMAGE_NEIGHBOR: the star on an image is matched with more
     82      than one star in the catalog, but not in the same catalog file.
     83*/
     84
     85/*** FITS DB structure  ***/
     86typedef struct {
     87  FILE  *f;
     88  char  *filename;
     89  int    dbstate;
     90  int    lockstate;
     91  double timeout;
     92  Header header;
     93  Matrix matrix;
     94  Header theader;
     95  FTable ftable;
     96} FITS_DB;
     97
     98/* the standard astrometric coordinates structure */
     99typedef struct {
     100  double   crval1, crval2;
     101  float    crpix1, crpix2;
     102  float    cdelt1, cdelt2;
     103  float    pc1_1, pc1_2;
     104  float    pc2_1, pc2_2;
     105  float    polyterms[7][2];
     106  char     ctype[15];
     107  char     Npolyterms;
     108} Coords;  /* 120 bytes / Coords */
     109
     110/*** FITS_DB functions ***/
     111
     112/* in fits_db.c */
     113int   fits_db_init                PROTO((FITS_DB *db));
     114int   fits_db_lock                PROTO((FITS_DB *db, char *filename));
     115int   fits_db_load                PROTO((FITS_DB *db));
     116int   fits_db_close               PROTO((FITS_DB *db));
     117int   fits_db_free                PROTO((FITS_DB *db));
     118int   fits_db_save                PROTO((FITS_DB *db));
     119int   fits_db_update              PROTO((FITS_DB *db, VTable *vtable));
     120
     121/* in coords.c */
     122int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
     123int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
     124int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
     125int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
     126int  GetCoords (Coords *coords, Header *header);
     127int  PutCoords (Coords *coords, Header *header);
     128void RegisterMosaic (Coords *coords);
     129void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    5130
    6131# if (LONEOS)
     
    16141# endif
    17142
     143# include <dvo-autocode.h>
     144
     145/* these functions refer to the DVO structures define in the includes above */
     146int   Fread (void *ptr, int size, int nitems, FILE *f, char *type);
     147int   Fwrite (void *ptr, int size, int nitems, FILE *f, char *type);
     148int   ByteSwap (char *ptr, int size, int nitems, char *type);
     149int   ConvertStruct (char *buffer, int size, int Nbytes, char *type);
  • trunk/Ohana/src/libohana/include/elixir.h

    r3473 r3508  
    1111# ifndef ELIXIR_H
    1212# define ELIXIR_H
    13 
    14 # define e_time unsigned int
    15 
    16 /* image data modes in RegImage */
    17 enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE};
    18 enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE};
    19 
    20 /* convert these to enums? */
    21 /* RegImage.flag values */
    22 # define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
    23 
    24 /* catalog values to be loaded */
    25 # define LOAD_AVES 0x01
    26 # define LOAD_MEAS 0x02
    27 # define LOAD_MISS 0x04
    28 # define LOAD_SECF 0x08
    29 
    30 /* invalid mag value */
    31 # define NO_MAG    0x7fff
    32 # define NO_ERR    0xff
    33 
    34 /* photometry code types */
    35 # define PHOT_PRI 0x01
    36 # define PHOT_SEC 0x02
    37 # define PHOT_DEP 0x03
    38 # define PHOT_REF 0x04
    39 # define PHOT_ALT 0x05  /* never stored, only for look-ups */
    40 
    41 /* Image.code values.  these are codes to note bad images */
    42 # define ID_IMAGE_NEW   0x0000  /* no nrphot attempted */
    43 # define ID_IMAGE_NOCAL 0x0001  /* used within nrphot to mean "don't apply fit" */
    44 # define ID_IMAGE_POOR  0x0002  /* relphot says image is bad */
    45 # define ID_IMAGE_SKIP  0x0004  /* external information image is bad */
    46 # define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
    47 
    48 /* Measure.flags values */
    49 # define ID_MEAS_NOCAL        0x0001
    50 # define ID_MEAS_POOR         0x0002
    51 # define ID_MEAS_SKIP         0x0004
    52 # define ID_MEAS_AREA         0x0008
    53 # define BLEND_IMAGE          0x0100
    54 # define BLEND_CATALOG        0x0200
    55 # define BLEND_IMAGE_NEIGHBOR 0x1000
    56 # define ID_MEAS_TRAIL        0x2000
    57 # define ID_MEAS_GHOST        0x4000
    58 
    59 /* Average.code values */
    60 # define ID_STAR_FEW   0x0001 /* used within relphot: skip star */
    61 # define ID_STAR_POOR  0x0002 /* used within relphot: skip star */
    62 # define ID_PROPER     0x0400 /* star with large proper motion */
    63 # define ID_TRANSIENT  0x1000 /* is this mutually exclusive with USNO?  */
    64 # define ID_VARIABLE   0x2000 /* not currently set? */
    65 # define ID_ASTEROID   0x2000 /* identified with an asteroid */
    66 # define ID_BAD_OBJECT 0x4000 /* if all measurements are bad, set this bit */
    67 # define ID_MOVING     0x8000
    68 # define ID_ROCK       0xa000 /* 0x8000 + 0x2000 */
    69 # define ID_GHOST      0xc001 /* 0x8000 + 0x4000 + 0x0001 */
    70 # define ID_TRAIL      0xc002 /* 0x8000 + 0x4000 + 0x0002 */
    71 # define ID_BLEED      0xc003 /* 0x8000 + 0x4000 + 0x0003 */
    72 # define ID_COSMIC     0xc004 /* 0x8000 + 0x4000 + 0x0004 */
    73 
    74 /*
    75    BLEND_IMAGE: the star on an image is matched with more
    76       than one star in the catalog (image has worse seeing than catalog)
    77    BLEND_CATALOG: the star in the catalog is matched with more
    78       than one star on the image (image has better seeing than catalog)
    79    CALIBRATED: relative photometry has been performed on this measurement
    80    BLEND_IMAGE_NEIGHBOR: the star on an image is matched with more
    81       than one star in the catalog, but not in the same catalog file.
    82 */
    8313
    8414/************  database structures ************************************/
     
    194124  short int dM;               /* scatter on alt mag */
    195125} SecFilt; /* 6 byte / SecFilt */
    196 
    197 /* the standard astrometric coordinates structure */
    198 typedef struct {
    199   double   crval1, crval2;
    200   float    crpix1, crpix2;
    201   float    cdelt1, cdelt2;
    202   float    pc1_1, pc1_2;
    203   float    pc2_1, pc2_2;
    204   float    polyterms[7][2];
    205   char     ctype[15];
    206   char     Npolyterms;
    207 } Coords;  /* 120 bytes / Coords */
    208126
    209127/* image structure for binary data storage of image data */
     
    296214int save_catalog (Catalog *catalog, char VERBOSE);
    297215
    298 int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
    299 int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
    300 int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
    301 int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
    302 int  GetCoords (Coords *coords, Header *header);
    303 int  PutCoords (Coords *coords, Header *header);
    304 void RegisterMosaic (Coords *coords);
    305 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    306 int FindMosaicForImage (Image *images, int Nimages, int entry);
    307 int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
    308 int FindMosaicForImage_MatchSearch (Image *images, int Nimages, int entry);
    309 int BuildChipMatch (Image *images, int Nimages);
    310 
    311216int FindMosaicForImage (Image *images, int Nimages, int entry);
    312217int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
  • trunk/Ohana/src/libohana/include/loneos.h

    r3466 r3508  
    1 
    2 /*** this file uses data types which must have fixed sizes regardless
    3      of the platform.  It originally used the basic C primitives:
    4        float, double, int, short int, unsigned long int, etc.
    5      this breaks under 64 bit (and probably on other systems).
    6      I should define internal data types which should be set by the
    7      use of # define statements if needed.  I will cheat for now and use
    8      the time_t to replace unsigned long int in this file
    9 ***/
    101
    112# ifndef LONEOS_H
    123# define LONEOS_H
    134
    14 # define e_time unsigned int
    15 
    16 /* image data modes in RegImage */
    17 enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE};
    18 enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE};
    19 
    20 /* convert these to enums? */
    21 /* RegImage.flag values */
    22 # define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
    23 
    24 /* catalog values to be loaded */
    25 # define LOAD_AVES 0x01
    26 # define LOAD_MEAS 0x02
    27 # define LOAD_MISS 0x04
    28 # define LOAD_SECF 0x08
    29 
    30 /* invalid mag value */
    31 # define NO_MAG    0x7fff
    32 # define NO_ERR    0xff
    33 
    34 /* photometry code types */
    35 # define PHOT_PRI 0x01
    36 # define PHOT_SEC 0x02
    37 # define PHOT_DEP 0x03
    38 # define PHOT_REF 0x04
    39 # define PHOT_ALT 0x05  /* never stored, only for look-ups */
    40 
    41 /* Image.code values.  these are codes to note bad images */
    42 # define ID_IMAGE_NEW   0x0000  /* no nrphot attempted */
    43 # define ID_IMAGE_NOCAL 0x0001  /* used within nrphot to mean "don't apply fit" */
    44 # define ID_IMAGE_POOR  0x0002  /* relphot says image is bad */
    45 # define ID_IMAGE_SKIP  0x0004  /* external information image is bad */
    46 # define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
    47 
    48 /* Measure.flags values */
    49 # define ID_MEAS_NOCAL        0x0001
    50 # define ID_MEAS_POOR         0x0002
    51 # define ID_MEAS_SKIP         0x0004
    52 # define ID_MEAS_AREA         0x0008
    53 # define BLEND_IMAGE          0x0100
    54 # define BLEND_CATALOG        0x0200
    55 # define BLEND_IMAGE_NEIGHBOR 0x1000
    56 # define ID_MEAS_TRAIL        0x2000
    57 # define ID_MEAS_GHOST        0x4000
    58 
    59 /* Average.code values */
    60 # define ID_STAR_FEW   0x0001 /* used within relphot: skip star */
    61 # define ID_STAR_POOR  0x0002 /* used within relphot: skip star */
    62 # define ID_PROPER     0x0400 /* star with large proper motion */
    63 # define ID_TRANSIENT  0x1000 /* is this mutually exclusive with USNO?  */
    64 # define ID_VARIABLE   0x2000 /* not currently set? */
    65 # define ID_ASTEROID   0x2000 /* identified with an asteroid */
    66 # define ID_BAD_OBJECT 0x4000 /* if all measurements are bad, set this bit */
    67 # define ID_MOVING     0x8000
    68 # define ID_ROCK       0xa000 /* 0x8000 + 0x2000 */
    69 # define ID_GHOST      0xc001 /* 0x8000 + 0x4000 + 0x0001 */
    70 # define ID_TRAIL      0xc002 /* 0x8000 + 0x4000 + 0x0002 */
    71 # define ID_BLEED      0xc003 /* 0x8000 + 0x4000 + 0x0003 */
    72 # define ID_COSMIC     0xc004 /* 0x8000 + 0x4000 + 0x0004 */
    73 
    74 /*
    75    BLEND_IMAGE: the star on an image is matched with more
    76       than one star in the catalog (image has worse seeing than catalog)
    77    BLEND_CATALOG: the star in the catalog is matched with more
    78       than one star on the image (image has better seeing than catalog)
    79    CALIBRATED: relative photometry has been performed on this measurement
    80    BLEND_IMAGE_NEIGHBOR: the star on an image is matched with more
    81       than one star in the catalog, but not in the same catalog file.
    82 */
     5/************  database structures ************************************/
    836
    847/* structure for Image Registration Database */
     
    183106  short int dM;               /* scatter on alt mag */
    184107} SecFilt; /* 6 byte / SecFilt */
    185 
    186 /* the standard astrometric coordinates structure */
    187 typedef struct {
    188   double   crval1, crval2;
    189   float    crpix1, crpix2;
    190   float    cdelt1, cdelt2;
    191   float    pc1_1, pc1_2;
    192   float    pc2_1, pc2_2;
    193   float    polyterms[7][2];
    194   char     ctype[15];
    195   char     Npolyterms;
    196 } Coords;  /* 120 bytes / Coords */
    197108
    198109/* image structure for binary data storage of image data */
     
    286197SecFilt *FixOldSecFilt (OldSecFilt *in, int Nvalues);
    287198
    288 int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
    289 int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
    290 int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
    291 int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
    292 int  GetCoords (Coords *coords, Header *header);
    293 int  PutCoords (Coords *coords, Header *header);
    294 void RegisterMosaic (Coords *coords);
    295 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    296 int FindMosaicForImage (Image *images, int Nimages, int entry);
    297 int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
    298 int FindMosaicForImage_MatchSearch (Image *images, int Nimages, int entry);
    299 int BuildChipMatch (Image *images, int Nimages);
    300 
    301199int FindMosaicForImage (Image *images, int Nimages, int entry);
    302200int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
  • trunk/Ohana/src/libohana/include/ohana.h

    r3400 r3508  
    2525# define OHANA_H
    2626
    27 extern double hypot();
    28 
    2927# define TRUE (1)
    3028# define FALSE (0)
     
    3634# define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
    3735# define SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
     36# define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec))
    3837
    3938# define LCK_UNLOCK  0   /* file is unlocked */
     
    5554# endif
    5655
    57 int setlockfile2 (char *filename, double timeout, int type, int *state);
    58 int clearlockfile2 (char *filename, int fd, int type, int *state);
    59 
    60 FILE *fsetlockfile (char *filename, double timeout, int type, int *state);
    61 int fclearlockfile (char *filename, FILE *f, int type, int *state);
     56# define DEG_RAD 57.295779513082322
     57# define RAD_DEG  0.017453292519943
    6258
    6359# ifndef PROTO
     
    10399# endif /* FOPEN */
    104100
    105 # define DEG_RAD 57.295779513082322
    106 # define RAD_DEG  0.017453292519943
    107 
    108 # define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec))
     101extern double hypot();
    109102
    110103/* in string.c */
     
    118111int   get_argument (int argc, char **argv, char *arg);
    119112int   remove_argument (int N, int *argc, char **argv);
     113void  uppercase (char *string);
    120114
    121 int   Fread (void *ptr, int size, int nitems, FILE *f, char *type);
    122 int   Fwrite (void *ptr, int size, int nitems, FILE *f, char *type);
    123 int   ByteSwap (char *ptr, int size, int nitems, char *type);
    124 int   ConvertStruct (char *buffer, int size, int Nbytes, char *type);
    125 
     115/* in findexec.c */
    126116char *pathname (char *name);
    127117char *filebasename (char *name);
    128118char *filerootname (char *name);
    129119char *findexec (int argc, char **argv);
    130 int mkdirhier (char *path);
     120int   mkdirhier (char *path);
     121void  make_backup (char *filename);
    131122
     123/* in glockfile.c */
    132124FILE *fsetlockfile (char *filename, double timeout, int type, int *state);
    133 int fclearlockfile (char *filename, FILE *f, int type, int *state);
    134 int setlockfile2 (char *filename, double timeout, int type, int *state);
    135 int clearlockfile2 (char *filename, int fd, int type, int *state);
     125int   fclearlockfile (char *filename, FILE *f, int type, int *state);
     126int   setlockfile2 (char *filename, double timeout, int type, int *state);
     127int   clearlockfile2 (char *filename, int fd, int type, int *state);
    136128
     129/* in config.c */
    137130char *SelectConfigFile (int *argc, char **argv, char *progname);
    138131char *LoadConfigFile (char *filename);
     
    141134char *fileextname (char *file);
    142135char *LoadRawConfigFile (char *, int);
     136
     137/* in Fseek.c */
     138int   Fseek (FILE *f, long offset, int whence);
    143139
    144140/*
  • trunk/Ohana/src/libohana/include/panstarrs.h

    r3473 r3508  
    22# ifndef PANSTARRS_H
    33# define PANSTARRS_H
    4 
    5 # define e_time unsigned int
    6 
    7 /* image data modes in RegImage */
    8 enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE};
    9 enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE};
    10 
    11 /* convert these to enums? */
    12 /* RegImage.flag values */
    13 # define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
    14 
    15 /* catalog values to be loaded */
    16 # define LOAD_AVES 0x01
    17 # define LOAD_MEAS 0x02
    18 # define LOAD_MISS 0x04
    19 # define LOAD_SECF 0x08
    20 
    21 /* invalid mag value */
    22 # define NO_MAG    0x7fff
    23 # define NO_ERR    0xff
    24 
    25 /* photometry code types */
    26 # define PHOT_PRI 0x01
    27 # define PHOT_SEC 0x02
    28 # define PHOT_DEP 0x03
    29 # define PHOT_REF 0x04
    30 # define PHOT_ALT 0x05  /* never stored, only for look-ups */
    31 
    32 /* Image.code values.  these are codes to note bad images */
    33 # define ID_IMAGE_NEW   0x0000  /* no nrphot attempted */
    34 # define ID_IMAGE_NOCAL 0x0001  /* used within nrphot to mean "don't apply fit" */
    35 # define ID_IMAGE_POOR  0x0002  /* relphot says image is bad */
    36 # define ID_IMAGE_SKIP  0x0004  /* external information image is bad */
    37 # define ID_IMAGE_FEW   0x0008  /* currently too few measurements for good value */
    38 
    39 /* Measure.flags values */
    40 # define ID_MEAS_NOCAL        0x0001
    41 # define ID_MEAS_POOR         0x0002
    42 # define ID_MEAS_SKIP         0x0004
    43 # define ID_MEAS_AREA         0x0008
    44 # define BLEND_IMAGE          0x0100
    45 # define BLEND_CATALOG        0x0200
    46 # define BLEND_IMAGE_NEIGHBOR 0x1000
    47 # define ID_MEAS_TRAIL        0x2000
    48 # define ID_MEAS_GHOST        0x4000
    49 
    50 /* Average.code values */
    51 # define ID_STAR_FEW   0x0001 /* used within relphot: skip star */
    52 # define ID_STAR_POOR  0x0002 /* used within relphot: skip star */
    53 # define ID_PROPER     0x0400 /* star with large proper motion */
    54 # define ID_TRANSIENT  0x1000 /* is this mutually exclusive with USNO?  */
    55 # define ID_VARIABLE   0x2000 /* not currently set? */
    56 # define ID_ASTEROID   0x2000 /* identified with an asteroid */
    57 # define ID_BAD_OBJECT 0x4000 /* if all measurements are bad, set this bit */
    58 # define ID_MOVING     0x8000
    59 # define ID_ROCK       0xa000 /* 0x8000 + 0x2000 */
    60 # define ID_GHOST      0xc001 /* 0x8000 + 0x4000 + 0x0001 */
    61 # define ID_TRAIL      0xc002 /* 0x8000 + 0x4000 + 0x0002 */
    62 # define ID_BLEED      0xc003 /* 0x8000 + 0x4000 + 0x0003 */
    63 # define ID_COSMIC     0xc004 /* 0x8000 + 0x4000 + 0x0004 */
    64 
    65 /*
    66    BLEND_IMAGE: the star on an image is matched with more
    67       than one star in the catalog (image has worse seeing than catalog)
    68    BLEND_CATALOG: the star in the catalog is matched with more
    69       than one star on the image (image has better seeing than catalog)
    70    CALIBRATED: relative photometry has been performed on this measurement
    71    BLEND_IMAGE_NEIGHBOR: the star on an image is matched with more
    72       than one star in the catalog, but not in the same catalog file.
    73 */
    744
    755/************  database structures ************************************/
     
    185115  short int dM;               /* scatter on alt mag */
    186116} SecFilt; /* 6 byte / SecFilt */
    187 
    188 /* the standard astrometric coordinates structure */
    189 typedef struct {
    190   double   crval1, crval2;
    191   float    crpix1, crpix2;
    192   float    cdelt1, cdelt2;
    193   float    pc1_1, pc1_2;
    194   float    pc2_1, pc2_2;
    195   float    polyterms[7][2];
    196   char     ctype[15];
    197   char     Npolyterms;
    198 } Coords;  /* 120 bytes / Coords */
    199117
    200118/* image structure for binary data storage of image data */
     
    287205int save_catalog (Catalog *catalog, char VERBOSE);
    288206
    289 int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
    290 int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
    291 int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
    292 int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
    293 int  GetCoords (Coords *coords, Header *header);
    294 int  PutCoords (Coords *coords, Header *header);
    295 void RegisterMosaic (Coords *coords);
    296 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    297 int FindMosaicForImage (Image *images, int Nimages, int entry);
    298 int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
    299 int FindMosaicForImage_MatchSearch (Image *images, int Nimages, int entry);
    300 int BuildChipMatch (Image *images, int Nimages);
    301 
    302207int FindMosaicForImage (Image *images, int Nimages, int entry);
    303208int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
  • trunk/Ohana/src/libohana/src/findexec.c

    r2413 r3508  
    250250
    251251}
     252
     253void make_backup (char *filename) {
     254
     255  int status, cmode;
     256  struct stat filestat;
     257  char line[256];
     258
     259  status = stat (filename, &filestat);
     260  if (status == 0) { /* file exists, make backup copy */
     261    sprintf (line, "cp %s %s~", filename, filename);
     262    status = system (line);
     263    if (status) {
     264      fprintf (stderr, "ERROR: unable to create %s~, exiting\n", filename);
     265      exit (0);
     266    }
     267    cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
     268    sprintf (line, "%s~", filename);
     269    chmod (line, cmode);
     270  }
     271}
  • trunk/Ohana/src/libohana/src/string.c

    r2413 r3508  
    156156  return (N);
    157157}
     158
     159void uppercase (char *string) {
     160
     161  int i;
     162   
     163  for (i = 0; i < strlen (string); i++) string[i] = toupper (string[i]);
     164
     165}
Note: See TracChangeset for help on using the changeset viewer.