starlink.Grf.grf_matplotlib
"GRF module" can be used with
the PyAST starlink.Ast.Plot
class to produce annotated
coordinate grids, etc. To use any other graphics system, an equivalent
GRF module must be written.
Note, if using PyAST with Python version 3, it is necessary to use the "matplotlib for Python 3" branch.
starlink.Atl.PyFITSAdapter
class provides a simple means of
transferring FITS header cards bwteeen PyFITS headers and the PyAST
FitsChan
class.
% python setup.py install
To test it, do:
% python starlink/ast/test/test.py
>>> import starlink.Ast as Ast
The following is a list of general points about how to use PyAST (until
more appropriate examples are produced, the PyAST test script -
starlink/ast/test/test.py
- can be consulted for examples of
how to use the functions provided by PyAST):
astTranN
" method becomes "trann
" in Python).
starlink.Ast.ZOOMI
is
raised if an AST function returns an error code of AST__ZOOMI
). All of
these Exception subclasses inherit from the single Exception type
starlink.Ast.AstError
, which itself inherits from Exception.
options
"
parameter, which allow the attributes of the new object to be specified
as a comma-separated list of "attribute=value" strings. Each PyAST
wrapper has an equivalent optional string parameter. If the parameter is
omitted, the object attributes will be left at their default values. A
future version of PyAST may allow attributes to be set using the usual
Python approach of an optional set of keyword arguments.
>>> zm.set("Zoom=1.2")
>>> zm.Zoom = 1.2
Note, some AST attributes are multi-valued, with individual values being
refered to by attribute names of the form "name(index)
" (i.e. the
attribute name followed by a numerical of string index in parentheses).
The corresponding Python properties are of the form "name_index
"
(i.e.the index is appended with an underscore rather than being enclosed in
parentheses). For instance, either of the following will set the Label
attribute for the second axis of a Frame:
>>> frm.set("Label(2)=Flux density")
>>> frm.Label_2 = "Flux density"
and this will set the colour of a Plot border to colour index 1:
>>> plot.set("Colour(Border)=1")
>>> Plot.Colour_Border = 1
Colours: - when a colour is specified within an options string (as in the first of the above two examples), only integer values are allowed. However, when using the equivalent Python property (as in the second of the above examples), colours may also be specified as strings, if this is allowed by the Grf module in use. The default matplotlib Grf module supplied with pyast allows colours to be specified using any string format that is recognised by matplotlib. So the second example could for instance be replaced by:
>>> Plot.Colour_Border = "lime"
Note, when retrieving the value of a colour property, the colour will be converted to a named colour if possible, and will be represented as a hex HTML colour string otherwise. For instance:
>>> Plot.Colour_Border = "#000000"
>>> print( Plot.Colour_Border )
'black'
>>> Plot.Colour_Border = "#FFEBC0"
>>> print( Plot.Colour_Border )
'#FFEBC0'
starlink.Ast.get()
method or the corresponding Python property:
>>> print( zm.get("Zoom") )
>>> print( zm.Zoom )
starlink.Ast.test()
and starlink.Ast.clear()
methods:
>>> zm.clear("Zoom")
>>> zm.test("Zoom")
AST__xxx
(e.g. AST__BAD
).
In Python, these constants are available as starlink.Ast.xxx
(e.g. starlink.Ast.BAD
).