Search in sources :

Example 56 with InvalidSettingsException

use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.

the class FileWorkflowPersistor method loadOutPortTemplate.

/**
 * Sub class hook o read port settings.
 *
 * @param settings Ignored.
 * @return null
 * @throws InvalidSettingsException Not actually thrown here.
 */
WorkflowPortTemplate loadOutPortTemplate(final NodeSettingsRO settings) throws InvalidSettingsException {
    if (getLoadVersion().isOlderThan(LoadVersion.V200)) {
        throw new InvalidSettingsException("No ports for metanodes in version 1.x.x");
    } else {
        int index = settings.getInt("index");
        String name = settings.getString("name");
        NodeSettingsRO portTypeSettings = settings.getNodeSettings("type");
        PortType type = PortType.load(portTypeSettings);
        WorkflowPortTemplate result = new WorkflowPortTemplate(index, type);
        result.setPortName(name);
        return result;
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) PortType(org.knime.core.node.port.PortType)

Example 57 with InvalidSettingsException

use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.

the class OneWayANOVANodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
    DataTableSpec spec = inSpecs[0];
    if (m_settings.getGroupingColumn() == null || !spec.containsName(m_settings.getGroupingColumn())) {
        throw new InvalidSettingsException("Please define a grouping column.");
    }
    FilterResult filterResult = m_settings.getTestColumns().applyTo(spec);
    if (filterResult.getIncludes().length == 0) {
        if (filterResult.getExcludes().length > 0) {
            throw new InvalidSettingsException("Please select at least " + "one test column.");
        } else {
            throw new InvalidSettingsException("There are no numeric columns " + "in the input table. At least one numeric column " + "is needed to perform the test.");
        }
    }
    if (m_settings.getConfidenceIntervalProb() > 0.99 || m_settings.getConfidenceIntervalProb() < 0.01) {
        throw new InvalidSettingsException("The property " + "\"Confidence Interval (in %)\" must be in the range " + "[1, 99].");
    }
    return new DataTableSpec[] { OneWayANOVAStatistics.getTableSpec(), LeveneTestStatistics.getTableSpec(), OneWayANOVAStatistics.getGroupStatisticsSpec() };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Example 58 with InvalidSettingsException

use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.

the class OneWayANOVANodeModel method getGroups.

private List<String> getGroups(final BufferedDataTable inData, final ExecutionMonitor exec) throws InvalidSettingsException, CanceledExecutionException {
    DataTableSpec spec = inData.getSpec();
    int gIndex = spec.findColumnIndex(m_settings.getGroupingColumn());
    LinkedHashSet<String> groups = new LinkedHashSet<String>();
    if (gIndex < 0) {
        throw new InvalidSettingsException("Grouping column not found.");
    }
    final int rowCount = inData.getRowCount();
    int rowIndex = 0;
    for (DataRow row : inData) {
        exec.checkCanceled();
        exec.setProgress(rowIndex++ / (double) rowCount, rowIndex + "/" + rowCount + " (\"" + row.getKey() + "\")");
        DataCell group = row.getCell(gIndex);
        if (!group.isMissing()) {
            groups.add(group.toString());
        }
    }
    return Arrays.asList(groups.toArray(new String[groups.size()]));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DataTableSpec(org.knime.core.data.DataTableSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DataCell(org.knime.core.data.DataCell) DataRow(org.knime.core.data.DataRow)

Example 59 with InvalidSettingsException

use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.

the class OneSampleTTestNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
    DataTableSpec spec = inSpecs[0];
    FilterResult filterResult = m_settings.getTestColumns().applyTo(spec);
    if (filterResult.getIncludes().length == 0) {
        if (filterResult.getExcludes().length > 0) {
            throw new InvalidSettingsException("Please select at least " + "one test column.");
        } else {
            throw new InvalidSettingsException("There are no numeric columns " + "in the input table. At least one numeric column " + "is needed to perform the test.");
        }
    }
    if (m_settings.getConfidenceIntervalProb() > 0.99 || m_settings.getConfidenceIntervalProb() < 0.01) {
        throw new InvalidSettingsException("The property " + "\"Confidence Interval (in %)\" must be in the range " + "[1, 99].");
    }
    return new DataTableSpec[] { OneSampleTTestStatistics.getTableSpec(), OneSampleTTestStatistics.getDescStatsSpec() };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Example 60 with InvalidSettingsException

use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.

the class TwoSampleTTestNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
    DataTableSpec spec = inSpecs[0];
    if (m_settings.getGroupingColumn() == null || !spec.containsName(m_settings.getGroupingColumn())) {
        throw new InvalidSettingsException("Please define a grouping column.");
    }
    if (m_settings.getGroupOne() == null) {
        throw new InvalidSettingsException("Value of group one is not set.");
    }
    if (m_settings.getGroupTwo() == null) {
        throw new InvalidSettingsException("Value of group two is not set.");
    }
    FilterResult filterResult = m_settings.getTestColumns().applyTo(spec);
    if (filterResult.getIncludes().length == 0) {
        if (filterResult.getExcludes().length > 0) {
            throw new InvalidSettingsException("Please select at least " + "one test column.");
        } else {
            throw new InvalidSettingsException("There are no numeric columns " + "in the input table. At least one numeric column " + "is needed to perform the test.");
        }
    }
    if (m_settings.getConfidenceIntervalProb() > 0.99 || m_settings.getConfidenceIntervalProb() < 0.01) {
        throw new InvalidSettingsException("The property " + "\"Confidence Interval (in %)\" must be in the range " + "[1, 99].");
    }
    return new DataTableSpec[] { TwoSampleTTestStatistics.getTableSpec(), LeveneTestStatistics.getTableSpec(), TwoSampleTTestStatistics.getGroupStatisticsSpec() };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Aggregations

InvalidSettingsException (org.knime.core.node.InvalidSettingsException)818 DataTableSpec (org.knime.core.data.DataTableSpec)278 DataColumnSpec (org.knime.core.data.DataColumnSpec)211 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)153 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)121 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)113 IOException (java.io.IOException)109 DataCell (org.knime.core.data.DataCell)99 ArrayList (java.util.ArrayList)96 DataType (org.knime.core.data.DataType)89 PortObjectSpec (org.knime.core.node.port.PortObjectSpec)82 File (java.io.File)72 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)69 DataRow (org.knime.core.data.DataRow)66 DoubleValue (org.knime.core.data.DoubleValue)58 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)48 SettingsModelFilterString (org.knime.core.node.defaultnodesettings.SettingsModelFilterString)47 FileInputStream (java.io.FileInputStream)43 LinkedHashMap (java.util.LinkedHashMap)42 NotConfigurableException (org.knime.core.node.NotConfigurableException)41