1.1.3 Set new reference code
Description
This function sets the reference code for the specified coordinate type.
Examples of reference codes are B1950 and J2000 for direction coordinates, or
LSRK and BARY for spectral coordinates.
You must specify type, selecting from ’direction’, or ’spectral’ (the first two letters will do). If the Coordinate System does not contain a coordinate of the type you specify, an exception is generated.
Specify the new code with argument value. To see the list of possible codes, use the function referencecode (see example).
If adjust is T, then the reference value is recomputed. This is invariably the correct thing to do. If adjust is F, then the reference code is simply overwritten; do this very carefully.
Arguments
| Inputs |
| ||
| value |
| Reference code
| |
| allowed: | string |
|
| Default: |
|
|
| type |
| Coordinate type: direction or spectral
| |
| allowed: | string |
|
| Default: | direction |
|
| adjust |
| Adjust reference value ?
| |
| allowed: | bool |
|
| Default: | true |
|
Example
"""
# print "\t----\t Ex setreferencecode 1 \t----" csys = cs.newcoordsys(direction=T) clist = csys.referencecode(’dir’, T) # See possibilities print clist #[’J2000’, ’JMEAN’, ’JTRUE’, ’APP’, ’B1950’, ’BMEAN’, ’BTRUE’, ’GALACTIC’, # ’HADEC’, ’AZEL’, ’AZELSW’, ’AZELNE’, ’AZELGEO’, ’AZELSWGEO’, ’AZELNEGEO’, # ’JNAT’, ’ECLIPTIC’, ’MECLIPTIC’, ’TECLIPTIC’, ’SUPERGAL’, ’ITRF’, ’TOPO’, # ’ICRS’, ’MERCURY’, ’VENUS’, ’MARS’, ’JUPITER’, ’SATURN’, ’URANUS’, # ’NEPTUNE’, ’PLUTO’, ’SUN’, ’MOON’, ’COMET’] print cs.referencecode(’dir’) #J2000 cs.setreferencecode(’B1950’, ’dir’, T) # """ |
In this example we first get the list of all possible reference codes for a direction coordinate. Then we set the actual reference code for the direction coordinate in our Coordinate System.
Example
"""
# print "\t----\t Ex setreferencecode 2 \t----" ia.maketestimage(’myimage.j2000’,overwrite=true) # Open image csys = ia.coordsys() # Get Coordinate System print csys.referencecode(’dir’, F) #J2000 csys.setreferencecode(’B1950’, ’dir’, T) # Set new direction system im2 = ia.regrid(outfile=’myimage.b1950’, csys=csys.torecord(), overwrite=true) # Regrid and make new image # """ |
In this example we show how to regrid an image from J2000 to B1950. First we recover the Coordinate System into the Coordsys tool called cs. We then set a new direction reference code, making sure we recompute the reference value. Then the new Coordinate System is supplied in the regridding process (done with an Image tool).
Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu
Copyright © 2008 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search
Updated daily during alpha development.