org.opensha.sha.magdist
Class TaperedGR_MagFreqDist

java.lang.Object
  extended by org.opensha.commons.data.function.AbstractXY_DataSet
      extended by org.opensha.commons.data.function.AbstractDiscretizedFunc
          extended by org.opensha.commons.data.function.EvenlyDiscretizedFunc
              extended by org.opensha.sha.magdist.IncrementalMagFreqDist
                  extended by org.opensha.sha.magdist.TaperedGR_MagFreqDist
All Implemented Interfaces:
Serializable, Iterable<Point2D>, DiscretizedFunc, XY_DataSet, Named, PlotElement, XMLSaveable, IncrementalMagFreqDistAPI

public class TaperedGR_MagFreqDist
extends IncrementalMagFreqDist

Title: TaperedGR_MagFreqDist

Description: This is a tapered incremental Gutenberg-Richter distribution.

Version:
1.0
Author:
Edward Field
See Also:
Serialized Form

Field Summary
static String NAME
           
 
Fields inherited from class org.opensha.sha.magdist.IncrementalMagFreqDist
defaultInfo, defaultName
 
Fields inherited from class org.opensha.commons.data.function.EvenlyDiscretizedFunc
C, delta, first, maxX, minX, num, points
 
Fields inherited from class org.opensha.commons.data.function.AbstractDiscretizedFunc
tolerance, XML_METADATA_NAME, XML_METADATA_POINT_NAME, XML_METADATA_POINTS_NAME
 
Fields inherited from class org.opensha.commons.data.function.AbstractXY_DataSet
info, name, xAxisName, yAxisName
 
Constructor Summary
TaperedGR_MagFreqDist(double bValue, double totCumRate, double min, double max, int num)
          constructor: this is sameas parent class constructor
TaperedGR_MagFreqDist(double min, double max, int num)
          constructor: this is sameas parent class constructor
TaperedGR_MagFreqDist(double min, int num, double delta)
          constructor : this is same as parent class constructor
TaperedGR_MagFreqDist(double min, int num, double delta, double magLower, double magCorner, double totMoRate, double bValue)
          constructor:
 
Method Summary
 double get_bValue()
           
 String getDefaultInfo()
          this function returns String for drawing Legen in JFreechart
 String getDefaultName()
          returns the name of this class
 double getMagCorner()
           
 double getMagLower()
           
 double getTotCumRate()
           
static void main(String[] args)
           
 void set(double x, double y)
          Overriden to prevent value setting.
 void set(int index, double y)
          Overriden to prevent value setting.
 void set(Point2D point)
          Overriden to prevent value setting.
 void setAllButCornerMag(double magLower, double totMoRate, double totCumRate, double bValue)
          Set All but magCorner.
 void setAllButTotCumRate(double magLower, double magCorner, double totMoRate, double bValue)
          Set all values except Cumulative Rate
 void setAllButTotMoRate(double magLower, double magCorner, double totCumRate, double bValue)
          Set all values except total moment rate
 
Methods inherited from class org.opensha.sha.magdist.IncrementalMagFreqDist
compute_bValue, compute_bValue, deepClone, findMagJustAboveMomentRate, getCumMomentRateDist, getCumRate, getCumRate, getCumRateDist, getCumRateDistWithOffset, getIncrRate, getIncrRate, getInfo, getMaxMagWithNonZeroRate, getMinMagWithNonZeroRate, getMomentRate, getMomentRate, getMomentRateDist, getName, getTotalIncrRate, getTotalMomentRate, normalizeByTotalRate, scaleToCumRate, scaleToCumRate, scaleToIncrRate, scaleToIncrRate, scaleToTotalMomentRate, setValuesAboveMomentRateToZero, zeroAboveMag, zeroAtAndAboveMag
 
Methods inherited from class org.opensha.commons.data.function.EvenlyDiscretizedFunc
add, add, areAllXValuesInteger, clear, equalXAndYValues, equalXValues, get, getAllInterpolatedX, getClosestXIndex, getClosestY, getDelta, getFirstInterpolatedX_afterXindex, getFirstInterpolatedX_inLogXLogYDomain, getFirstInterpolatedX, getIndex, getInterpolatedY_inLogXLogYDomain, getInterpolatedY_inLogYDomain, getInterpolatedY, getMaxX, getMaxY, getMetadataString, getMinX, getMinY, getNum, getPointsIterator, getX, getXIndex, getXindexForMaxY, getY, getY, hasPoint, hasPoint, set, set, toString, withinTolerance
 
Methods inherited from class org.opensha.commons.data.function.AbstractDiscretizedFunc
calcSumOfY_Vals, equals, fromXMLMetadata, getTolerance, loadFuncFromSimpleFile, loadFuncFromSimpleFile, scale, setTolerance, toXMLMetadata, toXMLMetadata, writeSimpleFuncFile, writeSimpleFuncFile
 
Methods inherited from class org.opensha.commons.data.function.AbstractXY_DataSet
getClosestX, getDatasetsToPlot, getPlotNumColorList, getXAxisName, getXValuesIterator, getYAxisName, getYValuesIterator, iterator, setInfo, setName, setXAxisName, setYAxisName, xValues, yValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensha.commons.data.function.XY_DataSet
getClosestX, getXAxisName, getXValuesIterator, getYAxisName, getYValuesIterator, setInfo, setName, setXAxisName, setYAxisName, xValues, yValues
 
