ccd
Class FechnerDriver

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by io.AbstractDriver
                  extended by ccd.AbstractCcdDriver<T>
                      extended by ccd.SynchronousCcdDriver<String>
                          extended by ccd.FechnerDriver
All Implemented Interfaces:
CcdDriver<String>, Driver, Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class FechnerDriver
extends SynchronousCcdDriver<String>

The class to work with thomas fechner's guider ccd.


Nested Class Summary
static class FechnerDriver.Test
          A test class.
 
Nested classes/interfaces inherited from class ccd.SynchronousCcdDriver
SynchronousCcdDriver.ExposureThread
 
Nested classes/interfaces inherited from class ccd.AbstractCcdDriver
AbstractCcdDriver.Endurance, AbstractCcdDriver.Exposure, AbstractCcdDriver.Shot
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  CCDClient ccdclient
          RPC client instance.
private  cmd command
          cmd instance to specify the arguments for client functions.
private static boolean DEFCOUNTERRESET
          Default property value.
static String DEFDRIVERNAME
          Default name of the fechner ccd driver.
private static long DEFEXPOSEMULTIPLY
          Default property value.
private static boolean DEFINCREMENTING
          Default property value.
private static int DEFRPCTIMEOUT
          Default property value.
private static String DEFSERVERNAME
          Default property value.
private static String DEFSERVERPATH
          Default property value.
private  int fitscount
          Internal counter to keep track of incremental images.
private static NumberFormat INCREMENTFORMAT
          Formatter for running fits number..
static String INCREMENTSEPARATOR
          General separator between fits filename and running number.
static String KEY_COUNTERRESET
          If true, driver resets counter at any call to incrementing.
static String KEY_EXPOSEMULTIPLY
          The multiplier for exposure times returned to ms.
static String KEY_INCREMENTING
          Image incrementing at init.
static String KEY_RPCTIMEOUT
          The RPC time-out in millisecond.
static String KEY_SERVERNAME
          FCDN of the host where the guider rpc server is running.
static String KEY_SERVERPATH
          The path where the server should store its fits.
static int OK
          General return code from rpc calls indicating okay.
private  erg result
          erg instance to access return values of the client functions.
 
Fields inherited from class ccd.AbstractCcdDriver
KEY_AMPLIFIERS, KEY_AREAREADOUT, KEY_COLUMNPOST, KEY_COLUMNPRIOR, KEY_COLUMNREADOUT, KEY_FIXEDREADOUT, KEY_INITSIZE, KEY_ROWPOST, KEY_ROWPRIOR, KEY_ROWREADOUT, KEY_XBINNING, KEY_XCHIPSIZE, KEY_XORIGIN, KEY_XSIZE, KEY_YBINNING, KEY_YCHIPSIZE, KEY_YORIGIN, KEY_YSIZE
 
Fields inherited from class io.AbstractDriver
KEY_DRIVERNAME
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface ccd.CcdDriver
FITSEXTENSION
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
FechnerDriver(Map<String,String> info)
          Constructor.
 
Method Summary
protected  void clearArguments()
          Initalizies the RPC function arguments.
 boolean close()
          Close the RPC communication.
 int expose()
          Make an exposure.
 int exposeBias()
          Makes a bias exposure.
 int exposeDark()
          Makes a dark exposure.
 Dimension getBinning()
          Get the binning values in x (columns) and y (rows).
 Class<String> getBufferType()
          We work on strings, that are the file names of the fits files stored.
 Map getCcdInfo()
          This ccd does not provide any additional info.
 String getDataBuffer()
          Returns the output buffer.
 long getExposureTime()
          Get the current exposure time in milliseconds.
private  String getFitsDir()
          Get current FITS file output directory.
protected  String getFitsName()
          Get the current base of the output FITS file.
protected  Dimension getMaxPixel()
          Get the max_pixel values for x (columns) and y (rows).
 Rectangle getWindow()
          Get the current image origin (pre-gap) in x (columns) and y (rows) and the size
 void init()
          On init, we default the initial read-out window to the chip size.
 boolean isIncrementing()
          Get the increment status.
 boolean isOpen()
          We consider the driver to be open if the ccdclient is initialized.
protected  boolean openController()
          Initializes an RPC driver.
 boolean setBinning(int xbin, int ybin)
          Set the binning values in x (columns) and y (rows).
 boolean setDataBuffer(String file)
          Sets the output buffer.
 boolean setExposureTime(long exptime)
          Set the current exposure time in milliseconds.
private  boolean setFitsDir(String dir)
          Sets the fits directory.
protected  boolean setFitsName(String filename)
          Set the current name of the output FITS file.
 boolean setIncrementing(boolean set)
          Set the increment status parameter: true = increments a file number for storing all fits files, false = overwriting of existing files.
