public software.sextractor

[/] [branches/] [multi/] [src/] [fits/] [fitshead.c] - Diff between revs 266 and 267

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 266 Rev 267
Line 99... Line 99...
PURPOSE Read the current FITS header basic keywords.
PURPOSE Read the current FITS header basic keywords.
INPUT   pointer to catstruct.
INPUT   pointer to catstruct.
OUTPUT  -.
OUTPUT  -.
NOTES   -.
NOTES   -.
AUTHOR  E. Bertin (IAP)
AUTHOR  E. Bertin (IAP)
VERSION 15/07/2011
VERSION 25/09/2004
 ***/
 ***/
void    readbasic_head(tabstruct *tab)
void    readbasic_head(tabstruct *tab)
 
 
  {
  {
   char         str[88];
   char         str[88];
Line 125... Line 125...
    error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename);
    error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename);
 
 
  tabsize = 0;
  tabsize = 0;
  if (tab->naxis>0)
  if (tab->naxis>0)
    {
    {
 
    QFREE(tab->naxisn);
 
    QMALLOC(tab->naxisn, int, tab->naxis);
/*--get the size of the array*/
/*--get the size of the array*/
    tabsize = 1;
    tabsize = 1;
    for (i=0; i<tab->naxis && i<999; i++)
    for (i=0; i<tab->naxis && i<999; i++)
      {
      {
      sprintf(key,"NAXIS%-3d", i+1);
      sprintf(key,"NAXIS%-3d", i+1);
Line 196... Line 198...
INPUT   pointer to tabstruct.
INPUT   pointer to tabstruct.
OUTPUT  RETURN_OK if a binary table was found and mapped, RETURN_ERROR
OUTPUT  RETURN_OK if a binary table was found and mapped, RETURN_ERROR
        otherwise.
        otherwise.
NOTES   -.
NOTES   -.
AUTHOR  E. Bertin (IAP & Leiden observatory)
AUTHOR  E. Bertin (IAP & Leiden observatory)
VERSION 15/07/2011
VERSION 20/07/2010
 ***/
 ***/
int     readbintabparam_head(tabstruct *tab)
int     readbintabparam_head(tabstruct *tab)
 
 
  {
  {
   catstruct    *cat;
   catstruct    *cat;
   keystruct    *key, *prevkey;
   keystruct    *key, *prevkey;
   char         strf[88], strk[16];
   char         strf[88], strk[16];
   char         *str;
   char         *str;
 
   int          naxisn[32];
   int          i,j, larray, nfields,narray, pos;
   int          i,j, larray, nfields,narray, pos;
 
 
  if (!(cat = tab->cat))
  if (!(cat = tab->cat))
    error(EXIT_FAILURE, "*Internal Error*: Table has no parent catalog","!");
    error(EXIT_FAILURE, "*Internal Error*: Table has no parent catalog","!");
 
 
Line 283... Line 286...
      default:
      default:
        error(EXIT_FAILURE, "*Error*: Unknown TFORM in ", cat->filename);
        error(EXIT_FAILURE, "*Error*: Unknown TFORM in ", cat->filename);
      }
      }
 
 
/*--handle the special case of multimensional arrays*/
/*--handle the special case of multimensional arrays*/
    if ((key->naxisn[0] = key->nbytes/t_size[key->ttype]) > 1)
    if ((naxisn[0] = key->nbytes/t_size[key->ttype]) > 1)
      {
      {
      sprintf(strk, "TDIM%-3d", i+1);
      sprintf(strk, "TDIM%-3d", i+1);
      if (fitsread(tab->headbuf, strk, strf, H_STRING, T_STRING) == RETURN_OK)
      if (fitsread(tab->headbuf, strk, strf, H_STRING, T_STRING) == RETURN_OK)
        {
        {
        str = strf;
        str = strf;
        for (j=0; (key->naxisn[j]=(int)strtol(str+1, &str, 10)); j++);
        for (j=0; (naxisn[j]=(int)strtol(str+1, &str, 10)); j++);
        key->naxis = j;
        key->naxis = j;
        }
        }
      else
      else
        key->naxis = 1;
        key->naxis = 1;
 
      QMALLOC(key->naxisn, int, key->naxis);
 
      for (j=0; j<key->naxis; j++)
 
        key->naxisn[j] = naxisn[j];
      }
      }
    else
    else
      key->naxis = 0;
      key->naxis = 0;
 
 
    key->nobj = narray;
    key->nobj = narray;