com.isti.jevalresp
Class OutputGenerator

java.lang.Object
  extended by com.isti.jevalresp.OutputGenerator

public class OutputGenerator
extends java.lang.Object

Class OutputGenerator generates 'evalresp'-style output from a FISSURES 'Response' object.


Nested Class Summary
static class OutputGenerator.TypeNormStringBlock
          Class TypeNormStringBlock defines a data block containing two strings, one for "type" and one for "normalization".
 
Field Summary
protected static java.lang.String A0_STR
           
static int ACCEL_UNIT_CONV
          Unit conversion type index value for "acceleration".
protected  boolean allStagesAmpPhaseCalcFlag
           
protected  boolean allStagesAnyAmpsNotPositiveFlag
           
protected  boolean allStagesAnyAmpsNotPosSetupFlag
           
protected static java.lang.String ANALOG_STR
           
protected  boolean anyAmpsNotPositiveFlag
           
protected  boolean anyAmpsNotPosSetupFlag
           
protected  double b62XValue
           
protected  boolean calcIntDelayCorrFlag
           
protected  double calcSenseFrequency
           
protected  double[] calcSensitivityArray
           
protected  double calculatedDelay
           
protected static java.lang.String COMPOSITE_STR
           
protected  double correctionApplied
           
static java.text.NumberFormat decValFormatObj
          Formatter object for displaying floating-point decimal values.
static int DEFAULT_UNIT_CONV
          Unit conversion type index value for "default".
static int DISPLACE_UNIT_CONV
          Unit conversion type index value for "displacement".
protected  java.lang.String errorMessage
           
protected  double estimatedDelay
           
protected static int FIR_ASYM
           
static double FIR_NORM_TOL
          Tolerance value used by 'checkFixFirFreq0Norm()' method.
protected static int FIR_SYM1
           
protected static int FIR_SYM2
           
protected static int FIR_UNKNOWN
           
protected  edu.iris.Fissures.Unit firstUnitProc
           
protected static java.lang.String H0_STR
           
protected  java.lang.String infoMessage
           
protected  edu.iris.Fissures.Unit lastUnitProc
           
protected static java.lang.String LIST_STR
           
protected  boolean listInterpInFlag
           
protected  boolean listInterpOutFlag
           
protected  double listInterpTension
           
protected  boolean listStageFlag
           
protected  boolean logSpacingFlag
           
protected static java.lang.String NO_TYPE_STR
           
protected  boolean normalizedFlag
           
protected  int numCalcStages
           
protected  int outUnitsConv
           
protected static java.lang.String POLYNOMIAL_STR
           
protected  double[] requestedFreqArray
           
protected  RespArraysInfo[] respArraysInfoArray
           
protected  edu.iris.Fissures.IfNetwork.Response respObj
           
protected  double sampleInterval
           
protected  boolean showInputFlag
           
protected  int startStageNum
           
protected  int stopStageNum
           
protected  boolean totalSensitFlag
           
static double TWO_PI
          Value of 'pi' times 2.
static int UNIT_CONV_DEFIDX
          Default index value for 'outUnitsConv' (-u) parameter ("vel").
static java.lang.String[] UNIT_CONV_LONGSTRS
          Longer versions of strings associated with the '..._UNIT_CONV' values.
static java.lang.String[] UNIT_CONV_STRS
          Strings associated with the '..._UNIT_CONV' values.
protected  boolean unwrapPhaseFlag
           
protected  boolean useEstDelayFlag
           
static int VELOCITY_UNIT_CONV
          Unit conversion type index value for "velocity".
 
Constructor Summary
OutputGenerator(AmpPhaseBlk[] ampPhaseArray, double[] calcFreqArray, boolean logSpacingFlag)
          Creates an output generating object.
OutputGenerator(AmpPhaseBlk[] ampPhaseArray, double[] calcFreqArray, boolean logSpacingFlag, boolean useEstDelayFlag, boolean showInputFlag)
          Creates an output generating object.
OutputGenerator(ComplexBlk[] cSpectraArray, double[] calcFreqArray, boolean logSpacingFlag)
          Creates an output generating object.
OutputGenerator(ComplexBlk[] cSpectraArray, double[] calcFreqArray, boolean logSpacingFlag, boolean useEstDelayFlag, boolean showInputFlag)
          Creates an output generating object.
OutputGenerator(edu.iris.Fissures.IfNetwork.Response respObj)
          Creates an output generating object.
 
Method Summary
 boolean allStagesAnyAmpsNotPositive()
          Determines, for all stages in the response, if any amplitude values are less than or equal to zero.
static ComplexBlk analogTrans(edu.iris.Fissures.IfNetwork.PoleZeroFilter filterObj, double normFact, double freq)
          Calculates the response of an analog poles/zeros filter.
 boolean anyAmpsNotPositive()
          Determines if any amplitude values are less than or equal to zero.
protected  boolean calcAmpPhaseArray(RespArraysInfo rArrsInfoObj, int respArrIdx)
          Calculates amplitude/phase values via the complex-spectra values from the given reponse arrays/information object.
