decimator
Class DecimatorProcess

java.lang.Object
  extended by PamguardMVC.PamProcess
      extended by decimator.DecimatorProcess
All Implemented Interfaces:
Annotator, PamObserver

public class DecimatorProcess
extends PamProcess

Decimates data - i.e. reduces it's frequency by firswt of all digitally filtering, then downsampling

Author:
Doug Gillespie

Field Summary
private  double[] b1
           
private  double[] b2
           
private  DecimatorControl decimatorControl
           
private  double[][] filteredData
           
private  Filter[] filters
           
private  int outputBlockSize
          Number of samples in each output block.
private  double[][] outputData
           
private  PamRawDataBlock outputDataBlock
           
private  int[] outputIndex
           
private  long[] outputSampleNumber
           
private  long[] sampleCounts
           
private  float sourceSampleRate
           
private  float step
          step size between samples.
private  double[] x
           
 
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, processName, sampleRate
 
Constructor Summary
DecimatorProcess(DecimatorControl controlUnit)
           
 
Method Summary
 int getOfflineData(PamDataBlock dataBlock, PamObserver endUser, long startMillis, long endMillis)
          Request offline data.
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
 void masterClockUpdate(long milliSeconds, long sampleNumber)
           
 void newData(PamObservable obs, PamDataUnit newData)
           
(package private)  void newSettings()
           
 void pamStart()
          Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.
 void pamStop()
          Stops the process.
 void prepareProcess()
          Called for each process before any of them receive the PamStart command
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
(package private)  void setupFilters()
           
 void setupProcess()
          called for every process once the systemmodel has been created.
 
Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, fillXMLElement, fillXMLParameters, getAncestorDataBlock, getAnnotation, getBackendProcess, getChainPosition, getCpuPercent, getNumAnnotations, getNumOutputDataBlocks, getObserverName, getObserverObject, getOutputDataBlock, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, noteNewSettings, notifyModelChanged, relMillisecondsToSamples, relSamplesToMilliseconds, removeObservable, removeOutputDatablock, saveViewerData, setBackendProcess, setCanMultiThread, setParentDataBlock, setParentDataBlock, setProcessName, toString, update, updateData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

decimatorControl

private DecimatorControl decimatorControl

filters

private Filter[] filters

sampleCounts

private long[] sampleCounts

filteredData

private double[][] filteredData

outputData

private double[][] outputData

outputIndex

private int[] outputIndex

outputSampleNumber

private long[] outputSampleNumber

outputDataBlock

private PamRawDataBlock outputDataBlock

sourceSampleRate

private float sourceSampleRate

x

private double[] x

b1

private double[] b1

b2

private double[] b2

step

private float step
step size between samples.


outputBlockSize

private int outputBlockSize
Number of samples in each output block.

Constructor Detail

DecimatorProcess

DecimatorProcess(DecimatorControl controlUnit)
Method Detail

setupProcess

public void setupProcess()
Description copied from class: PamProcess
called for every process once the systemmodel has been created. this is a good time to check out and find input data blocks and similar tasks.

Overrides:
setupProcess in class PamProcess

getRequiredDataHistory

public long getRequiredDataHistory(PamObservable o,
                                   java.lang.Object arg)
Specified by:
getRequiredDataHistory in interface PamObserver
Overrides:
getRequiredDataHistory in class PamProcess
Parameters:
o - PamObservable class requiring the data
arg - optional argument from PamObservable
Returns:
time in milliseconds requried by data held in PamObservable

setSampleRate

public void setSampleRate(float sampleRate,
                          boolean notify)
Description copied from interface: PamObserver
New sample rate

Specified by:
setSampleRate in interface PamObserver
Overrides:
setSampleRate in class PamProcess
notify - Notify other PamObservers and PamObservables in the chain.

masterClockUpdate

public void masterClockUpdate(long milliSeconds,
                              long sampleNumber)
Specified by:
masterClockUpdate in interface PamObserver
Overrides:
masterClockUpdate in class PamProcess

newSettings

void newSettings()

pamStart

public void pamStart()
Description copied from class: PamProcess
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.

Specified by:
pamStart in class PamProcess

setupFilters

void setupFilters()

pamStop

public void pamStop()
Description copied from class: PamProcess
Stops the process.

Specified by:
pamStop in class PamProcess

newData

public void newData(PamObservable obs,
                    PamDataUnit newData)
Overrides:
newData in class PamProcess

prepareProcess

public void prepareProcess()
Description copied from class: PamProcess
Called for each process before any of them receive the PamStart command

Overrides:
prepareProcess in class PamProcess

getOfflineData

public int getOfflineData(PamDataBlock dataBlock,
                          PamObserver endUser,
                          long startMillis,
                          long endMillis)
Description copied from class: PamProcess
Request offline data.

This will be called from a PamDatablock in offline viewer mode from requestOfflineData(PamObserver observer, long startMillis, long endMillis).

this is used to request data from upstream processes, e.g. o get raw data to turn into FFT data units to go to the spectrogram display (possible going via decimators and any other processes before spitting out the right data.

Overrides:
getOfflineData in class PamProcess
Parameters:
dataBlock - data block making the request.
endUser - observer which made the original data request.
startMillis - start time in milliseconds
endMillis - end time in milliseconds.
Returns:
true if request can be satisfied (or partially satisfied).