Skip to content

Commit

Permalink
frame: Added astNormPoints to normalise points into a contiguous range
Browse files Browse the repository at this point in the history
  • Loading branch information
dsberry committed Oct 28, 2021
1 parent ab9e74b commit 16b771a
Show file tree
Hide file tree
Showing 11 changed files with 1,223 additions and 12 deletions.
12 changes: 12 additions & 0 deletions ast.news
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ environment-independent.
Main Changes in this Version
----------------------------

- A new method called astNormPoints has been added to the Frame
class. This is similar to the existing astNorm method in that it can be
used to normalise axis values, but can be used on a vector of points rather
than just a single point. In addition, it has an option to choose a
normalisation that avoids discontinuities in the Frame's coordinate
system. The most common usage will be to modify vectors of sky position
in such a way as to avoid sudden jumps of 360 degrees in longitude within
groups of points that span the longitude origin.

- A bug has been fixed in the KeyMap class that caused astMapGet1<X>
functions to return a vector length of 1 for KeyMap entries with an
undefined value. A vector length of zero is now returned in such cases.
Expand All @@ -27,6 +36,9 @@ variances include aberrant ultra-low values. The change should result in
fewer output pixels being set bad in such cases. This change only affects
cases where the AST__GENVAR flag is not set.

- An option "--with-external-cminpack" had been added to the configure script.
It omits the internal cminpack routines from the built library, and instead
links with an external cminpack library.

Main Changes in V9.2.4
----------------------
Expand Down
2 changes: 1 addition & 1 deletion ast_tester/ast_tester
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if( $1 != "-nd" ) then
endif

# Note - testhuge is not included because it takes so long to run.
foreach prog (testyamlchan testmoc testmocchan testmapping testchebymap testunitnormmap testskyframe testframeset testchannel testpolymap testcmpmap testlutmap testfitstable testtable teststcschan teststc testspecframe testfitschan testswitchmap testrebin testrebinseq testtrangrid testnormmap testtime testrate testflux testratemap testspecflux testxmlchan testregions testkeymap )
foreach prog (testcmpframe testyamlchan testmoc testmocchan testmapping testchebymap testunitnormmap testskyframe testframeset testchannel testpolymap testcmpmap testlutmap testfitstable testtable teststcschan teststc testspecframe testfitschan testswitchmap testrebin testrebinseq testtrangrid testnormmap testtime testrate testflux testratemap testspecflux testxmlchan testregions testkeymap )

gfortran -fno-second-underscore -w -g -o $prog -g $prog.f -fno-range-check -fallow-argument-mismatch $LDFLAGS -I$AST/include \
-I$STARLINK_DIR/include -L$AST/lib -L$STARLINK_DIR/lib `ast_link -ems` \
Expand Down
102 changes: 102 additions & 0 deletions ast_tester/testcmpframe.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
program testcmpframe
implicit none

include 'AST_PAR'
include 'AST_ERR'
include 'SAE_PAR'

integer status, pfrm, sfrm, cfrm, perm(3), nc, i
double precision in( 4, 3 ), ra(4), dec(4), px(4)
double precision out( 4, 3 )

data ra / 6.1D0, 6.1D0, 0.04D0, 0.04D0 /,
: dec / 0.2D0, -0.2D0, -0.2D0, 0.2D0 /,
: px / -100.0D0, -10.0D0, 10.0D0, 100.0D0 /

c call ast_watchmemory(100)

status = sai__ok
call err_mark( status )
call ast_begin( status )


sfrm = ast_skyframe( ' ', status )
perm( 1 ) = 2
perm( 2 ) = 1
call ast_permaxes( sfrm, perm, status )

pfrm = ast_frame( 1, "Domain=FPLANE", status )


cfrm = ast_cmpframe( pfrm, sfrm, ' ', status )
perm( 1 ) = 3
perm( 2 ) = 1
perm( 3 ) = 2
call ast_permaxes( cfrm, perm, status )

do i = 1, 4
in( i, 1 ) = ra( i )
in( i, 2 ) = px( i )
in( i, 3 ) = dec( i )
end do

call ast_normpoints( cfrm, 4, 3, 4, in, 1, 3, 4, out, status )

if( out( 1, 1 ) .ne. ra( 1 ) - 2*AST__DPI ) then
call stopit( status, 'Error 1' )
else if( out( 2, 1 ) .ne. ra( 2 ) - 2*AST__DPI ) then
call stopit( status, 'Error 2' )
else if( out( 3, 1 ) .ne. ra( 3 ) ) then
call stopit( status, 'Error 3' )
else if( out( 4, 1 ) .ne. ra( 4 ) ) then
call stopit( status, 'Error 4' )
else
do i = 1, 4
if( out( i, 2 ) .ne. px( i ) ) then
call stopit( status, 'Error 5' )
else if( out( i, 3 ) .ne. dec( i ) ) then
call stopit( status, 'Error 6' )
end if
end do
end if

call ast_normpoints( cfrm, 4, 3, 4, in, 0, 3, 4, out, status )

do i = 1, 4
if( out( i, 1 ) .ne. ra( i ) ) then
call stopit( status, 'Error 7' )
else if( out( i, 2 ) .ne. px( i ) ) then
call stopit( status, 'Error 8' )
else if( out( i, 3 ) .ne. dec( i ) ) then
call stopit( status, 'Error 9' )
end if
end do

call ast_end( status )
call err_rlse( status )

call ast_activememory( 'testcmpframe' )
call ast_flushmemory( 1 );

if( status .eq. sai__ok ) then
write(*,*) 'All CmpFrame tests passed'
else
write(*,*) 'CmpFrame tests failed'
end if

end



subroutine stopit( status, text )
implicit none
include 'SAE_PAR'
integer status
character text*(*)

if( status .ne. sai__ok ) return
status = sai__error
write(*,*) text

end

Loading

0 comments on commit 16b771a

Please sign in to comment.