|
[HepData-svn] r1803 - in trunk/hepdata-webapp/src/main: java/cedar/hepdata/formats java/cedar/hepdata/webapp/components resources/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Jul 11 18:55:21 BST 2014
Author: watt Date: Fri Jul 11 18:55:21 2014 New Revision: 1803 Log: Fix formatting of systematic uncertainties with flipped signs Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Wed Jun 25 13:33:33 2014 (r1802) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java Fri Jul 11 18:55:21 2014 (r1803) @@ -314,11 +314,13 @@ 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 { 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);} } if(err.getComment() != null && !err.getComment().equals("")) { Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Wed Jun 25 13:33:33 2014 (r1802) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Fri Jul 11 18:55:21 2014 (r1803) @@ -265,6 +265,10 @@ s.append("\t" + ae.getPlus()); s.append("\t+" + ae.getMinus()); } + else if (ae.getPlus() < 0.0) { + s.append("\t" + ae.getPlus()); + s.append("\t+" + ae.getMinus()); + } else { s.append("\t+" + ae.getPlus()); s.append("\t-" + ae.getMinus()); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Wed Jun 25 13:33:33 2014 (r1802) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Fri Jul 11 18:55:21 2014 (r1803) @@ -23,29 +23,29 @@ public class DatasetAsHtml { @Inject - private RequestGlobals _reqGlobals; + private RequestGlobals _reqGlobals; @Inject - @Path("context:/button_expand.png") - private Asset button_expand; + @Path("context:/button_expand.png") + private Asset button_expand; @Inject - @Path("context:/button_hide.png") - private Asset button_hide; + @Path("context:/button_hide.png") + private Asset button_hide; @Parameter - private String _format; + private String _format; public String getFormat() { return _format; } public void getFormat(String f) { _format = f; } @BeginRender - void renderMessage(MarkupWriter writer) { + void renderMessage(MarkupWriter writer) { String dsid = "datacell"+_dataset.getId().toString(); // Output the table comment(CT) omitting the location(TFP) - // writer.element("p"); + // writer.element("p"); writer.attributes("class", "datasetcomments"); boolean verbatim = false; boolean plotit = true; @@ -57,8 +57,8 @@ int iend = ls; int ihash = comment.indexOf("#"); if(ihash>0) { iend = ihash; } -// writer.element("br"); writer.end(); -// writer.write(comment.substring(0,iend)); + // writer.element("br"); writer.end(); + // writer.write(comment.substring(0,iend)); if(iend<ls){ comment=comment.substring(ihash+1); ls=comment.length(); @@ -69,7 +69,7 @@ } } - // now try to deal with additional dataset errors... + // now try to deal with additional dataset errors... for (DatasetError de : _dataset.getErrors()){ writer.write("Additional systematic error: "); if(de.getPlus() != 0.0 || de.getPlus() != 0.0) { @@ -77,7 +77,7 @@ writer.writeRaw("±"); writer.write(" " + de.getPlus()); } else{ - writer.write("+" + de.getPlus() + ",-" + de.getMinus() + " "); + writer.write("+" + de.getPlus() + ",-" + de.getMinus() + " "); } writer.write(de.getNormType().toSymbol()+ " "); } @@ -108,16 +108,16 @@ } } -// writer.end(); //p + // writer.end(); //p -// This next sections adds any extra information to the specific table. -// Not ideal because the relative table Id could change but I see no better was. -// Requires two files: description.n and link.n in the specific resource direcotry + // This next sections adds any extra information to the specific table. + // Not ideal because the relative table Id could change but I see no better was. + // Requires two files: description.n and link.n in the specific resource direcotry String location=""; for (String comment : _dataset.getComments()){ - if(comment.startsWith("Location:")) { - location = comment.substring(10).replaceAll(" ","_"); - } + if(comment.startsWith("Location:")) { + location = comment.substring(10).replaceAll(" ","_"); + } } Long paperid = _dataset.getPaper().getSpiresId(); @@ -131,17 +131,17 @@ String linkname="/home/hepdata/resource/"+paperid+"/link."+location; File descfile = new File(descname); if(descfile.exists()) { - try{ - BufferedReader indesc=new BufferedReader(new FileReader(descname)); - BufferedReader inlink=new BufferedReader(new FileReader(linkname)); - String desc = indesc.readLine(); - String link = inlink.readLine(); - writer.write(desc); - writer.element("a"); - writer.attributes("href","/resource/"+paperid+"/"+link); - writer.write(" table:"+location); - writer.end(); - } catch (IOException e){} + try{ + BufferedReader indesc=new BufferedReader(new FileReader(descname)); + BufferedReader inlink=new BufferedReader(new FileReader(linkname)); + String desc = indesc.readLine(); + String link = inlink.readLine(); + writer.write(desc); + writer.element("a"); + writer.attributes("href","/resource/"+paperid+"/"+link); + writer.write(" table:"+location); + writer.end(); + } catch (IOException e){} } // Determine the number of axes and points in the dataset @@ -163,8 +163,8 @@ writer.element("table"); writer.attributes("class", "dataset"); - // y-axis comments (i.e. non-numerical properties - // new version has these added in with the properties - below + // y-axis comments (i.e. non-numerical properties + // new version has these added in with the properties - below int nmatch = 0; // Next the numerical properties new version @@ -195,42 +195,42 @@ } } if(comment.startsWith(". :")){ - comment = comment.replace(". :","zzzz :"); - } + comment = comment.replace(". :","zzzz :"); + } if(!comment.startsWith("Axis error")){ - storelist.add(comment); + storelist.add(comment); } else{ - comment=comment.replaceFirst("Axis","Axis("+y.getId().toString()+")"); - writer.write(comment); - writer.element("br"); - writer.end(); + comment=comment.replaceFirst("Axis","Axis("+y.getId().toString()+")"); + writer.write(comment); + writer.element("br"); + writer.end(); } } for (Property property : y.getProperties()) { j++; String tempstr = property.getName().toString(); - tempstr = tempstr.concat(" : "); - if (property.getFocus() != null){ - tempstr = tempstr.concat(property.getFocus().toString()); - } - if (property.getLowValue() != null && property.getHighValue() != null && - property.getLowValue().equals(property.getHighValue())) { - tempstr = tempstr.concat(property.getLowValue().toString()); - } else { - if(property.getFocus() != null) { tempstr = tempstr.concat(" ("); } - tempstr = tempstr.concat(property.getLowValue().toString()); - tempstr = tempstr.concat("-"); - tempstr = tempstr.concat(property.getHighValue().toString()); - if(property.getFocus() != null) { tempstr = tempstr.concat(")"); } - } - if (property.getUnit().toString().equals("") || !property.getUnit().isDimensionless()) { - tempstr = tempstr.concat(" "); - tempstr = tempstr.concat(property.getUnit().toString()); - } - if(tempstr.startsWith(". :")){ - tempstr = tempstr.substring(3); - } - storelist.add(tempstr); + tempstr = tempstr.concat(" : "); + if (property.getFocus() != null){ + tempstr = tempstr.concat(property.getFocus().toString()); + } + if (property.getLowValue() != null && property.getHighValue() != null && + property.getLowValue().equals(property.getHighValue())) { + tempstr = tempstr.concat(property.getLowValue().toString()); + } else { + if(property.getFocus() != null) { tempstr = tempstr.concat(" ("); } + tempstr = tempstr.concat(property.getLowValue().toString()); + tempstr = tempstr.concat("-"); + tempstr = tempstr.concat(property.getHighValue().toString()); + if(property.getFocus() != null) { tempstr = tempstr.concat(")"); } + } + if (property.getUnit().toString().equals("") || !property.getUnit().isDimensionless()) { + tempstr = tempstr.concat(" "); + tempstr = tempstr.concat(property.getUnit().toString()); + } + if(tempstr.startsWith(". :")){ + tempstr = tempstr.substring(3); + } + storelist.add(tempstr); } Collections.sort(storelist); int ij=-1; @@ -253,23 +253,23 @@ writer.write(store[0][i].substring(0,store[0][i].indexOf(" : "))); } else{ - // writer.write(store[0][i]); + // writer.write(store[0][i]); } -// if(store[0][i].startsWith("RE")){ -// writer.element("a"); -// writer.attributes("href","/h3test/ReactionHelp"); -// writer.attributes("onClick","return popitup(this)"); -// writer.attributes("title","click for more help on this reaction"); -// writer.writeRaw("?=>"); -// writer.end(); -// } -// else{ -// writer.writeRaw(" "); -// } + // if(store[0][i].startsWith("RE")){ + // writer.element("a"); + // writer.attributes("href","/h3test/ReactionHelp"); + // writer.attributes("onClick","return popitup(this)"); + // writer.attributes("title","click for more help on this reaction"); + // writer.writeRaw("?=>"); + // writer.end(); + // } + // else{ + // writer.writeRaw(" "); + // } writer.end(); -// this is the actual output -// first check is same across row + // this is the actual output + // first check is same across row Boolean same = true; for (int nmy=0; nmy<ny-1; nmy++){ @@ -303,7 +303,7 @@ else { writer.attributes("class","multiple_last qualifier_class"); } if(store[nmy][i] != null) { if(nmy>0){ writer.write( store[nmy][i].substring(ii+1)); } - // if(nmy<0){ writer.write( store[nmy][i].substring(ii+1)); } + // if(nmy<0){ writer.write( store[nmy][i].substring(ii+1)); } else { if(store[nmy][i].indexOf(" : ")>-1) { writer.write( store[nmy][i].substring(store[nmy][i].indexOf(" : ")+2)); @@ -323,7 +323,7 @@ writer.element("tr"); writer.attributes("class", "xyheaders"); - // X headers + // X headers for (XAxis x : _dataset.getXAxes()) { writer.element("th"); writer.attributes("class", "xheader qualifier_class"); @@ -356,7 +356,7 @@ } writer.end(); //tr -/////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////// if(_dataset.getNumPoints() == 0){ writer.element("th"); writer.attributes("colspan",ny+nx); @@ -364,19 +364,19 @@ writer.write("No data is encoded for this table"); writer.end(); } - // writer.element("tr"); - // writer.element("td"); - // writer.attributes("colspan",nx+ny); - // writer.end(); - // writer.element("img"); - // writer.attributes("src",button_hide.toClientURL()); - // String hide = button_hide.toClientURL(); - // String expand = button_expand.toClientURL(); - // writer.attributes("onclick","ExpandClicked(this,'"+expand+"','"+hide+"');"); - // writer.end(); - // writer.end(); + // writer.element("tr"); + // writer.element("td"); + // writer.attributes("colspan",nx+ny); + // writer.end(); + // writer.element("img"); + // writer.attributes("src",button_hide.toClientURL()); + // String hide = button_hide.toClientURL(); + // String expand = button_expand.toClientURL(); + // writer.attributes("onclick","ExpandClicked(this,'"+expand+"','"+hide+"');"); + // writer.end(); + // writer.end(); -// if (getFormat().equals("full") && _dataset.getNumPoints() != 0) { + // if (getFormat().equals("full") && _dataset.getNumPoints() != 0) { if ( _dataset.getNumPoints() != 0) { // Finally the numbers themselves @@ -661,92 +661,92 @@ // Alternative formats (link from table list) /// @todo Move to component template or separate component if(plotit==true){ - writer.element("tr"); - writer.attributes("class", "altformats"); - for (int ix = 1; ix <= nx; ix++) { - writer.element("td"); - writer.writeRaw(" "); - writer.end(); //td - } - - String baseurl = _reqGlobals.getRequest().getContextPath(); - String urlid = ""; - if(_dataset.getPaper().getInspireId() != null) { urlid = "/ins"+_dataset.getPaper().getInspireId(); } - else if(_dataset.getPaper().getSpiresId() != null) { urlid = "/irn"+_dataset.getPaper().getSpiresId(); } - else if(_dataset.getPaper().getCdsId() != null) { urlid = "/cds"+_dataset.getPaper().getCdsId(); } - else if(_dataset.getPaper().getRedId() != null) { urlid = "/red"+_dataset.getPaper().getRedId() ;} - else { urlid = "/p"+_dataset.getPaper().getId(); } - String urlparts = "" - + urlid - + "/d" + _dataset.getId(); - for (int iy = 1; iy <= ny; iy++) { - writer.element("td"); - - // // Numbers link - // writer.element("a"); - // writer.attributes("href", baseurl + "/view:plain?" + urlparts + "&x=1&y=" + iy); - // writer.attributes("title", "View the contents of this axis as plain text"); - // writer.write("Numbers"); - // writer.end(); - - // writer.element("br"); writer.end(); - - // Plot link - Double yratio = _dataset.getYAxis(iy).getMaxValue()/_dataset.getYAxis(iy).getMinValue(); - if(nx==1){ - writer.element("a"); - if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ - writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/ylog" + iy); - } - else{ - writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); - } - writer.attributes("title", "Display this table in graphical form"); - writer.write("Plot"); - writer.end(); - writer.element("br"); writer.end(); - } - else { - for (int nxx=1; nxx<=nx; nxx++){ - writer.element("a"); - if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ - writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/ylog" + iy); - } - else { - writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/y" + iy); - } - writer.attributes("title", "Display this table in graphical form using xaxis "+nxx); - writer.write("Plot v x"+nxx); - writer.end(); - writer.element("br"); writer.end(); - } - } - // Plot selection link - writer.element("a"); - writer.attributes("href", baseurl + "/saveplot?string=" + getSearchString() + "&plot=" + _dataset.getPaper().getId() + "ds" + _dataset.getId() + "ya" + iy); - writer.attributes("title", "Add this table to the list for combined plotting"); - writer.write("SelectPlot"); - writer.end(); - - writer.end(); //td - } - writer.end(); //tr + writer.element("tr"); + writer.attributes("class", "altformats"); + for (int ix = 1; ix <= nx; ix++) { + writer.element("td"); + writer.writeRaw(" "); + writer.end(); //td + } + + String baseurl = _reqGlobals.getRequest().getContextPath(); + String urlid = ""; + if(_dataset.getPaper().getInspireId() != null) { urlid = "/ins"+_dataset.getPaper().getInspireId(); } + else if(_dataset.getPaper().getSpiresId() != null) { urlid = "/irn"+_dataset.getPaper().getSpiresId(); } + else if(_dataset.getPaper().getCdsId() != null) { urlid = "/cds"+_dataset.getPaper().getCdsId(); } + else if(_dataset.getPaper().getRedId() != null) { urlid = "/red"+_dataset.getPaper().getRedId() ;} + else { urlid = "/p"+_dataset.getPaper().getId(); } + String urlparts = "" + + urlid + + "/d" + _dataset.getId(); + for (int iy = 1; iy <= ny; iy++) { + writer.element("td"); + + // // Numbers link + // writer.element("a"); + // writer.attributes("href", baseurl + "/view:plain?" + urlparts + "&x=1&y=" + iy); + // writer.attributes("title", "View the contents of this axis as plain text"); + // writer.write("Numbers"); + // writer.end(); + + // writer.element("br"); writer.end(); + + // Plot link + Double yratio = _dataset.getYAxis(iy).getMaxValue()/_dataset.getYAxis(iy).getMinValue(); + if(nx==1){ + writer.element("a"); + if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/ylog" + iy); + } + else{ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); + } + writer.attributes("title", "Display this table in graphical form"); + writer.write("Plot"); + writer.end(); + writer.element("br"); writer.end(); + } + else { + for (int nxx=1; nxx<=nx; nxx++){ + writer.element("a"); + if(_dataset.getYAxis(iy).getMinValue()>0.0 && yratio > 100.0){ + writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/ylog" + iy); + } + else { + writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/y" + iy); + } + writer.attributes("title", "Display this table in graphical form using xaxis "+nxx); + writer.write("Plot v x"+nxx); + writer.end(); + writer.element("br"); writer.end(); + } + } + // Plot selection link + writer.element("a"); + writer.attributes("href", baseurl + "/saveplot?string=" + getSearchString() + "&plot=" + _dataset.getPaper().getId() + "ds" + _dataset.getId() + "ya" + iy); + writer.attributes("title", "Add this table to the list for combined plotting"); + writer.write("SelectPlot"); + writer.end(); + + writer.end(); //td + } + writer.end(); //tr } } // end "full format only" writer.end(); //table -// writer.element("input"); -// if(!getFormat().equals("full")) { writer.attributes("type", "hidden");} -// writer.attributes("name", "string"); -// writer.attributes("value", getSearchString()); -// writer.end(); -// + // writer.element("input"); + // if(!getFormat().equals("full")) { writer.attributes("type", "hidden");} + // writer.attributes("name", "string"); + // writer.attributes("value", getSearchString()); + // writer.end(); + // } @Parameter(name="dataset") - private Dataset _dataset; + private Dataset _dataset; public String forms(Double value) { Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml ============================================================================== --- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml Wed Jun 25 13:33:33 2014 (r1802) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/View.tml Fri Jul 11 18:55:21 2014 (r1803) @@ -174,6 +174,7 @@ <t:if test="paper.cdsId"> Record in: <a href=" http://cds.cern.ch/record/${paper.cdsId}"><b>CERN Document Server</b></a> + <br/> </t:if> <t:if test="paper.haveRivet"> Rivet Analysis:
More information about the HepData-svn mailing list |