neic-glass3  1.4.6
Public Member Functions | Static Public Attributes | List of all members
glasscore::CHypo Class Reference

glasscore hypocenter class More...

#include <Hypo.h>

Collaboration diagram for glasscore::CHypo:
Collaboration graph

Public Member Functions

 CHypo ()
 CHypo constructor. More...
 
 CHypo (std::shared_ptr< json::Object > detection, double thresh, int cut, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, std::shared_ptr< traveltime::CTTT > ttt, double resolution=100, double aziTaper=360.0, double maxDepth=800.0, CSiteList *pSiteList=NULL)
 CHypo advanced constructor. More...
 
 CHypo (double lat, double lon, double z, double time, std::string pid, std::string web, double bayes, double thresh, int cut, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, std::shared_ptr< traveltime::CTTT > ttt, double resolution=100, double aziTaper=360.0, double maxDepth=800.0)
 CHypo advanced constructor. More...
 
 CHypo (std::shared_ptr< CTrigger > trigger, std::shared_ptr< traveltime::CTTT > ttt)
 CHypo advanced constructor. More...
 
 CHypo (std::shared_ptr< CCorrelation > corr, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, std::shared_ptr< traveltime::CTTT > ttt)
 CHypo advanced constructor. More...
 
 ~CHypo ()
 CHypo destructor. More...
 
void clear ()
 CHypo clear function. More...
 
bool initialize (double lat, double lon, double z, double time, std::string pid, std::string web, double bayes, double thresh, int cut, std::shared_ptr< traveltime::CTravelTime > firstTrav, std::shared_ptr< traveltime::CTravelTime > secondTrav, std::shared_ptr< traveltime::CTTT > ttt, double resolution=100, double aziTaper=360.0, double maxDepth=800.0)
 CHypo initialization function. More...
 
bool addPickReference (std::shared_ptr< CPick > pck)
 Add pick reference to this hypo. More...
 
void removePickReference (std::shared_ptr< CPick > pck)
 Remove pick reference from this hypo. More...
 
bool hasPickReference (std::shared_ptr< CPick > pck)
 Check if pick is referenced by this hypo. More...
 
void clearPickReferences ()
 Clear all pick references for this hypo. More...
 
void addCorrelationReference (std::shared_ptr< CCorrelation > corr)
 Add correlation reference to this hypo. More...
 
void removeCorrelationReference (std::shared_ptr< CCorrelation > corr)
 Remove correlation reference from this hypo. More...
 
bool hasCorrelationReference (std::shared_ptr< CCorrelation > corr)
 Check if correlation is referenced by this hypo. More...
 
void clearCorrelationReferences ()
 Clear all correlation references for this hypo. More...
 
std::shared_ptr< json::Object > generateHypoMessage ()
 Generate Hypo message. More...
 
std::shared_ptr< json::Object > generateEventMessage ()
 Generate Event message. More...
 
std::shared_ptr< json::Object > generateCancelMessage ()
 Generate cancel message. More...
 
std::shared_ptr< json::Object > generateExpireMessage ()
 Generate expire message. More...
 
bool canAssociate (std::shared_ptr< CPick > pick, double sigma, double sdassoc, bool p_only=false, bool debug=false)
 Check to see if pick could be associated. More...
 
double getTravelTimeForPhase (std::shared_ptr< CPick > pick, std::string phaseName)
 Gets the travel time for the given pick and phase to this hypo. More...
 
double calculateDistanceToPick (std::shared_ptr< CPick > pick)
 Gets the distance between the given pick and phase to this hypo. More...
 
double calculateResidual (std::shared_ptr< CPick > pick, bool *useForLocations=NULL, std::string *phaseName=NULL, bool p_only=false)
 Calculates the residual of a pick to this hypo. More...
 
bool canAssociate (std::shared_ptr< CCorrelation > corr, double tWindow, double xWindow)
 Check to see if correlation could be associated. More...
 
double calculateAffinity (std::shared_ptr< CPick > pck)
 
double calculateAffinity (std::shared_ptr< CCorrelation > corr)
 
bool pruneData (CHypoList *parentThread=NULL)
 
bool cancelCheck ()
 Evaluate hypocenter viability. More...
 
bool reportCheck ()
 Evaluate hypocenter report suitability. More...
 
void calculateStatistics ()
 Calculate supporting data statistical values. More...
 
double anneal (int nIter=5000, double dStart=100.0, double dStop=1.0, double tStart=5., double tStop=.5)
 Fast baysian fit synthetic annealing location algorithm used by nucleation. More...
 
double localize ()
 Location calculation function. More...
 
void annealingLocateBayes (int nIter, double dStart, double dStop, double tStart, double tStop, bool nucleate=false)
 Baysian Fit synthetic annealing location algorithm. More...
 
void annealingLocateResidual (int nIter, double dStart, double dStop, double tStart, double tStop, bool nucleate=false)
 Residual synthetic annealing location algorithm. More...
 
double calculateGap (double lat, double lon, double z)
 Calculate gap. More...
 
double calculateCurrentBayes ()
 Calculate bayes at current location. More...
 
double calculateBayes (double xlat, double xlon, double xZ, double oT, bool nucleate)
 Calculate bayes. More...
 
double calculateAbsResidualSum (double xlat, double xlon, double xZ, double oT, bool nucleate)
 Calculate absolute residual sum. More...
 
double calculateWeightedResidual (std::string sPhase, double tObs, double tCal)
 Calculate residual for a phase Calculates the weighted residual (with S down weighted) for the current location given the phase, observed travel time, and calculated travel time. More...
 
void graphicsOutput ()
 Write files for plotting output. More...
 
bool resolveData (std::shared_ptr< CHypo > hypo, bool allowStealing=true, CHypoList *parentThread=NULL)
 Ensure all supporting data belong to this hypo. More...
 
void trap ()
 Supporting data link checking function. More...
 
double getAzimuthTaper () const
 Get the azimuth taper used on the bayseian stack value in order to compensate for a large azimuthal gap. More...
 
double getMaxDepth () const
 Get the maximum allowed depth for this hypo. More...
 
double getLatitude () const
 Get the latitude for this hypo. More...
 
void setLatitude (double lat)
 Set the latitude for this hypo. More...
 
double getLongitude () const
 Get the longitude for this hypo. More...
 
