问题描述
- JAVA-JHepWork数据拟合(curve fitting)报错:“/ is a folder”
-
import java.awt.Color;
import java.util.*;
import jhplot.*;
import jhplot.stat.LinReg;public class ScanTest2 {
public static void main(String[] args) { HPlot c1=new HPlot("cad"); c1.visible(); c1.setAutoRange(); HFitter f=new HFitter(); f.setFunc("g"); P1D p1=new P1D(); p1.setPenWidth(2); p1.setDrawLine(false); p1.setColor(Color.red); Random r=new Random(); for(int i=0;i<=100;i++){ double x=r.nextGaussian(); double y=180+30*x; p1.add(x, y); } c1.draw(p1); //f.fit(p1); //f.fit(p1);
// LinReg lr=new LinReg(p1);
// c1.draw(lr.getResult());
// c1.draw(lr.getPrediction(Color.red));
}}
错误信息:
Exception in thread "main" java.lang.IllegalArgumentException: / is a folder
at hep.aida.ref.tree.Tree.rm(Tree.java:588)
at hep.aida.ref.tree.Tree.add(Tree.java:1129)
at hep.aida.ref.tree.Tree.add(Tree.java:1115)
at hep.aida.ref.tree.Tree.addFromFactory(Tree.java:1110)
at hep.aida.ref.histogram.DataPointSetFactory.create(DataPointSetFactory.java:55)
at hep.aida.ref.histogram.DataPointSetFactory.create(DataPointSetFactory.java:51)
at jhplot.P1D.getIDataPointSet(P1D.java:4799)
at jhplot.HFitter.doFit(HFitter.java:430)
at jhplot.HFitter.fit(HFitter.java:334)
at com.sbl.io.video.ScanTest2.main(ScanTest2.java:36)