protected  void calcIntvlDelayCorrValues()
          Calculates the response's sample interval, delay and correction applied values.
 boolean calculateResponse(double[] freqArray, boolean logSpacingFlag, int outUnitsConv, int startStageNum, int stopStageNum)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double[] freqArray, boolean logSpacingFlag, int outUnitsConv, int startStageNum, int stopStageNum, boolean useEstDelayFlag, boolean showInputFlag)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double[] freqArray, boolean logSpacingFlag, int outUnitsConv, int startStageNum, int stopStageNum, boolean useEstDelayFlag, boolean showInputFlag, boolean listInterpOutFlag, boolean listInterpInFlag, double listInterpTension)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double[] freqArray, boolean logSpacingFlag, int outUnitsConv, int startStageNum, int stopStageNum, boolean useEstDelayFlag, boolean showInputFlag, boolean listInterpOutFlag, boolean listInterpInFlag, double listInterpTension, boolean unwrapPhaseFlag, boolean totalSensitFlag)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double[] freqArray, boolean logSpacingFlag, int outUnitsConv, int startStageNum, int stopStageNum, boolean useEstDelayFlag, boolean showInputFlag, boolean listInterpOutFlag, boolean listInterpInFlag, double listInterpTension, boolean unwrapPhaseFlag, boolean totalSensitFlag, double b62XValue)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double freqVal, int outUnitsConv)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double freqVal, int outUnitsConv, int startStageNum, int stopStageNum)
          Calculates a response for each of the given frequencies.
 boolean calculateResponse(double freqVal, int outUnitsConv, int startStageNum, int stopStageNum, boolean useEstDelayFlag, boolean showInputFlag)
          Calculates a response for each of the given frequencies.
 void checkFixFirFreq0Norm(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj, int stageNum)
          Checks if the FIR coefficients filter should be normalized to 1.0 at frequency zero and adjusts the filter values if so.
 boolean checkResponse()
          Checks the validity of various elements of the response; if OK then returns true, if error then sets an error message (retrievable via 'getErrorMessage()') and returns false.
 boolean checkResponse(boolean dontCheckUnitsFlag)
          Checks the validity of various elements of the response; if OK then returns true, if error then sets an error message (retrievable via 'getErrorMessage()') and returns false.
 void clearErrorMessage()
          Clears the error message string.
 void clearInfoMessage()
          Clears the info message string.
protected static double[] clipFreqArray(double[] srcArr, double[] chkArr, boolean showNotesFlag)
          Returns a modified version of the given 'srcArr' array with any of its entries outside of the given 'chkArr' array clipped.
protected static java.lang.String determineFirTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj)
          Determines the symmetry type for the given stage object containing an FIR-filter object.
protected static int determineFirTypeVal(edu.iris.Fissures.IfNetwork.Filter filterObj)
          Determines the symmetry type for the given FIR filter.
static double[] fetchAmpPhaAmpArray(AmpPhaseBlk[] ampPhaseArr)
          Returns an array containing the amplitude values held by the given array of 'AmpPhaseBlk' objects.
static double[] fetchAmpPhaPhaseArray(AmpPhaseBlk[] ampPhaseArr)
          Returns an array containing the phase values held by the given array of 'AmpPhaseBlk' objects.
static ComplexBlk firTrans(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj, double normFact, double sIntervalTime, double wVal, int firTypeVal)
          Calculates the response of a digital FIR filter.
 RespArraysInfo[] getAllStagesAmpPhaseArrays()
          Returns the arrays of amplitude/phase response values generated by 'calculateResponse()' for all stages in the response.
 AmpPhaseBlk[] getAmpPhaseArray()
          Returns the array of amplitude/phase response values generated by 'calculateResponse()'.
 double[] getCalcFreqArray()
          Returns the array of frequencies used to calculate response output.
 double getCalcSenseFrequency()
           
 double getCalcSensitivity()
           
 double getCalculatedDelay()
           
protected static OutputGenerator.TypeNormStringBlock getCoefficientsStageTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj, int numDenoms)
          Returns a type identification string for the given "coefficients" stage object.
 double getCorrectionApplied()
           
 ComplexBlk[] getCSpectraArray()
          Returns the array of complex spectra response values generated by 'calculateResponse()'.
protected  java.lang.String getDescHeaderString()
          Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, the start and stop stages used (if not zero for all stages), and the current date/time.
 boolean getErrorFlag()
          Returns true if an error was detected.
 java.lang.String getErrorMessage()
          Returns message string for last error (or 'No error' if none).
 double getEstimatedDelay()
           
 edu.iris.Fissures.Unit getFirstUnitProc()
           
 boolean getInfoFlag()
          Determines an info message has been entered.
 java.lang.String getInfoMessage()
          Returns the info message string (or 'No message' if none).
 edu.iris.Fissures.Unit getLastUnitProc()
           
 boolean getListInterpInFlag()
          Returns true if List-blockette "input" interpolation is enabled.
 boolean getListInterpOutFlag()
          Returns true if List-blockette "output" interpolation is enabled.
 boolean getListStageFlag()
          Returns true if the response contains a List (blockette 55) stage and 'calculateResponse()' has been called.
static java.lang.String getLongUnitConvString(int indexVal)
          Converts the given output-units-conversion index to a string.
 int getNumCalcStages()
           
 java.lang.String getOutputHeaderString(java.lang.String sepStr, java.lang.String newlineStr)
          Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, and the start and stop stages used (if not zero for all stages).
 java.lang.String getOutputHeaderString(java.lang.String sLineStr, java.lang.String sepStr, java.lang.String newlineStr)
          Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, and the start and stop stages used (if not zero for all stages).
protected static OutputGenerator.TypeNormStringBlock getPolesZerosStageTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj)
          Returns a type identification string for the given "poles and zeros" stage object.
 java.lang.String getRespInfoString()
          Returns a string of information about the response held by this object.
 java.lang.Float getRespS1NormFactor()
          Returns the normalization factor for the first stage of the response.
 java.lang.Float getRespS1NormFreq()
          Returns the normalization frequency for the first stage of the response.
 java.lang.Float getRespSensitFactor()
          Returns the response-sensitivity factor.
 java.lang.Float getRespSensitFreq()
          Returns the response-sensitivity frequency.
 double getSampleInterval()
           
 java.lang.String getStagesListStr()
          Returns a String containing a listing of the stages in the response, in the format used by 'evalresp'.
 boolean getTotalSensitFlag()
          Determines if stage 0 (total) sensitivity was used to calculate response.
protected static java.lang.String getTypeStrForStage(edu.iris.Fissures.IfNetwork.Stage stageObj)
          Returns a type identification string for the given stage.
 boolean getUnwrapPhaseFlag()
          Determines if phase output values are to be unwrapped.
static ComplexBlk iirPzTrans(edu.iris.Fissures.IfNetwork.PoleZeroFilter filterObj, double normFact, double sIntervalTime, double wVal)
          Calculates the response of a "Digital (Z - transform)" IIR poles/zeros filter.
