[Swift-commit] r4651 - usertools/plotter/src/plotter
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Mon Jun 20 16:53:18 CDT 2011
Author: jonmon
Date: 2011-06-20 16:53:18 -0500 (Mon, 20 Jun 2011)
New Revision: 4651
Modified:
usertools/plotter/src/plotter/Dual.java
usertools/plotter/src/plotter/Lines.java
Log:
o ok now i moved the plotter method to the top of the Dual class.
Modified: usertools/plotter/src/plotter/Dual.java
===================================================================
--- usertools/plotter/src/plotter/Dual.java 2011-06-20 21:29:23 UTC (rev 4650)
+++ usertools/plotter/src/plotter/Dual.java 2011-06-20 21:53:18 UTC (rev 4651)
@@ -42,7 +42,87 @@
static Double ymin2 = null;
static Double ymax2 = null;
+ /**
+ Args: Lines <properties> <output file> <data file>*
+ Reads settings from properties: see scanProperties()
+ Produces EPS output file
+ Data files are two-columns of numbers each -
+ see LineReader.read() and LineReader.array()
+ */
+ public void plotter(String[] args)
+ {
+ // Settings:
+ boolean verbose = false;
+ Getopt g = new Getopt("testprog", args, "v");
+ int c = -1;
+ while ((c = g.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'v':
+ verbose = true;
+ }
+ }
+
+ if (args.length < 3)
+ {
+ System.err.println
+ ("usage: [<options>] <properties> <output> <data>*");
+ System.exit(2);
+ }
+
+ Bits.init();
+ Util.verbose(verbose);
+
+ String propFile = args[0];
+ String output = args[1];
+ List<String> names = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++)
+ names.add(args[i]);
+
+ String title = null;
+ String xlabel = null;
+ String ylabel1 = null;
+ String ylabel2 = null;
+ List<double[][]> data = new ArrayList<double[][]>();
+ List<String> labels = new ArrayList<String>();
+
+ properties = new Properties();
+ load(propFile);
+ title = properties.getProperty("title");
+ xlabel = properties.getProperty("xlabel");
+ ylabel1 = properties.getProperty("ylabel1");
+ ylabel2 = properties.getProperty("ylabel2");
+
+ scanProperties();
+
+ for (String name : names)
+ {
+ File file = new File(name);
+ Util.verbose("open: " + file);
+ List<String> lines = null;
+ try
+ {
+ lines = LineReader.read(file);
+ }
+ catch (FileNotFoundException e)
+ {
+ System.err.println("not found: " + file);
+ System.exit(1);
+ }
+ double[][] array = LineReader.array(lines);
+ data.add(array);
+ addLabel(name, labels);
+ Util.verbose("array:\n" + toString(array));
+ }
+
+ XYSeriesCollection[] collections =
+ collections(data, labels, names);
+
+ plot(collections, title, xlabel, ylabel1, ylabel2, output);
+ }
+
/**
Generate simple plot
@param collection The x,y data
@@ -195,87 +275,6 @@
plot.configureRangeAxes();
}
- /**
- Args: Lines <properties> <output file> <data file>*
- Reads settings from properties: see scanProperties()
- Produces EPS output file
- Data files are two-columns of numbers each -
- see LineReader.read() and LineReader.array()
- */
- public void plotter(String[] args)
- {
- // Settings:
- boolean verbose = false;
-
- Getopt g = new Getopt("testprog", args, "v");
- int c = -1;
- while ((c = g.getopt()) != -1)
- {
- switch (c)
- {
- case 'v':
- verbose = true;
- }
- }
-
- if (args.length < 3)
- {
- System.err.println
- ("usage: [<options>] <properties> <output> <data>*");
- System.exit(2);
- }
-
- Bits.init();
- Util.verbose(verbose);
-
- String propFile = args[0];
- String output = args[1];
- List<String> names = new ArrayList<String>();
- for (int i = 2; i < args.length; i++)
- names.add(args[i]);
-
- String title = null;
- String xlabel = null;
- String ylabel1 = null;
- String ylabel2 = null;
- List<double[][]> data = new ArrayList<double[][]>();
- List<String> labels = new ArrayList<String>();
-
- properties = new Properties();
- load(propFile);
- title = properties.getProperty("title");
- xlabel = properties.getProperty("xlabel");
- ylabel1 = properties.getProperty("ylabel1");
- ylabel2 = properties.getProperty("ylabel2");
-
- scanProperties();
-
- for (String name : names)
- {
- File file = new File(name);
- Util.verbose("open: " + file);
- List<String> lines = null;
- try
- {
- lines = LineReader.read(file);
- }
- catch (FileNotFoundException e)
- {
- System.err.println("not found: " + file);
- System.exit(1);
- }
- double[][] array = LineReader.array(lines);
- data.add(array);
- addLabel(name, labels);
- Util.verbose("array:\n" + toString(array));
- }
-
- XYSeriesCollection[] collections =
- collections(data, labels, names);
-
- plot(collections, title, xlabel, ylabel1, ylabel2, output);
- }
-
static XYSeriesCollection[] collections(List<double[][]> data,
List<String> labels,
List<String> names)
Modified: usertools/plotter/src/plotter/Lines.java
===================================================================
--- usertools/plotter/src/plotter/Lines.java 2011-06-20 21:29:23 UTC (rev 4650)
+++ usertools/plotter/src/plotter/Lines.java 2011-06-20 21:53:18 UTC (rev 4651)
@@ -1,4 +1,3 @@
-
package plotter;
import gnu.getopt.Getopt;
More information about the Swift-commit
mailing list