Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: coordsys.setdirection - Function Up: coordsys - Tool Previous: coordsys.restfrequency - Function


coordsys.setconversiontype - Function



Package general
Module images
Tool coordsys


Set extra reference conversion layer


Synopsis
setconversiontype(direction, spectral)


Arguments

direction in Reference code
    Allowed: String or unset
    Default: None
spectral in Reference code
    Allowed: String or unset
    Default: None



Returns
T, F or fail



Description

Some coordinates contain a reference code. Examples of reference codes are B1950 and J2000 for direction coordinates, or LSRK and BARY for spectral coordinates. When you do conversions between pixel and world coordinate, the coordinates are in the reference frame corresponding to these codes.

This function allows you to specify a different reference frame which is used when converting between world and pixel coordinate (see function conversiontype to recover the conversion types). If it returns F, it means that although the conversion machines were successfully created, a trial conversion failed. This usually means the REST frame was involved which requires a radial velocity (not yet implemented). If this happens, the conversion type will left as it was. You will get a fail if more blatant things are wrong like a missing coordinate, or an incorrect reference code.

The list of possible reference codes can be obtained via function referencecode.

With this function, you specify the desired reference code. Then, when a conversion between pixel and world is requested, an extra conversion is done to (toWorld) or from (toPixel) the specified reference frame.

The summary function shows the extra conversion reference system to the right of the native reference system (if it is different) and in parentheses.

Note that to convert between different spectral reference frames, you need a position, epoch and direction. The position (telescope) and epoch (date of observation), if not in your coordinate system can be set with functions settelescope and setepoch. The direction is the reference direction of the required direction coordinate in the coordinate system.

As an example, let us say you are working with a spectral coordinate which was constructed with the LSRK reference frame. You want to convert some pixel coordinates to barycentric velocities (reference code BARY).

- cs := coordsys(direction=T, spectral=T); # Create coordinate system
- local pa, wa;
- cs.findcoordinate(pa, wa, 'spectral')    # Find spectral coordinate
- u := cs.units()[wa[1]];                  # Spectral unit
- cs.referencecode(type='spectral')        # Which is  in LSRK reference frame
LSRK
-
- p := [10,20,30]
- w := cs.toworld(p, format='n')           # Convert a pixel to LSRK world
- print 'pixel, world = ', p, w
pixel, world =  [10 20 30]  [21590.9999 19.0000967 1.415029e+09] 
-
- p2 := cs.topixel(w)                      # and back to pixel
- print 'world, pixel = ', w, p2
world, pixel =  [21590.9999 19.0000967 1.415029e+09]  [10 20 30] 
-
- v := cs.frequencytovelocity(value=w[wa[1]],     # Convert LSRK frequency to LSRK velocity
                              frequnit=u, 
                              doppler='RADIO', 
                              velunit='m/s');
- print 'pixel, frequency, velocity = ', p[pa[1]], w[wa[1]], v
pixel, frequency, velocity =  30 1.415029e+09 1134823.36
-
-
- cs.setconversiontype(spectral='BARY')    # Specify BARY reference code
- w := cs.toworld(p, format='n')           # Convert a pixel to BARY world
print 'pixel, world = ', p, w
pixel, world =  [10 20 30]  [21590.9999 19.0000967 1.41498179e+09] 
-
- p2 := cs.topixel(w)                      # and back to pixel
- print 'world, pixel = ', w, p2
world, pixel =  [21590.9999 19.0000967 1.41498179e+09]  [10 20 29.9952772] 
-
- v := cs.frequencytovelocity(value=w[wa[1]],   # Convert BARY frequency to BARY velocity
                              frequnit=u, 
                              doppler='RADIO', 
                              velunit='m/s');
- print 'pixel, frequency, velocity = ', p[pa[1]], w[wa[1]], v
pixel, frequency, velocity =  30 1.41498179e+09 1144787.26

You must also be aware of when this extra layer is active and when it is not. It's a bit nasty.

  • - Whenever you use toWorld, toPixel toWorldMany, or toPixelMany the layer is active.

  • - Whenever you use convert or convertMany the layer may be active. Here are the rules !

    It is only relevant to spectral and direction coordinates.

    For the direction coordinate part of your conversion, if you request a pure world or pixel conversion it is active. Any pixel/world mix will not invoke it (because it is ill defined).

    For the spectral coordinate part it is always active (only one axis so must be pixel or world).

  • - This layer is irrelevant to all functions converting between frequency and velocity, and absolute and relative. The values are in whatever frame you are working with.

The summary function lists the reference frame for direction and spectral coordinates. If you have also set a conversion reference code it also lists that (to the right in parentheses).





next up previous contents index
Next: coordsys.setdirection - Function Up: coordsys - Tool Previous: coordsys.restfrequency - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01