void setLongitude (double lon)
 Set the longitude for this hypo, accounting for the longitude wrap at +/-180. More...
 
double getDepth () const
 Get the depth for this hypo. More...
 
void setDepth (double z)
 Sets the depth for this hypo. More...
 
glass3::util::Geo getGeo () const
 Get the combined hypo location (latitude, longitude, depth) as a CGeo object. More...
 
double getTOrigin () const
 Get the origin time for this hypo. More...
 
void setTOrigin (double newTOrg)
 Sets the origin time for this hypo. More...
 
double getBayesValue () const
 Gets the current bayes stack value for this hypo. More...
 
bool getCorrelationAdded () const
 Gets whether a correlation has been added to this hypo. More...
 
void setCorrelationAdded (bool corrAdded)
 Sets whether a correlation has been added to this hypo. More...
 
bool getEventGenerated () const
 Gets whether an event message was generated for this hypo. More...
 
bool getHypoGenerated () const
 Gets whether an hypo message was generated for this hypo. More...
 
bool getFixed () const
 Gets whether this hypo is fixed. More...
 
void setFixed (bool fixed)
 Sets whether this hypo is fixed. More...
 
double getInitialBayesValue () const
 Gets the initial (nucleation) bayes stack value for this hypo. More...
 
double getAssociationDistanceCutoff () const
 Gets the association distance cutoff used in canAssociate() and generateAffinitu() More...
 
double getDistanceCutoffFactor () const
 Gets the distance cutoff factor used in calculating the Association Distance Cutoff. More...
 
