stella.firecam
Class FireDriver

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<nom.tam.fits.Fits>
                          extended by stella.firecam.FireDriver
All Implemented Interfaces:
CcdDriver<nom.tam.fits.Fits>, Driver, Resettable, Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class FireDriver
extends SynchronousCcdDriver<nom.tam.fits.Fits>
implements Resettable

The interface to the STELLA API to allow the firewire-CCD camera be used as a standard CCD using the CcdDriver interface. The firwire camera itself is mainly used in adapter as a main guider or a fiber viewing unit.

The camera itself only supports full-frame transfer, so sub-frames and binning is done in the java part.

Additionally, a setFramesToAdd(int) method is present that allows the user to specify up to 16 frames that should be co-added on the server side. This circumvents the 12-bit weakness of the camera somehow. A unique feature is also the possibility to change the gain from zero to 723, which corresponds to 25dB. Combining that with measured gains (what astronomers see as it), this 0-723g translates to a gain of

   gain=2.8*10^(-2.0082e-3*g)
   
This also means that the gain of the camera is adjustable between 2.8 and 0.1 (0 and 723, respectively).
If used on RoboTel, the pixel scale is approximately 0.2385 arcsec/px. On STELLA-II, it will be roughly 0.1272


Nested Class Summary
 
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  nom.tam.fits.Fits async
          The data buffer for asynchroneous retrieval.
static String DATE
          Estimated start of exposure.
static String DATEREM
           
static String DBGAIN
          Raw gain in 25/723 dB.
static String DBGREM
           
static int DC1394_SUCCESS
          The constant that indicates success in core library.
private static double DEFAREAREADOUT
          Always zero.
private static double DEFATMOSTIME
          Default characteristic time scale of the atmosphere, in seconds.
private static int DEFDBGAIN
          Default gain in db to set on startup.
static String DEFDRIVERNAME
          Default name of the unibrain ccd driver.
private static double DEFFIXEDREADOUT
          Always read the full frame.
static double DEFFRAMERATE
          Default frame rate.
private static long DEFMAXEXPOSE
          Default exposure time 65 sec.
private static long DEFMINEXPOSE
          Default minimal exposure time 5 microseconds.
private static int DEFRPCTIMEOUT
          Default property value.
private static String DEFSERVERNAME
          Default property value.
private static int DEFXCHIPSIZE
          Default size.
private static int DEFYCHIPSIZE
          Default size.
static String EXPOSE
          Exposure time in ms.
static String EXPREM
           
private static FirecamClient fire
          RPC client instance.
static double[] FRAMES
          Frame rates supported.
static String KEY_ATMOSTIME
          The atmospheric characteristic time.
static String KEY_DBGAIN
          The gain to set on startup.
static String KEY_MAXEXPOSE
          The maximum exposure time allowed in microsec.
static String KEY_MINEXPOSE
          The minimum exposure time allowed in microsec.
static String KEY_RESETSERVER
          FCDN of the host where the fircam reset server is running.
static String KEY_RPCTIMEOUT
          The RPC time-out in millisecond.
static String KEY_SERVERNAME
          FCDN of the host where the fircam rpc server is running.
private  int nframe
          Number of frames to co-add, 1 to 16.
static String NFRAME
          Numbers of frame added on server side.
static String NREM
           
private  Rectangle window
          Active window on chip.
private  int xbin
          Current binning in x.
static String XBIN
          Binning used in x.
static String XBINREM
           
static String XORGREM
          Comment for entering x-pregap info to header.
static String XORIGIN
          All FITS header is manufactured by us, this is the unbinned x pregap.
static String XSIZE
          Fits key for entering chip total size in x.
static String XSIZEREM
           
private  int ybin
          Current binning in x.
static String YBIN
          Binning used in y.
static String YBINREM
           
static String YORGREM
          Comment for entering y-pregap info to header.
static String YORIGIN
          Fits key for entering y-pregap info to header.
static String YSIZE
          Fits key for entering chip total size in y.
static String YSIZEREM
           
 
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
FireDriver(Map<String,String> info)
          Constructor.
 
Method Summary
 boolean close()
          Close the RPC communication.
