IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35108


Ignore:
Timestamp:
Feb 6, 2013, 3:28:06 PM (13 years ago)
Author:
eugene
Message:

options to set more of the header metadata in mkcmf

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

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/GetFileMode.c

    r34088 r35108  
    2222  if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ;
    2323
    24   if (haveNaxis && ((Naxis == 2) || TEXTMODE || !simple)) {
     24  if (haveNaxis && (Naxis == 2)) {
     25    int Nx, Ny;
     26    gfits_scan (header, "NAXIS1",  "%d", 1, &Nx);
     27    gfits_scan (header, "NAXIS2",  "%d", 1, &Ny);
     28    if ((Nx > 0) && (Ny > 0)) {
     29      if (haveCTYPE && !strcmp (&ctype[4], "-WRP")) {
     30        return MOSAIC_CMP;
     31      }
     32      return SIMPLE_CMP;
     33    }
     34  }
     35
     36  if (haveNaxis && (TEXTMODE || !simple)) {
    2537    if (haveCTYPE && !strcmp (&ctype[4], "-WRP")) {
    2638      return MOSAIC_CMP;
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r34620 r35108  
    4040  Coords coords;
    4141
     42  int APPEND = FALSE;
     43  if ((N = get_argument (argc, argv, "-append"))) {
     44    remove_argument (N, &argc, argv);
     45    APPEND = TRUE;
     46  }
     47
    4248  static char *photcode = "SIMTEST.r.Chip";
    4349  if ((N = get_argument (argc, argv, "-photcode"))) {
     
    6975  }
    7076
     77  char extname[80], exthead[80];
     78  strcpy (extname, "Chip.psf");
     79  strcpy (exthead, "Chip.hdr");
     80  if ((N = get_argument (argc, argv, "-extname"))) {
     81    remove_argument (N, &argc, argv);
     82    snprintf (extname, 80, "%s.psf", argv[N]);
     83    snprintf (exthead, 80, "%s.hdr", argv[N]);
     84    remove_argument (N, &argc, argv);
     85  }
     86
    7187  double RA = 10.0;
    7288  double DEC = 20.0;
     
    101117    remove_argument (N, &argc, argv);
    102118    airmass = atof (argv[N]);
     119    remove_argument (N, &argc, argv);
     120  } 
     121
     122  int imageID = -1;
     123  if ((N = get_argument (argc, argv, "-imageID"))) {
     124    remove_argument (N, &argc, argv);
     125    imageID = atof (argv[N]);
     126    remove_argument (N, &argc, argv);
     127  } 
     128  int sourceID = -1;
     129  if ((N = get_argument (argc, argv, "-sourceID"))) {
     130    remove_argument (N, &argc, argv);
     131    sourceID = atof (argv[N]);
    103132    remove_argument (N, &argc, argv);
    104133  } 
     
    254283  gfits_modify (&header, "EXPTIME", "%lf", 1, exptime);
    255284  gfits_modify (&header, "AIRMASS", "%lf", 1, airmass);
    256   gfits_modify (&header, "NASTRO",   "%d", 1, 10);
    257 
    258   int imageID = 1000.0*drand48();
    259   int sourceID = 100.0*drand48();
    260 
     285  gfits_modify (&header, "NASTRO",   "%d", 1, 100);
     286
     287  if (imageID == -1) imageID = 1000.0*drand48();
     288  if (sourceID == -1) sourceID = 100.0*drand48();
    261289  gfits_modify (&header, "IMAGEID",  "%d", 1, imageID);
    262290  gfits_modify (&header, "SOURCEID", "%d", 1, sourceID);
    263291
    264292  PutCoords (&coords, &header);
    265   gfits_modify (&header, "EXTNAME",   "%s", 1, "Chip.hdr");
     293  gfits_modify (&header, "EXTNAME",   "%s", 1, exthead);
    266294
    267295  ftable.header = &theader;
     
    298326  }
    299327
    300   gfits_modify (ftable.header, "EXTHEAD",   "%s", 1, "Chip.hdr");
    301   gfits_modify (ftable.header, "EXTNAME",   "%s", 1, "Chip.psf");
    302 
    303   fits = fopen (argv[2], "w");
     328  gfits_modify (ftable.header, "EXTHEAD",   "%s", 1, exthead);
     329  gfits_modify (ftable.header, "EXTNAME",   "%s", 1, extname);
     330
     331  // open for append (if you want a new file, need to blow the old object)
     332  if (APPEND) {
     333    fits = fopen (argv[2], "a+");
     334  } else {
     335    fits = fopen (argv[2], "w");
     336  }
    304337  if (fits == NULL) {
    305338    fprintf (stderr, "ERROR: can't open output file %s\n", argv[2]);
    306339    exit (1);
     340  }
     341
     342  /* if we are appending, fix up header */
     343  if (APPEND) {
     344    static char simple[] = "XTENSION= 'IMAGE  '            / Image extension";
     345    int Ns, No;
     346    Ns = strlen (simple);
     347    No = 80 - Ns;
     348    strncpy (header.buffer, simple, Ns);
     349    memset (&header.buffer[Ns], ' ', No);
    307350  }
    308351
     
    516559    stars[i].dSky      = DSKY;
    517560    stars[i].psfChisq  = PSFCHI;
     561    stars[i].psfNdof   = 1;
     562    stars[i].psfNpix   = 2;
    518563    stars[i].crNsigma  = CRN;
    519564    stars[i].extNsigma = EXTN;
     
    570615    stars[i].dSky      = DSKY;
    571616    stars[i].psfChisq  = PSFCHI;
     617    stars[i].psfNdof   = 1;
     618    stars[i].psfNpix   = 2;
    572619    stars[i].crNsigma  = CRN;
    573620    stars[i].extNsigma = EXTN;
     
    624671    stars[i].dSky      = DSKY;
    625672    stars[i].psfChisq  = PSFCHI;
     673    stars[i].psfNdof   = 1;
     674    stars[i].psfNpix   = 2;
    626675    stars[i].crNsigma  = CRN;
    627676    stars[i].extNsigma = EXTN;
     
    690739    stars[i].dSky      = DSKY;
    691740    stars[i].psfChisq  = PSFCHI;
     741    stars[i].psfNdof   = 1;
     742    stars[i].psfNpix   = 2;
    692743    stars[i].crNsigma  = CRN;
    693744    stars[i].extNsigma = EXTN;
Note: See TracChangeset for help on using the changeset viewer.