Changeset bfba720 in sasview for src/sas/sascalc/calculator/slit_length_calculator.py
- Timestamp:
- Mar 24, 2017 3:27:46 PM (8 years ago)
- 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:
- b61bd57
- Parents:
- 1a30720
- git-author:
- Andrew Nelson <andyfaff@…> (03/23/17 22:01:57)
- git-committer:
- Andrew Nelson <andyfaff@…> (03/24/17 15:27:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/slit_length_calculator.py
rb699768 rbfba720 16 16 # y data 17 17 self.y = None 18 # default slit length18 # default slit length 19 19 self.slit_length = 0.0 20 20 … … 42 42 """ 43 43 # None data do nothing 44 if self.y == None or self.x ==None:44 if self.y is None or self.x is None: 45 45 return 46 46 # set local variable … … 54 54 y_sum = 0.0 55 55 y_max = 0.0 56 ind = 0 .056 ind = 0 57 57 58 58 # sum 10 or more y values until getting max_y, … … 70 70 # defaults 71 71 y_half_d = 0.0 72 ind = 0 .072 ind = 0 73 73 # find indices where it crosses y = y_half. 74 74 while True: … … 81 81 82 82 # 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] 84 84 85 85 # get corresponding x values 86 86 x_half_d = x[ind] 87 x_half_u = x[ind -1]87 x_half_u = x[ind - 1] 88 88 89 89 # calculate x at y = y_half using linear interpolation … … 91 91 x_half = (x_half_d + x_half_u)/2.0 92 92 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)) 96 96 97 97 # Our slit length is half width, so just give half beam value
Note: See TracChangeset
for help on using the changeset viewer.