OpendTect-6_4  6.4
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DataClipper Class Reference

A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage is desired. More...

Public Member Functions

 DataClipper ()
 
bool isEmpty () const
 
void setApproxNrValues (od_int64 nrsamples, int statsize=2000)
 
void putData (float)
 
void putData (const float *, od_int64 sz)
 
void putData (const ValueSeries< float > &, od_int64 sz)
 
void putData (const ArrayND< float > &)
 
bool calculateRange (float cliprate, Interval< float > &)
 
bool calculateRange (float lowcliprate, float highcliprate, Interval< float > &)
 
bool fullSort ()
 
bool getRange (float cliprate, Interval< float > &) const
 
bool getRange (float lowcliprate, float highcliprate, Interval< float > &) const
 
bool getSymmetricRange (float cliprate, float midval, Interval< float > &) const
 
void reset ()
 
const LargeValVec< float > & statPts () const
 

Static Public Member Functions

static bool calculateRange (float *vals, od_int64 nrvals, float lowcliprate, float highcliprate, Interval< float > &)
 

Protected Attributes

int approxstatsize_
 
float sampleprob_
 
bool subselect_
 
LargeValVec< float > samples_
 
Interval< float > absoluterg_
 

Detailed Description

A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage is desired.

For simple cases, where no subselection is needed (i.e. the stats will be performed on all values, and only one dataset is used) the static function calculateRange is good enough:

DataClipper::calculateRange( mydata.arr(), mydata.size(), 0.05, 0.05,
range );

If there are more than one dataset, or if a subselection is wanted, the class is used as follows:

  1. Create object
  2. If subselection is wanted, set total nr of samples and statsize with setApproxNrValues
  3. Add all your sources putData
  4. If you only want a fixed range, call calculateRange.
  5. If you want to come back an get multiple ranges, call fullSort. After fullSort, the getRange functions can be called, any number of times.
  6. To prepare the object for a new set of data, call reset.

Example

Array3D<float> somedata;
TypeSet<float> moredata;
float otherdata;
DataClipper clipper;
setApproxNrValues( somedata.info().getTotalSz()+moredata.size()+1, 2000 );
clipper.putData( somedata );
clipper.putData( moredata.arr(), moredata.size() );
clipper.putData( otherdata );
clipper.fullSort();
clipper.getRange( 0.01, clip99 );
clipper.getRange( 0.05, clip95 );
clipper.getRange( 0.10, clip90 );

Constructor & Destructor Documentation

DataClipper::DataClipper ( )

cliprate is between 0 and 0.5, cliprate0 is the bottom cliprate, cliprate1 is the top cliprate, when cliprate1 is -1, it will get the value of cliprate0

Member Function Documentation

bool DataClipper::calculateRange ( float  cliprate,
Interval< float > &   
)

Does not do a full sort. Also performes reset

bool DataClipper::calculateRange ( float  lowcliprate,
float  highcliprate,
Interval< float > &   
)

Does not do a full sort. Also performes reset

static bool DataClipper::calculateRange ( float *  vals,
od_int64  nrvals,
float  lowcliprate,
float  highcliprate,
Interval< float > &   
)
static

Does not do a full sort.

Note
vals are modified.
bool DataClipper::fullSort ( )
bool DataClipper::getRange ( float  cliprate,
Interval< float > &   
) const
bool DataClipper::getRange ( float  lowcliprate,
float  highcliprate,
Interval< float > &   
) const
bool DataClipper::getSymmetricRange ( float  cliprate,
float  midval,
Interval< float > &   
) const
bool DataClipper::isEmpty ( ) const
inline
void DataClipper::putData ( float  )
void DataClipper::putData ( const float *  ,
od_int64  sz 
)
void DataClipper::putData ( const ValueSeries< float > &  ,
od_int64  sz 
)
void DataClipper::putData ( const ArrayND< float > &  )
void DataClipper::reset ( )
void DataClipper::setApproxNrValues ( od_int64  nrsamples,
int  statsize = 2000 
)

Will make it faster if large amount of data is used. The Object will then randomly subselect on the input to get about statsize samples to do the stats on.

const LargeValVec<float>& DataClipper::statPts ( ) const
inline

Member Data Documentation

Interval<float> DataClipper::absoluterg_
protected
int DataClipper::approxstatsize_
protected
float DataClipper::sampleprob_
protected
LargeValVec<float> DataClipper::samples_
protected
bool DataClipper::subselect_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019