protected  boolean setMaxPixel(Dimension max)
          Set the max_pixel values for x (columns) and y (rows).
 boolean setWindow(Rectangle window)
          Set the current image window.
 
Methods inherited from class ccd.SynchronousCcdDriver
ensureReady, isExposing, threadedDarkExpose, threadedExpose
 
Methods inherited from class ccd.AbstractCcdDriver
getChipSize, getReadoutTime, open
 
Methods inherited from class io.AbstractDriver
createDriver, equals, getDriverName, hashCode
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface io.Driver
getDriverName
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

INCREMENTSEPARATOR

public static final String INCREMENTSEPARATOR
General separator between fits filename and running number.

See Also:
Constant Field Values

OK

public static final int OK
General return code from rpc calls indicating okay.

See Also:
Constant Field Values

KEY_INCREMENTING

public static final String KEY_INCREMENTING
Image incrementing at init.

See Also:
Constant Field Values

KEY_COUNTERRESET

public static final String KEY_COUNTERRESET
If true, driver resets counter at any call to incrementing.

See Also:
Constant Field Values

KEY_SERVERNAME

public static final String KEY_SERVERNAME
FCDN of the host where the guider rpc server is running.

See Also:
Constant Field Values

KEY_SERVERPATH

public static final String KEY_SERVERPATH
The path where the server should store its fits.

See Also:
Constant Field Values

KEY_EXPOSEMULTIPLY

public static final String KEY_EXPOSEMULTIPLY
The multiplier for exposure times returned to ms.

See Also:
Constant Field Values

KEY_RPCTIMEOUT

public static final String KEY_RPCTIMEOUT
The RPC time-out in millisecond.

See Also:
Constant Field Values

DEFDRIVERNAME

public static final String DEFDRIVERNAME
Default name of the fechner ccd driver.

See Also:
Constant Field Values

DEFSERVERNAME

private static final String DEFSERVERNAME
Default property value.

See Also:
Constant Field Values

DEFSERVERPATH

private static final String DEFSERVERPATH
Default property value.

See Also:
Constant Field Values

DEFRPCTIMEOUT

private static final int DEFRPCTIMEOUT
Default property value.

See Also:
Constant Field Values

DEFINCREMENTING

private static final boolean DEFINCREMENTING
Default property value.

See Also:
Constant Field Values

DEFCOUNTERRESET

private static final boolean DEFCOUNTERRESET
Default property value.

See Also:
Constant Field Values

DEFEXPOSEMULTIPLY

private static final long DEFEXPOSEMULTIPLY
Default property value.

See Also:
Constant Field Values

ccdclient

private CCDClient ccdclient
RPC client instance.


command

private cmd command
cmd instance to specify the arguments for client functions.


result

private erg result
erg instance to access return values of the client functions.


fitscount

private int fitscount
Internal counter to keep track of incremental images.


INCREMENTFORMAT

private static final NumberFormat INCREMENTFORMAT
Formatter for running fits number..

Constructor Detail

FechnerDriver

public FechnerDriver(Map<String,String> info)
Constructor. Does not open the connection, this is done in init().

Method Detail

init

public void init()
On init, we default the initial read-out window to the chip size.

Specified by:
init in interface Initializable
Overrides:
init in class AbstractCcdDriver<String>

openController

protected boolean openController()
                          throws IOException
Initializes an RPC driver. Tries to connect to the server via tcp/ip.

Specified by:
openController in class AbstractCcdDriver<String>
Throws:
IOException - If controller connection fails.

isOpen

public boolean isOpen()
We consider the driver to be open if the ccdclient is initialized.

Returns:
True, if a previous initialization was successful

close

public boolean close()
              throws IOException
Close the RPC communication.

Returns:
True if clean-up was successful.
Throws:
IOException

getCcdInfo

public Map getCcdInfo()
This ccd does not provide any additional info.


expose

public int expose()
           throws IOException
Make an exposure. The exposure time and the data buffer must be set prior to a call to this function. Note that this method does not check for proper settings. In TF's driver this method blocks.

Returns:
Number of pixel writtn.
Throws:
IOException - Any subclass of IOException.
See Also:
startExpose

exposeBias

public int exposeBias()
               throws IOException
Makes a bias exposure. If bias is not supported by the driver directly, this should be indicated by the #KEY_SUPPORTBIAS key set to false. In the latter case, this method thros an UnsupportedOperationException.

The data buffer has to be set prior to a call to this method.

Returns:
Number of pixel writtn.
Throws:
IOException - Any subclass of IOException.

exposeDark

public int exposeDark()
               throws IOException
Makes a dark exposure. If dark is not supported by the driver, e.g. if no shutter is present, this should be indicated by the #KEY_SUPPORTDARK key set to false. In the latter case, this method thros an UnsupportedOperationException.