private  boolean doExposure()
          Does an exposure.
 int expose()
          Make an exposure.
 int exposeBias()
          Not supported.
 int exposeDark()
          Not supported.
 Dimension getBinning()
          Get the binning values in x (columns) and y (rows).
 Class<nom.tam.fits.Fits> getBufferType()
          We work directly on a fits object.
 Map getCcdInfo()
          This ccd does not provide any additional info.
 nom.tam.fits.Fits getDataBuffer()
          Returns the output buffer.
 long getExposureTime()
          Set the current exposure time in milliseconds.
 double getFramerate()
          Returns the gain setting in the camera, which is a setting in decibel.
 int getFramesToAdd()
          Returns the current active number of co-added frames.
 int getGainDecibel()
          Returns the gain setting in the camera, which is a setting in decibel.
 long getReadoutTime(Rectangle area)
          Always read out the whole frame, multiply this with internal number of frames.
 Rectangle getWindow()
          Get the current image origin (pre-gap) in x (columns) and y (rows) and the size
 void init()
          Clear any leftovers.
 boolean isOpen()
          We consider the driver to be open if the ccdclient is initialized.
private  short[][] manufacture(short[] yx, Rectangle to, int xb, int yb)
          Manufactures a binned and sliced image array out from the full frame.
protected  boolean openController()
          Initializes the fechner driver.
 boolean reset()
          Resets the firewire bus by issuing a reset to the server.
 boolean setBinning(int xb, int yb)
          Set the binning values in x (columns) and y (rows).
 boolean setDataBuffer(nom.tam.fits.Fits file)
          Sets the output buffer.
 boolean setExposureTime(long expt)
          Set the current exposure time in milliseconds.
 boolean setFramerate(double frate)
          Allows to change the frame rate to one of the supported frames rates.
 boolean setFramesToAdd(int n)
          Sets the number of frames that should be co-added on the server side.
 boolean setGainDecibel(int db)
          Allows to change the gain setting in the camera, which is a setting in decibel.
 boolean setWindow(Rectangle w)
          Set the current image window.
 
Methods inherited from class ccd.SynchronousCcdDriver
ensureReady, isExposing, threadedDarkExpose, threadedExpose
 
Methods inherited from class ccd.AbstractCcdDriver
getChipSize, 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, open
 
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

FRAMES

public static final double[] FRAMES
Frame rates supported.


DEFFRAMERATE

public static final double DEFFRAMERATE
Default frame rate.

See Also:
Constant Field Values

XORIGIN

public static final String XORIGIN
All FITS header is manufactured by us, this is the unbinned x pregap.

See Also:
Constant Field Values

XORGREM

public static final String XORGREM
Comment for entering x-pregap info to header.

See Also:
Constant Field Values

YORIGIN

public static final String YORIGIN
Fits key for entering y-pregap info to header.

See Also:
Constant Field Values

YORGREM

public static final String YORGREM
Comment for entering y-pregap info to header.

See Also:
Constant Field Values

XSIZE

public static final String XSIZE
Fits key for entering chip total size in x.

See Also:
Constant Field Values

XSIZEREM

public static final String XSIZEREM
See Also:
Constant Field Values

YSIZE

public static final String YSIZE
Fits key for entering chip total size in y.

See Also:
Constant Field Values

YSIZEREM

public static final String YSIZEREM
See Also:
Constant Field Values

XBIN

public static final String XBIN
Binning used in x.

See Also:
Constant Field Values

XBINREM

public static final String XBINREM
See Also:
Constant Field Values

YBIN

public static final String YBIN
Binning used in y.

See Also:
Constant Field Values

YBINREM

public static final String YBINREM
See Also:
Constant Field Values

EXPOSE

public static final String EXPOSE
Exposure time in ms.

See Also:
Constant Field Values

EXPREM

public static final String EXPREM
See Also:
Constant Field Values

DATE

public static final String DATE
Estimated start of exposure.

See Also:
Constant Field Values

DATEREM

public static final String DATEREM
See Also:
Constant Field Values

NFRAME

public static final String NFRAME
Numbers of frame added on server side.

See Also:
Constant Field Values

NREM

public static final String NREM
See Also:
Constant Field Values

DBGAIN

public static final String DBGAIN
Raw gain in 25/723 dB.

See Also:
Constant Field Values

DBGREM

public static final String DBGREM
See Also:
Constant Field Values

DC1394_SUCCESS

public static final int DC1394_SUCCESS
The constant that indicates success in core library.

See Also:
Constant Field Values

KEY_SERVERNAME

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

See Also:
Constant Field Values

KEY_RESETSERVER

public static final String KEY_RESETSERVER
FCDN of the host where the fircam reset server is running.

See Also:
Constant Field Values

KEY_RPCTIMEOUT

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

See Also:
Constant Field Values

KEY_MAXEXPOSE

public static final String KEY_MAXEXPOSE
The maximum exposure time allowed in microsec.

See Also:
Constant Field Values

KEY_MINEXPOSE

public static final String KEY_MINEXPOSE
The minimum exposure time allowed in microsec.

See Also:
Constant Field Values

KEY_DBGAIN

public static final String KEY_DBGAIN
The gain to set on startup.

See Also:
Constant Field Values

KEY_ATMOSTIME

public static final String KEY_ATMOSTIME
The atmospheric characteristic time. If exposure time is below, we add.

See Also:
Constant Field Values

DEFDRIVERNAME

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

See Also:
Constant Field Values

DEFSERVERNAME

private static final String DEFSERVERNAME
Default property value.

See Also:
Constant Field Values

DEFXCHIPSIZE

private static final int DEFXCHIPSIZE
Default size.

See Also:
Constant Field Values

DEFYCHIPSIZE

private static final int DEFYCHIPSIZE
Default size.

See Also:
Constant Field Values

DEFAREAREADOUT

private static final double DEFAREAREADOUT
Always zero.

See Also:
Constant Field Values

DEFFIXEDREADOUT

private static final double DEFFIXEDREADOUT
Always read the full frame.

See Also:
Constant Field Values

DEFRPCTIMEOUT

private static final int DEFRPCTIMEOUT
Default property value.

See Also:
Constant Field Values

DEFMAXEXPOSE

private static final long DEFMAXEXPOSE
Default exposure time 65 sec.

See Also:
Constant Field Values

DEFMINEXPOSE

private static final long DEFMINEXPOSE
Default minimal exposure time 5 microseconds.

See Also:
Constant Field Values

DEFDBGAIN

private static final int DEFDBGAIN
Default gain in db to set on startup.

See Also:
Constant Field Values

DEFATMOSTIME

private static final double DEFATMOSTIME
Default characteristic time scale of the atmosphere, in seconds.

See Also:
Constant Field Values

fire

private static FirecamClient fire
RPC client instance.


async

private nom.tam.fits.Fits async
The data buffer for asynchroneous retrieval.


nframe

private int nframe
Number of frames to co-add, 1 to 16.


xbin

private int xbin
Current binning in x.


ybin

private int ybin
Current binning in x.


window

private Rectangle window
Active window on chip.

Constructor Detail

FireDriver

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

Method Detail

init

public void init()
Clear any leftovers. Does not open the connection, this is done in openController().

Specified by:
init in interface Initializable
Overrides:
init in class AbstractCcdDriver<nom.tam.fits.Fits>

getReadoutTime

public long getReadoutTime(Rectangle area)
Always read out the whole frame, multiply this with internal number of frames.

Specified by:
getReadoutTime in interface CcdDriver<nom.tam.fits.Fits>
Overrides:
getReadoutTime in class AbstractCcdDriver<nom.tam.fits.Fits>

openController

protected boolean openController()
                          throws IOException
Initializes the fechner driver. Tries to connect to the server and sets default values for binning, maximum size of the chip and read-out window. If a shutter is supported, it is closed. Returns true if initialization was successful.

Specified by:
openController in class AbstractCcdDriver<nom.tam.fits.Fits>
Throws:
IOException - If controller connection fails.

isOpen

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

Specified by:
isOpen in interface Driver
Returns:
True, if a previous initialization was successful

close

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

Specified by:
close in interface Driver
Returns:
True if clean-up was successful.
Throws:
IOException

reset

public boolean reset()
              throws IOException
Resets the firewire bus by issuing a reset to the server.

Specified by:
reset in interface Resettable
Throws:
IOException

setBinning

public boolean setBinning(int xb,
                          int yb)
Set the binning values in x (columns) and y (rows). Binning can only be done software-wise.

Specified by:
setBinning in interface CcdDriver<nom.tam.fits.Fits>
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.

getBinning

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

Specified by:
getBinning in interface CcdDriver<nom.tam.fits.Fits>
Returns:
Dimension object, columns in width.

setWindow

public boolean setWindow(Rectangle w)
Set the current image window. Windowing is done on client side by slicing the server-supplied total image.

Specified by:
setWindow in interface CcdDriver<nom.tam.fits.Fits>
Parameters:
window - The origin being the upper left corner of the rectangle.
Returns:
True if successful.

getWindow

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

Specified by:
getWindow in interface CcdDriver<nom.tam.fits.Fits>
Returns:
A rectangle with pre-gap upper left corner.
Throws:
IOException - Any subclass of IOException.

