"Frame to search another Frame (or FrameSet) to identify a coordinate system which has a specified set of characteristics. If a suitable coordinate system can be found, the function returns a pointer to a FrameSet which describes the required coordinate system and how to convert coordinates to and from it.
This function is provided to help answer general questions about coordinate systems, such as typically arise when coordinate information is imported into a program as part of an initially unknown dataset. For example:
Is there a wavelength scale?
Is there a 2-dimensional coordinate system?
Is there a celestial coordinate system?
Can I plot the data in ecliptic coordinates?
You can also use this function as a means of reconciling a user
’ s preference for a
particular coordinate system (for example, what type of axes to draw) with what is
actually possible given the coordinate information available.
To perform a search, you supply a
" Frame (or FrameSet) which represents the
set of coordinate systems to be searched. If a basic Frame is given as the target, this
set of coordinate systems consists of the one described by this Frame, plus all
" coordinate systems which can potentially be reached from it by
applying built-in conversions (for example, any of the celestial coordinate
conversions known to the AST library would constitute a
" conversion). If a
FrameSet is given as the target, the set of coordinate systems to be searched
consists of the union of those represented by all the individual Frames within
To select from this large set of possible coordinate systems, you supply a
Frame which is an instance of the type of Frame you are looking for. Effectively,
you then ask the function to
" find a coordinate system that looks like this
You can make your request more or less specific by setting attribute values for the template Frame. If a particular attribute is set in the template, then the function will only find coordinate systems which have exactly the same value for that attribute. If you leave a template attribute un-set, however, then the function has discretion about the value the attribute should have in any coordinate system it finds. The attribute will then take its value from one of the actual (rather than virtual) coordinate systems in the target. If the target is a FrameSet, its Current attribute will be modified to indicate which of its Frames was used for this purpose.
The result of this process is a coordinate system represented by a hybrid Frame
which acquires some attributes from the template (but only if they were set)
and the remainder from the target. This represents the
" best compromise
between what you asked for and what was available. A Mapping is then generated
which converts from the target coordinate system to this hybrid one, and the
returned FrameSet encapsulates all of this information.
Note that if a FrameSet is supplied (and a suitable coordinate system is found), then
its Current attribute will be modified to indicate which Frame was used to obtain
attribute values which were not specified by the template. This Frame will, in some
sense, represent the
" non-virtual coordinate system to the one you requested.
"section for more ideas.
The function will first try to find a suitable coordinate system whose Domain attribute equals the first domain in this list. If this fails, the second domain in the list will be used, and so on, until a result is obtained. A blank domain (e.g. two consecutive commas) indicates that any coordinate system is acceptable (subject to the template) regardless of its domain.
This list is case-insensitive and all white space is ignored. If you do not wish to restrict the domain in this way, you should supply an empty string.
"string, the sequence in which Frames are searched can then become important. In this case, the search proceeds as follows:
Each field in the
" string is considered in turn.
An attempt is made to match the template to each of the target
’ s Frames in the order:
(1) the current Frame, (2) the base Frame, (3) each remaining Frame in the order of
being added to the target FrameSet.
Generally, the first match found is used. However, the Mapping between the target coordinate system and the resulting Frame is also examined. Preference is given to cases where both the forward and inverse transformations are defined (as indicated by the TranForward and TranInverse attributes). If only one transformation is defined, the forward one is preferred.
If a match is found and the domain of the resulting Frame also matches the current
" field, it is accepted. Otherwise, the next
" field is
considered and the process repeated.
If a suitable coordinate system is found, the Current attribute of the target FrameSet will be modified on exit to identify the Frame whose match with the target was eventually accepted.
If a FrameSet is returned, it will contain two Frames. Frame number 1 (its base Frame) represents the target coordinate system and will be the same as the (base Frame of the) target. Frame number 2 (its current Frame) will be a Frame representing the coordinate system which the function found. The Mapping which inter-relates these two Frames will describe how to convert between their respective coordinate systems.
Note that a FrameSet may be used both as a Mapping and as a Frame. If the result is used as a Mapping (e.g. with astTran2), then it provides a means of converting coordinates from the target coordinate system into the new coordinate system that was found (and vice versa if its inverse transformation is selected). If it is used as a Frame, its attributes will describe the new coordinate system.
"FrameSet. If the target is a FrameSet, then its Current attribute will be updated to identify the Frame that was used.
If no celestial coordinate system can be found, a value of AST__NULL will be returned without error.
This is acomplished by setting the MaxAxes attribute of the template SkyFrame to a large number (larger than or equal to the number of axes in the target CmpFrame). This allows the SkyFrame to be used as a match for Frames containing from 2 to 100 axes.
". If this search fails, a search is then made for one with the domain
". If this also fails, then any 2-dimensional coordinate system is returned as part of the
Only if no 2-dimensional coordinate systems can be reached by applying built-in conversions to any of the Frames in the target will a value of AST__NULL be returned.
’s Domain attribute and the fields in the
"FrameSet) will always be 1-dimensional, but will be related to the coordinate system that was found by a suitable Mapping (e.g. a PermMap) which simply extracts the first axis.
If we had wanted a Frame representing the actual (1, 2 or 3-dimensional) coordinate system found, we could set the PreserveAxes attribute to a non-zero value in the template.
The Mapping represented by the returned FrameSet results in alignment taking
place in the coordinate system specified by the AlignSystem attribute of the
" Frame. See the description of the AlignSystem attribute for further
Beware of setting the Domain attribute of the template and then using a
string which does not include the template
’ s domain (or a blank field). If you do so,
no coordinate system will be found.
A null Object pointer (AST__NULL) will be returned if this function is invoked with the AST error status set, or if it should fail for any reason.
"by the template you supply, and (b) the value of its Domain attribute appears in the
"string (except that a blank field in this string permits any domain). A successful match by the template depends on a number of criteria, as outlined below:
In general, a template will only match another Frame which belongs to the same class as the template, or to a derived (more specialised) class. For example, a SkyFrame template will match any other SkyFrame, but will not match a basic Frame. Conversely, a basic Frame template will match any class of Frame.
The exception to this is that a Frame of any class can be used to match a CmpFrame, if that CmpFrame contains a Frame of the same class as the template. Note however, the MaxAxes and MinAxes attributes of the template must be set to suitable values to allow it to match the CmpFrame. That is, the MinAxes attribute must be less than or equal to the number of axes in the target, and the MaxAxes attribute must be greater than or equal to the number of axes in the target.
If using a CmpFrame as a template frame, the MinAxes and MaxAxes for the template are determined by the MinAxes and MaxAxes values of the component Frames within the template. So if you want a template CmpFrame to be able to match Frames with different numbers of axes, then you must set the MaxAxes and/or MinAxes attributes in the component template Frames, before combining them together into the template CmpFrame.
If a template has a value set for any of its main attributes, then it will only match
Frames which have an identical value for that attribute (or which can be transformed,
using a built-in conversion, so that they have the required value for that attribute).
If any attribute in the template is un-set, however, then Frames are matched regardless
of the value they may have for that attribute. You may therefore make a template more
or less specific by choosing the attributes for which you set values. This requirement
does not apply to
’ attributes such as titles, labels, symbols,
An important application of this principle involves the Domain attribute. Setting the
Domain attribute of the template has the effect of restricting the search to a
particular type of Frame (with the domain you specify). Conversely, if the Domain
attribute is not set in the template, then the domain of the Frame found is not
relevant, so all Frames are searched. Note that the
" string provides an
alternative way of restricting the search in the same manner, but is a more convenient
interface if you wish to search automatically for another domain if the first search
Normally, a template will only match a Frame which has the same number of axes as itself. However, for some classes of template, this default behaviour may be changed by means of the MinAxes, MaxAxes and MatchEnd attributes. In addition, the behaviour of a template may be influenced by its Permute and PreserveAxes attributes, which control whether it matches Frames whose axes have been permuted, and whether this permutation is retained in the Frame which is returned (as opposed to returning the axes in the order specified in the template, which is the default behaviour). You should consult the descriptions of these attributes for details of this more advanced use of templates.