Changeset f1181977 in sasview


Ignore:
Timestamp:
Aug 8, 2008 9:00:56 AM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
0eb801a
Parents:
08b9e586
Message:

Can now add multiple additional curves, normalization now affects all added curves, acknowledgment statement added in about box.

Location:
prview
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • prview/license.txt

    ra4bd2ac rf1181977  
    33project funded by the US National Science Foundation.  
    44 
    5 If you use this program to do productive scientific research that leads 
    6 to publication, we ask that you acknowledge use of the program by citing 
    7 the following paper in your publication: 
     5If you use DANSE applications to do scientific research that leads to publication,  
     6we ask that you acknowledge the use of the software with the following sentence: 
    87 
    9 P. Butler, M. Doucet, G. Alina, R. Cortes Hernandez, J. Zhou,  
    10 "SANS analysis software", to be published. 
     8"This work benefited from DANSE software developed under NSF award DMR-0520547."  
    119 
    1210See the DANSE project web site for license information: 
  • prview/local_config.py

    r0bae207 rf1181977  
    2828project funded by the US National Science Foundation.  
    2929 
     30If you use DANSE applications to do scientific research that leads to publication,  
     31we ask that you acknowledge the use of the software with the following sentence: 
     32 
     33"This work benefited from DANSE software developed under NSF award DMR-0520547."  
    3034''' 
    3135_homepage = "http://danse.chem.utk.edu" 
  • prview/perspectives/pr/pr.py

    rea5551f rf1181977  
    1212from sans.pr.invertor import Invertor 
    1313 
    14 PR_FIT_LABEL       = "P_{fit}(r)" 
    15 PR_LOADED_LABEL    = "P_{loaded}(r)" 
    16 IQ_DATA_LABEL      = "I_{obs}(q)" 
    17 IQ_FIT_LABEL       = "I_{fit}(q)" 
    18 IQ_SMEARED_LABEL   = "I_{smeared}(q)" 
     14PR_FIT_LABEL       = r"$P_{fit}(r)$" 
     15PR_LOADED_LABEL    = r"$P_{loaded}(r)$" 
     16IQ_DATA_LABEL      = r"$I_{obs}(q)$" 
     17IQ_FIT_LABEL       = r"$I_{fit}(q)$" 
     18IQ_SMEARED_LABEL   = r"$I_{smeared}(q)$" 
    1919 
    2020import wx.lib 
     
    8080        self._scale_output_unity = False 
    8181         
     82        ## List of added P(r) plots 
     83        self._added_plots = {} 
     84        self._default_Iq  = {} 
     85         
    8286        # Log startup 
    8387        logging.info("Pr(r) plug-in started") 
     
    318322        else: 
    319323            new_plot = Data1D(x, y, dy=dy) 
    320         new_plot.name = "P_{fit}(r)" 
     324        new_plot.name = PR_FIT_LABEL 
    321325        new_plot.xaxis("\\rm{r}", 'A') 
    322326        new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
     
    516520        self.show_pr(self._last_out, self._last_pr, self._last_cov) 
    517521         
     522        # Now replot the original added data 
     523        for plot in self._added_plots: 
     524            self._added_plots[plot].y = numpy.copy(self._default_Iq[plot]) 
     525            wx.PostEvent(self.parent, NewPlotEvent(plot=self._added_plots[plot],  
     526                                                   title=self._added_plots[plot].name, 
     527                                                   update=True))         
     528         
     529        # Need the update flag in the NewPlotEvent to protect against 
     530        # the plot no longer being there... 
     531         
    518532    def _on_normalize(self, evt): 
    519533        """ 
    520             Switch normalization ON/OFF 
     534            Normalize the area under the P(r) curve to 1. 
     535            This operation is done for all displayed plots. 
     536             
    521537            @param evt: Menu event 
    522538        """ 
     
    526542        self.show_pr(self._last_out, self._last_pr, self._last_cov) 
    527543         
     544        # Now scale the added plots too 
     545        for plot in self._added_plots: 
     546            sum = numpy.sum(self._added_plots[plot].y) 
     547            npts = len(self._added_plots[plot].x) 
     548            sum *= self._added_plots[plot].x[npts-1]/npts 
     549            y = self._added_plots[plot].y/sum 
     550             
     551            new_plot = Theory1D(self._added_plots[plot].x, y) 
     552            new_plot.name = self._added_plots[plot].name 
     553            new_plot.xaxis("\\rm{r}", 'A') 
     554            new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
     555             
     556            wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, update=True, 
     557                                                   title=self._added_plots[plot].name)) 
     558                 
     559         
     560         
    528561    def _on_scale_unity(self, evt): 
    529562        """ 
    530             Switch normalization ON/OFF 
     563            Scale the maximum P(r) value on each displayed plot to 1. 
     564             
    531565            @param evt: Menu event 
    532566        """ 
     
    535569             
    536570        self.show_pr(self._last_out, self._last_pr, self._last_cov) 
     571         
     572        # Now scale the added plots too 
     573        for plot in self._added_plots: 
     574            _max = 0 
     575            for y in self._added_plots[plot].y: 
     576                if y>_max:  
     577                    _max = y 
     578            y = self._added_plots[plot].y/_max 
     579             
     580            new_plot = Theory1D(self._added_plots[plot].x, y) 
     581            new_plot.name = self._added_plots[plot].name 
     582            new_plot.xaxis("\\rm{r}", 'A') 
     583            new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
     584             
     585            wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, update=True, 
     586                                                   title=self._added_plots[plot].name))         
     587         
    537588         
    538589    def _on_add_data(self, evt): 
     
    547598        x, y, err = self.parent.load_ascii_1D(path) 
    548599         
     600        filename = os.path.basename(path) 
     601         
    549602        #new_plot = Data1D(x, y, dy=err) 
    550603        new_plot = Theory1D(x, y) 
    551         new_plot.name = "P_{loaded}(r)" 
     604        new_plot.name = filename 
    552605        new_plot.xaxis("\\rm{r}", 'A') 
    553606        new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
    554607             
    555         wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="P(r) fit")) 
     608        # Store a ref to the plottable for later use 
     609        self._added_plots[filename] = new_plot 
     610        self._default_Iq[filename]  = numpy.copy(y) 
     611         
     612        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=filename)) 
    556613         
    557614         
     
    653710            # Make a plot of I(q) data 
    654711            new_plot = Data1D(self.pr.x, self.pr.y, dy=self.pr.err) 
    655             new_plot.name = "I_{obs}(q)" 
     712            new_plot.name = IQ_DATA_LABEL 
    656713            new_plot.xaxis("\\rm{Q}", 'A^{-1}') 
    657714            new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
     
    689746        else: 
    690747            new_plot = Data1D(self.pr.x, self.pr.y, dy=self.pr.err) 
    691         new_plot.name = "I_{obs}(q)" 
     748        new_plot.name = IQ_DATA_LABEL 
    692749        new_plot.xaxis("\\rm{Q}", 'A^{-1}') 
    693750        new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
Note: See TracChangeset for help on using the changeset viewer.