Changeset c66a0bb in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Nov 30, 2017 10:51:13 AM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
0a9cbc3
Parents:
ee6ab94 (diff), 882cfec (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Kienzle <pkienzle@…> (11/30/17 10:51:13)
git-committer:
GitHub <noreply@…> (11/30/17 10:51:13)
Message:

Merge branch 'master' into ticket1007

Location:
src/sas/sasgui/perspectives
Files:
11 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py

    ra1b8fee r20fa5fe  
    113113    def compute(self): 
    114114        """ 
    115         excuting computation 
     115        executing computation 
    116116        """ 
    117117        #elapsed = time.time() - self.starttime 
  • src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.rst

    r5ed76f8 r1b67f3e  
    2626intensity from the particle is 
    2727 
    28 .. image:: gen_i.png 
     28.. math:: 
     29 
     30    I(\vec Q) = \frac{1}{V}\left| 
     31        \sum_j^N v_j \beta_j \exp(i\vec Q \cdot \vec r_j)\right|^2 
    2932 
    3033Equation 1. 
     
    4649atomic structure (such as taken from a PDB file) to get the right normalization. 
    4750 
    48 *NOTE! $\beta_j$ displayed in the GUI may be incorrect but this will not 
     51*NOTE!* $\beta_j$ *displayed in the GUI may be incorrect but this will not 
    4952affect the scattering computation if the correction of the total volume V is made.* 
    5053 
     
    5659^^^^^^^^^^^^^^^^^^^ 
    5760 
    58 For magnetic scattering, only the magnetization component, $M_\perp$, 
    59 perpendicular to the scattering vector $Q$ contributes to the magnetic 
     61For magnetic scattering, only the magnetization component, $\mathbf{M}_\perp$, 
     62perpendicular to the scattering vector $\vec Q$ contributes to the magnetic 
    6063scattering length. 
    6164 
     
    6467The magnetic scattering length density is then 
    6568 
    66 .. image:: dm_eq.png 
     69.. math:: 
     70 
     71    \beta_M = \frac{\gamma r_0}{2 \mu_B}\sigma \cdot \mathbf{M}_\perp 
     72        = D_M\sigma \cdot \mathbf{M}_\perp 
    6773 
    6874where the gyromagnetic ratio is $\gamma = -1.913$, $\mu_B$ is the Bohr 
     
    8187.. image:: gen_mag_pic.png 
    8288 
    83 Now let us assume that the angles of the *Q* vector and the spin-axis (x') 
    84 to the x-axis are $\phi$ and $\theta_\text{up}$ respectively (see above). Then, 
     89Now let us assume that the angles of the $\vec Q$ vector and the spin-axis ($x'$) 
     90to the $x$-axis are $\phi$ and $\theta_\text{up}$ respectively (see above). Then, 
    8591depending upon the polarization (spin) state of neutrons, the scattering 
    8692length densities, including the nuclear scattering length density ($\beta_N$) 
     
    8995*  for non-spin-flips 
    9096 
    91    .. image:: sld1.png 
     97.. math:: 
     98    \beta_{\pm\pm} = \beta_N \mp D_M M_{\perp x'} 
    9299 
    93100*  for spin-flips 
    94101 
    95    .. image:: sld2.png 
     102.. math:: 
     103    \beta_{\pm\mp} = - D_M(M_{\perp y'} \pm i M_{\perp z'}) 
    96104 
    97105where 
    98106 
    99 .. image:: mxp.png 
     107.. math:: 
    100108 
    101 .. image:: myp.png 
     109    M_{\perp x'} &= M_{0q_x}\cos\theta_\text{up} + M_{0q_y}\sin\theta_\text{up} \\ 
     110    M_{\perp y'} &= M_{0q_y}\cos\theta_\text{up} - M_{0q_x}\sin\theta_\text{up} \\ 
     111    M_{\perp z'} &= M_{0z} \\ 
     112    M_{0q_x} &= (M_{0x}\cos\phi - M_{0y}\sin\phi)\cos\phi \\ 
     113    M_{0q_y} &= (M_{0y}\sin\phi - M_{0y}\cos\phi)\sin\phi 
    102114 
    103 .. image:: mzp.png 
    104  
    105 .. image:: mqx.png 
    106  
    107 .. image:: mqy.png 
    108  
    109 Here the $M0_x$, $M0_y$ and $M0_z$ are the $x$, $y$ and $z$ 
    110 components of the magnetisation vector in the laboratory $xyz$ frame. 
     115Here the $M_{0x}$, $M_{0y}$ and $M_{0z}$ are 
     116the $x$, $y$ and $z$ components of the magnetisation vector in the 
     117laboratory $x$-$y$-$z$ frame. 
    111118 
    112119.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    148155uses the Debye equation below providing a 1D output 
    149156 
    150 .. image:: gen_debye_eq.png 
     157.. math:: 
     158 
     159    I(|\vec Q|) = \frac{1}{V}\sum_j^N v_j\beta_j \sum_k^N v_k \beta_k 
     160        \frac{\sin(|\vec Q||\vec r_j - \vec r_k|)}{|\vec Q||\vec r_j - \vec r_k|} 
    151161 
    152162where $v_j \beta_j \equiv b_j$ is the scattering 
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    r69363c7 r2469df7  
    338338            list_fnames = os.listdir(self.plugin_dir) 
    339339            # fake existing regular model name list 
    340             m_list = [model.name + ".py" for model in self.model_list] 
     340            m_list = [model + ".py" for model in self.model_list] 
    341341            list_fnames.append(m_list) 
    342342            if t_fname in list_fnames and title != mname: 
     
    344344                msg = "Name exists already." 
    345345 
    346         if self.good_name == False: 
     346        if not self.good_name: 
    347347            self.name_tcl.SetBackgroundColour('pink') 
    348348            info = 'Error' 
  • src/sas/sasgui/perspectives/calculator/resolcal_thread.py

    r959eb01 r20fa5fe  
    4444    def compute(self): 
    4545        """ 
    46         excuting computation 
     46        executing computation 
    4747        """ 
    4848        self.image = map(self.func, self.qx, self.qy, 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r0be6b6b r3bd677b  
    17331733        ind = 0 
    17341734        while(ind < len(list)): 
    1735             fun_box.Append(list[ind])         
     1735            for key, val in list.items(): 
     1736                if val == ind: 
     1737                    fun_box.Append(key, val) 
     1738                    break 
    17361739            ind += 1 
    17371740 
     
    17621765        value = fun_box.GetValue() 
    17631766        if value in self.model.fun_list: 
    1764             fun_val = fun_box.GetSelection() 
     1767            fun_val = self.model.fun_list[value] 
    17651768 
    17661769        self.model.setParam(name, fun_val) 
  • src/sas/sasgui/perspectives/fitting/fitproblem.py

    r251ef684 r20fa5fe  
    11""" 
    22Inferface containing information to store data, model, range of data, etc... 
    3 and retreive this information. This is an inferface 
     3and retrieve this information. This is an inferface 
    44for a fitProblem i.e relationship between data and model. 
    55""" 
     
    5656        """ 
    5757        :param flag: bool.When flag is 1 get the computer smear value. When 
    58             flag is 0 ingore smear value. 
     58            flag is 0 ignore smear value. 
    5959        """ 
    6060        self.smearer_enable = flag 
     
    305305        """ 
    306306        :param flag: bool.When flag is 1 get the computer smear value. When 
    307             flag is 0 ingore smear value. 
     307            flag is 0 ignore smear value. 
    308308        """ 
    309309        self._smear_on = flag 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r9706d88 r20fa5fe  
    763763        the current page and set value. 
    764764        :param value: integer 0 or 1 
    765         :param uid: the id related to a page contaning fitting information 
     765        :param uid: the id related to a page containing fitting information 
    766766        """ 
    767767        if uid in self.page_finder.keys(): 
     
    778778        Used by simfitpage.py to reset a parameter given the string constrainst. 
    779779 
    780         :param modelname: the name ot the model for with the parameter 
     780        :param modelname: the name of the model for with the parameter 
    781781                            has to reset 
    782782        :param value: can be a string in this case. 
    783         :param names: the paramter name 
     783        :param names: the parameter name 
    784784        """ 
    785785        sim_page_id = self.sim_page.uid 
     
    797797        name into model name and parameter name example: :: 
    798798 
    799             paramaterset (item) = M1.A 
     799            parameterset (item) = M1.A 
    800800            Will return model_name = M1 , parameter name = A 
    801801 
     
    11171117    def store_data(self, uid, data_list=None, caption=None): 
    11181118        """ 
    1119         Recieve a list of data and store them ans well as a caption of 
     1119        Receive a list of data and store them ans well as a caption of 
    11201120        the fit page where they come from. 
    11211121        :param uid: if related to a fit page 
     
    11961196        for a given interactor. 
    11971197 
    1198         :param event: contains type of slicer , paramaters for updating 
     1198        :param event: contains type of slicer , parameters for updating 
    11991199            the panel and panel_name to find the slicer 's panel concerned. 
    12001200        """ 
  • src/sas/sasgui/perspectives/fitting/fitting_widgets.py

    r959eb01 r20fa5fe  
    6464        selection_sizer.Add(self.data_2d_selected, (iy, ix), 
    6565                           (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    66         #contruction the sizer contaning button 
     66        #contruction the sizer containing button 
    6767        button_sizer.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    6868        button_sizer.Add(button_cancel, 0, 
  • src/sas/sasgui/perspectives/fitting/gpu_options.py

    r3bd677b r20fa5fe  
    8888        self.option_button = {} 
    8989        self.buttons = [] 
    90         #Check if SAS_OPENCL is already set as enviromental variable 
     90        #Check if SAS_OPENCL is already set as environment variable 
    9191        self.sas_opencl = os.environ.get("SAS_OPENCL", "") 
    9292 
  • src/sas/sasgui/perspectives/fitting/media/fitting.rst

    r3bd677b rc926a97  
    1818 
    1919   Polarisation/Magnetic Scattering <magnetism/magnetism> 
     20    
     21   Oriented Particles <orientation/orientation> 
    2022 
    2123   Information on the SasView Optimisers <optimizer> 
  • src/sas/sasgui/perspectives/fitting/simfitpage.py

    r0a3c740 r20fa5fe  
    976976        param_cbox = self.constraints_list[-1].param_cbox 
    977977        param_cbox.Clear() 
    978         # insert only fittable paramaters 
     978        # insert only fittable parameters 
    979979        for param in param_list: 
    980980            param_cbox.Append(str(param), model) 
  • src/sas/sasgui/perspectives/invariant/invariant_details.py

    r959eb01 r20fa5fe  
    422422        except: 
    423423            scale = RECTANGLE_SCALE 
    424             self.warning_msg += "Recieve an invalid scale for %s\n" 
     424            self.warning_msg += "Receive an invalid scale for %s\n" 
    425425            self.warning_msg += "check this value : %s\n" % str(percentage) 
    426426        return  scale 
  • src/sas/sasgui/perspectives/invariant/invariant_panel.py

    r7432acb r2469df7  
    707707 
    708708        # reset power_out to default to get ready for another '_on_text' 
    709         if self.is_power_out == True: 
     709        if self.is_power_out: 
    710710            self.state.container = copy.deepcopy(self.inv_container) 
    711711            self.state.timestamp = self._get_time_stamp() 
  • src/sas/sasgui/perspectives/invariant/invariant_state.py

    r1fa4f736 r2469df7  
    655655        : return: None 
    656656        """ 
    657         if self.cansas == True: 
     657        if self.cansas: 
    658658            return self._read_cansas(path) 
    659659        else: 
     
    763763        """ 
    764764        # Sanity check 
    765         if self.cansas == True: 
     765        if self.cansas: 
    766766            doc = self.write_toXML(datainfo, invstate) 
    767767            # Write the XML document 
  • src/sas/sasgui/perspectives/pr/explore_dialog.py

    r959eb01 r20fa5fe  
    9393 
    9494        :TODO: Would be nice to add printing and log/linear scales. 
    95             The current verison of plottools no longer plays well with 
     95            The current version of plottools no longer plays well with 
    9696            plots outside of guiframe. Guiframe team needs to fix this. 
    9797        """ 
  • src/sas/sasgui/perspectives/pr/inversion_state.py

    r1fa4f736 r2469df7  
    389389 
    390390        """ 
    391         if self.cansas == True: 
     391        if self.cansas: 
    392392            return self._read_cansas(path) 
    393393        else: 
     
    505505        """ 
    506506        # Sanity check 
    507         if self.cansas == True: 
     507        if self.cansas: 
    508508            doc = self.write_toXML(datainfo, prstate) 
    509509            # Write the XML document 
  • src/sas/sasgui/perspectives/pr/pr.py

    rcb62bd5 r2469df7  
    407407            y[i] = value 
    408408 
    409         if self._normalize_output == True: 
     409        if self._normalize_output: 
    410410            y = y / total 
    411411            dy = dy / total 
    412         elif self._scale_output_unity == True: 
     412        elif self._scale_output_unity: 
    413413            y = y / pmax 
    414414            dy = dy / pmax 
     
    544544            lines = buff.split('\n') 
    545545            for line in lines: 
    546                 if data_started == True: 
     546                if data_started: 
    547547                    try: 
    548548                        toks = line.split() 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r3bd677b ree6ab94  
    16431643                        if item_page[2].__class__.__name__ == "ComboBox": 
    16441644                            if item_page_info[2] in self.model.fun_list: 
    1645                                 fun_val = self.model.fun_list[item_page_info[2]] 
     1645                                # to fix: fun_list is not a dictionary, but a tuple 
     1646                                # so the following line (commented) will fail 
     1647                                # fun_val = self.model.fun_list[item_page_info[2]] 
     1648                                # I guess the following should work, but  
     1649                                # could not test as I don't know when this 
     1650                                # part is used by SasView. 
     1651                                fun_val = self.model.fun_list.index(item_page_info[2]) 
    16461652                                self.model.setParam(item_page_info[1], fun_val) 
    16471653                    if item_page[3] is not None: 
     
    16871693                selection = value 
    16881694                if value in self.model.fun_list: 
    1689                     selection = self.model.fun_list[value] 
     1695                    # to fix: fun_list is not a dictionary, so  
     1696                    # I commented the following original line  
     1697                    #selection = self.model.fun_list[value] 
     1698                    # and replaced by this. 
     1699                    # I think this should work, but could not test it. 
     1700                    selection = self.model.fun_list.index(value) 
    16901701                item_page[2].SetValue(selection) 
    16911702                self.model.setParam(param_name, selection) 
     
    33653376                    if item[2].__class__.__name__ == "ComboBox": 
    33663377                        if content[name][1] in self.model.fun_list: 
    3367                             fun_val = self.model.fun_list[content[name][1]] 
     3378                            # to fix: fun_list is not a dictionary, but a tuple 
     3379                            # so the following line (commented) will fail 
     3380                            # fun_val = self.model.fun_list[content[name][1]] 
     3381                            # I guess the following should work, but  
     3382                            # could not test as I don't know when this 
     3383                            # part is used by SasView. 
     3384                            fun_val = self.model.fun_list.index(content[name][1]) 
    33683385                            self.model.setParam(name, fun_val) 
    33693386                    try: 
     
    34153432                        if item[2].__class__.__name__ == "ComboBox": 
    34163433                            if value[0] in self.model.fun_list: 
    3417                                 fun_val = self.model.fun_list[value[0]] 
     3434                                # Fixed: fun_list not a dictionary! 
     3435                                # Arrives here when spherical_sld model is 
     3436                                # selected and number of shells modified. 
     3437                                fun_val = self.model.fun_list.index(value[0]) 
    34183438                                self.model.setParam(name, fun_val) 
    34193439                                # save state 
Note: See TracChangeset for help on using the changeset viewer.