Index: trunk/ippToPsps/jython/plotter.py
===================================================================
--- trunk/ippToPsps/jython/plotter.py	(revision 33496)
+++ trunk/ippToPsps/jython/plotter.py	(revision 33497)
@@ -1,9 +1,8 @@
 #!/usr/bin/env jython
 
-import tempfile
-import os
 import sys
 
 from ipptopsps import IppToPsps
+from plot import Plot
 
 
@@ -19,39 +18,13 @@
         super(Plotter, self).__init__(argv)
 
-    '''
-    Runs...
-    '''
-    def run(self):
+        self.plot = Plot(self.logger, self.config, self.ippToPspsDb)
+ 
+        if len(argv) < 3:
+            self.printUsage()
+            self.exitProgram("No plot type specified")
 
-        tempFilename = "./plotData.dat"
-        DATFILE = open(tempFilename,'w')
-        self.ippToPspsDb.createPendingDensityPlotData(self.config.name, DATFILE)
-        DATFILE.close()
-
-        OUTPUTFILE = self.config.name + ".png"
-        f = os.popen('gnuplot', 'w')
-            
-        max = self.ippToPspsDb.getMaxPendingInBox(self.config.name)
-
-        if 0:
-            TERM = "X11"
-        else:
-            TERM = "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8"
-                     
-        print >> f, "set term " + TERM + "; \
-            set output \"" + OUTPUTFILE + "\"; \
-            set title \"Density plot of unprocessed stuff\"; \
-            set grid; \
-            set xrange [" + str(self.config.minRa) + ":" + str(self.config.maxRa) + "] reverse; \
-            set yrange [" + str(self.config.minDec) + ":" + str(self.config.maxDec) + "]; \
-            unset key; \
-            set palette rgb 22,13,10; \
-            set ylabel \"Dec\"; \
-            set ylabel \"RA\"; \
-            set cbrange [0:" + str(max) + "]; \
-            set datafile missing \"NaN\"; \
-            plot '" + tempFilename + "' using 1:2:3 with image"
-
-        f.flush()
+        if argv[2] == "density": 
+            self.plot.createDensityPlot("P2")
+            self.plot.createDensityPlot("ST")
 
     '''
@@ -59,6 +32,5 @@
     '''
     def printUsage(self):
-        super(Plotter, self).printUsage()
-        print " [<density>]"
+        super(Plotter, self).printUsage("[density]")
 
 
@@ -67,4 +39,3 @@
 '''
 plotter = Plotter(sys.argv)
-plotter.run()
 plotter.exitProgram("finished")
