Changes in / [cb11a25:79c9ce5] in sasview


Ignore:
Files:
11 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/source/_extensions/dollarmath.py

    reddf6af5 r2a2fb09  
    1111 
    1212import re 
    13 _dollar = re.compile(r"(?:^|(?<=\s))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;:?\\()]))") 
     13_dollar = re.compile(r"(?:^|(?<=\s|[-(]))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[-.,;:?\\)]))") 
    1414_notdollar = re.compile(r"\\[$]") 
    1515 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r61f329f0 r2469df7  
    8282 
    8383    def read(self, xml_file, schema_path="", invalid=True): 
    84         if schema_path != "" or invalid != True: 
     84        if schema_path != "" or not invalid: 
    8585            # read has been called from self.get_file_contents because xml file doens't conform to schema 
    8686            _, self.extension = os.path.splitext(os.path.basename(xml_file)) 
     
    942942            pos, "z", datainfo.sample.position.z, 
    943943            {"unit": datainfo.sample.position_unit}) 
    944         if written == True: 
     944        if written: 
    945945            self.append(pos, sample) 
    946946 
     
    955955            ori, "yaw", datainfo.sample.orientation.z, 
    956956            {"unit": datainfo.sample.orientation_unit}) 
    957         if written == True: 
     957        if written: 
    958958            self.append(ori, sample) 
    959959 
     
    10021002            size, "z", datainfo.source.beam_size.z, 
    10031003            {"unit": datainfo.source.beam_size_unit}) 
    1004         if written == True: 
     1004        if written: 
    10051005            self.append(size, source) 
    10061006 
     
    10581058                    size, "z", aperture.size.z, 
    10591059                    {"unit": aperture.size_unit}) 
    1060                 if written == True: 
     1060                if written: 
    10611061                    self.append(size, apert) 
    10621062 
     
    10811081            written = written | self.write_node(det, "SDD", item.distance, 
    10821082                                                {"unit": item.distance_unit}) 
    1083             if written == True: 
     1083            if written: 
    10841084                self.append(det, instr) 
    10851085 
     
    10911091            written = written | self.write_node(off, "z", item.offset.z, 
    10921092                                                {"unit": item.offset_unit}) 
    1093             if written == True: 
     1093            if written: 
    10941094                self.append(off, det) 
    10951095 
     
    11031103                                                item.orientation.z, 
    11041104                                                {"unit": item.orientation_unit}) 
    1105             if written == True: 
     1105            if written: 
    11061106                self.append(ori, det) 
    11071107 
     
    11151115                                                item.beam_center.z, 
    11161116                                                {"unit": item.beam_center_unit}) 
    1117             if written == True: 
     1117            if written: 
    11181118                self.append(center, det) 
    11191119 
     
    11251125            written = written | self.write_node(pix, "z", item.pixel_size.z, 
    11261126                                                {"unit": item.pixel_size_unit}) 
    1127             if written == True: 
     1127            if written: 
    11281128                self.append(pix, det) 
    11291129            self.write_node(det, "slit_length", item.slit_length, 
  • src/sas/sascalc/dataloader/readers/danse_reader.py

    raf3e9f5 r2469df7  
    157157        # Store all data 
    158158        # Store wavelength 
    159         if has_converter == True and self.current_datainfo.source.wavelength_unit != 'A': 
     159        if has_converter and self.current_datainfo.source.wavelength_unit != 'A': 
    160160            conv = Converter('A') 
    161161            wavelength = conv(wavelength, 
     
    164164 
    165165        # Store distance 
    166         if has_converter == True and detector.distance_unit != 'm': 
     166        if has_converter and detector.distance_unit != 'm': 
    167167            conv = Converter('m') 
    168168            distance = conv(distance, units=detector.distance_unit) 
     
    170170 
    171171        # Store pixel size 
    172         if has_converter == True and detector.pixel_size_unit != 'mm': 
     172        if has_converter and detector.pixel_size_unit != 'mm': 
    173173            conv = Converter('mm') 
    174174            pixel = conv(pixel, units=detector.pixel_size_unit) 
  • src/sas/sascalc/fit/MultiplicationModel.py

    r574adc7 r0a9cbc3  
    6868        try: 
    6969            multiplicity = p_model.multiplicity 
    70         except: 
     70        except AttributeError: 
    7171            multiplicity = 1 
    7272        ## functional multiplicity of the model 
     
    7676        self.non_fittable = p_model.non_fittable 
    7777        self.multiplicity_info = [] 
    78         self.fun_list = {} 
     78        self.fun_list = [] 
    7979        if self.non_fittable > 1: 
    8080            try: 
     
    8282                self.fun_list = p_model.fun_list 
    8383                self.is_multiplicity_model = True 
    84             except: 
     84            except AttributeError: 
    8585                pass 
    8686        else: 
  • src/sas/sascalc/fit/qsmearing.py

    r50fcb09 r2469df7  
    9090            #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0] 
    9191    # If we found resolution smearing data, return a QSmearer 
    92     if _found_resolution == True: 
     92    if _found_resolution: 
    9393         return pinhole_smear(data, model) 
    9494 
     
    113113                break 
    114114    # If we found slit smearing data, return a slit smearer 
    115     if _found_slit == True: 
     115    if _found_slit: 
    116116        return slit_smear(data, model) 
    117117    return None 
  • src/sas/sascalc/pr/invertor.py

    rd04ac05 r2469df7  
    222222        elif name == 'est_bck': 
    223223            value = self.get_est_bck() 
    224             if value == 1: 
    225                 return True 
    226             else: 
    227                 return False 
     224            return value == 1 
    228225        elif name in self.__dict__: 
    229226            return self.__dict__[name] 
     
    460457 
    461458        # If we need to fit the background, add a term 
    462         if self.est_bck == True: 
     459        if self.est_bck: 
    463460            nfunc_0 = nfunc 
    464461            nfunc += 1 
     
    506503 
    507504        # Keep a copy of the last output 
    508         if self.est_bck == False: 
     505        if not self.est_bck: 
    509506            self.out = c 
    510507            self.cov = err 
     
    658655        file.write("#slit_width=%g\n" % self.slit_width) 
    659656        file.write("#background=%g\n" % self.background) 
    660         if self.est_bck == True: 
     657        if self.est_bck: 
    661658            file.write("#has_bck=1\n") 
    662659        else: 
     
    738735                    elif line.startswith('#has_bck='): 
    739736                        toks = line.split('=') 
    740                         if int(toks[1]) == 1: 
    741                             self.est_bck = True 
    742                         else: 
    743                             self.est_bck = False 
     737                        self.est_bck = int(toks[1]) == 1 
    744738 
    745739                    # Now read in the parameters 
  • src/sas/sascalc/pr/num_term.py

    ra1b8fee r2469df7  
    5555        medi = 0 
    5656        for i in range(dv): 
    57             if odd == True: 
     57            if odd: 
    5858                medi = osc[int(med)] 
    5959            else: 
     
    9898                new_osc3.append(self.osc_list[i]) 
    9999 
    100         if flag9 == True: 
     100        if flag9: 
    101101            self.dataset = new_osc1 
    102         elif flag8 == True: 
     102        elif flag8: 
    103103            self.dataset = new_osc2 
    104104        else: 
     
    141141            div = len(nts) 
    142142            tem = float(div) / 2.0 
    143             odd = self.is_odd(div) 
    144             if odd == True: 
     143            if self.is_odd(div): 
    145144                nt = nts[int(tem)] 
    146145            else: 
     
    148147            return nt, self.alpha_list[nt - 10], self.mess_list[nt - 10] 
    149148        except: 
    150             #TODO: check the logic above and make sure it doesn't  
     149            #TODO: check the logic above and make sure it doesn't 
    151150            # rely on the try-except. 
    152151            return self.nterm_min, self.invertor.alpha, '' 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r7432acb r2469df7  
    827827        on_Modify Plot Property_close 
    828828        """ 
    829         if self.appD.okay_clicked == True: 
     829        if self.appD.okay_clicked: 
    830830            info = self.appD.get_current_values() 
    831831            self.appearance_selected_plot.custom_color = \ 
  • 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

    r1c206d9 r2469df7  
    332332            msg = ("%s is not a valid Python name. Only alphanumeric \n" \ 
    333333                   "and underscore allowed" % self.name) 
    334          
     334 
    335335        #Now check if the name already exists 
    336336        if not self.overwrite_name and self.good_name: 
     
    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/fitting/basepage.py

    rdf4af9b reee94bf  
    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                                fun_val = self.model.fun_list.index(item_page_info[2]) 
    16461646                                self.model.setParam(item_page_info[1], fun_val) 
    16471647                    if item_page[3] is not None: 
     
    16871687                selection = value 
    16881688                if value in self.model.fun_list: 
    1689                     selection = self.model.fun_list[value] 
     1689                    selection = self.model.fun_list.index(value) 
    16901690                item_page[2].SetValue(selection) 
    16911691                self.model.setParam(param_name, selection) 
     
    33653365                    if item[2].__class__.__name__ == "ComboBox": 
    33663366                        if content[name][1] in self.model.fun_list: 
    3367                             fun_val = self.model.fun_list[content[name][1]] 
     3367                            fun_val = self.model.fun_list.index(content[name][1]) 
    33683368                            self.model.setParam(name, fun_val) 
    33693369                    try: 
     
    34153415                        if item[2].__class__.__name__ == "ComboBox": 
    34163416                            if value[0] in self.model.fun_list: 
    3417                                 fun_val = self.model.fun_list[value[0]] 
     3417                                fun_val = self.model.fun_list.index(value[0]) 
    34183418                                self.model.setParam(name, fun_val) 
    34193419                                # save state 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    rdf4af9b rbfeb823  
    17261726                and not self.temp_multi_functional: 
    17271727            return None 
    1728         # Get the func name list 
    1729         list = self.model.fun_list 
    1730         if len(list) == 0: 
    1731             return None 
    1732         # build function (combo)box 
    1733         ind = 0 
    1734         while(ind < len(list)): 
    1735             for key, val in list.items(): 
    1736                 if val == ind: 
    1737                     fun_box.Append(key, val) 
    1738                     break 
    1739             ind += 1 
     1728        for index, choice in enumerate(self.model.fun_list): 
     1729            fun_box.Append(choice, index) 
    17401730 
    17411731    def _on_select_accuracy(self, event): 
     
    17651755        value = fun_box.GetValue() 
    17661756        if value in self.model.fun_list: 
    1767             fun_val = self.model.fun_list[value] 
     1757            fun_val = self.model.fun_list.index(value) 
    17681758 
    17691759        self.model.setParam(name, fun_val) 
  • 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/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/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/plottools/PlotPanel.py

    ra1b8fee r2469df7  
    476476            return 
    477477        self.mousemotion = True 
    478         if self.leftdown == True and self.mousemotion == True: 
     478        if self.leftdown and self.mousemotion: 
    479479            ax = event.inaxes 
    480480            if ax is not None:  # the dragging is perform inside the figure 
  • src/sas/sasgui/plottools/fitDialog.py

    r7432acb r2469df7  
    4444        fitting and derives and displays specialized output parameters based 
    4545        on the scale choice of the plot calling it. 
    46          
     46 
    4747        :note1: The fitting is currently a bit convoluted as besides using 
    4848        plottools.transform.py to handle all the conversions, it uses 
     
    5555        This would considerably simplify the code and remove the need I think 
    5656        for LineModel.py and possibly fittins.py altogether.   -PDB 7/10/16 
    57          
     57 
    5858        :note2: The linearized fits do not take resolution into account. This 
    5959        means that for poor resolution such as slit smearing the answers will 
     
    142142        """ 
    143143 
    144         # set up sizers first.  
     144        # set up sizers first. 
    145145        # vbox is the panel sizer and is a vertical sizer 
    146146        # The first element of the panel is sizer which is a gridbagsizer 
     
    151151        sizer = wx.GridBagSizer(5, 5) 
    152152        sizer_button = wx.BoxSizer(wx.HORIZONTAL) 
    153          
     153 
    154154        #size of string boxes in pixels 
    155155        _BOX_WIDTH = 100 
     
    395395        sizer_button.Add(self.btClose, 0, 
    396396                         wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10) 
    397          
     397 
    398398        vbox.Add(sizer) 
    399         self.static_line_1 = wx.StaticLine(self, -1)         
     399        self.static_line_1 = wx.StaticLine(self, -1) 
    400400        vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 
    401401        vbox.Add(sizer_button, 0, wx.EXPAND | wx.BOTTOM | wx.TOP, 10) 
     
    439439        # makes transformation for y as a line to fit 
    440440        if self.x != []: 
    441             if self.checkFitValues(self.xminFit) == True: 
     441            if self.checkFitValues(self.xminFit): 
    442442                # Check if the field of Fit Dialog contain values 
    443443                # and use the x max and min of the user 
  • src/sas/sasgui/plottools/plottable_interactor.py

    ra1b8fee r2469df7  
    166166        from within the boundaries of an artist. 
    167167        """ 
    168         if self._context_menu == True: 
     168        if self._context_menu: 
    169169            self._context_menu = False 
    170170            evt.artist = self.marker 
     
    216216        """ 
    217217        if not evt.artist.__class__.__name__ == "AxesSubplot": 
    218             if self._context_menu == False: 
     218            if not self._context_menu: 
    219219                self.base.plottable_selected(None) 
    220220                try: 
  • src/sas/sasgui/plottools/plottables.py

    r2d9526d r2469df7  
    227227        max_value = None 
    228228        for p in self.plottables: 
    229             if p.hidden == True: 
     229            if p.hidden: 
    230230                continue 
    231231            if p.x is not None: 
     
    10621062        Renders the plottable on the graph 
    10631063        """ 
    1064         if self.interactive == True: 
     1064        if self.interactive: 
    10651065            kw['symbol'] = self.symbol 
    10661066            kw['id'] = self.id 
Note: See TracChangeset for help on using the changeset viewer.