static ComplexBlk iirTrans(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj, double normFact, double sIntervalTime, double wVal)
          Calculates the response of a digital IIR filter.
 boolean isAmpPhaseArrayCalculated()
          Determines if the amp/phase array has been calculated (via the 'getAmpPhaseArray()' method being called).
 boolean normalizeResponse(int startStageNum, int stopStageNum)
          Normalizes the response and calculates the sensitivity for all the stages in the response.
static java.io.FileWriter openFileWriter(java.io.File outputDirectory, java.lang.String fileName)
          Constructs a FileWriter object given a file name.
 void printListStageMsgs(java.io.PrintStream outStm, boolean ampPhaOutFlag)
          Prints messages about the current response's List stage to the given print stream.
protected  void setInfoMessage(java.lang.String str)
          Enters info message.
static int toUnitConvIndex(edu.iris.Fissures.Unit unitObj)
          Converts the given unit object to a UNIT_CONV index values or -1 if a conversion could not be made.
static java.lang.String toUnitConvString(edu.iris.Fissures.Unit unitObj)
          Converts the given unit object to a string.
static java.lang.String unitInfoStr(edu.iris.Fissures.Unit unitObj)
          Returns a string of information about the given unit.
protected static double[] unwrapPhaseArray(double[] srcPhaseArr)
          Unwraps the given array of 'phase' values.
protected static double[] unwrapPhaseArray(double[] srcPhaseArr, boolean firstNonNegFlag)
          Unwraps the given array of 'phase' values.
protected static double[] wrapPhaseArray(double[] srcPhaseArr)
          Wraps the given array of 'phase' values.
 boolean writeAmpPhaseData(java.io.File outputDirectory, java.lang.String fName, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to a file with the given name.
 boolean writeAmpPhaseData(java.io.File outputDirectory, java.lang.String ampFName, java.lang.String phaseFName, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two files with the given names.
 boolean writeAmpPhaseData(java.io.Writer outStm, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the given output stream.
 boolean writeAmpPhaseData(java.io.Writer outStm, java.lang.String fName, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the given output stream.
 boolean writeAmpPhaseData(java.io.Writer ampOutStm, java.io.Writer phaseOutStm, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two given output streams.
 boolean writeAmpPhaseData(java.io.Writer ampOutStm, java.io.Writer phaseOutStm, java.lang.String ampFName, java.lang.String phaseFName, java.lang.String headerStr)
          Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two given output streams.
 boolean writeCSpectraData(java.io.File outputDirectory, java.lang.String fName, java.lang.String headerStr)
          Writes the complex spectra response values generated by 'calculateResponse()' to a file with the given name.
 boolean writeCSpectraData(java.io.Writer outStm, java.lang.String headerStr)
          Writes the complex spectra response values generated by 'calculateResponse()' to the given output stream.
 boolean writeCSpectraData(java.io.Writer outStm, java.lang.String fName, java.lang.String headerStr)
          Writes the complex spectra response values generated by 'calculateResponse()' to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_UNIT_CONV

public static final int DEFAULT_UNIT_CONV
Unit conversion type index value for "default".

See Also:
Constant Field Values

DISPLACE_UNIT_CONV

public static final int DISPLACE_UNIT_CONV
Unit conversion type index value for "displacement".

See Also:
Constant Field Values

VELOCITY_UNIT_CONV

public static final int VELOCITY_UNIT_CONV
Unit conversion type index value for "velocity".

See Also:
Constant Field Values

ACCEL_UNIT_CONV

public static final int ACCEL_UNIT_CONV
Unit conversion type index value for "acceleration".

See Also:
Constant Field Values

UNIT_CONV_STRS

public static final java.lang.String[] UNIT_CONV_STRS
Strings associated with the '..._UNIT_CONV' values.


UNIT_CONV_DEFIDX

public static final int UNIT_CONV_DEFIDX
Default index value for 'outUnitsConv' (-u) parameter ("vel").

See Also:
Constant Field Values

UNIT_CONV_LONGSTRS

public static final java.lang.String[] UNIT_CONV_LONGSTRS
Longer versions of strings associated with the '..._UNIT_CONV' values.


TWO_PI

public static final double TWO_PI
Value of 'pi' times 2.

See Also:
Constant Field Values

FIR_NORM_TOL

public static final double FIR_NORM_TOL
Tolerance value used by 'checkFixFirFreq0Norm()' method.

See Also:
Constant Field Values

decValFormatObj

public static final java.text.NumberFormat decValFormatObj
Formatter object for displaying floating-point decimal values.


ANALOG_STR

protected static final java.lang.String ANALOG_STR
See Also:
Constant Field Values

COMPOSITE_STR

protected static final java.lang.String COMPOSITE_STR
See Also:
Constant Field Values

LIST_STR

protected static final java.lang.String LIST_STR
See Also:
Constant Field Values

POLYNOMIAL_STR

protected static final java.lang.String POLYNOMIAL_STR
See Also:
Constant Field Values

NO_TYPE_STR

protected static final java.lang.String NO_TYPE_STR
See Also:
Constant Field Values

A0_STR

protected static final java.lang.String A0_STR
See Also:
Constant Field Values

H0_STR

protected static final java.lang.String H0_STR
See Also:
Constant Field Values

FIR_ASYM

protected static final int FIR_ASYM
See Also:
Constant Field Values

FIR_SYM1

protected static final int FIR_SYM1
See Also:
Constant Field Values

FIR_SYM2

protected static final int FIR_SYM2
See Also:
Constant Field Values

FIR_UNKNOWN

protected static final int FIR_UNKNOWN
See Also:
Constant Field Values

respObj

protected final edu.iris.Fissures.IfNetwork.Response respObj

calcSensitivityArray

protected double[] calcSensitivityArray

calcSenseFrequency

protected double calcSenseFrequency

normalizedFlag

protected boolean normalizedFlag

requestedFreqArray

protected double[] requestedFreqArray

logSpacingFlag

protected boolean logSpacingFlag

outUnitsConv

protected int outUnitsConv

startStageNum

protected int startStageNum

stopStageNum

protected int stopStageNum

useEstDelayFlag

protected boolean useEstDelayFlag

showInputFlag

protected boolean showInputFlag

listInterpOutFlag

protected boolean listInterpOutFlag

listInterpInFlag

protected boolean listInterpInFlag

listInterpTension

protected double listInterpTension

unwrapPhaseFlag

protected boolean unwrapPhaseFlag

totalSensitFlag

protected boolean totalSensitFlag

b62XValue

protected double b62XValue

firstUnitProc

protected edu.iris.Fissures.Unit firstUnitProc

lastUnitProc

protected edu.iris.Fissures.Unit lastUnitProc

numCalcStages

protected int numCalcStages

listStageFlag

protected boolean listStageFlag

respArraysInfoArray

protected RespArraysInfo[] respArraysInfoArray

allStagesAmpPhaseCalcFlag

protected boolean allStagesAmpPhaseCalcFlag

anyAmpsNotPositiveFlag

protected boolean anyAmpsNotPositiveFlag

anyAmpsNotPosSetupFlag

protected boolean anyAmpsNotPosSetupFlag

allStagesAnyAmpsNotPositiveFlag

protected boolean allStagesAnyAmpsNotPositiveFlag

allStagesAnyAmpsNotPosSetupFlag

protected boolean allStagesAnyAmpsNotPosSetupFlag

calcIntDelayCorrFlag

protected boolean calcIntDelayCorrFlag

sampleInterval

protected double sampleInterval

estimatedDelay

protected double estimatedDelay

correctionApplied

protected double correctionApplied

calculatedDelay

protected double calculatedDelay

errorMessage

protected java.lang.String errorMessage

infoMessage

protected java.lang.String infoMessage
Constructor Detail

OutputGenerator

public OutputGenerator(edu.iris.Fissures.IfNetwork.Response respObj)
Creates an output generating object.

Parameters:
respObj - an 'edu.iris.Fissures.IfNetwork.Response' object to generate output from.

OutputGenerator

public OutputGenerator(ComplexBlk[] cSpectraArray,
                       double[] calcFreqArray,
                       boolean logSpacingFlag,
                       boolean useEstDelayFlag,
                       boolean showInputFlag)
Creates an output generating object.

Parameters:
cSpectraArray - an array of complex spectra output values from the calculated response.
calcFreqArray - an array of frequency values for the calculated response.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).

OutputGenerator

public OutputGenerator(ComplexBlk[] cSpectraArray,
                       double[] calcFreqArray,
                       boolean logSpacingFlag)
Creates an output generating object.

Parameters:
cSpectraArray - an array of complex spectra output values from the calculated response.
calcFreqArray - an array of frequency values for the calculated response.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.

OutputGenerator

public OutputGenerator(AmpPhaseBlk[] ampPhaseArray,
                       double[] calcFreqArray,
                       boolean logSpacingFlag,
                       boolean useEstDelayFlag,
                       boolean showInputFlag)
Creates an output generating object.

Parameters:
ampPhaseArray - an array of amplitude/phase response values.
calcFreqArray - an array of frequency values for the calculated response.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).

OutputGenerator

public OutputGenerator(AmpPhaseBlk[] ampPhaseArray,
                       double[] calcFreqArray,
                       boolean logSpacingFlag)
Creates an output generating object.

Parameters:
ampPhaseArray - an array of amplitude/phase response values.
calcFreqArray - an array of frequency values for the calculated response.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
Method Detail

openFileWriter

public static java.io.FileWriter openFileWriter(java.io.File outputDirectory,
                                                java.lang.String fileName)
                                         throws java.io.IOException
Constructs a FileWriter object given a file name.

Parameters:
outputDirectory - output directory or null for current directory.
fileName - String The system-dependent filename.
Returns:
FileWriter object
Throws:
java.io.IOException - if the specified file is not found or if some other I/O error occurs.

checkResponse

public boolean checkResponse(boolean dontCheckUnitsFlag)
Checks the validity of various elements of the response; if OK then returns true, if error then sets an error message (retrievable via 'getErrorMessage()') and returns false. For the response to be seen as valid, it must meet the following conditions:
 1. The response must contain no null handles.
 2. If 'dontCheckUnitsFlag'==false and the response contains multiple
    stages, input units must match output units of previous stages.
 3. All stages must contain one filter (except for gain-only stages).
 4. Each filter must specify a supported transfer/response type.
 5. If a stage contains a Poles & Zeros or Coefficients filter with
    a transfer type of Digital then a decimation must be specified.
 6. If a stage contains a Poles & Zeros filter then it must also
    contain a normalization.
 7. If a stage contains a Response List filter then it must be the
    the only stage in the response, and there must be no normalization
    for the stage.  In the list filter object, the frequency units
    must be specified as 'Hertz' ('Seconds^-1') and the phase units
    must be specified as 'Degrees' or 'Radians'.
 8. If the response contains multiple stages, each stage must contain
    a gain value.  If the response contains only one stage then
    either an overall (stage 0) sensitivity or a gain value for
    the stage (or both) must be specified.
 9. If input units are 'Pascal' or 'Tesla' then output units
    conversion must be 'Velocity' or 'Default'.

Parameters:
dontCheckUnitsFlag - if false and the response contains multiple stages then the input units must match the output units of previous stages; if true then the units are not checked.
Returns:
true if response elements are valid.

checkResponse

public boolean checkResponse()
Checks the validity of various elements of the response; if OK then returns true, if error then sets an error message (retrievable via 'getErrorMessage()') and returns false. For the response to be seen as valid, it must meet the following conditions:
 1. The response must contain no null handles.
 2. If the response contains multiple stages, input units must
    match the output units of previous stages.
 3. All stages must contain one filter (except for gain-only stages).
 4. Each filter must specify a supported transfer/response type.
 5. If a stage contains a Poles & Zeros or Coefficients filter with
    a transfer type of Digital then a decimation must be specified.
 6. If a stage contains a Poles & Zeros filter then it must also
    contain a normalization.
 7. If the response contains multiple stages, each stage must contain
    a gain value.  If the response contains only one stage then
    either an overall (stage 0) sensitivity or a gain value for
    the stage (or both) must be specified.

Returns:
true if response elements are valid

normalizeResponse

public boolean normalizeResponse(int startStageNum,
                                 int stopStageNum)
Normalizes the response and calculates the sensitivity for all the stages in the response. Normalization objects may be added to the stages to hold the normalization values, and the gain factor and frequency for stages may be modified. The calculated sensitivity value is retrievable via the 'getCalcSensitivity()' method. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double[] freqArray,
                                 boolean logSpacingFlag,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum,
                                 boolean useEstDelayFlag,
                                 boolean showInputFlag,
                                 boolean listInterpOutFlag,
                                 boolean listInterpInFlag,
                                 double listInterpTension,
                                 boolean unwrapPhaseFlag,
                                 boolean totalSensitFlag,
                                 double b62XValue)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqArray - an array of frequency values to use.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).
listInterpOutFlag - true to interpolate amp/phase output from responses containing List blockettes.
listInterpInFlag - true to interpolate amp/phase input from List blockettes in responses (before output is calculated).
listInterpTension - tension value for List-blockette interpolation algorithm.
unwrapPhaseFlag - true to unwrap phase output values.
totalSensitFlag - true to use stage 0 (total) sensitivity; false to use computed sensitivity.
b62XValue - sample value for polynomial blockette (62).
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double[] freqArray,
                                 boolean logSpacingFlag,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum,
                                 boolean useEstDelayFlag,
                                 boolean showInputFlag,
                                 boolean listInterpOutFlag,
                                 boolean listInterpInFlag,
                                 double listInterpTension,
                                 boolean unwrapPhaseFlag,
                                 boolean totalSensitFlag)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqArray - an array of frequency values to use.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).
listInterpOutFlag - true to interpolate amp/phase output from responses containing List blockettes.
listInterpInFlag - true to interpolate amp/phase input from List blockettes in responses (before output is calculated).
listInterpTension - tension value for List-blockette interpolation algorithm.
unwrapPhaseFlag - true to unwrap phase output values.
totalSensitFlag - true to use stage 0 (total) sensitivity; false to use computed sensitivity.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double[] freqArray,
                                 boolean logSpacingFlag,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum,
                                 boolean useEstDelayFlag,
                                 boolean showInputFlag,
                                 boolean listInterpOutFlag,
                                 boolean listInterpInFlag,
                                 double listInterpTension)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqArray - an array of frequency values to use.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).
listInterpOutFlag - true to interpolate amp/phase output from responses containing List blockettes.
listInterpInFlag - true to interpolate amp/phase input from List blockettes in responses (before output is calculated).
listInterpTension - tension value for List-blockette interpolation algorithm.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double[] freqArray,
                                 boolean logSpacingFlag,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum,
                                 boolean useEstDelayFlag,
                                 boolean showInputFlag)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqArray - an array of frequency values to use.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double[] freqArray,
                                 boolean logSpacingFlag,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqArray - an array of frequency values to use.
logSpacingFlag - true to indicate that the frequency spacing is logarithmic; false to indicate linear spacing.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double freqVal,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum,
                                 boolean useEstDelayFlag,
                                 boolean showInputFlag)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqVal - a single frequency value to use.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
useEstDelayFlag - true to use estimated delay in phase calculations on asymmetrical FIR filters.
showInputFlag - true to show RESP input text (sent to stdout).
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double freqVal,
                                 int outUnitsConv,
                                 int startStageNum,
                                 int stopStageNum)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqVal - a single frequency value to use.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
startStageNum - if greater than zero then the start of the range of stage sequence numbers to use, otherwise all stages are used.
stopStageNum - if greater than zero then the end of the range of stage sequence numbers to use, otherwise only the single stage specified by 'startStageNum' is used.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

calculateResponse

public boolean calculateResponse(double freqVal,
                                 int outUnitsConv)
Calculates a response for each of the given frequencies. The array containing the generated complex spectra response values may be fetched via the 'getCSpectraArray()' method, and the amplitude/phase response values may be calculated and returned via the 'getAmpPhaseArray()' method. If 'normalizeResponse()' has not yet been called then it is called first. Note that this method assumes that each stage contains only one filter object in its 'filters[]' array.

Parameters:
freqVal - a single frequency value to use.
outUnitsConv - output units conversion value for the requested output units type; one of the '..._UNIT_CONV' values.
Returns:
true if successful, false if an error occurred (in which case 'getErorMessage()' may be used to fetch information about the error).

getCSpectraArray

public ComplexBlk[] getCSpectraArray()
Returns the array of complex spectra response values generated by 'calculateResponse()'.

Returns:
The array of complex spectra response values generated by 'calculateResponse()', or null if 'calculateResponse()' has not yet been performed.

calcAmpPhaseArray

protected boolean calcAmpPhaseArray(RespArraysInfo rArrsInfoObj,
                                    int respArrIdx)
Calculates amplitude/phase values via the complex-spectra values from the given reponse arrays/information object.

Parameters:
rArrsInfoObj - reponse arrays/information object to use.
respArrIdx - associated index into 'respArraysInfoArray[]'.
Returns:
true if successful; false if an error occurred.

getAmpPhaseArray

public AmpPhaseBlk[] getAmpPhaseArray()
Returns the array of amplitude/phase response values generated by 'calculateResponse()'.

Returns:
The array of amplitude/phase response values generated by 'calculateResponse()', or null if 'calculateResponse()' has not yet been performed or if an error occurs (in which case an error message may be fetched via the 'getErrorMessage()' method).

isAmpPhaseArrayCalculated

public boolean isAmpPhaseArrayCalculated()
Determines if the amp/phase array has been calculated (via the 'getAmpPhaseArray()' method being called).

Returns:
true if the amp/phase array has been calculated; false if not.

getAllStagesAmpPhaseArrays

public RespArraysInfo[] getAllStagesAmpPhaseArrays()
Returns the arrays of amplitude/phase response values generated by 'calculateResponse()' for all stages in the response.

Returns:
An array of 'RespArraysInfo' objects whose amplitude/phase values have been calculated and entered, or null if 'calculateResponse()' has not yet been performed or if an error occurs (in which case an error message may be fetched via the 'getErrorMessage()' method).

