Changeset 045b7eac in sasview


Ignore:
Timestamp:
Mar 24, 2017 1:29:26 PM (7 years ago)
Author:
GitHub <noreply@…>
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
253eb6c6, 6d8a26c, f4de527
Parents:
1a30720 (diff), bfba720 (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:
Andrew Nelson <andyfaff@…> (03/24/17 13:29:26)
git-committer:
GitHub <noreply@…> (03/24/17 13:29:26)
Message:

Merge pull request #49 from andyfaff/slit_calc

MAINT: SlitlengthCalculator? - removed float indexing

File:
1 edited

Legend:

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

    rb699768 rbfba720  
    1616        # y data 
    1717        self.y = None 
    18         #default slit length 
     18        # default slit length 
    1919        self.slit_length = 0.0 
    2020 
     
    4242        """ 
    4343        # None data do nothing 
    44         if self.y == None or self.x == None: 
     44        if self.y is None or self.x is None: 
    4545            return 
    4646        # set local variable 
     
    5454        y_sum = 0.0 
    5555        y_max = 0.0 
    56         ind = 0.0 
     56        ind = 0 
    5757 
    5858        # sum 10 or more y values until getting max_y, 
     
    7070        # defaults 
    7171        y_half_d = 0.0 
    72         ind = 0.0 
     72        ind = 0 
    7373        # find indices where it crosses y = y_half. 
    7474        while True: 
     
    8181 
    8282        # y value and ind just before passed the spot of the half height 
    83         y_half_u = y[ind-1] 
     83        y_half_u = y[ind - 1] 
    8484 
    8585        # get corresponding x values 
    8686        x_half_d = x[ind] 
    87         x_half_u = x[ind-1] 
     87        x_half_u = x[ind - 1] 
    8888 
    8989        # calculate x at y = y_half using linear interpolation 
     
    9191            x_half = (x_half_d + x_half_u)/2.0 
    9292        else: 
    93             x_half = (x_half_u * (y_half - y_half_d)  \ 
    94                        + x_half_d * (y_half_u - y_half)) \ 
    95                         / (y_half_u - y_half_d) 
     93            x_half = ((x_half_u * (y_half - y_half_d) 
     94                       + x_half_d * (y_half_u - y_half)) 
     95                       / (y_half_u - y_half_d)) 
    9696 
    9797        # Our slit length is half width, so just give half beam value 
Note: See TracChangeset for help on using the changeset viewer.