/**
   * Output dataset for the given run number. This is a dataset wrapped around {@link
   * #getValues(int)} and {@link #getValueNames()}.
   *
   * @param run run number
   * @return collector function values.
   * @throws CDataGridException if problem creating dataset
   */
  private CDataCacheContainer getValuesAsDataset(int run) throws CDataGridException {
    // Set up new Casper container for the results
    String columnNames = columnHeading + ",Value";
    final Class<?>[] columnTypes = new Class[] {String.class, Double.class};

    CDataCacheContainer container =
        CDataCacheContainer.newInsertionOrdered(getName(), columnNames, columnTypes);

    // Fill container with values from the arrays
    double[] values = getValues(run);
    String[] names = getValueNames();

    if (values.length != names.length) {
      throw new IllegalArgumentException(
          "\""
              + getShortName()
              + "\" values.length ("
              + values.length
              + ") != names.length ("
              + names.length
              + ")");
    }

    for (int i = 0; i < values.length; i++) {
      container.addSingleRow(new Object[] {names[i], values[i]});
    }

    return container;
  }
Пример #2
0
  /**
   * Construct {@link Glimmix} from casper container. The container must have a string column called
   * "Effect" which specifies the variable name, and a double column called "Estimate" which
   * specifies the variables coefficient.
   *
   * @param container casper container
   * @throws CDataGridException if problem reading container
   */
  public Glimmix(CDataCacheContainer container) throws CDataGridException {
    CRowMetaData meta = container.getMetaDefinition();
    CDataRowSet rows = container.getAll();

    while (rows.next()) {
      String effect = rows.getString("Effect");

      // if this effect has levels, append the level
      // to the effect name
      if (meta.containsColumn(effect)) {
        effect = effect + "Lvl" + rows.getString(effect);
      }

      effectEstimates.put(effect, rows.getDouble("Estimate"));
    }
  }