int getNucleationDataThreshold () const
 Gets the threshold that represents the minimum count of data required to successfully nucleate or maintain (via passing cancelCheck() a hypocenter. More...
 
void setNucleationDataThreshold (int cut)
 Sets the threshold that represents the minimum count of data required to successfully nucleate or maintain (via passing cancelCheck() a hypocenter. More...
 
double getNucleationStackThreshold () const
 Gets the nucleation stack minimum threshold used in determining hypo viability in cancelCheck() More...
 
void setNucleationStackThreshold (double thresh)
 Sets the nucleation stack minimum threshold used in determining hypo viability in cancelCheck() More...
 
double getGap () const
 Gets the azimuthal gap as of the last call of calculateStatistics. More...
 
int getTeleseismicPhaseCount () const
 Gets the teleseismic phase count as of the last call of calculateStatistics. More...
 
double getMedianDistance () const
 Gets the median data distance as of the last call of calculateStatistics() More...
 
double getMinDistance () const
 Gets the minimum data distance as of the last call of calculateStatistics() More...
 
std::mutex & getProcessingMutex ()
 Gets the mutex used to ensure that the hypo can be processed by only one thread at a time. More...
 
double getWebResolution () const
 Gets the node resolution of the web that nucleated this hypo. More...
 
double getDistanceSD () const
 Gets the current distance standard deviation. More...
 
int getProcessCount () const
 Gets the current process count, used by HypoList to prevent continuous hypo reprocessing. More...
 
int setProcessCount (int newCycle)
 Sets the process count, used by HypoList to prevent continuous hypo reprocessing. More...
 
int getTotalProcessCount () const
 Gets the total process count. More...
 
int incrementTotalProcessCount ()
 Increments the total process count. More...
 
const std::string & getID () const
 Gets the identifier for this hypo. More...
 
const std::string & getWebName () const
 Gets the name of the web that nucleated this hypo. More...
 
int getPickDataSize () const
 Get the current size of the supporting data pick vector. More...
 
std::vector< std::shared_ptr< CPick > > getPickData () const
 Get a vector containing all the supporting pick data for this hypo. More...
 
int getCorrelationDataSize () const
 Get the current size of the supporting data correlation vector. More...
 
double getTCreate () const
 Get the time that this hypo was created. More...
 
std::shared_ptr< traveltime::CTravelTimegetNucleationTravelTime1 () const
 Get the primary phase/travel time used in nucleating this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in the calculateBayes() and calculateAbsResidualSum() functions. More...
 
std::shared_ptr< traveltime::CTravelTimegetNucleationTravelTime2 () const
 Get the secondary phase/travel time used in nucleating this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in the calculateBayes() and calculateAbsResidualSum() functions. More...
 
std::shared_ptr< traveltime::CTTTgetTravelTimeTables () const
 Get the list of association phases / travel times for this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in canAssociate() calculateResidual(), and annealingLocateResidual() functions. More...
 
int getReportCount () const
 Gets the number of times that this hypo has been reported. More...
 
bool isLockedForProcessing ()
 Gets whether the mutex accessed via getProcessingMutex() is locked. More...
 
int64_t getTSort () const
 Get the sorting time for this hypo. More...
 
void setTSort (double newTSort)
 Set the sorting time for this hypo. More...
 
void setTCreate (double newTCreate)
 Sets the time that this hypo was created. More...
 
void setNucleationAuditingInfo (double tNucleation, double tNucleationKeyPickInsertion)
 Set nucleation auditing info for this hypo. More...
 
const HypoAuditingPerformanceStructgetHypoAuditingPerformanceInfo ()
 Returns performance-auditing information for the hypo via a const HypoAuditingPerformanceStruct pointer. More...
 

Static Public Attributes

static constexpr double k_dResidualSigmaLengthSeconds = 1.0
 The residual sigma length in seconds. More...
 
static constexpr double k_dGapTaperDownBegin = 270.0
 The beginning of the gap taper. More...
 
static constexpr double k_dGapTaperDownEnd = 360.0
 The end of the gap taper. More...
 
static constexpr double k_dTimeToDistanceCorrectionFactor = 10.0
 The factor to correct time to distance. More...
 
static constexpr double k_dVerticalToHorizontalDistanceCorrectionFactor = 2.0
 The factor to correct vertical to horizontal distance. More...
 
static constexpr double k_dBayesFactorMaximumRange = 0.2
 The maximum range factor used in bayes stack calculations. More...
 
static constexpr double k_dBayesFactorExponent = 2.0
 The exponent factor used in bayes stack calculations. More...
 
static constexpr double k_dBayesFactorStepSizeReduction = 500.0
 The step size reduction factor used in bayes stack calculations. More...
 
static constexpr double k_dLocationChangeWebResolutionRatio = 0.5
 
static constexpr double k_dMinimumDepthChangeKMThreshold = 7.5
 The minimum depth change in km that constitutes a significant change in location. Used for auditing purposes. More...
 
static constexpr double k_dMinimumDepthChangeRatioThreshold = 0.25
 The minimum depth change (expressed as a ratio to the previous depth, that constitutes a significant change in location. Used for auditing purposes. More...
 
static constexpr double k_dInitialAnnealStepReducationFactor = .5
 The initial step reduction factor for anneal. More...
 
static constexpr double k_dFinalAnnealStepReducationFactor = 100.0
 The final step reduction factor for anneal. More...
 
static constexpr double k_dLocationMinDistanceStepSize = 1.0
 The minimum location iteration distance step size. More...
 
static constexpr double k_dLocationMinTimeStepSize = 0.1
 The minimum location iteration time step size. More...
 
static constexpr double k_dLocationSearchRadiusToTime = 30.0
 The factor used to convert the location search radius to time. More...
 
static constexpr double k_dLocationTaperConstant = 0.0001
 The location taper constant. More...
 
static constexpr double k_dLocationMaxTaperThreshold = 30.0
 The maximum threshold for the location taper. More...
 
static const int k_iLocationNPicksToSkipSmall = 5
 The small nPick threshold to skip during location. More...
 
static const int k_iLocationNPicksToSkipMedium = 10
 The medium nPick threshold to skip during location. More...
 
static const int k_iLocationNPicksToSkipLarge = 25
 The large nPick threshold to skip during location. More...
 
static const int k_iLocationNPickThresholdSmall = 25
 The nPick threshold indicating a small hypo during location. More...
 
static const int k_iLocationNPickThresholdMedium = 50
 The nPick threshold indicating a medium hypo during location. More...
 
static const int k_iLocationNPickThresholdLarge = 150
 The nPick threshold indicating a large hypo during location. More...
 
static const int k_iLocationNumIterationsSmall = 500
 The small number of location iterations to perform for a hypo. More...
 
static const int k_iLocationNumIterationsMedium = 1250
 The medium number of location iterations to perform for a hypo. More...
 
static const int k_iLocationNumIterationsLarge = 10000
 The large number of location iterations to perform for a hypo. More...
 
static constexpr double k_dSearchRadiusResolutionFactor = 1.0
 The factor for dividing the web resolution when computing the location search radius. More...
 
static constexpr double k_dSearchRadiusTaperFactor = 0.75
 The factor for multiplying the taper when computing the location search radius. More...
 
static constexpr double k_dSearchRadiusFactor = 0.5
 The factor for dividing when computing the location search radius. More...
 

Detailed Description

glasscore hypocenter class

The CHypo class is the class that encapsulates everything necessary to represent an earthquake hypocenter.

CHypo also maintains vectors of shared_ptr's to CPick and CCorrelation objects that make up the data that supports the hypocenter

CHypo contains functions to support association, disassociation, location, removal, and various statistical calculations, as well as generating output data in various formats.

The CHypo associate() and prune() functions essentially make up the glasscore data association engine, along with the various statistical calculations.

The glasscore location algorithm consists of the CHypo anneal(), localize(), annealingLocateBayes(), annealingLocateResidual(), calculateBayes(), and calculateAbsResidualSum() functions, along with the various statistical calculations.

CHypo uses smart pointers (std::shared_ptr).

Constructor & Destructor Documentation

glasscore::CHypo::CHypo ( )

CHypo constructor.

The constructor for the CHypo class. Sets allocated objects to null. Initializes members to default values.

glasscore::CHypo::CHypo ( std::shared_ptr< json::Object >  detection,
double  thresh,
int  cut,
std::shared_ptr< traveltime::CTravelTime firstTrav,
std::shared_ptr< traveltime::CTravelTime secondTrav,
std::shared_ptr< traveltime::CTTT ttt,
double  resolution = 100,
double  aziTaper = 360.0,
double  maxDepth = 800.0,
CSiteList pSiteList = NULL 
)

CHypo advanced constructor.

An advanced constructor for the CHypo class. This function initializes members to the provided values found in the json detection message.

Parameters
detection- A shared pointer to a json::Object to containing the data to construct the hypo from
thresh- A double containing the threshold value for this hypo
cut- An integer containing the Bayesian stack threshold for this hypo
firstTrav- A traveltime::CTravelTime containing the first travel time used in creating this hypo
secondTrav- A traveltime::CTravelTime containing the second travel time used in creating this hypo
ttt- A traveltime::CTTT to be used for association for this hypo
resolution- A double value containing the web resolution used
aziTaper= A double value containing the azimuth taper to be used, defaults to 360
maxDepth= A double value containing the maximum allowed depth, defaults to 800
pSiteList- A pointer to the CSiteList class to use when looking up the pick station
Returns
Returns true if successful, false otherwise.
glasscore::CHypo::CHypo ( double  lat,
double  lon,
double  z,
double  time,
std::string  pid,
std::string  web,
double  bayes,
double  thresh,
int  cut,
std::shared_ptr< traveltime::CTravelTime firstTrav,
std::shared_ptr< traveltime::CTravelTime secondTrav,
std::shared_ptr< traveltime::CTTT ttt,
double  resolution = 100,
double  aziTaper = 360.0,
double  maxDepth = 800.0 
)

CHypo advanced constructor.

An advanced constructor for the CHypo class. This function initializes members to the provided values.

Parameters
lat- A double containing the geocentric latitude in degrees to use
lon- A double containing the geocentric longitude in degrees to use
z- A double containing the geocentric depth in kilometers to use
time- A double containing the Gregorian time in seconds to use
pid- A std::string containing the id of this hypo
web- A std::string containing the name of the web that nucleated this hypo
bayes- A double containing the bayesian value for this hypo.
thresh- A double containing the threshold value for this hypo
cut- An integer containing the Bayesian stack threshold for this hypo
firstTrav- A traveltime::CTravelTime containing the first travel time used in creating this hypo
secondTrav- A traveltime::CTravelTime containing the second travel time used in creating this hypo
ttt- A traveltime::CTTT to be used for association for this hypo
resolution- A double value containing the web resolution used
aziTaper= A double value containing the azimuth taper to be used, defaults to 360
maxDepth= A double value containing the maximum allowed depth, defaults to 800
Returns
Returns true if successful, false otherwise.
glasscore::CHypo::CHypo ( std::shared_ptr< CTrigger trigger,
std::shared_ptr< traveltime::CTTT ttt 
)
explicit

CHypo advanced constructor.

An advanced constructor for the CHypo class. This function initializing members to the values contained in the provided CTrigger object, used when a new hypo is nucleated.

Parameters
trigger- A CTrigger object containing the nucleation trigger to construct this hypo from.
ttt- A traveltime::CTTT to be used for association for this hypo
glasscore::CHypo::CHypo ( std::shared_ptr< CCorrelation corr,
std::shared_ptr< traveltime::CTravelTime firstTrav,
std::shared_ptr< traveltime::CTravelTime secondTrav,
std::shared_ptr< traveltime::CTTT ttt 
)
explicit

CHypo advanced constructor.

An advanced constructor for the CHypo class. This function initializing members to the values contained in the provided CCorrelation object, used when a creating a new hypo based on a correlation message.

Parameters
corr- A shared pointer to a CNode object containing the correlation to construct this hypo from.
firstTrav- A traveltime::CTravelTime containing the first travel time used in creating this hypo
secondTrav- A traveltime::CTravelTime containing the second travel time used in creating this hypo
ttt- A traveltime::CTTT to be used for association for this hypo
glasscore::CHypo::~CHypo ( )

CHypo destructor.

The destructor for the CHypo class. Cleans up all memory allocated objects.

Member Function Documentation

void glasscore::CHypo::addCorrelationReference ( std::shared_ptr< CCorrelation corr)

Add correlation reference to this hypo.

Adds a shared_ptr reference to the given correlation to the list of supporting correlation references for this hypo, representing a graph database link between this hypocenter and the provided correlation. This link also represents a correlation association.

Note that this correlation may or may not also be referenced by other hypocenters

Parameters
corr- A std::shared_ptr to the CCorrelation object to add.
bool glasscore::CHypo::addPickReference ( std::shared_ptr< CPick pck)

Add pick reference to this hypo.

Adds a shared_ptr reference to the given pick to the list of supporting pick references for this hypo, representing a graph database link between this hypocenter and the provided pick. This link also represents a phase association.

Note that this pick may or may not also be referenced by other hypocenters

Parameters
pck- A std::shared_ptr to the CPick object to add.
Returns
True if successful, false otherwise
double glasscore::CHypo::anneal ( int  nIter = 5000,
double  dStart = 100.0,
double  dStop = 1.0,
double  tStart = 5.,
double  tStop = .5 
)

Fast baysian fit synthetic annealing location algorithm used by nucleation.

Rapid synthetic annealing algoritym used by nucleation to calculate an initial starting location.

Also computes supporting data statistics by calling calculateStatistics()

Parameters
nIter- An integer containing the number of iterations to perform, defaults to 250
dStart- A double value containing the starting distance iteration step size in kilometers, default 100 km
dStop- A double value containing the ending distance iteration step size in kilometers, default 1 km
tStart- A double value containing the starting time iteration step size in seconds, default 5 seconds
tStop- A double value containing the ending time iteration step size in seconds, default 0.5 seconds
Returns
Returns a double value containing the final baysian fit.
void glasscore::CHypo::annealingLocateBayes ( int  nIter,
double  dStart,
double  dStop,
double  tStart,
double  tStop,
bool  nucleate = false 
)

Baysian Fit synthetic annealing location algorithm.

Locator which uses synthetic annealing to compute the geographic point of the maximum bayesian fit given the supporting data.

Parameters
nIter- An integer value containing the number of iterations
dStart- A double value containing the distance starting value
dStop- A double value containing the distance stopping value
tStart- A double value containing the time starting value in gregorian seconds
tStop- A double value containing the time stopping value in gregorian seconds
nucleate- An boolean flag that sets if this is a nucleation which limits the phase used.
void glasscore::CHypo::annealingLocateResidual ( int  nIter,
double  dStart,
double  dStop,
double  tStart,
double  tStop,
bool  nucleate = false 
)

Residual synthetic annealing location algorithm.

Locator which uses synthetic annealing to compute the geographic point of the minimum of sum of absolute of residuals given the supporting data.

Parameters
nIter- An integer value containing the number of iterations
dStart- A double value containing the distance starting value
dStop- A double value containing the distance stopping value
tStart- A double value containing the time starting value in gregorian seconds
tStop- A double value containing the time stopping value in gregorian seconds
nucleate- A boolean flag that sets if this is a nucleation, which limits the phases used.
double glasscore::CHypo::calculateAbsResidualSum ( double  xlat,
double  xlon,
double  xZ,
double  oT,
bool  nucleate 
)

Calculate absolute residual sum.

Calculates the sum of the absolute residuals of the supporting data for a given location. Used in calculating locations by annealingLocateResidual()

Parameters
xlat- A double of the latitude to evaluate
xlon- A double of the longitude to evaluate
xZ- A double of the depth to evaluate
oT- A double of the oT in gregorian seconds
nucleate- A boolean flag that sets if this is a nucleation, which limits the phases used.
Returns
Returns a double value containing the absolute residual sum for the given location.
double glasscore::CHypo::calculateAffinity ( std::shared_ptr< CPick pck)
double glasscore::CHypo::calculateAffinity ( std::shared_ptr< CCorrelation corr)
double glasscore::CHypo::calculateBayes ( double  xlat,
double  xlon,
double  xZ,
double  oT,
bool  nucleate 
)

Calculate bayes.

Calculates the total bayseian stack value for a given location using the supporting data. Used in calculating locations by annealingLocateBayes()

Parameters
xlat- A double of the latitude to evaluate
xlon- A double of the longitude to evaluate
xZ- A double of the depth to evaluate
oT- A double of the oT to evaluate
nucleate- A boolean flag that sets if this is a nucleation, which limits the phases used.
Returns
Returns a double value containing the total bayseian stack value for the given location.
double glasscore::CHypo::calculateCurrentBayes ( )

Calculate bayes at current location.

Calculates the total bayseian stack value at current location using the supporting data.

Returns
Returns a double value containing the total bayseian stack value for the given location.
double glasscore::CHypo::calculateDistanceToPick ( std::shared_ptr< CPick pick)

Gets the distance between the given pick and phase to this hypo.

Calculates the distance between the given supporting data to this hypo for the given phase

Parameters
pick- The pick to calculate a distance for for
phaseName- The phase name to use for calcuation
Returns
Returns a double value containing the distance to the given pick in degrees
double glasscore::CHypo::calculateGap ( double  lat,
double  lon,
double  z 
)

Calculate gap.

Calculates the azimuthal gap for a given location using the supporting data

Parameters
lat- latitude of test location
lon- longitude of test location
z- depth of test location
Returns
Returns a double value containing the calculated gap
double glasscore::CHypo::calculateResidual ( std::shared_ptr< CPick pick,
bool *  useForLocations = NULL,
std::string *  phaseName = NULL,
bool  p_only = false 
)

Calculates the residual of a pick to this hypo.

Calculates the residual of the given supporting data to this hypo

Parameters
pick- The pick to calculate a residual for
useForLocations- An optional pointer to a boolean flag to be returned indicating whether this pick can be used in locations, default is null.
phaseName- An optional pointer to a string to be returned indicating the phase name, default is null.
p_only- A boolean flag indicating that this pick should calculate a residual ONLY for P, default to false
Returns
Returns a double value containing the residual of the given pick
void glasscore::CHypo::calculateStatistics ( )

Calculate supporting data statistical values.

Calculate various statistical values for this hypo, including minimum distance, median distance, gap, kurtosis value, and association distance cutoff as part of the anneal() and localize()

double glasscore::CHypo::calculateWeightedResidual ( std::string  sPhase,
double  tObs,
double  tCal 
)

Calculate residual for a phase Calculates the weighted residual (with S down weighted) for the current location given the phase, observed travel time, and calculated travel time.

Parameters
sPhase- A string with the phase type
tObs- The observed travel time in gregorian seconds
tCal- The calculated travel time in gregorian seconds
Returns
Returns a double value containing the weighted residual
bool glasscore::CHypo::canAssociate ( std::shared_ptr< CPick pick,
double  sigma,
double  sdassoc,
bool  p_only = false,
bool  debug = false 
)

Check to see if pick could be associated.

Check to see if a given pick could be associated to this CHypo

Parameters
pick- A std::shared_ptr to the CPick object to check.
sigma- A double value containing the sigma to use
sdassoc- A double value containing the standard deviation assocaiation limit to use
p_only- A boolean flag indicating that this pick should try to associate ONLY with P, default to false
p_only- A boolean flag indicating that debug logging should be performed, default to false
Returns
Returns true if the pick can be associated, false otherwise
bool glasscore::CHypo::canAssociate ( std::shared_ptr< CCorrelation corr,
double  tWindow,
double  xWindow 
)

Check to see if correlation could be associated.

Check to see if a given correlation could be associated to this CHypo

Parameters
corr- A std::shared_ptr to the CCorrelation object to check.
tWindow- A double value containing the time window to use
xWindow- A double value containing the distance window
Returns
Returns true if the correlation can be associated, false otherwise
bool glasscore::CHypo::cancelCheck ( )

Evaluate hypocenter viability.

Evaluate whether the hypocenter is viable, first by checking to see if the current number of supporting data exceeds the configured threshold, second checking if the current bayes value exceeds the configured threshold, and finally making a depth/gap check to ensure the hypocenter is not a "whispy".

Returns
Returns true if the hypocenter is not viable, false otherwise
void glasscore::CHypo::clear ( )

CHypo clear function.

void glasscore::CHypo::clearCorrelationReferences ( )

Clear all correlation references for this hypo.

Clears the list of supporting shared_ptr correlation references for this hypo

Note correlations may or may not be still referenced by other hypocenters

void glasscore::CHypo::clearPickReferences ( )

Clear all pick references for this hypo.

Clears the list of supporting shared_ptr pick references for this hypo

Note picks may or may not be still referenced by other hypocenters

std::shared_ptr< json::Object > glasscore::CHypo::generateCancelMessage ( )

Generate cancel message.

Generate a json object representing a cancellation of this hypocenter in the "Cancel" format

Returns
Returns the generated json object in the "Cancel" format.
std::shared_ptr< json::Object > glasscore::CHypo::generateEventMessage ( )

Generate Event message.

Generate a json object representing a summary of this hypocenter in the "Event" format

Returns
Returns the generated json object in the "Event" format.
std::shared_ptr< json::Object > glasscore::CHypo::generateExpireMessage ( )

Generate expire message.

Generate a json object representing a expiration of this hypocenter in the "Expire" format

If this hypocenter was previously reported, a copy of it is included in this message via the generateHypoMessage() function

Returns
Returns the generated json object in the "Expire" format.
std::shared_ptr< json::Object > glasscore::CHypo::generateHypoMessage ( )

Generate Hypo message.

Generate a json object representing this hypocenter in the "Hypo" format

Returns
Returns the generated json object in the "Hypo" format.
double glasscore::CHypo::getAssociationDistanceCutoff ( ) const

Gets the association distance cutoff used in canAssociate() and generateAffinitu()

Returns
Returns a double value containing the current association distance cutoff
double glasscore::CHypo::getAzimuthTaper ( ) const

Get the azimuth taper used on the bayseian stack value in order to compensate for a large azimuthal gap.

Returns
Returns a double value containing the taper to use
double glasscore::CHypo::getBayesValue ( ) const

Gets the current bayes stack value for this hypo.

Returns
Returns a double containing the current bayes stack value
bool glasscore::CHypo::getCorrelationAdded ( ) const

Gets whether a correlation has been added to this hypo.

Gets whether a correlation has been added to this hypo. This flag is used in preserving hypos generated from correlations long enough for supporting data to be added.

Returns
Returns a boolean flag indicating whether a correlation has been added to this hypo, true if one has, false otherwise
int glasscore::CHypo::getCorrelationDataSize ( ) const

Get the current size of the supporting data correlation vector.

Returns
Returns an integer containing current size of the supporting data correlation vector
double glasscore::CHypo::getDepth ( ) const

Get the depth for this hypo.

Returns
Returns a double containing the hypo depth in kilometers
double glasscore::CHypo::getDistanceCutoffFactor ( ) const

Gets the distance cutoff factor used in calculating the Association Distance Cutoff.

Returns
Returns a double value containing the distance cutoff factor
double glasscore::CHypo::getDistanceSD ( ) const

Gets the current distance standard deviation.

Returns
Returns a double value containing the current distance standard deviation
bool glasscore::CHypo::getEventGenerated ( ) const

Gets whether an event message was generated for this hypo.

Returns
Returns a boolean flag indicating whether an event message has been generated for this hypo, true if one has, false otherwise
bool glasscore::CHypo::getFixed ( ) const

Gets whether this hypo is fixed.

Returns
Returns a boolean flag indicating whether this hypo is fixed, true if it is, false otherwise
double glasscore::CHypo::getGap ( ) const

Gets the azimuthal gap as of the last call of calculateStatistics.

Returns
Returns a double value containing the azimuthal gap
glass3::util::Geo glasscore::CHypo::getGeo ( ) const

Get the combined hypo location (latitude, longitude, depth) as a CGeo object.

Returns
Returns a glass3::util::Geo object containing the combined location.
const HypoAuditingPerformanceStruct * glasscore::CHypo::getHypoAuditingPerformanceInfo ( )

Returns performance-auditing information for the hypo via a const HypoAuditingPerformanceStruct pointer.

bool glasscore::CHypo::getHypoGenerated ( ) const

Gets whether an hypo message was generated for this hypo.

Returns
Returns a boolean flag indicating whether a hypo message has been generated for this hypo, true if one has, false otherwise
const std::string & glasscore::CHypo::getID ( ) const

Gets the identifier for this hypo.

Returns
Returns a std::string containing this hypo's identifier
double glasscore::CHypo::getInitialBayesValue ( ) const

Gets the initial (nucleation) bayes stack value for this hypo.

Returns
Returns a double value containing the initial (nucleation) bayes stack value
double glasscore::CHypo::getLatitude ( ) const

Get the latitude for this hypo.

Returns
Returns a double containing the hypo latitude in degrees
double glasscore::CHypo::getLongitude ( ) const

Get the longitude for this hypo.

Returns
Returns a double containing the hypo longitude in degrees
double glasscore::CHypo::getMaxDepth ( ) const

Get the maximum allowed depth for this hypo.

Returns
Returns a double value containing the maximum depth in kilometers
double glasscore::CHypo::getMedianDistance ( ) const

Gets the median data distance as of the last call of calculateStatistics()

Returns
Returns a double value containing the median data distance
double glasscore::CHypo::getMinDistance ( ) const

Gets the minimum data distance as of the last call of calculateStatistics()

Returns
Returns a double value containing the minimum data distance
int glasscore::CHypo::getNucleationDataThreshold ( ) const

Gets the threshold that represents the minimum count of data required to successfully nucleate or maintain (via passing cancelCheck() a hypocenter.

If threshold is 10, then 8 picks + 1 correlation + 1 beam would be sufficient, but 9 picks would not be.

Returns
Returns a double value containing the nucleation minimum stack threshold
double glasscore::CHypo::getNucleationStackThreshold ( ) const

Gets the nucleation stack minimum threshold used in determining hypo viability in cancelCheck()

Returns
Returns an integer value containing the nucleation data minimum threshold
std::shared_ptr< traveltime::CTravelTime > glasscore::CHypo::getNucleationTravelTime1 ( ) const

Get the primary phase/travel time used in nucleating this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in the calculateBayes() and calculateAbsResidualSum() functions.

Returns
Returns a shared_ptr to the primary CTravelTime used in nucleating this hypo
std::shared_ptr< traveltime::CTravelTime > glasscore::CHypo::getNucleationTravelTime2 ( ) const

Get the secondary phase/travel time used in nucleating this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in the calculateBayes() and calculateAbsResidualSum() functions.

Returns
Returns a shared_ptr to the secondary CTravelTime used in nucleating this hypo
std::vector< std::shared_ptr< CPick > > glasscore::CHypo::getPickData ( ) const

Get a vector containing all the supporting pick data for this hypo.

Returns
Returns a std::vector containing all the supporting pick data
int glasscore::CHypo::getPickDataSize ( ) const

Get the current size of the supporting data pick vector.

Returns
Returns an integer containing current size of the supporting data pick vector
int glasscore::CHypo::getProcessCount ( ) const

Gets the current process count, used by HypoList to prevent continuous hypo reprocessing.

Returns
Returns an integer value containing the current process count
std::mutex & glasscore::CHypo::getProcessingMutex ( )

Gets the mutex used to ensure that the hypo can be processed by only one thread at a time.

Returns
Returns a std::mutex
int glasscore::CHypo::getReportCount ( ) const

Gets the number of times that this hypo has been reported.

Returns
Returns an integer value containing the report count
double glasscore::CHypo::getTCreate ( ) const

Get the time that this hypo was created.

Returns
Returns a double value containg the time this hypo was created in Gregorian seconds
int glasscore::CHypo::getTeleseismicPhaseCount ( ) const

Gets the teleseismic phase count as of the last call of calculateStatistics.

Returns
Returns an integer value containing the teleseismic phase count
double glasscore::CHypo::getTOrigin ( ) const

Get the origin time for this hypo.

Returns
Returns a double containing the hypo origin time in Gregorian seconds
int glasscore::CHypo::getTotalProcessCount ( ) const

Gets the total process count.

Returns
Returns an integer value containing the total process count
double glasscore::CHypo::getTravelTimeForPhase ( std::shared_ptr< CPick pick,
std::string  phaseName 
)

Gets the travel time for the given pick and phase to this hypo.

Calculates the travel time of the given supporting data to this hypo for the given phase

Parameters
pick- The pick to calculate a travel tiem for for
phaseName- The phase name to use for calcuation
Returns
Returns a double value containing the travel time of the given pick for the given phase
std::shared_ptr< traveltime::CTTT > glasscore::CHypo::getTravelTimeTables ( ) const

Get the list of association phases / travel times for this hypo This object is kept in CHypo for performance (throughput) reasons, and is used in canAssociate() calculateResidual(), and annealingLocateResidual() functions.

Returns
Returns a shared_ptr to the association CTTT used in this hypo
int64_t glasscore::CHypo::getTSort ( ) const

Get the sorting time for this hypo.

Returns
Returns an int64_t containing the hypo sort time in Gregorian seconds
const std::string & glasscore::CHypo::getWebName ( ) const

Gets the name of the web that nucleated this hypo.

Returns
Returns a std::string containing the name of the web that nuclated this hypo
double glasscore::CHypo::getWebResolution ( ) const

Gets the node resolution of the web that nucleated this hypo.

Returns
Returns a double value containing the node resolution of the web that nucleated this hypo in kilometers
void glasscore::CHypo::graphicsOutput ( )

Write files for plotting output.

bool glasscore::CHypo::hasCorrelationReference ( std::shared_ptr< CCorrelation corr)

Check if correlation is referenced by this hypo.

Check to see if a shared_ptr reference from the given correlation to this hypo exists

Note that this correlation may or may not be also referenced by other hypocenters

Parameters
corr- A std::shared_ptr to the CCorrelation object to check.
Returns
returns true if a reference exists to the given correlation, false otherwise
bool glasscore::CHypo::hasPickReference ( std::shared_ptr< CPick pck)

Check if pick is referenced by this hypo.

Check to see if a shared_ptr reference from the given pick to this hypo exists

Note that this pick may or may not be also referenced by other hypocenters

Parameters
pck- A std::shared_ptr to the CPick object to check.
Returns
returns true if a reference exists to the given pick, false otherwise
int glasscore::CHypo::incrementTotalProcessCount ( )

Increments the total process count.

Returns
Returns an integer value containing the new total process count
bool glasscore::CHypo::initialize ( double  lat,
double  lon,
double  z,
double  time,
std::string  pid,
std::string  web,
double  bayes,
double  thresh,
int  cut,
std::shared_ptr< traveltime::CTravelTime firstTrav,
std::shared_ptr< traveltime::CTravelTime secondTrav,
std::shared_ptr< traveltime::CTTT ttt,
double  resolution = 100,
double  aziTaper = 360.0,
double  maxDepth = 800.0 
)

CHypo initialization function.

Initializes hypo class to provided values.

Parameters
lat- A double containing the geocentric latitude in degrees to use
lon- A double containing the geocentric longitude in degrees to use
z- A double containing the geocentric depth in kilometers to use
time- A double containing the Gregorian time in seconds to use
pid- A std::string containing the id of this hypo
web- A std::string containing the name of the web that nucleated this hypo
bayes- A double containing the bayesian value for this hypo.
thresh- A double containing the threshold value for this hypo
cut- An integer containing the Bayesian stack threshold for this hypo
firstTrav- A traveltime::CTravelTime containing the first travel time used in creating this hypo
secondTrav- A traveltime::CTravelTime containing the second travel time used in creating this hypo
ttt- A traveltime::CTTT to be used for association for this hypo
resolution- A double value containing the web resolution used
aziTaper= A double value containing the azimuth taper to be used, defaults to 360
maxDepth= A double value the maximum event depth for the locator, defaults to 800
Returns
Returns true if successful, false otherwise.
bool glasscore::CHypo::isLockedForProcessing ( )

Gets whether the mutex accessed via getProcessingMutex() is locked.

Returns
Returns a boolean flag indicating whether the mutex is locked, true if it is, false otherwise
double glasscore::CHypo::localize ( )

Location calculation function.

This function calculates the current location of this hypo given the supporting data using either a maximum baysian fit (annealingLocateBayes) or minimum residual (annealingLocateResidual) depending on the configuration

Also computes supporting data statistics by calling calculateStatistics()

Returns
Returns a double value containing the final baysian fit.
bool glasscore::CHypo::pruneData ( CHypoList parentThread = NULL)
void glasscore::CHypo::removeCorrelationReference ( std::shared_ptr< CCorrelation corr)

Remove correlation reference from this hypo.

Remove a shared_ptr reference to the given correlation from the list of supporting correlation references for this hypo, breaking the graph database link between this hypocenter and the provided correlation. The breaking of this link also represents a correlation disassociation.

Note that this correlation may or may not still be referenced by other hypocenters

Parameters
corr- A std::shared_ptr to the CCorrelation object to remove.
void glasscore::CHypo::removePickReference ( std::shared_ptr< CPick pck)

Remove pick reference from this hypo.

Remove a shared_ptr reference to the given pick from the list of supporting pick references for this hypo, breaking the graph database link between this hypocenter and the provided pick. The breaking of this link also represents a phase disassociation.

Note that this pick may or may not be still referenced by other hypocenters

Parameters
pck- A std::shared_ptr to the CPick object to remove.
bool glasscore::CHypo::reportCheck ( )

Evaluate hypocenter report suitability.

Evaluate whether the hypocenter is suitable to be reported, utilizing the reporting data and stack thresholds (instead of the nucleation thresholds)

Returns
Returns true if the hypocenter can be reported, false otherwise
bool glasscore::CHypo::resolveData ( std::shared_ptr< CHypo hypo,
bool  allowStealing = true,
CHypoList parentThread = NULL 
)

Ensure all supporting data belong to this hypo.

Search through all supporting data (eg. Picks) in the given hypocenter's lists, using the affinity functions to determine whether the data best fits this hypocenter or not.

Parameters
hypo- A shared_ptr to a CHypo to use when adding references to this hypo. This parameter is passed because issues occurred using this-> to reference data.
allowStealing- A boolean flag indicating whether to allow resolveData to steal data, defaults to true
parentThread- A pointer to a parent Hypolist thread to reprt status to.
Returns
Returns true if the hypocenter's pick list was changed, false otherwise.
void glasscore::CHypo::setCorrelationAdded ( bool  corrAdded)

Sets whether a correlation has been added to this hypo.

Sets whether a correlation has been added to this hypo. This flag is used in preserving hypos generated from correlations long enough for supporting data to be added.

Parameters
corrAdded- a boolean flag indicating whether a correlation has been added to this hypo, true if one has, false otherwise
void glasscore::CHypo::setDepth ( double  z)

Sets the depth for this hypo.

Parameters
z- a double containing the hypo depth in kilometers
void glasscore::CHypo::setFixed ( bool  fixed)

Sets whether this hypo is fixed.

Parameters
fixed- a boolean flag indicating whether this hypo is fixed, true if it is, false otherwise
void glasscore::CHypo::setLatitude ( double  lat)

Set the latitude for this hypo.

Parameters
lat- a double containing the hypo latitude in degrees
void glasscore::CHypo::setLongitude ( double  lon)

Set the longitude for this hypo, accounting for the longitude wrap at +/-180.

Parameters
lon- a double containing the hypo longitude in degrees
void glasscore::CHypo::setNucleationAuditingInfo ( double  tNucleation,
double  tNucleationKeyPickInsertion 
)

Set nucleation auditing info for this hypo.

Parameters
tNucleation- time this hypo was nucleated(Gregorian seconds).
tNucleationKeyPickInsertion- time the key pick for nucleating this hypo was inserted into Glass3(Gregorian seconds).
void glasscore::CHypo::setNucleationDataThreshold ( int  cut)

Sets the threshold that represents the minimum count of data required to successfully nucleate or maintain (via passing cancelCheck() a hypocenter.

If threshold is 10, then 8 picks + 1 correlation + 1 beam would be sufficient, but 9 picks would not be.

Parameters
cut- a double value containing the nucleation minimum stack threshold
void glasscore::CHypo::setNucleationStackThreshold ( double  thresh)

Sets the nucleation stack minimum threshold used in determining hypo viability in cancelCheck()

Parameters
thresh- an integer value containing the nucleation stack minimum threshold
int glasscore::CHypo::setProcessCount ( int  newCycle)

Sets the process count, used by HypoList to prevent continuous hypo reprocessing.

Returns
newCycle - an integer value containing the new process count
void glasscore::CHypo::setTCreate ( double  newTCreate)

Sets the time that this hypo was created.

Parameters
newTCreate- a double containing the hypo creation time in Gregorian seconds
void glasscore::CHypo::setTOrigin ( double  newTOrg)

Sets the origin time for this hypo.

Parameters
newTOrg- a double containing the hypo origin time in Gregorian seconds
void glasscore::CHypo::setTSort ( double  newTSort)

Set the sorting time for this hypo.

Parameters
newTSort- a double containing the hypo sort time in Gregorian seconds
void glasscore::CHypo::trap ( )

Supporting data link checking function.

Causes CHypo to print any data in in it's lists that are either improperly linked or do not belong to this CHypo.

Member Data Documentation

constexpr double glasscore::CHypo::k_dBayesFactorExponent = 2.0
static

The exponent factor used in bayes stack calculations.

constexpr double glasscore::CHypo::k_dBayesFactorMaximumRange = 0.2
static

The maximum range factor used in bayes stack calculations.

constexpr double glasscore::CHypo::k_dBayesFactorStepSizeReduction = 500.0
static

The step size reduction factor used in bayes stack calculations.

constexpr double glasscore::CHypo::k_dFinalAnnealStepReducationFactor = 100.0
static

The final step reduction factor for anneal.

constexpr double glasscore::CHypo::k_dGapTaperDownBegin = 270.0
static

The beginning of the gap taper.

constexpr double glasscore::CHypo::k_dGapTaperDownEnd = 360.0
static

The end of the gap taper.

constexpr double glasscore::CHypo::k_dInitialAnnealStepReducationFactor = .5
static

The initial step reduction factor for anneal.

constexpr double glasscore::CHypo::k_dLocationChangeWebResolutionRatio = 0.5
static
constexpr double glasscore::CHypo::k_dLocationMaxTaperThreshold = 30.0
static

The maximum threshold for the location taper.

constexpr double glasscore::CHypo::k_dLocationMinDistanceStepSize = 1.0
static

The minimum location iteration distance step size.

constexpr double glasscore::CHypo::k_dLocationMinTimeStepSize = 0.1
static

The minimum location iteration time step size.

constexpr double glasscore::CHypo::k_dLocationSearchRadiusToTime = 30.0
static

The factor used to convert the location search radius to time.

constexpr double glasscore::CHypo::k_dLocationTaperConstant = 0.0001
static

The location taper constant.

constexpr double glasscore::CHypo::k_dMinimumDepthChangeKMThreshold = 7.5
static

The minimum depth change in km that constitutes a significant change in location. Used for auditing purposes.

constexpr double glasscore::CHypo::k_dMinimumDepthChangeRatioThreshold = 0.25
static

The minimum depth change (expressed as a ratio to the previous depth, that constitutes a significant change in location. Used for auditing purposes.

constexpr double glasscore::CHypo::k_dResidualSigmaLengthSeconds = 1.0
static

The residual sigma length in seconds.

constexpr double glasscore::CHypo::k_dSearchRadiusFactor = 0.5
static

The factor for dividing when computing the location search radius.

constexpr double glasscore::CHypo::k_dSearchRadiusResolutionFactor = 1.0
static

The factor for dividing the web resolution when computing the location search radius.

constexpr double glasscore::CHypo::k_dSearchRadiusTaperFactor = 0.75
static

The factor for multiplying the taper when computing the location search radius.

constexpr double glasscore::CHypo::k_dTimeToDistanceCorrectionFactor = 10.0
static

The factor to correct time to distance.

constexpr double glasscore::CHypo::k_dVerticalToHorizontalDistanceCorrectionFactor = 2.0
static

The factor to correct vertical to horizontal distance.

const int glasscore::CHypo::k_iLocationNPicksToSkipLarge = 25
static

The large nPick threshold to skip during location.

const int glasscore::CHypo::k_iLocationNPicksToSkipMedium = 10
static

The medium nPick threshold to skip during location.

const int glasscore::CHypo::k_iLocationNPicksToSkipSmall = 5
static

The small nPick threshold to skip during location.

const int glasscore::CHypo::k_iLocationNPickThresholdLarge = 150
static

The nPick threshold indicating a large hypo during location.

const int glasscore::CHypo::k_iLocationNPickThresholdMedium = 50
static

The nPick threshold indicating a medium hypo during location.

const int glasscore::CHypo::k_iLocationNPickThresholdSmall = 25
static

The nPick threshold indicating a small hypo during location.

const int glasscore::CHypo::k_iLocationNumIterationsLarge = 10000
static

The large number of location iterations to perform for a hypo.

const int glasscore::CHypo::k_iLocationNumIterationsMedium = 1250
static

The medium number of location iterations to perform for a hypo.

const int glasscore::CHypo::k_iLocationNumIterationsSmall = 500
static

The small number of location iterations to perform for a hypo.


The documentation for this class was generated from the following files: