next up previous contents
Next: About this document ... Up: Appendices Previous: TrueColor Support   Contents


Glish

The following is a list of events supported by aipsview. They have all been tested and all work. For more information on glish, consult the Glish Tutorial or for even more information on glish check the Glish Reference Manual.

displayFile(<filename>)
This loads the file $<$filename$>$ and returns an imageID event with an id to be used in referring later to the image:

% glish
Glish version 2.5.2
- a := client("aipsview")
- whenever a->imageID do id := $value
- id := -1
- a->displayFile("data/H13CN.fits")

replaceFile(ID, <filename>)
This loads new data from $<$filename$>$ into the image identified with the integer value ID, (n.b., the image identified with ID must have same dimensions as image identified by the filename).

% glish
Glish version 2.5.2
- a := client("aipsview)
- whenever a->imageID do id := $value
- id := -1
- a->displayFile("data/HCN.fits")
- a->replaceFile(id, "data/H13CN.fits")

displayArray(array)
Here array is any glish array.

% glish
Glish version 2.5.2
- a := client("aipsview")
- whenever a->imageID do id := $value
- arr := array(1:254, 256, 256)
- a->displayArray(arr)

displayImage(image)
Here image is an array with coordinates and other information as demonstrated in the following example:

% glish
Glish version 2.5.2
- a := client("aipsview");
- arr := array(1:129, 128, 64, 5);
- pcmatrix := array(0, 3, 3);
- pcmatrix[1,1] := 1;
- pcmatrix[2,2] := 1;
- pcmatrix[3,3] := 1;
- image := [=];
- image.data := arr;
- header := [=];
- header.imageShape := arr::shape;
- header.axisNames := ['SIN Right Ascension', 'SIN Declination', 'STOKES'];
- header.referenceValues := [20.567, 34.5607, 1];
- header.referencePixels := [34, 34, 1];
- header.deltas := [0.002, 0.002, 1.0];
- header.pcmatrix := pcmatrix;
- header.projectionParameters := [0,0,0,0,0,0,0,0,0,0];
- header.longpole := 180.0;
- header.name := 'test3D';
- header.dataUnits := 'JY/BEAM';
- image.header := header;
- av->displayImage(image);

releaseImage(ID)
Delete image identified by ID.

% glish
Glish version 2.5.2
- a := client("aipsview")
- whenever a->imageID do id := $value
- arr := array(1:254, 256, 256)
- a->displayArray(arr)
- a->releaseImage(id)

selectImageRegion(ID), getImageRegion(ID), and selectImageLocation(ID)
Queue a request for selection from image identified by ID. Events are sent when the selection is made.

queryImageRegion(ID)
Return an imageRegion event with the following record:

{
  imageID        (int)                       id of queried image
  vertices       (array of pairs of floats)  vertices defining the region
}

For now, only two vertices are given representing the corners of an orthogonal 2-rectangle in 3-space.

queryImageLocation(ID)
Return an imageLocation event with the following record:

{
  imageID        (int)          id of queried image
  pixelLocation  (int array)    location of last pick on this image
  worldLocation  (float array)  linear approximation to world pos of last pick
  value          (float)        data value at last pick
}

Both queryImageRegion and queryImageLocation commands will queue a request if no previous selection exists.

queryImages()
Return an imageList event with the following record:

{
  count          (int)          number of images loaded
  ids            (int array)    list of ID's
  names          (string array) list of names
}

scrollBufBegin(image, N)
This command creates a multidimensional strip chart we call a scrolling buffer. The first argument establishes the shape of the dataset, and the second defines how many datasets to keep around. The buffer stacks the incoming images along an extra axis and presents it to aipsview as a dataset whose number of dimensions is one more than that of the passed image. The scrollBufAddImage(id, image) command adds an image to this scrolling buffer dataset, discarding the old image if the number of accumulated images is equal to N. The scrolling buffer will use the time axis if it finds one to stack the images.

The example below creates an 2D image with 4D coordinates. First an image template is created, and the scrolling buffer is initialized to match the image template and keep 20 images around. Then every two seconds a new image is sent to the scrolling buffer dataset. The first twenty images sent to the display without scrolling the buffer. After twenty images have been sent, the data scrolls as a new image is pushed on top and an old one falls out the bottom.

% glish
Glish version 2.5.2
- a := client("aipsview");
- image := [=];
- image.data := array(1:65,64,64,1,1);
- ndim := 4;
- pcmatrix := array(0, ndim, ndim);
- for (n in 1:ndim) pcmatrix[n,n] := 1;
- image.header := [=];
- image.header.imageShape := image.data::shape;
- image.header.axisNames := ['NCP Right Ascension', 'NCP Declination',
    'time', 'STOKES'];
- image.header.referenceValues := [20.567, 34.5607, 1000, 1];
- image.header.referencePixels := [34, 34, 1, 1];
- image.header.deltas := [0.0027, 0.0027, 10, 1];
- image.header.pcmatrix := pcmatrix;
- # NCP parm1 is latitude of observing interferometer
- image.header.projectionParameters := [-30.0,0,0,0,0,0,0,0,0,0];
- image.header.longpole := 180.0;
- image.header.name := 'ScrollingBufferTest';
- image.header.dataUnits := 'JY/BEAM';
- image.header.globalDataMin := 0;
- image.header.globalDataMax := 300;
- # initialize with this dataset
- av->scrollBufBegin(image, 20);
- await av->imageID;
- id := $value;
- print '----- SCROLLING BUFFER INITIALIZED (id is :', id, ')------\n';
- shell("sleep 5");
- for (n in 1:100)
- {
-     image.header.dataMin := n*2+1;
-     image.header.dataMax := n*2+65;
-     image.header.referenceValues[3] +:= 10;
-     image.data +:= 2;
-     av->scrollBufAddImage(id, image);
-     shell("sleep 2");
- }

scrollBufAddImage(ID, image)
This command adds an image to a previously created scrolling buffer dataset identified by ID returned by scrollBufBegin(image, N). The image must have the same shape and same coordinate system as the image used in the call to scrollBufBegin. The example shown above illustrates its use.


next up previous contents
Next: About this document ... Up: Appendices Previous: TrueColor Support   Contents