anyAmpsNotPositive

public boolean anyAmpsNotPositive()
Determines if any amplitude values are less than or equal to zero.

Returns:
true if any amplitude values are less than or equal to zero.

allStagesAnyAmpsNotPositive

public boolean allStagesAnyAmpsNotPositive()
Determines, for all stages in the response, if any amplitude values are less than or equal to zero.

Returns:
true if, for all stages in the response, any amplitude values are less than or equal to zero.

calcIntvlDelayCorrValues

protected void calcIntvlDelayCorrValues()
Calculates the response's sample interval, delay and correction applied values. This is method is called automatically the first time any of the values are requested.


getSampleInterval

public double getSampleInterval()
Returns:
the (final) sample interval value for the response.

getEstimatedDelay

public double getEstimatedDelay()
Returns:
the estimated delay value for the response.

getCorrectionApplied

public double getCorrectionApplied()
Returns:
the correction applied value for the response.

getCalculatedDelay

public double getCalculatedDelay()
Returns:
the calculated delay value for the response.

writeCSpectraData

public boolean writeCSpectraData(java.io.Writer outStm,
                                 java.lang.String fName,
                                 java.lang.String headerStr)
Writes the complex spectra response values generated by 'calculateResponse()' to the given output stream. Each outputted line contains 3 numbers: the frequency followed by the real and imaginary parts of the complex spectra response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outStm - output stream to write to.
fName - file name associated with output stream.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeCSpectraData

public boolean writeCSpectraData(java.io.Writer outStm,
                                 java.lang.String headerStr)
Writes the complex spectra response values generated by 'calculateResponse()' to the given output stream. Each outputted line contains 3 numbers: the frequency followed by the real and imaginary parts of the complex spectra response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outStm - output stream to write to.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeCSpectraData

public boolean writeCSpectraData(java.io.File outputDirectory,
                                 java.lang.String fName,
                                 java.lang.String headerStr)
Writes the complex spectra response values generated by 'calculateResponse()' to a file with the given name. Each outputted line contains 3 numbers: the frequency followed by the real and imaginary parts of the complex spectra response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
fName - file name associated with output stream.
outputDirectory - output directory or null for current directory.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.Writer ampOutStm,
                                 java.io.Writer phaseOutStm,
                                 java.lang.String ampFName,
                                 java.lang.String phaseFName,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two given output streams. Each outputted line contains 2 numbers: the frequency followed by the amplitude or phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
ampOutStm - output stream to write amplitude data to.
phaseOutStm - output stream to write phase data to.
ampFName - file name associated with the amplitude data output stream.
phaseFName - file name associated with the phase data output stream.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.Writer ampOutStm,
                                 java.io.Writer phaseOutStm,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two given output streams. Each outputted line contains 2 numbers: the frequency followed by the amplitude or phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
ampOutStm - output stream to write amplitude data to.
phaseOutStm - output stream to write phase data to.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.File outputDirectory,
                                 java.lang.String ampFName,
                                 java.lang.String phaseFName,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the two files with the given names. Each outputted line contains 2 numbers: the frequency followed by the amplitude or phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outputDirectory - output directory or null for current directory.
ampFName - name of output file to write amplitude data to.
phaseFName - name of output file to write phase data to.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.Writer outStm,
                                 java.lang.String fName,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the given output stream. Each outputted line contains 3 numbers: the frequency followed by the amplitude and phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outStm - output stream to write to.
fName - file name associated with output stream.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.Writer outStm,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to the given output stream. Each outputted line contains 3 numbers: the frequency followed by the amplitude and phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outStm - output stream to write to.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

writeAmpPhaseData

public boolean writeAmpPhaseData(java.io.File outputDirectory,
                                 java.lang.String fName,
                                 java.lang.String headerStr)
Calculates and writes amplitude/phase response values generated by 'calculateResponse()' to a file with the given name. Each outputted line contains 3 numbers: the frequency followed by the amplitude and phase response value for the frequency. Each number is written in floating-point exponent format with 7 significant digits.

Parameters:
outputDirectory - output directory or null for current directory.
fName - file name associated with output stream.
headerStr - a String of header information to be included in the output, or null to indicate no header information.
Returns:
true if successful, false if error (in which case an error message may be fetched via the 'getErrorMessage()' method).

getDescHeaderString

protected java.lang.String getDescHeaderString()
Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, the start and stop stages used (if not zero for all stages), and the current date/time.

Returns:
A new header information string.

getOutputHeaderString

public java.lang.String getOutputHeaderString(java.lang.String sLineStr,
                                              java.lang.String sepStr,
                                              java.lang.String newlineStr)
Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, and the start and stop stages used (if not zero for all stages).

Parameters:
sLineStr - the string to begin each line with.
sepStr - the item separator string to use.
newlineStr - the new-line string to use.
Returns:
A new header information string.

getOutputHeaderString

public java.lang.String getOutputHeaderString(java.lang.String sepStr,
                                              java.lang.String newlineStr)
Returns a header information string describing the frequencies used by this 'OutputGenerator', the output units convertion type, and the start and stop stages used (if not zero for all stages).

Parameters:
sepStr - the item separator string to use.
newlineStr - the new-line string to use.
Returns:
A new header information string.

getRespSensitFactor

public java.lang.Float getRespSensitFactor()
Returns the response-sensitivity factor.

Returns:
A new Float object containing the response-sensitivity factor, or null if none available.

getRespSensitFreq

public java.lang.Float getRespSensitFreq()
Returns the response-sensitivity frequency.

Returns:
A new Float object containing the response-sensitivity frequency, or null if none available.

getRespS1NormFactor

public java.lang.Float getRespS1NormFactor()
Returns the normalization factor for the first stage of the response.

Returns:
A new Float object containing the normalization factor for the first stage of the response, or null if none available.

getRespS1NormFreq

public java.lang.Float getRespS1NormFreq()
Returns the normalization frequency for the first stage of the response.

Returns:
A new Float object containing the normalization frequency for the first stage of the response, or null if none available.

getCalcSensitivity

