Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
msc
sextractor
Commits
b6e8c209
Commit
b6e8c209
authored
Jul 17, 2019
by
Teake Nutma
Browse files
Add #ifdef HAVE_CFITSIO statements
parent
59dd1ec4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/fits/fitsbody.c
View file @
b6e8c209
...
...
@@ -297,7 +297,7 @@ void free_body(tabstruct *tab)
return
;
}
#ifdef HAVE_CFITSIO
void
readTileCompressed
(
tabstruct
*
tab
,
size_t
spoonful
,
double
*
bufdata0
)
{
int
status
,
hdutype
;
...
...
@@ -352,6 +352,7 @@ void readTileCompressed(tabstruct *tab, size_t spoonful, double* bufdata0) {
// update file 'pointer'
tab
->
currentElement
+=
spoonful
;
}
#endif
/******* read_body ************************************************************
PROTO read_body(tabstruct *tab, PIXTYPE *ptr, long size)
...
...
@@ -409,10 +410,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
spoonful
=
size
;
bufdata
=
(
char
*
)
bufdata0
;
//
CFITSIO
#ifdef HAVE_
CFITSIO
if
(
tab
->
isTileCompressed
)
readTileCompressed
(
tab
,
spoonful
,
bufdata0
);
else
#endif
QFREAD
(
bufdata
,
spoonful
*
tab
->
bytepix
,
cat
->
file
,
cat
->
filename
);
switch
(
tab
->
bitpix
)
...
...
@@ -732,9 +734,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
bufdata
=
(
char
*
)
bufdata0
;
// CFITSIO
#ifdef HAVE_CFITSIO
if
(
tab
->
isTileCompressed
)
readTileCompressed
(
tab
,
spoonful
,
bufdata0
);
else
#endif
QFREAD
(
bufdata
,
spoonful
*
tab
->
bytepix
,
cat
->
file
,
cat
->
filename
);
switch
(
tab
->
bitpix
)
...
...
@@ -1033,6 +1037,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
}
// CFITSIO - if cfitsio output file has been set up, then proceed to write using cfitsio
#ifdef HAVE_CFITSIO
if
(
0
&&
tab
->
infptr
!=
NULL
)
{
// TODO
int
status
=
0
;
fits_write_img
(
tab
->
infptr
,
TFLOAT
,
tab
->
currentElement
,
spoonful
,
cbufdata0
,
&
status
);
...
...
@@ -1047,6 +1052,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
}
// otherwise, continue with usual AstrOmatic fits writing routine
else
#endif
QFWRITE
(
cbufdata0
,
spoonful
*
tab
->
bytepix
,
cat
->
file
,
cat
->
filename
);
}
break
;
...
...
src/fits/fitscat.c
View file @
b6e8c209
...
...
@@ -166,6 +166,7 @@ int close_cat(catstruct *cat)
}
#ifdef HAVE_CFITSIO
int
close_cfitsio
(
catstruct
*
cat
)
{
...
...
@@ -184,6 +185,7 @@ int close_cfitsio(catstruct *cat)
}
//printf("NO CFITSIO FILE TO CLOSE\n");
}
#endif
/****** free_cat ***************************************************************
PROTO void free_cat(catstruct **cat, int ncat)
...
...
@@ -343,6 +345,7 @@ int map_cat(catstruct *cat)
tab
->
cat
=
cat
;
QFTELL
(
cat
->
file
,
tab
->
headpos
,
cat
->
filename
);
#ifdef HAVE_CFITSIO
// CFITSIO
fitsfile
*
infptr
;
int
status
,
hdutype
,
hdunum
;
...
...
@@ -352,6 +355,7 @@ int map_cat(catstruct *cat)
printf
(
"ERROR could not open FITS file with cfitsio: %s
\n
"
,
cat
->
filename
);
}
hdunum
=
1
;
#endif
for
(
ntab
=
0
;
!
get_head
(
tab
);
ntab
++
)
{
...
...
@@ -360,7 +364,7 @@ int map_cat(catstruct *cat)
QFTELL
(
cat
->
file
,
tab
->
bodypos
,
cat
->
filename
);
tab
->
nseg
=
tab
->
seg
=
1
;
//
CFITSIO
#ifdef HAVE_
CFITSIO
tab
->
hdunum
=
hdunum
;
tab
->
infptr
=
infptr
;
status
=
0
;
fits_movabs_hdu
(
tab
->
infptr
,
tab
->
hdunum
,
&
hdutype
,
&
status
);
...
...
@@ -368,14 +372,15 @@ int map_cat(catstruct *cat)
//tab->tabsize = infptr->Fptr->rowlength;
//printf("TABSIZE = %ld\n", tab->tabsize);
#endif
if
(
tab
->
tabsize
)
{
#ifdef HAVE_CFITSIO
// IMPORTANT: moving to start of next header using fseek and cfitsio position rather than table size, as done previously
fseek
(
cat
->
file
,
infptr
->
Fptr
->
headstart
[
hdunum
],
SEEK_SET
);
#else
// this is how it was done previously
//QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename);
QFSEEK
(
cat
->
file
,
PADTOTAL
(
tab
->
tabsize
),
SEEK_CUR
,
cat
->
filename
);
#endif
}
if
(
prevtab
)
{
...
...
@@ -389,8 +394,9 @@ int map_cat(catstruct *cat)
tab
->
cat
=
cat
;
QFTELL
(
cat
->
file
,
tab
->
headpos
,
cat
->
filename
);
//
CFITSIO
#ifdef HAVE_
CFITSIO
hdunum
++
;
#endif
}
cat
->
ntab
=
ntab
;
...
...
src/fits/fitscat.h
View file @
b6e8c209
...
...
@@ -36,8 +36,9 @@
#include
<sys/types.h>
#endif
//
CFITSIO
#ifdef HAVE_
CFITSIO
#include FITSIO_H
#endif
#define MAXCHARS 256
/* max. number of characters */
#define WARNING_NMAX 1000
/* max. number of recorded warnings */
...
...
@@ -196,8 +197,9 @@ typedef struct structtab
char
swapname
[
MAXCHARS
];
/* name of the swapfile */
unsigned
int
bodysum
;
/* Checksum of the FITS body */
//
CFITSIO
#ifdef HAVE_
CFITSIO
fitsfile
*
infptr
;
/* a cfitsio pointer to the file */
#endif
int
hdunum
;
/* FITS HDU number for this 'table' */
int
isTileCompressed
;
/* is this a tile compressed image? */
long
currentElement
;
/* tracks the current image pixel */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment