stella.parameter
Class FitsMoments

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractRemoteParameter
                      extended by stella.parameter.AbstractFitsParameter
                          extended by stella.parameter.FitsMoments
All Implemented Interfaces:
Cloneable, Remote, EventListener, EventTrigger, Parameter, ParameterDepending, RemoteFitsParameter, RemoteParameter, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster

public class FitsMoments
extends AbstractFitsParameter
implements ParameterDepending, RemoteParameter, ExitCleaning

Fits moments calculates statistical moments of the ADU distribution. It does not calculate image moments, no x/y info of the image is stored.

This parameter is best situated in the VM that also does the fits retireval. To allow outside masters access to it, the moments can be queried as a remote parameter.


Nested Class Summary
private  class FitsMoments.Calculate
          The thread that calculates the moments.
static class FitsMoments.File
          Takes a fits file and processes it.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Rectangle box
          The read-out window for moment calculation if no frame registered.
private  FitsMoments.Calculate calcthread
          The thread that does the calculation.
private static boolean DEFBIND
          The default auto-binding as a RemoteParameter.
static String DEFBINDNAME
          Default binding name.
private static String DEFFRAMENAME
          Default frame.
private static int DEFMOMENTORDER
          Default order of the central moments.
static String DEFNAME
          My default name.
private static boolean DEFUSECACHED
          The default auto-binding as a RemoteParameter.
private  Parameter frameprovider
          The frame provider used to get the moments window.
static String KEY_BIND
          The key in the Map for auto-binding of the trigger.
static String KEY_FRAMENAME
          This is the name of the frame providing parameter we use
static String KEY_MOMENTORDER
          We calculate up to this moment order.
static String KEY_MOMENTWINDOW
          The window we take pixels from
static String KEY_ORDERNAME
          This is the name of the order providing parameter we use
static String KEY_TARGETNAME
          This is the name of the order providing parameter we use
static String KEY_USECACHED
          If false we wait for the new moments to be calculated.
private  Object oldname
          The name of the target when the last fits was registered.
private  int order
          The order to which moments are calculated.
private  Value orderprovider
          The order provider used to get the moments order to which we calc.
private  List<CentralMoments> quadrants
          The pixel extracted from the fits file as a list of Doubles.
private  List<RmiListener> stubs
          A list of registered rmi listners.
private  Parameter targetname
          The target name.
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
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 util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
FitsMoments(Map<String,String> prop)
          Constructs a new fits-order moments parameter.
 
Method Summary
 void addRmiListener(RmiListener ear)
          Adds a listener for notification on exit.
 boolean bindToRegistry()
          Binds to registry.
 List<CentralMoments> blockGet()
          Always wait for the calc thread to exit.
 void exit()
          Unbinds from registry, if bound.
 Object get()
          Returns all moments accumulated.
 Rectangle getBox()
          We return the current moment frame or null if none is set.
 int getOrder()
          We return the current active moment oreder.
 List<CentralMoments> getQuadrants()
          Returns all moments accumulated.
 void init()
          We scan our default properties for a possible read-out window and use the default order.
 boolean isValid()
          Returns true.
protected  boolean processFits(nom.tam.fits.Fits file, Rectangle readout, Dimension bin, Date when, long registered, double expt)
          The fits file should be registered just when the fits file resides in memory.
 void registerParameter(Parameter p)
          We register a frame parameter of the name KEY_FRAMENAME
 Object remoteGet()
          The remote edge of this trigger.
 void removeRmiListener(RmiListener ear)
          Removes a listener.
 void setBox(Rectangle b)
          We set the current moment frame or null if none is ddesired.
 void setOrder(int o)
          We set the current active moment oreder.
 boolean unbindFromRegistry()
          Unbinds from registry.
 
Methods inherited from class stella.parameter.AbstractFitsParameter
getDateObs, getExposureTime, getRegistered, registerFits, registerMonitor, rmiDateObs, rmiExposureTime, rmiRegistered, set, setDateObs, setExposureTime, setRegistered
 
Methods inherited from class stella.parameter.AbstractRemoteParameter
rescanned
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, register, setName, toString
 
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, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_MOMENTWINDOW

public static final String KEY_MOMENTWINDOW
The window we take pixels from

See Also:
Constant Field Values

KEY_MOMENTORDER

public static final String KEY_MOMENTORDER
We calculate up to this moment order.

See Also:
Constant Field Values

KEY_FRAMENAME

public static final String KEY_FRAMENAME
This is the name of the frame providing parameter we use

See Also:
Constant Field Values

KEY_ORDERNAME

public static final String KEY_ORDERNAME
This is the name of the order providing parameter we use

See Also:
Constant Field Values

KEY_TARGETNAME

public static final String KEY_TARGETNAME
This is the name of the order providing parameter we use

See Also:
Constant Field Values

KEY_BIND

public static final String KEY_BIND
The key in the Map for auto-binding of the trigger.

See Also:
Constant Field Values

KEY_USECACHED

public static final String KEY_USECACHED
If false we wait for the new moments to be calculated.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
My default name.

See Also:
Constant Field Values

DEFBINDNAME

public static final String DEFBINDNAME
Default binding name.

See Also:
Constant Field Values

DEFMOMENTORDER

private static final int DEFMOMENTORDER
Default order of the central moments.

See Also:
Constant Field Values

DEFFRAMENAME

private static final String DEFFRAMENAME
Default frame.

See Also:
Constant Field Values

DEFBIND

private static final boolean DEFBIND
The default auto-binding as a RemoteParameter.

See Also:
Constant Field Values

DEFUSECACHED

private static final boolean DEFUSECACHED
The default auto-binding as a RemoteParameter.

See Also:
Constant Field Values

quadrants

private List<CentralMoments> quadrants
The pixel extracted from the fits file as a list of Doubles.


stubs

private List<RmiListener> stubs
A list of registered rmi listners.


order

private int order
The order to which moments are calculated.


box

private Rectangle box
The read-out window for moment calculation if no frame registered.


frameprovider

private Parameter frameprovider
The frame provider used to get the moments window.


targetname

private Parameter targetname
The target name.


oldname

private Object oldname
The name of the target when the last fits was registered.


orderprovider

private Value orderprovider
The order provider used to get the moments order to which we calc.


calcthread

private FitsMoments.Calculate calcthread
The thread that does the calculation.

Constructor Detail

FitsMoments

public FitsMoments(Map<String,String> prop)
            throws RemoteException
Constructs a new fits-order moments parameter.

Throws:
RemoteException
Method Detail

init

public void init()
We scan our default properties for a possible read-out window and use the default order.

Specified by:
init in interface Initializable
Overrides:
init in class AbstractRemoteParameter

exit

public void exit()
Unbinds from registry, if bound.

Specified by:
exit in interface ExitCleaning
Overrides:
exit in class AbstractRemoteParameter

registerParameter

public void registerParameter(Parameter p)
We register a frame parameter of the name KEY_FRAMENAME

Specified by:
registerParameter in interface ParameterDepending

getOrder

public int getOrder()
We return the current active moment oreder.


setOrder

public void setOrder(int o)
We set the current active moment oreder.


getBox

public Rectangle getBox()
We return the current moment frame or null if none is set.


setBox

public void setBox(Rectangle b)
We set the current moment frame or null if none is ddesired.


processFits

protected boolean processFits(nom.tam.fits.Fits file,
                              Rectangle readout,
                              Dimension bin,
                              Date when,
                              long registered,
                              double expt)
The fits file should be registered just when the fits file resides in memory. Here the moments are calculated, which can be a lengthy process.

Specified by:
processFits in class AbstractFitsParameter
Parameters:
file - The fits object holding the data
readout - The readout frame
bin - The applied binning
when - The time of the exposure or the register time, if dateobs unknown.
registered - The time this fits was registered.
expt - Exposure time in seconds.

get

public Object get()
Returns all moments accumulated.

Specified by:
get in interface Parameter

blockGet

public List<CentralMoments> blockGet()
Always wait for the calc thread to exit.


getQuadrants

public List<CentralMoments> getQuadrants()
Returns all moments accumulated.


bindToRegistry

public boolean bindToRegistry()
                       throws RemoteException
Binds to registry.

Specified by:
bindToRegistry in interface RmiCaster
Overrides:
bindToRegistry in class AbstractRemoteParameter
Returns:
True if successful.
Throws:
RemoteException

unbindFromRegistry

public boolean unbindFromRegistry()
                           throws RemoteException
Unbinds from registry.

Specified by:
unbindFromRegistry in interface RmiCaster
Overrides:
unbindFromRegistry in class AbstractRemoteParameter
Returns:
True if successful.
Throws:
RemoteException

remoteGet

public Object remoteGet()
                 throws RemoteException
The remote edge of this trigger.

Specified by:
remoteGet in interface RemoteParameter
Overrides:
remoteGet in class AbstractRemoteParameter
Throws:
RemoteException

addRmiListener

public void addRmiListener(RmiListener ear)
                    throws RemoteException
Adds a listener for notification on exit.

Specified by:
addRmiListener in interface RemoteParameter
Overrides:
addRmiListener in class AbstractFitsParameter
Throws:
RemoteException

removeRmiListener

public void removeRmiListener(RmiListener ear)
                       throws RemoteException
Removes a listener.

Specified by:
removeRmiListener in interface RemoteParameter
Overrides:
removeRmiListener in class AbstractFitsParameter
Throws:
RemoteException

isValid

public boolean isValid()
                throws RemoteException
Returns true.

Specified by:
isValid in interface RmiCaster
Overrides:
isValid in class AbstractRemoteParameter
Throws:
RemoteException