Changeset 882cfec in sasview


Ignore:
Timestamp:
Nov 28, 2017 9:56:33 AM (5 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:
b6b81a3, 19b5c886, fb7c816, 814ee32
Parents:
45bfe3f1 (diff), c926a97 (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/28/17 09:56:33)
git-committer:
GitHub <noreply@…> (11/28/17 09:56:33)
Message:

Merge pull request #126 from SasView?/ticket-776-orientation

a

Files:
12 deleted
56 edited

Legend:

Unmodified
Added
Removed
  • 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> 
  • 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 
  • docs/sphinx-docs/source/conf.py

    rf80b416e r3ca67dcf  
    7878# 
    7979# The short X.Y version. 
    80 version = '4.1' 
     80version = '4.2' 
    8181# The full version, including alpha/beta/rc tags. 
    82 release = '4.1.2' 
     82release = '4.2.0' 
    8383 
    8484# The language for content autogenerated by Sphinx. Refer to documentation 
  • setup.py

    r36ca21e rae42c85  
    428428    entry_points={ 
    429429        'console_scripts': [ 
    430             "sasview = sas.sasview.sasview:run", 
     430            "sasview = sas.sasview.sasview:run_gui", 
    431431        ] 
    432432    }, 
  • src/examples/test_panel2D.py

    r9a5097c r20fa5fe  
    205205            L=Loader() 
    206206             
    207             #Recieves data  
     207            #Receives data 
    208208            try: 
    209209                output=L.load(path) 
  • src/sas/sascalc/calculator/instrument.py

    r574adc7 rf4775563  
    314314        """ 
    315315        To plot the wavelength spactrum 
    316         : requirment: matplotlib.pyplot 
     316        : requirement: matplotlib.pyplot 
    317317        """ 
    318318        try: 
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r9e6aeaf r20fa5fe  
    8585 
    8686        # Return a list of parsed entries that data_loader can manage 
    87         return self.output 
     87        final_data = self.output 
     88        self.reset_state() 
     89        return final_data 
     90 
     91    def reset_state(self): 
     92        """ 
     93        Resets the class state to a base case when loading a new data file so previous 
     94        data files do not appear a second time 
     95        """ 
     96        self.current_datainfo = None 
     97        self.current_dataset = None 
     98        self.output = [] 
    8899 
    89100    def nextline(self): 
     
    112123        """ 
    113124        Generic error handler to add an error to the current datainfo to 
    114         propogate the error up the error chain. 
     125        propagate the error up the error chain. 
    115126        :param msg: Error message 
    116127        """ 
     
    314325    def splitline(line): 
    315326        """ 
    316         Splits a line into pieces based on common delimeters 
     327        Splits a line into pieces based on common delimiters 
    317328        :param line: A single line of text 
    318329        :return: list of values 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r2b538cd r2469df7  
    6868        data files do not appear a second time 
    6969        """ 
    70         self.current_datainfo = None 
    71         self.current_dataset = None 
    72         self.current_data1d = None 
     70        super(Reader, self).reset_state() 
    7371        self.data = [] 
    7472        self.process = Process() 
     
    7977        self.names = [] 
    8078        self.cansas_defaults = {} 
    81         self.output = [] 
    8279        self.ns_list = None 
    8380        self.logging = [] 
     
    8582 
    8683    def read(self, xml_file, schema_path="", invalid=True): 
    87         if schema_path != "" or invalid != True: 
     84        if schema_path != "" or not invalid: 
    8885            # read has been called from self.get_file_contents because xml file doens't conform to schema 
    8986            _, self.extension = os.path.splitext(os.path.basename(xml_file)) 
     
    945942            pos, "z", datainfo.sample.position.z, 
    946943            {"unit": datainfo.sample.position_unit}) 
    947         if written == True: 
     944        if written: 
    948945            self.append(pos, sample) 
    949946 
     
    958955            ori, "yaw", datainfo.sample.orientation.z, 
    959956            {"unit": datainfo.sample.orientation_unit}) 
    960         if written == True: 
     957        if written: 
    961958            self.append(ori, sample) 
    962959 
     
    10051002            size, "z", datainfo.source.beam_size.z, 
    10061003            {"unit": datainfo.source.beam_size_unit}) 
    1007         if written == True: 
     1004        if written: 
    10081005            self.append(size, source) 
    10091006 
     
    10611058                    size, "z", aperture.size.z, 
    10621059                    {"unit": aperture.size_unit}) 
    1063                 if written == True: 
     1060                if written: 
    10641061                    self.append(size, apert) 
    10651062 
     
    10841081            written = written | self.write_node(det, "SDD", item.distance, 
    10851082                                                {"unit": item.distance_unit}) 
    1086             if written == True: 
     1083            if written: 
    10871084                self.append(det, instr) 
    10881085 
     
    10941091            written = written | self.write_node(off, "z", item.offset.z, 
    10951092                                                {"unit": item.offset_unit}) 
    1096             if written == True: 
     1093            if written: 
    10971094                self.append(off, det) 
    10981095 
     
    11061103                                                item.orientation.z, 
    11071104                                                {"unit": item.orientation_unit}) 
    1108             if written == True: 
     1105            if written: 
    11091106                self.append(ori, det) 
    11101107 
     
    11181115                                                item.beam_center.z, 
    11191116                                                {"unit": item.beam_center_unit}) 
    1120             if written == True: 
     1117            if written: 
    11211118                self.append(center, det) 
    11221119 
     
    11281125            written = written | self.write_node(pix, "z", item.pixel_size.z, 
    11291126                                                {"unit": item.pixel_size_unit}) 
    1130             if written == True: 
     1127            if written: 
    11311128                self.append(pix, det) 
    11321129            self.write_node(det, "slit_length", item.slit_length, 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r2b538cd r61f329f0  
    6565        """ 
    6666        # Reinitialize when loading a new data file to reset all class variables 
    67         self.reset_class_variables() 
     67        self.reset_state() 
    6868 
    6969        filename = self.f_open.name 
     
    101101                            raise FileContentsException("Fewer than 5 data points found.") 
    102102 
    103     def reset_class_variables(self): 
     103    def reset_state(self): 
    104104        """ 
    105105        Create the reader object and define initial states for class variables 
    106106        """ 
    107         self.current_datainfo = None 
    108         self.current_dataset = None 
     107        super(Reader, self).reset_state() 
    109108        self.data1d = [] 
    110109        self.data2d = [] 
     
    112111        self.errors = set() 
    113112        self.logging = [] 
    114         self.output = [] 
    115113        self.parent_class = u'' 
    116114        self.detector = Detector() 
  • 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/file_converter/otoko_loader.py

    r0b1a677 r20fa5fe  
    3636 
    3737        Given the paths of two header files, this function will load each axis in 
    38         turn.  If loading is successfull then an instance of the OTOKOData class 
     38        turn.  If loading is successful then an instance of the OTOKOData class 
    3939        will be returned, else an exception will be raised. 
    4040 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    r574adc7 r20fa5fe  
    7878    def get_params(self, fitparams): 
    7979        """ 
    80         return a list of value of paramter to fit 
    81  
    82         :param fitparams: list of paramaters name to fit 
     80        return a list of value of parameter to fit 
     81 
     82        :param fitparams: list of parameters name to fit 
    8383 
    8484        """ 
  • 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/c_extensions/Cinvertor.c

    rd04ac05 ra52f32f  
    735735 
    736736const char get_peaks_doc[] = 
    737         "Returns the number of peaks in the output P(r) distrubution\n" 
     737        "Returns the number of peaks in the output P(r) distribution\n" 
    738738        "for the given set of coefficients.\n" 
    739739        " @param args: c-parameters\n" 
  • src/sas/sascalc/pr/fit/AbstractFitEngine.py

    r574adc7 r20fa5fe  
    7878    def get_params(self, fitparams): 
    7979        """ 
    80         return a list of value of paramter to fit 
    81  
    82         :param fitparams: list of paramaters name to fit 
     80        return a list of value of parameter to fit 
     81 
     82        :param fitparams: list of parameters name to fit 
    8383 
    8484        """ 
  • 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/data_processor.py

    ra1b8fee r20fa5fe  
    758758        cell pop up context by right clicking on a cell and gives the 
    759759        option to cut, paste, and clear. This will probably be removed in 
    760         future versions and is being superceded by more traditional cut and 
     760        future versions and is being superseded by more traditional cut and 
    761761        paste options. 
    762762        """ 
     
    800800        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
    801801        context menu which is being removed. This will probably be removed in 
    802         future versions and is being superceded by more traditional cut and 
     802        future versions and is being superseded by more traditional cut and 
    803803        paste options 
    804804        """ 
     
    812812        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
    813813        context menu which is being removed. This will probably be removed in 
    814         future versions and is being superceded by more traditional cut and 
     814        future versions and is being superseded by more traditional cut and 
    815815        paste options 
    816816        """ 
     
    828828        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
    829829        context menu which is being removed. This will probably be removed in 
    830         future versions and is being superceded by more traditional cut and 
     830        future versions and is being superseded by more traditional cut and 
    831831        paste options 
    832832        """ 
     
    12331233        """ 
    12341234        Get object represented by the given cells and plot them.  Basically 
    1235         plot the colum in y vs the column in x. 
     1235        plot the column in y vs the column in x. 
    12361236        """ 
    12371237 
     
    19611961        selection_sizer.Add(self.save_to_file, (iy, ix), 
    19621962                            (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    1963         #contruction the sizer contaning button 
     1963        #contruction the sizer containing button 
    19641964        button_sizer.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    19651965 
  • src/sas/sasgui/guiframe/events.py

    r959eb01 r20fa5fe  
    1414#create a panel slicer 
    1515(SlicerPanelEvent, EVT_SLICER_PANEL)   = wx.lib.newevent.NewEvent() 
    16 #print update paramaters for panel slicer 
     16#print update parameers for panel slicer 
    1717(SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE)   = wx.lib.newevent.NewEvent() 
    1818#update the slicer from the panel 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    rb963b20 r20fa5fe  
    9090    def can_load_data(self): 
    9191        """ 
    92         if return True, then call handler to laod data 
     92        if return True, then call handler to load data 
    9393        """ 
    9494        return True 
  • 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/guiframe/local_perspectives/plotting/binder.py

    r463e7ffc r20fa5fe  
    359359        # TODO: Do we need an explicit focus command for keyboard? 
    360360        # TODO: Can we tab between items? 
    361         # TODO: How do unhandled events get propogated to axes, figure and 
     361        # TODO: How do unhandled events get propagated to axes, figure and 
    362362        # TODO: finally to application?  Do we need to implement a full tags 
    363363        # TODO: architecture a la Tk? 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py

    r7432acb r20fa5fe  
    216216        """ 
    217217        self.base.thaw_axes() 
    218         # Post paramters 
     218        # Post parameters 
    219219        event = SlicerParameterEvent() 
    220220        event.type = self.__class__.__name__ 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py

    r45dffa69 r20fa5fe  
    7777    def compute(self): 
    7878        """ 
    79         excuting computation 
     79        executing computation 
    8080        """ 
    8181        elapsed = time.time() - self.starttime 
  • src/sas/sasgui/guiframe/plugin_base.py

    r7432acb r20fa5fe  
    8282    def can_load_data(self): 
    8383        """ 
    84         if return True, then call handler to laod data 
     84        if return True, then call handler to load data 
    8585        """ 
    8686        return False 
  • src/sas/sasgui/guiframe/proxy.py

    ra1b8fee r20fa5fe  
    1717connect() function: 
    1818    - auto detects proxy in windows, osx 
    19     - in ux systems, the http_proxy enviroment variable must be set 
     19    - in ux systems, the http_proxy environment variable must be set 
    2020    - if it fails, try to find the proxy.pac address. 
    2121      - parses the file, and looks up for all possible proxies 
  • 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/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/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/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/binder.py

    ra1b8fee r20fa5fe  
    366366        # TODO: Do we need an explicit focus command for keyboard? 
    367367        # TODO: Can we tab between items? 
    368         # TODO: How do unhandled events get propogated to axes, figure and 
     368        # TODO: How do unhandled events get propagated to axes, figure and 
    369369        # TODO: finally to application?  Do we need to implement a full tags 
    370370        # TODO: architecture a la Tk? 
  • 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 
  • src/sas/sasgui/plottools/toolbar.py

    r959eb01 r20fa5fe  
    145145    def OnPrintPage(self, page): 
    146146        """ 
    147         Most rudimentry OnPrintPage overide.  instatiates a dc object, gets 
     147        Most rudimentry OnPrintPage override.  instatiates a dc object, gets 
    148148        its size, gets the size of the figure object, scales it to the dc 
    149149        canvas size keeping the aspect ratio intact, then prints as bitmap 
  • src/sas/sasview/__init__.py

    r6a88ad9 r3ca67dcf  
    1 __version__ = "4.1" 
     1__version__ = "4.2.0" 
    22__build__ = "GIT_COMMIT" 
  • src/sas/sasview/sasview.py

    r0225a3f r20fa5fe  
    203203    plugin_dir = os.path.join(sas.get_user_dir(), PLUGIN_MODEL_DIR) 
    204204    os.environ['SAS_MODELPATH'] = plugin_dir 
    205     #Initiliaze enviromental variable with custom setting but only if variable not set 
     205    #Initialize environment variable with custom setting but only if variable not set 
    206206    SAS_OPENCL = sas.get_custom_config().SAS_OPENCL 
    207207    if SAS_OPENCL and "SAS_OPENCL" not in os.environ: 
  • test/fileconverter/test/utest_nxcansas_writer.py

    r5a8cdbb rc16ffe7  
    33 
    44import os 
    5 import pylint 
    65import unittest 
    76import warnings 
  • test/sasdataloader/test/utest_abs_reader.py

    r574adc7 rfe15198  
    2020    def setUp(self): 
    2121        reader = AbsReader() 
    22         data = reader.read("jan08002.ABS") 
    23         self.data= data[0] 
     22        self.data_list = reader.read("jan08002.ABS") 
     23        self.data = self.data_list[0] 
    2424 
    2525    def test_abs_checkdata(self): 
     
    7676    def setUp(self): 
    7777        reader = DANSEReader() 
    78         data = reader.read("MP_New.sans") 
    79         self.data = data[0] 
     78        self.data_list = reader.read("MP_New.sans") 
     79        self.data = self.data_list[0] 
    8080 
    8181    def test_checkdata(self): 
     
    8787            tests won't pass 
    8888        """ 
     89        self.assertEqual(len(self.data_list), 1) 
    8990        self.assertEqual(self.data.filename, "MP_New.sans") 
    9091        self.assertEqual(self.data.meta_data['loader'], "DANSE") 
     
    114115        # the generic loader should work as well 
    115116        data = Loader().load("MP_New.sans") 
     117        self.assertEqual(len(data), 1) 
    116118        self.assertEqual(data[0].meta_data['loader'], "DANSE") 
    117119 
     
    121123    def setUp(self): 
    122124        reader = CANSASReader() 
    123         data = reader.read("cansas1d.xml") 
    124         self.data = data[0] 
     125        self.data_list = reader.read("cansas1d.xml") 
     126        self.data = self.data_list[0] 
    125127 
    126128    def test_generic_loader(self): 
    127129        # the generic loader should work as well 
    128130        data = Loader().load("cansas1d.xml") 
     131        self.assertEqual(len(data), 1) 
    129132        self.assertEqual(data[0].meta_data['loader'], "CanSAS XML 1D") 
    130133 
     
    141144            tests won't pass 
    142145        """ 
     146        self.assertEqual(len(self.data_list), 1) 
    143147        self.assertEqual(self.data.run[0], "1234") 
    144148        self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 
     
    281285        data = Loader().load(filename) 
    282286        self.data = data[0] 
     287        self.assertEqual(len(data), 1) 
    283288        self.assertEqual(self.data.filename, filename) 
    284289        self._checkdata() 
     
    294299        data = CANSASReader().read(filename) 
    295300        self.data = data[0] 
     301        self.assertEqual(len(data), 1) 
    296302        self.assertEqual(self.data.filename, filename) 
    297303        self._checkdata() 
     
    305311        data = CANSASReader().read(filename) 
    306312        self.data = data[0] 
     313        self.assertEqual(len(data), 1) 
    307314        self.assertEqual(self.data.filename, filename) 
    308315        # The followed should not have been loaded 
     
    321328        data = CANSASReader().read(filename) 
    322329        self.data = data[0] 
     330        self.assertEqual(len(data), 1) 
     331        self.assertEqual(len(self.data_list), 1) 
    323332        self.assertEqual(self.data.filename, filename) 
    324333        self.assertEqual(self.data.run[0], "1234") 
  • test/sasdataloader/test/utest_ascii.py

    ra78a02f rfe15198  
    2929        """ 
    3030        # The length of the data is 10 
     31        self.assertEqual(len(self.f1_list), 1) 
     32        self.assertEqual(len(self.f2_list), 1) 
     33        self.assertEqual(len(self.f3_list), 1) 
     34        self.assertEqual(len(self.f4_list), 1) 
     35        self.assertEqual(len(self.f5_list), 1) 
    3136        self.assertEqual(len(self.f1.x), 10) 
    3237        self.assertEqual(self.f1.x[0],0.002618) 
  • test/sasdataloader/test/utest_averaging.py

    r2a52b0e rfe15198  
    104104        filepath = os.path.join(os.path.dirname( 
    105105            os.path.realpath(__file__)), 'MAR07232_rest.h5') 
    106         self.data = Loader().load(filepath)[0] 
     106        self.data_list = Loader().load(filepath) 
     107        self.data = self.data_list[0] 
    107108 
    108109    def test_ring(self): 
     
    119120        filepath = os.path.join(os.path.dirname( 
    120121            os.path.realpath(__file__)), 'ring_testdata.txt') 
    121         answer = Loader().load(filepath)[0] 
    122  
     122        answer_list = Loader().load(filepath) 
     123        answer = answer_list[0] 
     124 
     125        self.assertEqual(len(answer_list), 1) 
    123126        for i in range(r.nbins_phi - 1): 
    124127            self.assertAlmostEqual(o.x[i + 1], answer.x[i], 4) 
  • test/sasdataloader/test/utest_generic_file_reader_class.py

    rbeba407 r3648cbf  
    1717 
    1818    def setUp(self): 
    19         self.reader = FileReader() 
     19        self.reader = TestFileReader() 
    2020        self.bad_file = "ACB123.txt" 
    2121        self.good_file = "123ABC.txt" 
    22         self.msg = "Unable to find file at: {}\n".format(self.bad_file) 
    23         self.msg += "Please check your file path and try again." 
    24         x = np.zeros(0) 
    25         y = np.zeros(0) 
    26         self.reader.current_dataset = plottable_1D(x, y) 
    27         self.reader.current_datainfo = DataInfo() 
    28         self.reader.send_to_output() 
    2922 
    3023    def test_bad_file_path(self): 
    3124        output = self.reader.read(self.bad_file) 
    32         self.assertEqual(len(output[0].errors), 1) 
    33         self.assertEqual(output[0].errors[0], self.msg) 
     25        self.assertEqual(output, []) 
    3426 
    3527    def test_good_file_path(self): 
    36         f_open = open(self.good_file, 'w') 
    37         f_open.close() 
     28        f = open(self.good_file, 'w') 
     29        f.write('123ABC exists!') 
     30        f.close() 
    3831        output = self.reader.read(self.good_file) 
    39         self.assertEqual(len(output[0].errors), 1) 
    40         self.assertEqual(output[0].errors[0], self.msg) 
     32        self.assertEqual(len(output), 1) 
     33        self.assertEqual(output[0].meta_data["blah"], '123ABC exists!') 
    4134 
    4235    def tearDown(self): 
     
    4538        if os.path.isfile(self.good_file): 
    4639            os.remove(self.good_file) 
     40 
     41class TestFileReader(FileReader): 
     42    def get_file_contents(self): 
     43        """ 
     44        Reader specific class to access the contents of the file 
     45        All reader classes that inherit from FileReader must implement 
     46        """ 
     47        x = np.zeros(0) 
     48        y = np.zeros(0) 
     49        self.current_dataset = plottable_1D(x,y) 
     50        self.current_datainfo = DataInfo() 
     51        self.current_datainfo.meta_data["blah"] = self.nextline() 
     52        self.send_to_output() 
  • test/sasdataloader/test/utest_red2d_reader.py

    r248ff73 rfe15198  
    1414    def setUp(self): 
    1515        self.loader = Loader() 
     16        self.data_list = self.loader.load("exp18_14_igor_2dqxqy.dat") 
    1617 
    1718    def test_checkdata(self): 
     
    1920            Test .DAT file loaded as IGOR/DAT 2D Q_map 
    2021        """ 
    21         f = self.loader.load("exp18_14_igor_2dqxqy.dat")[0] 
     22        f = self.data_list[0] 
    2223        # The length of the data is 10 
     24        self.assertEqual(len(self.data_list), 1) 
    2325        self.assertEqual(len(f.qx_data),  36864) 
    2426        self.assertEqual(f.qx_data[0],-0.03573497) 
  • test/sasdataloader/test/utest_sesans.py

    ra78a02f rfe15198  
    2222        f = file[0] 
    2323        # self.assertEqual(f, 5) 
     24        self.assertEqual(len(file), 1) 
    2425        self.assertEqual(len(f.x), 40) 
    2526        self.assertEqual(f.x[0], 391.56) 
     
    3940        file = self.loader("sesans_examples/sphere_isis.ses") 
    4041        f = file[0] 
     42        self.assertEqual(len(file), 1) 
    4143        self.assertEqual(len(f.x), 57) 
    4244        self.assertEqual(f.x[-1], 19303.4) 
Note: See TracChangeset for help on using the changeset viewer.