org.opensha.sha.magdist
Class ArbIncrementalMagFreqDist

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.ArbIncrementalMagFreqDist
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<java.awt.geom.Point2D>, DiscretizedFunc, XY_DataSet, Named, PlotElement, XMLSaveable, IncrementalMagFreqDistAPI

public class ArbIncrementalMagFreqDist
extends IncrementalMagFreqDist

Title: ArbIncrementalMagFreqDist.java

Description: This class allows the user to create a Arbitrary IncrementalMagFreqDist.

Version:
1.0
Author:
Nitin Gupta , Ned Field
See Also:
Serialized Form

Field Summary
static java.lang.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
ArbIncrementalMagFreqDist(double min, double max, int num)
           
ArbIncrementalMagFreqDist(double min, int num, double delta)
           
 
Method Summary
 void addResampledMagRate(double mag, double rate, boolean preserveRates)
          This and adds the rate & mag passed in to the MFD after rounding to the nearest x-axis value (ignoring those out of range).
 java.lang.String getDefaultInfo()
          Returns the default Info String for the Distribution
 java.lang.String getDefaultName()
          returns the name of the class
 void setCumRateDist(DiscretizedFunc cumFunc)
          This sets incremental rate according to the cumulative rates passed in.
 void setResampledMagFreqDist(DiscretizedFunc func, boolean preserveRates)
          This sets each mag & rate value here according to the function passed in.
 
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, set, 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 java.lang.String NAME
Constructor Detail

ArbIncrementalMagFreqDist

public ArbIncrementalMagFreqDist(double min,
                                 double max,
                                 int num)
                          throws XY_DataSetException,
                                 InvalidRangeException
Throws:
XY_DataSetException
InvalidRangeException

ArbIncrementalMagFreqDist

public ArbIncrementalMagFreqDist(double min,
                                 int num,
                                 double delta)
                          throws XY_DataSetException,
                                 InvalidRangeException
Throws:
XY_DataSetException
InvalidRangeException
Method Detail

setResampledMagFreqDist

public void setResampledMagFreqDist(DiscretizedFunc func,
                                    boolean preserveRates)
This sets each mag & rate value here according to the function passed in. Each x-axis value of the function passed in is rounded to the nearest x-axis value here, and rates are summed if more than one x-axis value of the input function fall on the same x-axis value here. X-axis values from the input function that are out of the bounds of the present MFD are ignored. Zeros will be present at any x-axis values where there wasn't a corresponding value in the input function. If the preserveRates boolean is false, then the moment rate of each point is preserved (although the total moment rates of the two functions may differ if any endpoints were ignored). Otherwise total rates are preserved (assuming no endpoints are ignored). Discretization of this MFD should be same (or more densely discretized) than that passed in or significant biases will result from the rounding (due to ??? rules for values exactly halfway between).

Parameters:
func - the new Magnitude Frequency distribution to be added
preserveRates - specifies whether to preserve rates or moment rates

setCumRateDist

public void setCumRateDist(DiscretizedFunc cumFunc)
This sets incremental rate according to the cumulative rates passed in.

Parameters:
cumFunc -

addResampledMagRate

public void addResampledMagRate(double mag,
                                double rate,
                                boolean preserveRates)
This and adds the rate & mag passed in to the MFD after rounding to the nearest x-axis value (ignoring those out of range). If the preserveRates boolean is false, then the moment rate of the point is preserved (assuming it's in range). Otherwise the rate of that point is preserved. Discretization of this MFD should be same (or more densely discretized) than that passed in or significant biases will result from the rounding (due to ??? rules for values exactly halfway between).

Parameters:
mag - & rate to be added
preserveRates - specifies whether to preserve rates or moment rates

getDefaultName

public java.lang.String getDefaultName()
returns the name of the class

Overrides:
getDefaultName in class IncrementalMagFreqDist
Returns:

getDefaultInfo

public java.lang.String getDefaultInfo()
Returns the default Info String for the Distribution

Overrides:
getDefaultInfo in class IncrementalMagFreqDist
Returns:
String