#6567 Remove use of GNU GSL

This commit is contained in:
Gaute Lindkvist
2020-09-23 15:48:19 +02:00
parent 2741b24e27
commit 9afac51bca
15 changed files with 32 additions and 231 deletions

View File

@@ -152,8 +152,6 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
{
CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values", "", "", "" );
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
@@ -192,14 +190,6 @@ RimCorrelationMatrixPlot::~RimCorrelationMatrixPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationMatrixPlot::CorrelationFactor RimCorrelationMatrixPlot::correlationFactor() const
{
return m_correlationFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -264,10 +254,10 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
const QVariant& newValue )
{
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
changedField == &m_sortByValues || changedField == &m_sortByAbsoluteValues ||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount ||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList )
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByValues ||
changedField == &m_sortByAbsoluteValues || changedField == &m_showOnlyTopNCorrelations ||
changedField == &m_topNFilterCount || changedField == &m_excludeParametersWithoutVariation ||
changedField == &m_selectedParametersList )
{
if ( changedField == &m_excludeParametersWithoutVariation )
{
@@ -284,8 +274,7 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
correlationGroup->add( &m_correlationFactor );
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
correlationGroup->add( &m_excludeParametersWithoutVariation );
correlationGroup->add( &m_selectedParametersList );
correlationGroup->add( &m_showAbsoluteValues );
@@ -553,14 +542,7 @@ void RimCorrelationMatrixPlot::createMatrix()
if ( parameterValues.empty() ) continue;
if ( m_correlationFactor == CorrelationFactor::PEARSON )
{
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
}
else
{
correlation = RiaStatisticsTools::spearmanCorrelation( parameterValues, caseValuesAtTimestep );
}
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
bool validResult = RiaCurveDataTools::isValidValue( correlation, false );
if ( validResult )
@@ -655,9 +637,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
{
if ( m_useAutoPlotTitle )
{
m_description = QString( "%1 Matrix for Parameters vs Result Vectors at %2" )
.arg( m_correlationFactor().uiText() )
.arg( timeStepString() );
m_description = QString( "Correlation Matrix for Parameters vs Result Vectors at %2" ).arg( timeStepString() );
}
if ( m_plotWidget )

View File

@@ -39,9 +39,6 @@ public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> matrixCellSelected;
public:
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
enum class Sorting
{
NO_SORTING,
@@ -55,7 +52,6 @@ public:
RimCorrelationMatrixPlot();
~RimCorrelationMatrixPlot() override;
CorrelationFactor correlationFactor() const;
bool showAbsoluteValues() const;
bool sortByAbsoluteValues() const;
RimRegularLegendConfig* legendConfig();
@@ -85,14 +81,13 @@ private:
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<SortingEnum> m_sortByValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<SortingEnum> m_sortByValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;

View File

@@ -47,19 +47,6 @@
#include <map>
#include <set>
namespace caf
{
template <>
void caf::AppEnum<RimCorrelationPlot::CorrelationFactor>::setUp()
{
addItem( RimCorrelationPlot::CorrelationFactor::PEARSON, "PEARSON", "Pearson Correlation Coefficient" );
#ifdef USE_GSL
addItem( RimCorrelationPlot::CorrelationFactor::SPEARMAN, "SPEARMAN", "Spearman's Rank Correlation Coefficient" );
#endif
setDefault( RimCorrelationPlot::CorrelationFactor::PEARSON );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimCorrelationPlot, "CorrelationPlot" );
//--------------------------------------------------------------------------------------------------
@@ -71,8 +58,6 @@ RimCorrelationPlot::RimCorrelationPlot()
{
CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_excludeParametersWithoutVariation,
@@ -111,10 +96,9 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
const QVariant& newValue )
{
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
changedField == &m_sortByAbsoluteValues || changedField == &m_excludeParametersWithoutVariation ||
changedField == &m_selectedParametersList || changedField == &m_showOnlyTopNCorrelations ||
changedField == &m_topNFilterCount )
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByAbsoluteValues ||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList ||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount )
{
if ( changedField == &m_excludeParametersWithoutVariation )
{
@@ -130,8 +114,7 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
correlationGroup->add( &m_correlationFactor );
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
correlationGroup->add( &m_excludeParametersWithoutVariation );
correlationGroup->add( &m_selectedParametersList );
@@ -264,10 +247,7 @@ void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chart
auto address = *addresses().begin();
std::vector<std::pair<EnsembleParameter, double>> correlations =
ensemble->parameterCorrelations( address,
selectedTimestep,
m_correlationFactor == CorrelationFactor::SPEARMAN,
m_selectedParametersList() );
ensemble->parameterCorrelations( address, selectedTimestep, m_selectedParametersList() );
QString timestepString = m_timeStep().toString( RiaPreferences::current()->dateTimeFormat() );
@@ -290,11 +270,8 @@ void RimCorrelationPlot::updatePlotTitle()
if ( m_useAutoPlotTitle && !ensembles().empty() )
{
auto ensemble = *ensembles().begin();
m_description = QString( "%1 for %2, %3 at %4" )
.arg( m_correlationFactor().uiText() )
.arg( ensemble->name() )
.arg( m_selectedVarsUiField )
.arg( timeStepString() );
m_description =
QString( "Correlations for %2, %3 at %4" ).arg( ensemble->name() ).arg( m_selectedVarsUiField ).arg( timeStepString() );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
@@ -321,22 +298,6 @@ void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle,
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot::CorrelationFactor RimCorrelationPlot::correlationFactor() const
{
return m_correlationFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::setCorrelationFactor( CorrelationFactor factor )
{
m_correlationFactor = factor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -40,21 +40,10 @@ class RimCorrelationPlot : public RimAbstractCorrelationPlot
public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> tornadoItemSelected;
public:
enum class CorrelationFactor
{
PEARSON,
SPEARMAN
};
using CorrelationFactorEnum = caf::AppEnum<CorrelationFactor>;
public:
RimCorrelationPlot();
~RimCorrelationPlot() override;
CorrelationFactor correlationFactor() const;
void setCorrelationFactor( CorrelationFactor factor );
bool showAbsoluteValues() const;
void setShowAbsoluteValues( bool showAbsoluteValues );
@@ -84,11 +73,10 @@ private:
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
};

View File

@@ -320,7 +320,6 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
m_parameterResultCrossPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
m_parameterResultCrossPlot->setAxisValueFontSize( m_axisValueFontSize() );
m_correlationPlot->setCorrelationFactor( m_correlationMatrixPlot->correlationFactor() );
m_correlationPlot->setShowAbsoluteValues( m_correlationMatrixPlot->showAbsoluteValues() );
m_correlationPlot->setSortByAbsoluteValues( m_correlationMatrixPlot->sortByAbsoluteValues() );

View File

@@ -38,8 +38,6 @@ class RiuMultiPlotPage;
class RimCorrelationReportPlot : public QObject, public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
public:
RimCorrelationReportPlot();