Index: prview/local_config.py
===================================================================
--- prview/local_config.py	(revision 9362f8515d8f9da6012db3ba79be33cc8a081a8f)
+++ prview/local_config.py	(revision feb21d8f521ffdba2b16a877bea39dfe584996e8)
@@ -6,6 +6,7 @@
 # Version of the application
 __appname__ = "PrView"
-__version__ = '0.2.1'
+__version__ = '0.2.2'
 __download_page__ = 'http://danse.chem.utk.edu'
+__update_URL__ = 'http://danse.chem.utk.edu/prview_version.txt'
 
 
Index: prview/perspectives/pr/pr.py
===================================================================
--- prview/perspectives/pr/pr.py	(revision 357b79bbbeba38e9d823b795286617198f6617c3)
+++ prview/perspectives/pr/pr.py	(revision feb21d8f521ffdba2b16a877bea39dfe584996e8)
@@ -60,5 +60,8 @@
         self.invertor    = None
         self.pr          = None
-        self.pr_estimate = None
+        # Copy of the last result in case we need to display it.
+        self._last_pr    = None
+        self._last_out   = None
+        self._last_cov   = None
         ## Calculation thread
         self.calc_thread = None
@@ -73,4 +76,6 @@
         ## Flag to let the plug-in know that it is running standalone
         self.standalone = True
+        self._normalize_output = False
+        self._scale_output_unity = False
         
         # Log startup
@@ -265,5 +270,5 @@
             self._pr_npts= dialog.get_content()
             dialog.Destroy()
-            self.show_pr(self.pr.out, self.pr, self.pr.cov)
+            self.show_pr(self._last_out, self._last_pr, self._last_cov)
         else:
             dialog.Destroy()
@@ -285,4 +290,5 @@
 
         sum = 0.0
+        pmax = 0.0
         cov2 = numpy.ascontiguousarray(cov)
         
@@ -293,8 +299,17 @@
                 (value, dy[i]) = pr.pr_err(out, cov2, x[i])
             sum += value*pr.d_max/len(x)
+            
+            # keep track of the maximum P(r) value
+            if value>pmax:
+                pmax = value
+                
             y[i] = value
-            
-        y = y/sum
-        dy = dy/sum
+                
+        if self._normalize_output==True:
+            y = y/sum
+            dy = dy/sum
+        elif self._scale_output_unity==True:
+            y = y/pmax
+            dy = dy/pmax
         
         if cov2==None:
@@ -378,6 +393,24 @@
         for item in graph.plottables:
             if item.name==PR_FIT_LABEL:
-                return [["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data],
+                m_list = [["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data],
                        ["Change number of P(r) points", "Change the number of points on the P(r) output", self._on_pr_npts]]
+
+                m_list.append(["Disable P(r) scaling", 
+                               "Let the output P(r) keep the scale of the data", 
+                               self._on_disable_scaling])
+                
+                if self._scale_output_unity==False:
+                    m_list.append(["Scale P_max(r) to unity", 
+                                   "Scale P(r) so that its maximum is 1", 
+                                   self._on_scale_unity])
+                    
+                if self._normalize_output==False:
+                    m_list.append(["Normalize P(r) to unity", 
+                                   "Normalize the integral of P(r) to 1", 
+                                   self._on_normalize])
+                    
+                return m_list
+                #return [["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data],
+                #       ["Change number of P(r) points", "Change the number of points on the P(r) output", self._on_pr_npts]]
 
             elif item.name==graph.selected_plottable:
@@ -386,4 +419,33 @@
         return []
 
+    def _on_disable_scaling(self, evt):
+        """
+            Disable P(r) scaling
+            @param evt: Menu event
+        """
+        self._normalize_output = False
+        self._scale_output_unity = False
+        self.show_pr(self._last_out, self._last_pr, self._last_cov)
+        
+    def _on_normalize(self, evt):
+        """
+            Switch normalization ON/OFF
+            @param evt: Menu event
+        """
+        self._normalize_output = True
+        self._scale_output_unity = False
+            
+        self.show_pr(self._last_out, self._last_pr, self._last_cov)
+        
+    def _on_scale_unity(self, evt):
+        """
+            Switch normalization ON/OFF
+            @param evt: Menu event
+        """
+        self._scale_output_unity = True
+        self._normalize_output = False
+            
+        self.show_pr(self._last_out, self._last_pr, self._last_cov)
+        
     def _on_add_data(self, evt):
         """
@@ -468,4 +530,9 @@
         # Save useful info
         self.elapsed = elapsed
+        # Keep a copy of the last result
+        self._last_pr  = pr.clone()
+        self._last_out = out
+        self._last_cov = cov
+        
         # Save Pr invertor
         self.pr = pr
Index: prview/perspectives/pr/requirements.txt
===================================================================
--- prview/perspectives/pr/requirements.txt	(revision 660b1e60ab822e113405bbf2f810f6667b460fe6)
+++ prview/perspectives/pr/requirements.txt	(revision feb21d8f521ffdba2b16a877bea39dfe584996e8)
@@ -2,28 +2,30 @@
 2. Find good defaults. Automate the inversion.
    -How do we estimate d_max? Guinier fit?
-   -How do we estimate alpha? [partially done]
+   -How do we estimate alpha? [done]
    Compute the residuals once and choose a value that brings the reg term up to 
    a fraction of the residuals.
 3. When fitting a plottable on a Graph with multiple plottables, remember the one the user chose [done]
-4. What q-range do we need to make it work? What are the constraints?
-5. Create handshake so that a plug-in can set context menu items to its own panels...
-6. Return figure of merit values and suggest the values for d_max and alpha.
+4. What q-range do we need to make it work? What are the constraints? [studied by Raiza]
+5. Create handshake so that a plug-in can set context menu items to its own panels... [done]
+6. Return figure of merit values and suggest the values for d_max and alpha. [alpha, nfunc done]
 7. Show time estimate [done]
-8. Plot the reg term alone to see what it looks like
-9. Use data loader perspective/plug-in to load data/choose file
-10. Common module for file reading and file choosing
-11. Define limits of applicability
-12. Return figures of merit
+8. Plot the reg term alone to see what it looks like 
+9. Use data loader perspective/plug-in to load data/choose file [done]
+10. Common module for file reading and file choosing 
+11. Define limits of applicability 
+12. Return figures of merit [done]
 13. Errors on output constants [done]
-14. Clean up the InversionDialog
-15. Add online help for inputs and outputs (especially figures of merit)
+14. Clean up the InversionDialog [done]
+15. Add online help for inputs and outputs (especially figures of merit) [done]
 16. Add help text to the interface (description of what we are minimizing, to explain alpha and nfunc).
-17. Get rid of all output prints.
+17. Get rid of all output prints. 
 18. Clean up
 19. Replace help dialog text with a nice image. Mention how to choose alpha and what the suggested alpha means.
 20. If a figure of merit is clearly bad, put its background red
-21. Option to save data.
-22. If you click compute before loading data, an error occurs.
-23. Plot I(q) immediately when you choose a new file.
+21. Option to save data. [done]
+22. If you click compute before loading data, an error occurs. [fixed]
+23. Plot I(q) immediately when you choose a new file. [done]
 24. *** probably need to ship the perspectives separately...
-25. If no data is available, disable the Fit button.
+25. If no data is available, disable the Fit button. [Message sent instead]
+26. Remove an added curve...
+27. Add multiple additional data curves.
Index: prview/release_notes.txt
===================================================================
--- prview/release_notes.txt	(revision ab7615b8fb8470332879530e8e4db869948ae08f)
+++ prview/release_notes.txt	(revision feb21d8f521ffdba2b16a877bea39dfe584996e8)
@@ -6,6 +6,11 @@
 Package name: None
 
-1- Version 0.2.1
+1- Version 0.2.2
 
+	- Release date: 7/8/2008
+	- Added option to normalize P(r) to 1, scale P_max to 1, or leave as is.
+	- Fixed problem with changing the number of P(r) points.
+
+   Version 0.2.1
 	- Release date: 7/04/2008
 	- Improved user interface.
