From 21d935e35e6bfb833af6789bdb46d95bf6c2bbf3 Mon Sep 17 00:00:00 2001 From: Simon Ebner Date: Mon, 23 Sep 2013 09:55:41 +0200 Subject: [PATCH] Issue FDA-79 Removed restriction for manipulation --- ch.psi.fda/.classpath | 6 ++- .../core/manipulator/JythonManipulation.java | 3 +- .../ch/psi/fda/visualizer/Visualizer.java | 17 +++++++- .../templates/scan1d_manipulationNoDouble.xml | 43 +++++++++++++++++++ 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 ch.psi.fda/src/test/resources/home/scans/templates/scan1d_manipulationNoDouble.xml diff --git a/ch.psi.fda/.classpath b/ch.psi.fda/.classpath index 3865a70..2da5706 100644 --- a/ch.psi.fda/.classpath +++ b/ch.psi.fda/.classpath @@ -28,6 +28,10 @@ - + + + + + diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/manipulator/JythonManipulation.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/manipulator/JythonManipulation.java index 3cb0e53..ce6616a 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/manipulator/JythonManipulation.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/manipulator/JythonManipulation.java @@ -261,7 +261,8 @@ public class JythonManipulation implements Manipulation{ return(((Integer)r).doubleValue()); } else{ - return Double.NaN; +// return Double.NaN; + return r; } } } catch (ScriptException e) { diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/visualizer/Visualizer.java b/ch.psi.fda/src/main/java/ch/psi/fda/visualizer/Visualizer.java index d420182..309e06e 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/visualizer/Visualizer.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/visualizer/Visualizer.java @@ -141,7 +141,22 @@ public class Visualizer { // XYSeriesP series = ((LinePlot) xyfilter.getPlot()).getData().getSeries(xyfilter.getCount()); // TODO Does not work with multiple series filter per plot !!!! XYSeriesP series = xyfilter.getActualSeries(); // TODO Does not work with multiple series filter per plot !!!! // series.add((Double) m.getData().get(xyfilter.getIndexX()), (Double) m.getData().get(xyfilter.getIndexY())); - series.add((Double) m.getData().get(xyfilter.getIndexX()), (Double) m.getData().get(xyfilter.getIndexY()), updateAtStreamElement); + + + // There might be other values than double in the data, therefore we have to check for it + Object dX = m.getData().get(xyfilter.getIndexX()); + Object dY = m.getData().get(xyfilter.getIndexY()); + Double dataX = Double.NaN; + Double dataY = Double.NaN; + if(dX instanceof Double){ + dataX = (Double) dX; + } + if(dY instanceof Double){ + dataY = (Double) dY; + } + + // Add Data to the series + series.add(dataX , dataY, updateAtStreamElement); } if(filter instanceof XYSeriesArrayDataFilter){ final XYSeriesArrayDataFilter xyfilter = (XYSeriesArrayDataFilter) filter; diff --git a/ch.psi.fda/src/test/resources/home/scans/templates/scan1d_manipulationNoDouble.xml b/ch.psi.fda/src/test/resources/home/scans/templates/scan1d_manipulationNoDouble.xml new file mode 100644 index 0000000..4195eb3 --- /dev/null +++ b/ch.psi.fda/src/test/resources/home/scans/templates/scan1d_manipulationNoDouble.xml @@ -0,0 +1,43 @@ + + + + + + + + 0.0 + 8.0 + 0.5 + + + + + + + + + + + + + + + + + + + + + + + +