Methods inherited from interface org.opensha.commons.gui.plot.PlotElement
getDatasetsToPlot, getPlotNumColorList
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

NAME

public static String NAME
Constructor Detail

TaperedGR_MagFreqDist

public TaperedGR_MagFreqDist(double min,
                             int num,
                             double delta)
                      throws InvalidRangeException
constructor : this is same as parent class constructor

Parameters:
min -
num -
delta - using the parameters we call the parent class constructors to initialise the parent class variables
Throws:
InvalidRangeException

TaperedGR_MagFreqDist

public TaperedGR_MagFreqDist(double min,
                             double max,
                             int num)
                      throws XY_DataSetException,
                             InvalidRangeException
constructor: this is sameas parent class constructor

Parameters:
min -
max -
num - using the min, max and num we calculate the delta
Throws:
XY_DataSetException
InvalidRangeException

TaperedGR_MagFreqDist

public TaperedGR_MagFreqDist(double bValue,
                             double totCumRate,
                             double min,
                             double max,
                             int num)
                      throws XY_DataSetException,
                             InvalidRangeException
constructor: this is sameas parent class constructor

Parameters:
min -
max -
num - using the min, max and num we calculate the delta
Throws:
XY_DataSetException
InvalidRangeException

TaperedGR_MagFreqDist

public TaperedGR_MagFreqDist(double min,
                             int num,
                             double delta,
                             double magLower,
                             double magCorner,
                             double totMoRate,
                             double bValue)
                      throws InvalidRangeException,
                             Point2DException
constructor:

Parameters:
min -
num -
delta -
magLower - : lowest magnitude that has non zero rate
magCorner - : the corner magnitude
totMoRate - : total Moment Rate
bValue - : b value for this distribution
Throws:
InvalidRangeException
Point2DException
Method Detail

setAllButTotCumRate

public void setAllButTotCumRate(double magLower,
                                double magCorner,
                                double totMoRate,
                                double bValue)
                         throws Point2DException
Set all values except Cumulative Rate

Parameters:
magLower - : lowest magnitude that has non zero rate
magCorner - : the corner magnitude
totMoRate - : Total Moment Rate
bValue - : b Value
Throws:
Point2DException

setAllButTotMoRate

public void setAllButTotMoRate(double magLower,
                               double magCorner,
                               double totCumRate,
                               double bValue)
                        throws Point2DException
Set all values except total moment rate

Parameters:
magLower - : lowest magnitude that has non zero rate
magCorner - : the corner magnitude
totCumRate - : Total Cumulative Rate
bValue - : b value
Throws:
Point2DException

setAllButCornerMag

public void setAllButCornerMag(double magLower,
                               double totMoRate,
                               double totCumRate,
                               double bValue)
                        throws XY_DataSetException,
                               Point2DException
Set All but magCorner. This finds the corner magnitude iteratively, such that the final corner magnitude is guaranteed to be within 0.0001 of the "true" corner magnitude (and accordingly, there is a slight discrepancy in the final moment rate as well - typically orig/final moment rate = 1.0001). This throws a runtime exception if it cannot find a corner magnitude between magLower and maxX+0.0001 that satisfies the totMoRate. TO DO: FIX EXCEPTION THROWING TO BE CONSISTENT WITH OTHER METHODS AND THE MFD PARAMETER CLASS

Parameters:
magLower - : lowest magnitude that has non zero rate
totMoRate - : total moment rate
totCumRate - : total cumulative rate
bValue - : b value
Throws:
XY_DataSetException
Point2DException

main

public static void main(String[] args)

set

public void set(Point2D point)
Overriden to prevent value setting.

Specified by:
set in interface XY_DataSet
Overrides:
set in class EvenlyDiscretizedFunc
Throws:
UnsupportedOperationException

set

public void set(double x,
                double y)
Overriden to prevent value setting.

Specified by:
set in interface XY_DataSet
Overrides:
set in class EvenlyDiscretizedFunc
Throws:
UnsupportedOperationException

set

public void set(int index,
                double y)
Overriden to prevent value setting.

Specified by:
set in interface XY_DataSet
Overrides:
set in class EvenlyDiscretizedFunc
Throws:
UnsupportedOperationException

getTotCumRate

public double getTotCumRate()
                     throws Point2DException
Returns:
the cumulative rate at magLower
Throws:
Point2DException

get_bValue

public double get_bValue()
Returns:
th bValue for this distribution

getMagLower

public double getMagLower()
Returns:
the magLower : lowest magnitude that has non zero rate

getMagCorner

public double getMagCorner()
Returns:
the magCorner : the corner mag of the tapered GR

getDefaultName

public String getDefaultName()
returns the name of this class

Overrides:
getDefaultName in class IncrementalMagFreqDist
Returns:

getDefaultInfo

public String getDefaultInfo()
                      throws Point2DException
this function returns String for drawing Legen in JFreechart

Overrides:
getDefaultInfo in class IncrementalMagFreqDist
Returns:
: returns the String which is needed for Legend in graph
Throws:
Point2DException