Tim,
> > Is this wcsframe command correct or did you mean:
> >
> > wcsframe ndf=13_raw frame=pixel
> >
>
> He actually meant neither of these. FRAME=pixel works since it doesn't
> require (presumably) that a WCS frame is created from the fits headers.
Not so. A FrameSet is created from the FITS headers even if you only want
pixel coords.
> If I use FRAME=SKY I get a core dump in cmpframe.c.
Just tried that - no joy, wcsframe still completes succesfully for me.
Did you do anything non-standard when building kappa/ast/kaplibs ?
Like for instance, did you have any CFLAGS or FFLAGS set?
> Note that I also get a core dump from ndftrace, since that is also trying
> to read the FITS headers to create a WCS extension.
ndftrace works OK for me too.
> 0 0x42bff2c4 in Resolve (this_frame=0x81d6990, point1=0x81d7178,
> point2=0xbfff94c8,
> point3=0x42c415b3, point4=0x42d4e718, d1=0x3, d2=0xbfff9798) at
> cmpframe.c:4820
> 4820 *d1 = AST__BAD;
>
> Here d1=0x3 is the culprit.
Have you re-built kaplibs and ndf? There have been changes to the AST
include files which *may* possible be the cause...
> with
>
> % ndftrace u20040922_00013_raw
>
> > Not sure what to suggest next. You are *really* sure you have everything
> > updated in CVS?
> >
>
> I've just rebuilt AST and still get the problem
Maybe we should try to ascertain whether its a purely AST problem, or a
problem caused by the integration of AST and KAPPA. I've attached one of
my AST test progs which does not use any kappa stuff. Maybe you could
build it and run it to see if it gives you the same problem. I build it
like:
% g77 -fno-second-underscore -g -o fplottest fplottest.f -L$STAR/lib \
`chr_link` `ast_link -pgplot -ems` `pgplot_link` `err_link`
To run it, you need first to create a text file containing the fits
headers:
% fitslist u20040922_00013_raw > headers
(then edit headers to remove the non-FITS commentary lines added by
fitslist). Then do:
% fplottest headers
and it should read a FrameSet from the headers and draw an annotated coord
grid (it may ask you for the pixel bounds if your headers do not include
NAXIS1/NAXIS2 values).
David
PROGRAM FPLOTTEST
* Usage:
* fplottest <fits header file> <device> <plot settings>
IMPLICIT NONE
INCLUDE 'SAE_PAR'
INCLUDE 'AST_PAR'
EXTERNAL SOURCE
CHARACTER FILE*80, CARD*80, ATTR*80, TEXT*80, JUST*10, DOM*30,
: DEV*40, SETTING*80, NAME*20, VALUE*80
INTEGER IC, FC, FS, PL, PGBEG, NAXIS1, NAXIS2, STATUS, CHR_LEN
REAL GBOX(4), RANGE, DELTA, ASP, UP(2)
DOUBLE PRECISION PBOX(4), INA(2), INB(2), OUTA(2), OUTB(2)
LOGICAL MORE, GRID
INTEGER ICURR, FRM, I, FR, CUR, WM, FR2, FS2, OPT, BF, CH, IARGC
DOUBLE PRECISION X0,Y0,XX,YY,POS(2)
*
* Create a FitsChan to store the FITS headers.
*
STATUS = SAI__OK
FC = AST_FITSCHAN( AST_NULL, AST_NULL, 'IWC=1', STATUS )
*
* Open a text file containing a listy of FITS headers.
*
IF( IARGC() .GE. 1 ) THEN
CALL GETARG( 1, FILE )
ELSE
WRITE(*,'(A,$)') 'Enter name of FITS header file: '
READ(*,'(A)') FILE
END IF
OPEN( UNIT=10, FILE=FILE, STATUS='OLD' )
*
* Read each card out of the text file and store it in the FitsChan.
*
CALL ERR_MARK
DO WHILE( .TRUE. .AND. STATUS .EQ. SAI__OK )
READ( 10, '(A)', END = 10 ) CARD
CALL AST_PUTFITS( FC, CARD, 0, STATUS )
END DO
10 CLOSE( 10 )
*
* See if values were supplied for NAXIS1 and NAXIS2. If not assume a value
* of 100 for each. The FitsChan is re-wound before calling AST_FINDFITS so
* that the search starts form the beginning.
*
CALL AST_CLEAR( FC, 'CARD', STATUS )
IF ( AST_FINDFITS( FC, 'NAXIS1', CARD, .TRUE., STATUS ) ) THEN
READ(CARD(11:),*) NAXIS1
ELSE
NAXIS1 = 100
END IF
CALL AST_CLEAR( FC, 'CARD', STATUS )
IF ( AST_FINDFITS( FC, 'NAXIS2', CARD, .TRUE., STATUS ) ) THEN
READ(CARD(11:),*) NAXIS2
ELSE
NAXIS2 = 100
END IF
PBOX(1) = 0.5
PBOX(2) = 0.5
PBOX(3) = DBLE( NAXIS1 ) + 0.5
PBOX(4) = DBLE( NAXIS2 ) + 0.5
c PBOX(1) = 1
c PBOX(2) = 1
c PBOX(3) = 200
c PBOX(4) = 200
*
* Read an Object from the contents of the FitsChan. This should be a
* FrameSet (this should be tested really, and an error reported if any
* other type of Object is obtained). Re-wind the FitsChan first so that
* its entire contents are read. Note, this is a destructive read, in that
* the cards which are significant to the creation of the FrameSet are
* removed from the FitsChan (this is why NAXIS1 and NAXIS2 are read out
* earlier - just in case they are significant to the FrameSet). Any
* insignificant cards are left as they are.
*
CALL AST_CLEAR( FC, 'CARD', STATUS )
FS = AST_READ( FC, STATUS )
*
* If an error has occurred while reading the file as a FITS file, annul
* it.
*
IF( STATUS .NE. SAI__OK ) CALL ERR_FLUSH( STATUS )
CALL ERR_RLSE
*
* If we have not read an object try reading the file as an AST file.
*
IF( FS .EQ. AST__NULL ) THEN
* Open the input file.
OPEN( UNIT=10, FILE=FILE, STATUS='OLD' )
* Create the Channel and read an Object from it.
CH = AST_CHANNEL( SOURCE, AST_NULL, ' ', STATUS )
FS = AST_READ( CH, STATUS )
* Annul the Channel and close the file when done.
CALL AST_ANNUL( CH, STATUS )
CLOSE( 10 )
* Get the Base Frame bounds to map to the PGPLOT window.
IF( AST_ISAFRAMESET( FS, STATUS ) ) THEN
BF = AST_GETFRAME( FS, AST__BASE, STATUS )
ELSE
BF = AST_CLONE( FS, STATUS )
END IF
DOM = AST_GETC( BF, 'DOMAIN', STATUS )
WRITE(*,'(A,$)') 'Enter plot bounds in '//
: DOM( : CHR_LEN( DOM ) )//
: ' Frame (x1,y1,x2,y2): '
READ(*,*) PBOX(1), PBOX(2), PBOX(3), PBOX(4)
END IF
*
* Abort if no object could be read from the file either as a FITS file
* or as an AST file.
*
IF( FS .EQ. AST__NULL ) THEN
WRITE(*,*) '!!! No object read from file!!!'
GO TO 999
END IF
*
* If all is OK, start up PGPLOT.
*
IF( STATUS .EQ. 0 ) THEN
IF( IARGC() .GE. 3 ) THEN
CALL GETARG( 3, SETTING )
ELSE
SETTING = ' '
END IF
IF( IARGC() .GE. 2 ) THEN
CALL GETARG( 2, DEV )
ELSE
DEV = '?'
END IF
IF( PGBEG( 0, DEV, 1, 1 ) .EQ. 1 ) THEN
CALL PGPAGE
CALL PGWNAD( 0.0, 1.0, 0.0, 1.0 )
*
* Create the Plot. The pixel coordinates box (0,0) to (NAXIS1,NAXIS2) is
* mapped onto a window which is 10% smaller than the full PGPLOT window.
* This gives some space for things like tick marks with negative length
* (which stick outside the pixel cooridnates box).
*
IF( .NOT. AST_ISAPLOT( FS, STATUS ) ) THEN
CALL PGQWIN( GBOX(1), GBOX(3), GBOX(2), GBOX(4) )
RANGE = GBOX(3) - GBOX(1)
GBOX(1) = GBOX(1) + 0.05*RANGE
GBOX(3) = GBOX(3) - 0.05*RANGE
RANGE = GBOX(4) - GBOX(2)
GBOX(2) = GBOX(2) + 0.05*RANGE
GBOX(4) = GBOX(4) - 0.05*RANGE
ASP = ABS( REAL( PBOX( 4 ) - PBOX( 2 ) )/
: REAL( PBOX( 3 ) - PBOX( 1 ) ) )
IF( ASP .LT. 0.2 .OR. ASP .GT. 5.0 ) ASP = 1.0
IF( ASP .GT. 1.0 ) THEN
DELTA = ( ASP - 1.0 )*( GBOX(3) - GBOX(1) )/
: ( 2.0*ASP )
GBOX(3) = GBOX(3) - DELTA
GBOX(1) = GBOX(1) + DELTA
ELSE
DELTA = ( 1.0 - ASP )*( GBOX(4) - GBOX(2) )/2.0
GBOX(4) = GBOX(4) - DELTA
GBOX(2) = GBOX(2) + DELTA
END IF
PL = AST_PLOT( FS, GBOX, PBOX, SETTING, STATUS )
ELSE
CALL PGSWIN( REAL( PBOX(1) ), REAL( PBOX(3) ),
: REAL( PBOX(2) ), REAL( PBOX(4) ) )
PL = AST_CLONE( FS, STATUS )
END IF
*
* No loop round drawing annotated coordinate grids.
*
MORE = .TRUE.
GRID = .TRUE.
DO WHILE( STATUS .EQ. 0 .AND. MORE )
IF( GRID ) CALL AST_GRID( PL, STATUS )
IF( IARGC() .GE. 2 ) THEN
OPT = 7
ELSE
WRITE(*,*) '0 - plot again'
WRITE(*,*) '1 - set attributes'
WRITE(*,*) '2 - set a single attribute'
WRITE(*,*) '3 - get attribute'
WRITE(*,*) '4 - clear attribute'
WRITE(*,*) '5 - show Plot'
WRITE(*,*) '6 - draw text'
WRITE(*,*) '7 - change current Frame'
WRITE(*,*) '8 - quit'
WRITE(*,'(A,$)') 'Option: '
READ( *, * ) OPT
END IF
GRID = .FALSE.
IF( OPT .EQ. 0 ) THEN
GRID = .TRUE.
ELSE IF( OPT .EQ. 1 ) THEN
WRITE(*,'(A,$)') 'Give a list of attribute settings: '
READ( *, '(A)' ) ATTR
CALL AST_SET( PL, ATTR, STATUS )
ELSE IF( OPT .EQ. 2 ) THEN
WRITE(*,'(A,$)') 'Give an attribute name: '
READ( *, '(A)' ) NAME
WRITE(*,'(A,$)') 'Give an attribute value: '
READ( *, '(A)' ) VALUE
CALL AST_SETC( PL, NAME, VALUE, STATUS )
ELSE IF( OPT .EQ. 3 ) THEN
WRITE(*,'(A,$)') 'Give an attribute name: '
READ( *, '(A)' ) ATTR
WRITE(*,*) AST_GETC( PL, ATTR, STATUS )
ELSE IF( OPT .EQ. 4 ) THEN
WRITE(*,'(A,$)') 'Give an attribute name: '
READ( *, '(A)' ) ATTR
CALL AST_CLEAR( PL, ATTR, STATUS )
ELSE IF( OPT .EQ. 5 ) THEN
CALL MYSHOW( PL, STATUS )
ELSE IF( OPT .EQ. 6 ) THEN
WRITE(*,'(A,$)') 'Give a text string: '
READ( *, '(A)' ) TEXT
WRITE(*,'(A,$)') 'Give physical coordinates: '
READ( *, * ) POS(1),POS(2)
WRITE(*,'(A,$)') 'Give up-vector: '
READ( *, * ) UP(1),UP(2)
WRITE(*,'(A,$)') 'Give justification string: '
READ( *, '(A)' ) JUST
CALL AST_TEXT( PL, TEXT, POS, UP, JUST, STATUS )
ELSE IF( OPT .EQ. 7 ) THEN
WRITE(*,'(A,$)') 'Give Domain of new current Frame: '
READ( *, '(A)' ) TEXT
ICURR = AST__NOFRAME
DO I = 1, AST_GETI( PL, 'NFrame', STATUS )
FRM = AST_GETFRAME( PL, I, STATUS )
DOM = AST_GETC( FRM, 'DOMAIN', STATUS )
IF( DOM .EQ. TEXT ) THEN
ICURR = I
END IF
END DO
IF( ICURR .NE. AST__NOFRAME ) THEN
CALL AST_SETI( PL, 'CURRENT', ICURR, STATUS )
ELSE
WRITE(*,*) 'Cannot find Frame with Domain ',TEXT
END IF
ELSE
MORE = .FALSE.
END IF
IF( STATUS .NE. 0 ) CALL ERR_FLUSH( STATUS )
IF( GRID ) CALL PGPAGE
END DO
*
* Annul the Plot, and close PGPLOT.
*
CALL AST_ANNUL( PL, STATUS )
CALL PGEND
END IF
END IF
*
* Annul the other objects.
*
CALL AST_ANNUL( FS, STATUS )
999 CALL AST_ANNUL( FC, STATUS )
END
subroutine myshow( obj, status )
implicit none
include 'AST_PAR'
integer obj, status, ch, n
call err_begin( status )
ch = ast_channel( AST_NULL, AST_NULL, 'Full=1', status )
n = ast_write( ch, obj, status )
call ast_annul( ch, status )
call err_end( status )
end
SUBROUTINE SOURCE( STATUS )
INTEGER STATUS
CHARACTER * ( 200 ) BUFFER
READ( 10, '(A)', END = 99 ) BUFFER
CALL AST_PUTLINE( BUFFER, LEN( BUFFER ), STATUS )
RETURN
99 CALL AST_PUTLINE( BUFFER, -1, STATUS )
END
|