Package pyraf :: Module irafdisplay
[hide private]
[frames] | no frames]

Module irafdisplay

source code

irafdisplay.py: Interact with IRAF-compatible image display

Modeled after the NOAO Client Display Library (CDL)

Public functions:

readCursor(sample=0)
        Read image cursor position

open(imtdev=None)
        Open a connection to the display server.  This is called
        automatically by readCursor if the display has not already been
        opened, so it is not generally necessary for users to call it.

        See the open doc string for info on the imtdev argument, which
        allows various forms of socket and network connections.

close()
        Close the active display server.  Called automatically on exit.

Various classes are defined for the different connections (ImageDisplay,
ImageDisplayProxy, UnixImageDisplay, InetImageDisplay, FifoImageDisplay).
They should generally be created using the _open factory function.
This could be used to maintain references to multiple display servers.

Ultimately more functionality may be added to make this a complete
replacement for CDL.

$Id: irafdisplay.py 779 2007-02-09 16:52:50Z rij $

Classes [hide private]
  ImageDisplay
Interface to IRAF-compatible image display
  FifoImageDisplay
FIFO version of image display
  UnixImageDisplay
Unix socket version of image display
  InetImageDisplay
INET socket version of image display
  ImageDisplayProxy
Interface to IRAF-compatible image display
Functions [hide private]
 
_open(imtdev=None)
Open connection to the image display server
source code
Variables [hide private]
  _default_imtdev = "unix:/tmp/.IMT%d", "fifo:/dev/imt1i:/dev/im...
  _display = ImageDisplayProxy()
  readCursor = _display.readCursor
  open = _display.open
  close = _display.close

Imports: os, socket, numpy, fcntl, irafutils, FCNTL


Function Details [hide private]

_open(imtdev=None)

source code 
Open connection to the image display server

This is a factory function that returns an instance of the ImageDisplay
class for the specified imtdev.  The default connection if no imtdev is
specified is given in the environment variable IMTDEV (if defined) or
is "unix:/tmp/.IMT%d".  Failing that, a connection is attempted on the
/dev/imt1[io] named fifo pipes.

The syntax for the imtdev argument is <domain>:<address> where <domain>
is one of "inet" (internet tcp/ip socket), "unix" (unix domain socket)
or "fifo" (named pipe).  The form of the address depends upon the
domain, as illustrated in the examples below.

inet:5137                   Server connection to port 5137 on the local
                            host.  For a client, a connection to the
                            given port on the local host.

inet:5137:foo.bar.edu       Client connection to port 5137 on internet
                            host foo.bar.edu.  The dotted form of address
                            may also be used.

unix:/tmp/.IMT212           Unix domain socket with the given pathname
                            IPC method, local host only.

fifo:/dev/imt1i:/dev/imt1o  FIFO or named pipe with the given pathname.
                            IPC method, local host only.  Two pathnames
                            are required, one for input and one for
                            output, since FIFOs are not bidirectional.
                            For a client the first fifo listed will be
                            the client's input fifo; for a server the
                            first fifo will be the server's output fifo.
                            This allows the same address to be used for
                            both the client and the server, as for the
                            other domains.

The address field may contain one or more "%d" fields.  If present, the
user's UID will be substituted (e.g. "unix:/tmp/.IMT%d").


Variables Details [hide private]

_default_imtdev

Value:
"unix:/tmp/.IMT%d", "fifo:/dev/imt1i:/dev/imt1o"