Function: WCSBOX Purpose: WCSBOX prompts the user to define a box inside/around a subset. Category: USER IO, PHYSICAL COORDINATES File: ioutils.py Author: M.G.R. Vogelaar Use: blo, bhi = gset.wcsbox(key="BOX=", # Character string mes="", # Character string default=1, # Integer showdev=0, # Integer option=0) # Integer gset Object of class Set for which a box should be defined. key Keyword for prompt. mes Message for prompt default Default code as in USERxxx. showdev Device (as in ANYOUT) to which some info about the chosen box is displayed. option 0: Check on upper limits for blo and bhi using attributes of 'gset' blo bhi Two lists with coordinates which set the axes limits of the input subset. The coordinates are sorted so that 'blo' represents the lower limits and 'bhi' the upper limits. Note that also the Set object (gset) is updated. Therefore you can retrieve the limits also by accessing attributes gset.blo, gset.bhi Description: WCSBOX is a function to set the grid limits of the axes in a subset. it usually is called after the input of the data file (GIPSY set or FITS file). This function is similar to GIPSY's gdsbox() but it is based on WCSLIB and supports more projection- and sky systems. It needs the coordinate word of a subset to determine for which axes limits are needed. For these axes it creates a default prompt which can be overruled with keyword parameter 'mes'. A box is defined with two positions. The first position sets the lower limits of the axes and the second sets the upper limits. One position consists of n coordinates where n is equal to the dimensionality of the subset. Notes: In most situations the conversion between grids and world coordinates is independent of the subset. E.g. in a sequence of channel maps, each RA,Dec image represents the same coordinate system. However, when we create subsets with only one spatial axis, then the matching spatial coordinate depends on the selected subset (e.g. with XV maps). Here we follow the implementation in gdsbox.c. That is, only the first subset is used for coordinate transformations. Examples: BOX=-10 -10 20 30 BOX= 0 0 D 30 50 BOX= 2h10m30s 60d32m2.7s D 10 10 BOX= 2h10m30s 60d32m2.7s D 2 arcmin 3 arcmin Example of a small task that asks a user to enter a box: #!/usr/bin/env python import gipsy from kapteyn import ioutils gipsy.init() gipsyset = ioutils.wcsinp() gipsyset.printinfo() blo, bhi = gipsyset.wcsbox() gipsy.anyout("Box from %s to %s"%(str(blo), str(bhi))) gipsy.finis() Updates: Apr 23, 2009: VOG, Document created.