git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@76709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
30eba80a83
commit
c82e445bdf
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.contentmanagement.graphtools.data.conversions.ImageTools;
|
||||
import org.gcube.contentmanagement.graphtools.plotting.graphs.GaussianDistributionGraph;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.DatabaseFactory;
|
||||
|
@ -19,6 +20,7 @@ import org.gcube.dataanalysis.geo.insertion.RasterTable;
|
|||
import org.gcube.dataanalysis.geo.meta.features.FeaturesManager;
|
||||
import org.gcube.dataanalysis.geo.retrieval.GeoIntersector;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.data.function.NormalDistributionFunction2D;
|
||||
import org.jfree.data.general.DatasetUtilities;
|
||||
import org.jfree.data.xy.XYSeriesCollection;
|
||||
|
@ -59,6 +61,12 @@ public class MapsComparator extends StandardLocalExternalAlgorithm{
|
|||
int time1 = ((time1$!=null) && (time1$.trim().length()>0))? Integer.parseInt(time1$):0;
|
||||
int time2 = ((time2$!=null) && (time2$.trim().length()>0))? Integer.parseInt(time2$):0;
|
||||
|
||||
if (time1<0)
|
||||
time1=0;
|
||||
|
||||
if (time2<0)
|
||||
time2=0;
|
||||
|
||||
double valuesthreshold = 0.1;
|
||||
if ((valuesthr$!=null)&&(valuesthr$.trim().length()>0))
|
||||
try{valuesthreshold =Double.parseDouble(valuesthr$);}catch(Exception ee){}
|
||||
|
@ -129,7 +137,7 @@ public class MapsComparator extends StandardLocalExternalAlgorithm{
|
|||
AnalysisLogger.getLogger().debug("MapsComparator: Analyzing discrepancy between maps: "+rastertable1+" and "+rastertable2);
|
||||
DiscrepancyAnalysis da = new DiscrepancyAnalysis();
|
||||
da.setConfiguration(config);
|
||||
da.init();
|
||||
da.init(false);
|
||||
outputParameters = da.analyze();
|
||||
outputParameters.put("Resolution", ""+resolution);
|
||||
status = 80;
|
||||
|
@ -185,20 +193,26 @@ public class MapsComparator extends StandardLocalExternalAlgorithm{
|
|||
AnalysisLogger.getLogger().debug("MapsComparator: Producing Gaussian Distribution for the errors");
|
||||
//build image:
|
||||
HashMap<String, Image> producedImages = new HashMap<String, Image>();
|
||||
GaussianDistributionGraph gauss = new GaussianDistributionGraph("Error Distribution");
|
||||
|
||||
//gaussian
|
||||
XYSeriesCollection xyseriescollection = new XYSeriesCollection();
|
||||
double mean = Double.parseDouble(outputParameters.get("MEAN"));
|
||||
double variance = Double.parseDouble(outputParameters.get("VARIANCE"));
|
||||
if (variance==0)
|
||||
variance=0.01;
|
||||
|
||||
AnalysisLogger.getLogger().debug("MapsComparator: Adopting mean:"+ mean+" and variance:"+variance);
|
||||
|
||||
NormalDistributionFunction2D normaldistributionfunction2d = new NormalDistributionFunction2D(mean,variance);
|
||||
org.jfree.data.xy.XYSeries xyseries = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d, 0, mean, 121, "NormalDistribution");
|
||||
org.jfree.data.xy.XYSeries xyseries = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d, (mean-(2*variance)), (mean+(2*variance)), 121, "Distribution of the Error");
|
||||
xyseriescollection.addSeries(xyseries);
|
||||
producedImages.put("Gaussian Distribution of the Error", gauss.renderImgObject(680, 420, xyseriescollection));
|
||||
//end gaussian
|
||||
JFreeChart chart = GaussianDistributionGraph.createStaticChart(xyseriescollection, mean, variance);
|
||||
Image image = ImageTools.toImage(chart.createBufferedImage(680, 420));
|
||||
producedImages.put("Gaussian Distribution of the Error", image);
|
||||
|
||||
PrimitiveType images = new PrimitiveType(HashMap.class.getName(), producedImages, PrimitiveTypes.IMAGES, "ErrorRepresentation", "Graphical representation of the error spread");
|
||||
|
||||
gauss.render(xyseriescollection);
|
||||
// gauss.render(xyseriescollection);
|
||||
//end build image
|
||||
AnalysisLogger.getLogger().debug("MapsComparator: Gaussian Distribution Produced");
|
||||
//collect all the outputs
|
||||
|
|
Loading…
Reference in New Issue