An alternative to changing the number of Frame axes, which is not
allowed, is to create a new Frame by selecting axes from an existing
one. The method of doing this is very similar to the way AST_PERMAXES
is used (), in that we supply an integer
array filled with the numbers of the axes we want, in their new
order. In this case, however, the number of array elements need not
equal the number of Frame axes.
For example, we could select axes 3 and 2 (in that order) from a 3-dimensional Frame as follows:
INTEGER FRAME1, FRAME2, MAPPING, PICK( 2 ) DATA PICK / 3, 2 / ... FRAME2 = AST_PICKAXES( FRAME1, 2, PICK, MAPPING, STATUS )
This would return a pointer to a 2-dimensional Frame (FRAME2) which
contains the information associated with axes 3 and 2, in that order,
from the original Frame (FRAME1). The original Frame is not altered by
this process. Beware, however, that the axis information may still be
shared by both Frames, so if you wish to alter either of them
independently you may first need to use AST_COPY
() to make an independent copy.
In addition to the new Frame pointer, AST_PICKAXES will also return a
pointer to a new Mapping via its fourth argument. This Mapping will
inter-relate the two Frames. By this we mean that its forward
transformation will convert coordinates originally in the coordinate
system represented by FRAME1 into that represented by FRAME2, while
its inverse transformation will convert in the opposite direction. In
this particular case, the Mapping would be a PermMap
() and would implement the following
transformations:
Forward: (1, 2, 3) --> (3, 2) (2, 4, 6) --> (6, 4) (3, 6, 9) --> (9, 6) (4, 8, 12) --> (12, 8) (5, 10, 15) --> (15, 10) Inverse: (3, 2) --> (<bad>, 2, 3) (6, 4) --> (<bad>, 4, 6) (9, 6) --> (<bad>, 6, 9) (12, 8) --> (<bad>, 8, 12) (15, 10) --> (<bad>, 10, 15)
This is our first introduction to the idea of inter-relating pairs of Frames via a Mapping, but this will assume a central role later on.
Note that when using AST_PICKAXES, it is also possible to request
more axes than there were in the original Frame. This will involve
selecting axes from the original Frame that do not exist. To do this,
the corresponding axis number (in the PICK array) should be set to
zero and the effect is to introduce an additional new axis which is
not derived from the original Frame. This axis will have default
values for all its attributes. You will need to do this because
AST_PICKAXES does not allow you to select any of the original axes
more than once.13
AST A Library for Handling World Coordinate Systems in Astronomy