The data buffer has to be set prior to a call to this method.

Returns:
Number of pixel writtn..
Throws:
IOException - Any subclass of IOException.

setDataBuffer

public boolean setDataBuffer(String file)
                      throws IOException
Sets the output buffer. Currently, only writing to a file is supported. If the argument passed to this method is not a File or URL object, a ClassCastException is thrown. In case of invoking this method with an URL, only the file part is kept.

Parameters:
file - Any sort of buffer the driver knows to store CCD-data in.
Returns:
True if successful.
Throws:
IOException - Any subclass of IOException.

getDataBuffer

public String getDataBuffer()
                     throws IOException
Returns the output buffer. In this driver, we query for the fits file name. If we are incrementing, we try to guess the correct file name by appending -0000n, n being the internal fits counter, to the file name returned. An ending #FITS is appended. Return type is of String. Can be used with a class loader to find the resource.

Throws:
IOException - Any subclass of IOException.

getBufferType

public Class<String> getBufferType()
We work on strings, that are the file names of the fits files stored.


setBinning

public boolean setBinning(int xbin,
                          int ybin)
                   throws IOException
Set the binning values in x (columns) and y (rows).

Parameters:
xbin - binning factor in x-direction (1 <= binning factor <= 255)
ybin - binning factor in y-direction (1 <= binning factor <= 255)
Returns:
True if successful.
Throws:
IOException - Any subclass of IOException

getBinning

public Dimension getBinning()
                     throws IOException
Get the binning values in x (columns) and y (rows).

Returns:
Dimension object, columns in width.
Throws:
IOException - Any subclass of IOException.

setWindow

public boolean setWindow(Rectangle window)
                  throws IOException
Set the current image window.

Parameters:
window - The origin being the upper left corner of the rectangle.
Returns:
True if successful.
Throws:
IOException - Any subclass of IOException.

getWindow

public Rectangle getWindow()
                    throws IOException
Get the current image origin (pre-gap) in x (columns) and y (rows) and the size

Returns:
A rectangle with pre-gap upper left corner.
Throws:
IOException - Any subclass of IOException.

setExposureTime

public boolean setExposureTime(long exptime)
                        throws IOException
Set the current exposure time in milliseconds.

Parameters:
expTime - exposure time in milliseconds. (0 <= expTime < 65536 ms)
Returns:
True if successful.
Throws:
IOException - Any subclass of IOException.

getExposureTime

public long getExposureTime()
                     throws IOException
Get the current exposure time in milliseconds.

Returns:
current exposure time (in milliseconds).
Throws:
IOException - Any subclass of IOException.

clearArguments

protected void clearArguments()
Initalizies the RPC function arguments.


setMaxPixel

protected boolean setMaxPixel(Dimension max)
                       throws IOException
Set the max_pixel values for x (columns) and y (rows).

Parameters:
xmax - maximum CCD size in x-direction (1 <= value < 65536)
ymax - maximum CCD size in y-direction (1 <= value < 65536)
Throws:
IOException

getMaxPixel

protected Dimension getMaxPixel()
                         throws IOException
Get the max_pixel values for x (columns) and y (rows).

Returns:
A dimension object, where the size in x is the width.
Throws:
IOException

setFitsName

protected boolean setFitsName(String filename)
                       throws IOException
Set the current name of the output FITS file.

Parameters:
fileName - output FITS filename.
Throws:
IOException

setFitsDir

private boolean setFitsDir(String dir)
                    throws IOException
Sets the fits directory.

Throws:
IOException

getFitsName

protected String getFitsName()
                      throws IOException
Get the current base of the output FITS file.

Returns:
current output FITS filename.
Throws:
IOException

getFitsDir

private String getFitsDir()
                   throws IOException
Get current FITS file output directory.

Returns:
the current FITS file output directory.
Throws:
IOException

setIncrementing

public boolean setIncrementing(boolean set)
                        throws IOException
Set the increment status parameter: true = increments a file number for storing all fits files, false = overwriting of existing files. This means if increment = 1: the fits filename is concatenated from base name + number + extension. Example basename = "bias" number = "00657" extension = ".fits" result bias-00657.fits, next file will be bias-00658.fits etc.

WARNING: There is no way to query TF's server for the true fits name, thus setting this option may result in image trace lost. If this is not what is intended, a partial workaround is to reset the internal counter in TF guider_server.c, called BaseFn in each call to the set_increment_1_svc method (which would be a good idea anyhow). This allows tracing of the fits extension, but only, if no fits file with this extension already exists.

Parameters:
set - boolean to set the incrementing facility.
Throws:
IOException

isIncrementing

public boolean isIncrementing()
                       throws IOException
Get the increment status.

Returns:
the current incrementing status.
Throws:
IOException