Changeset 400155b in sasview


Ignore:
Timestamp:
Feb 17, 2015 8:20:48 AM (9 years ago)
Author:
gonzalezm
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:
66f21cd
Parents:
7eaf9f2
Message:

Implementing request from ticket 261 - default number of bins in Annulus [Phi View] is now 36 and the first bin is now centered at 0 degrees

Files:
142 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/dataloader/manipulations.py

    r79492222 r400155b  
    582582    """ 
    583583    #Todo: remove center. 
    584     def __init__(self, r_min=0, r_max=0, center_x=0, center_y=0, nbins=20): 
     584    def __init__(self, r_min=0, r_max=0, center_x=0, center_y=0, nbins=36): 
    585585        # Minimum radius 
    586586        self.r_min = r_min 
     
    593593        # Number of angular bins 
    594594        self.nbins_phi = nbins 
     595 
    595596         
    596597    def __call__(self, data2D): 
     
    622623        phi_values = numpy.zeros(self.nbins_phi) 
    623624        phi_err    = numpy.zeros(self.nbins_phi) 
    624          
     625         
     626        # Shift to apply to calculated phi values in order to center first bin at zero 
     627        phi_shift = Pi / self.nbins_phi 
     628 
    625629        for npt in range(len(data)): 
    626630            frac = 0 
     
    637641                continue 
    638642            # binning            
    639             i_phi = int(math.floor((self.nbins_phi) * phi_value / (2 * Pi))) 
     643            i_phi = int(math.floor((self.nbins_phi) * (phi_value+phi_shift) / (2 * Pi))) 
    640644             
    641645            # Take care of the edge case at phi = 2pi. 
    642             if i_phi == self.nbins_phi: 
    643                 i_phi =  self.nbins_phi - 1 
     646            if i_phi >= self.nbins_phi: 
     647                i_phi =  0 
    644648            phi_bins[i_phi] += frac * data[npt] 
    645649             
     
    655659            phi_bins[i] = phi_bins[i] / phi_counts[i] 
    656660            phi_err[i] = math.sqrt(phi_err[i]) / phi_counts[i] 
    657             phi_values[i] = 2.0 * math.pi / self.nbins_phi * (1.0 * i + 0.5) 
     661            phi_values[i] = 2.0 * math.pi / self.nbins_phi * (1.0 * i) 
    658662             
    659663        idx = (numpy.isfinite(phi_bins)) 
  • src/sas/guiframe/local_perspectives/plotting/AnnulusSlicer.py

    r79492222 r400155b  
    3535     
    3636        ## Number of points on the plot 
    37         self.nbins = 20 
     37        self.nbins = 36 
    3838        #Cursor position of Rings (Left(-1) or Right(1)) 
    3939        self.xmaxd = self.base.data2D.xmax 
     
    131131                   math.fabs(self.outer_circle.get_radius())) 
    132132        #if the user does not specify the numbers of points to plot  
    133         # the default number will be nbins= 20 
     133        # the default number will be nbins= 36 
    134134        if nbins == None: 
    135             self.nbins = 20 
     135            self.nbins = 36 
    136136        else: 
    137137            self.nbins = nbins 
  • test/sasdataloader/test/ring_testdata.txt

    r8c9ffde r400155b  
    11<X>   <Y>   <dY> 
    2 0.157079632679 0.892216637179 0.0775663414595 
    3 0.471238898038 0.98455818481 0.079657697118 
    4 0.785398163397 0.961797998125 0.0788556980394 
    5 1.09955742876 0.97171642327 0.0791285423182 
    6 1.41371669412 1.0146882474 0.082063426639 
    7 1.72787595947 1.00992701463 0.080353091764 
    8 2.04203522483 1.02880481582 0.0815342153253 
    9 2.35619449019 1.00598046038 0.0798251732283 
    10 2.67035375555 1.07871021115 0.0836335498662 
    11 2.98451302091 0.998456910563 0.079747331585 
    12 3.29867228627 1.04419570592 0.0830428241489 
    13 3.61283155163 1.01232642025 0.0808308513267 
    14 3.92699081699 1.0083937443 0.0810028887009 
    15 4.24115008235 1.03216852956 0.0810389534812 
    16 4.55530934771 1.06499475793 0.0814085230439 
    17 4.86946861306 0.982265097403 0.0805528988046 
    18 5.18362787842 1.00390126667 0.0806633561062 
    19 5.49778714378 0.980815954717 0.0793145659499 
    20 5.81194640914 0.907713166456 0.0765782956648 
    21 6.1261056745 0.983188286879 0.0797444057771 
     20.0 0.974491286452 0.0803843574327 
     30.314159265359 0.9046853025 0.0768971192264 
     40.628318530718 0.964040908176 0.0790933208542 
     50.942477796077 0.922142905769 0.0781616076625 
     61.25663706144 1.02710537736 0.080875897538 
     71.57079632679 1.01448978075 0.0808313893873 
     81.88495559215 1.04677136013 0.0828850195035 
     92.19911485751 1.00067189877 0.0790510747578 
     102.51327412287 1.06280533013 0.0830643956456 
     112.82743338823 1.04313751703 0.0824585190353 
     123.14159265359 0.993559460696 0.0803376331443 
     133.45575191895 0.998101030127 0.0813124293449 
     143.76991118431 1.04589910764 0.0821364674302 
     154.08407044967 0.997201556522 0.0797466854806 
     164.39822971503 1.07289797405 0.0830165798358 
     174.71238898038 1.01212391625 0.0803021745794 
     185.02654824574 0.995907123899 0.0804649435453 
     195.3407075111 0.991431571613 0.0803765721376 
     205.65486677646 0.959020086792 0.0787114622667 
     215.96902604182 0.945705788519 0.0767669312314 
Note: See TracChangeset for help on using the changeset viewer.