Ignore:
Timestamp:
Mar 2, 2015 4:09:46 PM (10 years ago)
Author:
Doucet, Mathieu <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:
13e46abe
Parents:
c93122e
Message:

Remove extra white spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/calculator/slit_length_calculator.py

    r79492222 r6bd3a8d1  
    1111    """ 
    1212    def __init__(self): 
    13          
     13 
    1414        # x data 
    1515        self.x = None 
     
    1818        #default slit length 
    1919        self.slit_length = 0.0 
    20          
     20 
    2121        # The unit is unknown from SAXSess profile: 
    2222        # It seems 1/nm but it could be not fixed, 
    2323        # so users should be notified to determine the unit by themselves. 
    2424        self.slit_length_unit = "unknown" 
    25      
     25 
    2626    def set_data(self, x=None, y=None): 
    2727        """ 
    2828         Receive two vector x, y and prepare the slit calculator for 
    2929         computation. 
    30          
     30 
    3131        :param x: array 
    3232        :param y: array 
     
    3434        self.x = x 
    3535        self.y = y 
    36          
     36 
    3737    def calculate_slit_length(self): 
    3838        """ 
    3939        Calculate slit length. 
    40          
     40 
    4141        :return: the slit length calculated value. 
    4242        """ 
     
    5050        # find max y 
    5151        max_y = y.max() 
    52          
     52 
    5353        # initial values 
    5454        y_sum = 0.0 
    5555        y_max = 0.0 
    5656        ind = 0.0 
    57          
     57 
    5858        # sum 10 or more y values until getting max_y, 
    5959        while (True): 
     
    6464                y_max = y[ind] 
    6565            ind += 1 
    66       
     66 
    6767        # find the average value/2 of the top values 
    6868        y_half = y_sum/(2.0*ind) 
    69          
     69 
    7070        # defaults 
    7171        y_half_d = 0.0 
     
    7979            if y[ind] < y_half: 
    8080                break 
    81          
     81 
    8282        # y value and ind just before passed the spot of the half height 
    8383        y_half_u = y[ind-1] 
    84          
     84 
    8585        # get corresponding x values 
    8686        x_half_d = x[ind] 
    8787        x_half_u = x[ind-1] 
    88          
     88 
    8989        # calculate x at y = y_half using linear interpolation 
    9090        if y_half_u == y_half_d: 
     
    9494                       + x_half_d * (y_half_u - y_half)) \ 
    9595                        / (y_half_u - y_half_d) 
    96          
     96 
    9797        # Our slit length is half width, so just give half beam value 
    9898        slit_length = x_half 
    99          
     99 
    100100        # set slit_length 
    101101        self.slit_length = slit_length 
    102102        return self.slit_length 
    103    
     103 
    104104    def get_slit_length_unit(self): 
    105105        """ 
Note: See TracChangeset for help on using the changeset viewer.