use of de.lmu.ifi.dbs.elki.result.ScalesResult in project elki by elki-project.
the class OpenGL3DParallelCoordinates method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
boolean nonefound = true;
List<Relation<?>> rels = ResultUtil.getRelations(newResult);
for (Relation<?> rel : rels) {
if (!TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
continue;
}
@SuppressWarnings("unchecked") Relation<? extends O> vrel = (Relation<? extends O>) rel;
ScalesResult scales = ScalesResult.getScalesResult(vrel);
ProjectionParallel proj = new SimpleParallel(null, scales.getScales());
PropertiesBasedStyleLibrary stylelib = new PropertiesBasedStyleLibrary();
StylingPolicy stylepol = getStylePolicy(hier, stylelib);
new Instance<>(vrel, proj, settings, stylepol, stylelib).run();
nonefound = false;
}
if (nonefound && hier.equals(newResult)) {
LOG.warning("3DPC did not find a number vector field relation to visualize!");
}
}
use of de.lmu.ifi.dbs.elki.result.ScalesResult in project elki by elki-project.
the class AddSingleScale method run.
/**
* Add scales to a single vector relation.
*
* @param rel Relation
* @return Scales
*/
private ScalesResult run(Relation<? extends NumberVector> rel) {
final int dim = RelationUtil.dimensionality(rel);
LinearScale[] scales = new LinearScale[dim];
if (minmax == null) {
DoubleMinMax mm = new DoubleMinMax();
for (DBIDIter iditer = rel.iterDBIDs(); iditer.valid(); iditer.advance()) {
NumberVector vec = rel.get(iditer);
for (int d = 0; d < dim; d++) {
final double val = vec.doubleValue(d);
if (val != val) {
// NaN
continue;
}
mm.put(val);
}
}
LinearScale scale = new LinearScale(mm.getMin(), mm.getMax());
for (int i = 0; i < dim; i++) {
scales[i] = scale;
}
} else {
// Use predefined.
LinearScale scale = new LinearScale(minmax[0], minmax[1]);
for (int i = 0; i < dim; i++) {
scales[i] = scale;
}
}
ScalesResult res = new ScalesResult(scales);
return res;
}
use of de.lmu.ifi.dbs.elki.result.ScalesResult in project elki by elki-project.
the class AddUniformScale method run.
/**
* Add scales to a single vector relation.
*
* @param rel Relation
* @return Scales
*/
private ScalesResult run(Relation<? extends NumberVector> rel) {
double[][] mms = RelationUtil.computeMinMax(rel);
int dim = mms[0].length;
double delta = 0.;
for (int d = 0; d < dim; d++) {
double del = mms[1][d] - mms[0][d];
delta = del > delta ? del : delta;
}
if (delta < Double.MIN_NORMAL) {
delta = 1.;
}
int log10res = (int) Math.ceil(Math.log10(delta / (LinearScale.MAXTICKS - 1)));
double res = MathUtil.powi(10, log10res);
// Target width
double target = Math.ceil(delta / res) * res;
LinearScale[] scales = new LinearScale[dim];
for (int d = 0; d < dim; d++) {
double mid = (mms[0][d] + mms[1][d] - target) * .5;
double min = Math.floor(mid / res) * res;
double max = Math.ceil((mid + target) / res) * res;
scales[d] = new LinearScale(min, max);
}
return new ScalesResult(scales);
}
use of de.lmu.ifi.dbs.elki.result.ScalesResult in project elki by elki-project.
the class AddUniformScale method run.
@SuppressWarnings("unchecked")
@Override
public Result run(Database database) {
for (Relation<?> rel : database.getRelations()) {
if (TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
ScalesResult res = run((Relation<? extends NumberVector>) rel);
ResultUtil.addChildResult(rel, res);
}
}
return null;
}
use of de.lmu.ifi.dbs.elki.result.ScalesResult in project elki by elki-project.
the class AddSingleScale method run.
@SuppressWarnings("unchecked")
@Override
public Result run(Database database) {
for (Relation<?> rel : database.getRelations()) {
if (TypeUtil.NUMBER_VECTOR_FIELD.isAssignableFromType(rel.getDataTypeInformation())) {
ScalesResult res = run((Relation<? extends NumberVector>) rel);
ResultUtil.addChildResult(rel, res);
}
}
return null;
}
Aggregations