public double getCalcSensitivity()
Returns:
the sensitivity value calculated by 'normalizeResponse()', or 0.0 if 'normalizeResponse()' has not been performed.

getCalcSenseFrequency

public double getCalcSenseFrequency()
Returns:
the frequency used by 'normalizeResponse()', or 0.0 if 'normalizeResponse()' has not been performed.

getFirstUnitProc

public edu.iris.Fissures.Unit getFirstUnitProc()
Returns:
the first input unit processed by 'normalizeResponse()' or 'calculateResponse()', or null if neither function has been called.

getLastUnitProc

public edu.iris.Fissures.Unit getLastUnitProc()
Returns:
the last output unit processed by 'normalizeResponse()' or 'calculateResponse()', or null if neither function has been called.

getNumCalcStages

public int getNumCalcStages()
Returns:
the number of stages used in the last call to 'calculateResponse()', or 0 if 'calculateResponse()' has not been called.

getUnwrapPhaseFlag

public boolean getUnwrapPhaseFlag()
Determines if phase output values are to be unwrapped.

Returns:
true if phase output values are to be unwrapped; false if not.

getTotalSensitFlag

public boolean getTotalSensitFlag()
Determines if stage 0 (total) sensitivity was used to calculate response.

Returns:
true if stage 0 (total) sensitivity was used to calculate response; false if computed sensitivity was used.

getListStageFlag

public boolean getListStageFlag()
Returns true if the response contains a List (blockette 55) stage and 'calculateResponse()' has been called.

Returns:
true if the response contains a List (blockette 55) stage and 'calculateResponse()' has been called.

getListInterpOutFlag

public boolean getListInterpOutFlag()
Returns true if List-blockette "output" interpolation is enabled.

Returns:
true if List-blockette "output" interpolation is enabled.

getListInterpInFlag

public boolean getListInterpInFlag()
Returns true if List-blockette "input" interpolation is enabled.

Returns:
true if List-blockette "input" interpolation is enabled.

printListStageMsgs

public void printListStageMsgs(java.io.PrintStream outStm,
                               boolean ampPhaOutFlag)
Prints messages about the current response's List stage to the given print stream.

Parameters:
outStm - the 'PrintStream' object to use.
ampPhaOutFlag - true if amp/phase output is being generated; false if complex/spectra output is being generated.

getCalcFreqArray

public double[] getCalcFreqArray()
Returns the array of frequencies used to calculate response output.

Returns:
the array of frequencies used to calculate response output.

getRespInfoString

public java.lang.String getRespInfoString()
Returns a string of information about the response held by this object.

Returns:
a string of information about the response held by this object.

unitInfoStr

public static java.lang.String unitInfoStr(edu.iris.Fissures.Unit unitObj)
Returns a string of information about the given unit.

Parameters:
unitObj - unit object.
Returns:
a string of information about the given unit. The information includes the unit's name and, if applicable, the 'UNIT_CONV_STRS[]' string for the unit.

getErrorFlag

public boolean getErrorFlag()
Returns true if an error was detected.

Returns:
true if an error was detected. The error message may be fetched via the 'getErrorMessage()' method.

getErrorMessage

public java.lang.String getErrorMessage()
Returns message string for last error (or 'No error' if none).

Returns:
message string for last error (or 'No error' if none).

clearErrorMessage

public void clearErrorMessage()
Clears the error message string.


setInfoMessage

protected void setInfoMessage(java.lang.String str)
Enters info message.

Parameters:
str - message string.

getInfoFlag

public boolean getInfoFlag()
Determines an info message has been entered. The info message may be fetched via the 'getInfoMessage()' method.

Returns:
true if an info message has been entered; false if not.

getInfoMessage

public java.lang.String getInfoMessage()
Returns the info message string (or 'No message' if none).

Returns:
The info message string (or 'No message' if none).

clearInfoMessage

public void clearInfoMessage()
Clears the info message string.


getStagesListStr

public java.lang.String getStagesListStr()
Returns a String containing a listing of the stages in the response, in the format used by 'evalresp'. A line is output for each stage containing the stage sequence number, filter-type-name, normalization value, and further information.

Returns:
A String containing a listing of the stages in the response, in the format used by 'evalresp'.

getTypeStrForStage

protected static java.lang.String getTypeStrForStage(edu.iris.Fissures.IfNetwork.Stage stageObj)
Returns a type identification string for the given stage.

Parameters:
stageObj - stage object to use.
Returns:
A type identification string for the given stage.

getPolesZerosStageTypeStr

protected static OutputGenerator.TypeNormStringBlock getPolesZerosStageTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj)
Returns a type identification string for the given "poles and zeros" stage object. A normalization identification string is also returned.

Parameters:
stageObj - stage object to use.
Returns:
A new 'TypeNormStringBlock' object containing the type and normalization identification strings.

getCoefficientsStageTypeStr

protected static OutputGenerator.TypeNormStringBlock getCoefficientsStageTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj,
                                                                                 int numDenoms)
Returns a type identification string for the given "coefficients" stage object. A normalization identification string is also returned.

Parameters:
stageObj - stage object to use.
numDenoms - number of denominators in filter for stage.
Returns:
A new 'TypeNormStringBlock' object containing the type and normalization identification strings.

determineFirTypeVal

protected static int determineFirTypeVal(edu.iris.Fissures.IfNetwork.Filter filterObj)
Determines the symmetry type for the given FIR filter.

Parameters:
filterObj - FIR-filter object.
Returns:
One of the 'FIR_...' values.

determineFirTypeStr

protected static java.lang.String determineFirTypeStr(edu.iris.Fissures.IfNetwork.Stage stageObj)
Determines the symmetry type for the given stage object containing an FIR-filter object.

Parameters:
stageObj - stage object containing filter object.
Returns:
A string indicating the FIR-filter type.

clipFreqArray

protected static double[] clipFreqArray(double[] srcArr,
                                        double[] chkArr,
                                        boolean showNotesFlag)
Returns a modified version of the given 'srcArr' array with any of its entries outside of the given 'chkArr' array clipped. If any entries are clipped and 'showNotesFlag'==true then a message is sent to 'stderr'.

Parameters:
srcArr - source array.
chkArr - check array.
showNotesFlag - true to send "Note:" messages to 'stderr'.
Returns:
A modified version of the given 'srcArr' array, or the original array if no entries were clipped.

unwrapPhaseArray

protected static double[] unwrapPhaseArray(double[] srcPhaseArr,
                                           boolean firstNonNegFlag)
Unwraps the given array of 'phase' values. A phase array is "wrapped" by adding +/-360 to portions of the dataset to make all the array values be between -180 and +180 (inclusive). This method "unwraps" the given array by detecting transitions where the dataset has been "wrapped" and adding +/-360 to restore the "original" values.

Parameters:
srcPhaseArr - phase array to unwrap.
firstNonNegFlag - true if first phase value should always be made non-negative; false if not.
Returns:
A new 'double' array containing the unwrapped values, or the given array if it was not wrapped.

unwrapPhaseArray

protected static double[] unwrapPhaseArray(double[] srcPhaseArr)
Unwraps the given array of 'phase' values. A phase array is "wrapped" by adding +/-360 to portions of the dataset to make all the array values be between -180 and +180 (inclusive). This method "unwraps" the given array by detecting transitions where the dataset has been "wrapped" and adding +/-360 to restore the "original" values.

Parameters:
srcPhaseArr - phase array to unwrap.
Returns:
A new 'double' array containing the unwrapped values, or the given array if it was not wrapped.

wrapPhaseArray

protected static double[] wrapPhaseArray(double[] srcPhaseArr)
Wraps the given array of 'phase' values. A phase array is "wrapped" by adding +/-360 to portions of the dataset to make all the array values be between -180 and +180 (inclusive).

Parameters:
srcPhaseArr - phase array to wrap.
Returns:
A new 'double' array containing the wrapped values, or the given array if it did not need to be wrapped.

fetchAmpPhaAmpArray

public static double[] fetchAmpPhaAmpArray(AmpPhaseBlk[] ampPhaseArr)
Returns an array containing the amplitude values held by the given array of 'AmpPhaseBlk' objects.

Parameters:
ampPhaseArr - array of 'AmpPhaseBlk' objects.
Returns:
A new 'double' array containing the amplitude values held by the given array of 'AmpPhaseBlk' objects, or an empty array if none are available.

fetchAmpPhaPhaseArray

public static double[] fetchAmpPhaPhaseArray(AmpPhaseBlk[] ampPhaseArr)
Returns an array containing the phase values held by the given array of 'AmpPhaseBlk' objects.

Parameters:
ampPhaseArr - array of 'AmpPhaseBlk' objects.
Returns:
A new 'double' array containing the phase values held by the given array of 'AmpPhaseBlk' objects, or an empty array if none are available.

analogTrans

public static ComplexBlk analogTrans(edu.iris.Fissures.IfNetwork.PoleZeroFilter filterObj,
                                     double normFact,
                                     double freq)
Calculates the response of an analog poles/zeros filter.

Parameters:
filterObj - a poles/zeros filter object.
normFact - the normalization factor to use.
freq - the frequency value to use. If a Laplace filter then the frequency should be multplied by 2*pi.
Returns:
A 'ComplexBlk' object containing the response.

iirPzTrans

public static ComplexBlk iirPzTrans(edu.iris.Fissures.IfNetwork.PoleZeroFilter filterObj,
                                    double normFact,
                                    double sIntervalTime,
                                    double wVal)
Calculates the response of a "Digital (Z - transform)" IIR poles/zeros filter.

Parameters:
filterObj - a poles/zeros filter object.
normFact - the normalization factor to use.
sIntervalTime - the sample interval time to use.
wVal - the frequency value to use.
Returns:
A 'ComplexBlk' object containing the response.

iirTrans

public static ComplexBlk iirTrans(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj,
                                  double normFact,
                                  double sIntervalTime,
                                  double wVal)
Calculates the response of a digital IIR filter. It evaluates phase directly from imaginary and real parts of IIR filter coefficients.

Parameters:
filterObj - a coefficients filter object.
normFact - the normalization factor to use.
sIntervalTime - the sample interval time to use.
wVal - the frequency value to use.
Returns:
A 'ComplexBlk' object containing the response.

firTrans

public static ComplexBlk firTrans(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj,
                                  double normFact,
                                  double sIntervalTime,
                                  double wVal,
                                  int firTypeVal)
Calculates the response of a digital FIR filter. Only the numerators of the given filter object are used.

Parameters:
filterObj - a coefficients filter object.
normFact - the normalization factor to use.
sIntervalTime - the sample interval time to use.
wVal - the frequency value to use.
firTypeVal - one of the 'FIR_...' values.
Returns:
A 'ComplexBlk' object containing the response.

checkFixFirFreq0Norm

public void checkFixFirFreq0Norm(edu.iris.Fissures.IfNetwork.CoefficientFilter filterObj,
                                 int stageNum)
Checks if the FIR coefficients filter should be normalized to 1.0 at frequency zero and adjusts the filter values if so.

Parameters:
filterObj - a coefficients filter object.
stageNum - current stage number.

toUnitConvIndex

public static int toUnitConvIndex(edu.iris.Fissures.Unit unitObj)
Converts the given unit object to a UNIT_CONV index values or -1 if a conversion could not be made.

Parameters:
unitObj - unit object.
Returns:
One of the '..._UNIT_CONV' index values or -1 if a conversion could not be made.

toUnitConvString

public static java.lang.String toUnitConvString(edu.iris.Fissures.Unit unitObj)
Converts the given unit object to a string.

Parameters:
unitObj - unit object.
Returns:
One of the unit conversion strings. ("def", "dis", "vel", "acc"), or an emptry string if a conversion could not be made.

getLongUnitConvString

public static java.lang.String getLongUnitConvString(int indexVal)
Converts the given output-units-conversion index to a string.

Parameters:
indexVal - one of the ".._UNIT_CONV" index values.
Returns:
One of the unit conversion strings ("Default", "Displacement", "Velocity", "Acceleration"), or "???" if a conversion could not be made.