|
[HepData-svn] r1807 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formatsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Jul 24 09:31:37 BST 2014
Author: watt Date: Thu Jul 24 09:31:36 2014 New Revision: 1807 Log: Support all signs for errors in output formatters Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MarcXMLFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java Thu Jul 24 09:30:13 2014 (r1806) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/BdmsFormatter.java Thu Jul 24 09:31:36 2014 (r1807) @@ -273,8 +273,8 @@ else{ s.append(" +- " + f_plus + norm);} } else{ - if(yax.getPoint(i+1).getErrors().size()==1&&err.getSourceType().toString().equals("statistical")){ s.append(" (STAT=+" + f_plus + norm + ",-" + f_minus + norm+")");} - else { s.append(" +" + f_plus + norm + ",-" + f_minus + norm);} + if(yax.getPoint(i+1).getErrors().size()==1&&err.getSourceType().toString().equals("statistical")){ s.append(" (STAT=+" + f_plus + norm + "," + f_minus + norm+")");} + else { s.append(" +" + f_plus + norm + "," + f_minus + norm);} } } else if(nerr == 2) { @@ -283,14 +283,24 @@ // if(err.isSymmetric()) {s.append(err.getPlus() + norm);} // else{s.append("+" + err.getPlus() + norm + ",-" + err.getMinus() + norm);} if(err.isSymmetric()) {s.append(f_plus + norm);} - else{s.append("+" + f_plus + norm + ",-" + f_minus + norm);} + else { + if (err.getPlus() < 0.0) { s.append("" + f_plus + norm); } + else { s.append("+" + f_plus + norm); } + if (err.getMinus() < 0.0) { s.append("," + f_minus + norm); } + else { s.append(",+" + f_minus + norm); } + } } else { s.append(",DSYS="); // if(err.isSymmetric()) {s.append(err.getPlus() + norm);} // else{s.append("+" + err.getPlus() + norm + ",-" + err.getMinus() + norm);} if(err.isSymmetric()) {s.append(f_plus + norm);} - else{s.append("+" + f_plus + norm + ",-" + f_minus + norm);} + else { + if (err.getPlus() < 0.0) { s.append("" + f_plus + norm); } + else { s.append("+" + f_plus + norm); } + if (err.getMinus() < 0.0) { s.append("," + f_minus + norm); } + else { s.append(",+" + f_minus + norm); } + } } } if(nerr > 1) { s.append(")");} Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Thu Jul 24 09:30:13 2014 (r1806) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Thu Jul 24 09:31:36 2014 (r1807) @@ -303,7 +303,7 @@ s.append(" +- " + f_plus + norm); } else{ - s.append(" +" + f_plus + norm + ",-" + f_minus + norm); + s.append(" +" + f_plus + norm + "," + f_minus + norm); } } else if(nerr == 2) { @@ -314,14 +314,22 @@ s.append(" (DSYS="); } if(err.isSymmetric()) {s.append(f_plus + norm);} - else if (err.getPlus() < 0.0) { s.append("" + f_plus + norm + ",+" + f_minus + norm); } - else{s.append("+" + f_plus + norm + ",-" + f_minus + norm);} - } + else { + if (err.getPlus() < 0.0) { s.append("" + f_plus + norm); } + else { s.append("+" + f_plus + norm); } + if (err.getMinus() < 0.0) { s.append("," + f_minus + norm); } + else { s.append(",+" + f_minus + norm); } + } + } else { s.append(",DSYS="); if(err.isSymmetric()) {s.append(f_plus + norm);} - else if (err.getPlus() < 0.0) { s.append("" + f_plus + norm + ",+" + f_minus + norm); } - else{s.append("+" + f_plus + norm + ",-" + f_minus + norm);} + else { + if (err.getPlus() < 0.0) { s.append("" + f_plus + norm); } + else { s.append("+" + f_plus + norm); } + if (err.getMinus() < 0.0) { s.append("," + f_minus + norm); } + else { s.append(",+" + f_minus + norm); } + } } if(err.getComment() != null && !err.getComment().equals("")) { s.append(":" + err.getComment()); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java Thu Jul 24 09:30:13 2014 (r1806) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java Thu Jul 24 09:31:36 2014 (r1807) @@ -98,7 +98,7 @@ else{ ref = "no reference"; } - String tfp = ""; + String tfp = "Location:"; for ( String comment : d.getComments()){ if(comment.startsWith("Location:")){ tfp = comment; @@ -150,7 +150,7 @@ row.setAttribute("xfocus", xfocus); } Double yval = p.getValue(); - String ydesc = p.getDescription(); + String ydesc = p.getDescription(); Double statdn = 0.0; Double statup = 0.0; Double systdn = 0.0; @@ -169,6 +169,7 @@ if(nc == 1){ statup = ae.getPlus(); statdn = ae.getMinus(); + if (statdn < 0.0) { statdn = -statdn; } // G.W. 23/07/2014 } else { systup += ae.getPlus()*ae.getPlus(); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MarcXMLFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MarcXMLFormatter.java Thu Jul 24 09:30:13 2014 (r1806) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MarcXMLFormatter.java Thu Jul 24 09:31:36 2014 (r1807) @@ -284,7 +284,7 @@ public static String _numbersXML(Dataset ds){ StringBuffer s = new StringBuffer(); - // first deal with any dataser errors + // first deal with any dataset errors for (DatasetError de : ds.getErrors()){ s.append(" <error>"); s.append("Additional systematic error: "); @@ -516,9 +516,8 @@ s.append(e.getNormType().toSymbol()); } else { vale = new SignificantFigures(e.getPlus()); - if(e.getPlus()<0.0){ s.append("");} - else if(e.getPlus() > e.getMinus()) { s.append(" +"); } - else { s.append(" +"); } + if (e.getPlus()<0.0) { s.append(""); } + else { s.append(" +"); } if (e.getNormType() == ErrorNorm.PCT) { lsd = vale.getLSD(); } msd = vale.getMSD(); if (msd <= 0) msd = 1; @@ -526,9 +525,8 @@ else { s.append(Formats.forms(e.getPlus(), msd, -lsd)); } s.append(e.getNormType().toSymbol()); vale = new SignificantFigures(e.getMinus()); - if(e.getPlus()<0.0){ s.append(",+");} - else if(e.getPlus() > e.getMinus()) { s.append(",-");} - else { s.append(",-"); } + if (e.getMinus()<0.0) { s.append(","); } + else { s.append(",+"); } if (e.getNormType() == ErrorNorm.PCT) { lsd = vale.getLSD(); } msd = vale.getMSD(); if (msd <= 0) msd = 1; Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Thu Jul 24 09:30:13 2014 (r1806) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Thu Jul 24 09:31:36 2014 (r1807) @@ -261,17 +261,21 @@ for (Uncertainty e : d.getYAxis(ny).getPoint(r).getErrors()) { try { Uncertainty ae = e.getAbsoluteError(d.getYAxis(ny).getPoint(r)); - if(ae.isSymmetricReversed()){ - s.append("\t" + ae.getPlus()); + if (ae.isSymmetricReversed()) { + s.append("\t" + ae.getPlus()); s.append("\t+" + ae.getMinus()); - } - else if (ae.getPlus() < 0.0) { - s.append("\t" + ae.getPlus()); + } else if (ae.getPlus() < 0.0 && ae.getMinus() > 0.0) { + s.append("\t" + ae.getPlus()); + s.append("\t+" + ae.getMinus()); + } else if (ae.getPlus() < 0.0 && ae.getMinus() < 0.0) { + s.append("\t" + ae.getPlus()); + s.append("\t" + ae.getMinus()); + } else if (ae.getPlus() > 0.0 && ae.getMinus() > 0.0) { + s.append("\t+" + ae.getPlus()); s.append("\t+" + ae.getMinus()); - } - else { + } else { s.append("\t+" + ae.getPlus()); - s.append("\t-" + ae.getMinus()); + s.append("\t" + ae.getMinus()); } } catch (HDException hde) { s.append("\t+?\t?");
More information about the HepData-svn mailing list |