setExposureTime

public boolean setExposureTime(long expt)
                        throws IOException
Set the current exposure time in milliseconds. The underlying driver supports micro-seconds, a resolution lost in the driver.

Specified by:
setExposureTime in interface CcdDriver<nom.tam.fits.Fits>
Parameters:
expTime - exposure time in *micro*seconds. (0 <= expTime < 65000000 mus)
Returns:
True if successful.
Throws:
IOException - Any subclass of IOException.

getExposureTime

public long getExposureTime()
                     throws IOException
Set the current exposure time in milliseconds. The underlying driver supports micro-seconds, a resolution lost in the driver.

Specified by:
getExposureTime in interface CcdDriver<nom.tam.fits.Fits>
Parameters:
expTime - exposure time in milliseconds. (0 <= expTime < 65000 ms)
Returns:
The exposure time in ms.
Throws:
IOException - Any subclass of IOException.

getBufferType

public Class<nom.tam.fits.Fits> getBufferType()
We work directly on a fits object.

Specified by:
getBufferType in interface CcdDriver<nom.tam.fits.Fits>

setDataBuffer

public boolean setDataBuffer(nom.tam.fits.Fits file)
                      throws IOException
Sets the output buffer. The buffer must be a fits object.

Specified by:
setDataBuffer in interface CcdDriver<nom.tam.fits.Fits>
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 nom.tam.fits.Fits getDataBuffer()
                                throws IOException
Returns the output buffer. This is either the fits buffer set via a call to setDataBuffer(nom.tam.fits.Fits), or null if not set and no exposure has been taken. If an exposure has finished and the buffer has not been explicedly set, a new fits object has been allocated, which will be returned here.

Specified by:
getDataBuffer in interface CcdDriver<nom.tam.fits.Fits>
Throws:
IOException - Any subclass of IOException.

getCcdInfo

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

Specified by:
getCcdInfo in interface CcdDriver<nom.tam.fits.Fits>

setFramesToAdd

public boolean setFramesToAdd(int n)
Sets the number of frames that should be co-added on the server side. Uses the 12bit resolution of the camera to add up to 16 images.


getFramesToAdd

public int getFramesToAdd()
Returns the current active number of co-added frames.


setFramerate

public boolean setFramerate(double frate)
                     throws IOException
Allows to change the frame rate to one of the supported frames rates.

Throws:
IOException

getFramerate

public double getFramerate()
                    throws IOException
Returns the gain setting in the camera, which is a setting in decibel. Allowed values range from zero to 723.

Throws:
IOException

setGainDecibel

public boolean setGainDecibel(int db)
                       throws IOException
Allows to change the gain setting in the camera, which is a setting in decibel. Allowed values range from zero to 723.

Throws:
IOException

getGainDecibel

public int getGainDecibel()
                   throws IOException
Returns the gain setting in the camera, which is a setting in decibel. Allowed values range from zero to 723.

Throws:
IOException

exposeBias

public int exposeBias()
Not supported.

Specified by:
exposeBias in interface CcdDriver<nom.tam.fits.Fits>
Returns:
Number of pixel writtn.

exposeDark

public int exposeDark()
Not supported.

Specified by:
exposeDark in interface CcdDriver<nom.tam.fits.Fits>
Returns:
Number of pixel writtn..

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. This driver supports server-side coadding of up to 16 frames, see setFramesToAdd(int).

Specified by:
expose in interface CcdDriver<nom.tam.fits.Fits>
Returns:
Number of pixel writtn.
Throws:
IOException - Any subclass of IOException.
See Also:
startExpose

doExposure

private boolean doExposure()
                    throws IOException
Does an exposure. This method calls the RPC-methods FirecamClient.START_TRANSMISSION_1() to start a grab, FirecamClient.GRAB_IMAGES_1(int) to sum up the requested number of images on the server, FirecamClient.GET_IMAGE_1() to transfer the image data as a short array to this client and ends the grab with a call to FirecamClient.STOP_TRANSMISSION_1(). Currently, frame grabbing of multiple frames is only supported, if the exposure time of a single frame is below 0.54sec. Single grabs may extend up to 65 sec.

Binning and slicing of the image is done at the client, if different from full-frame and 1x1.

Throws:
IOException

manufacture

private final short[][] manufacture(short[] yx,
                                    Rectangle to,
                                    int xb,
                                    int yb)
Manufactures a binned and sliced image array out from the full frame.