Changeset afab469 in sasview for DataLoader/test/utest_averaging.py


Ignore:
Timestamp:
Mar 12, 2010 1:31:20 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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:
32e8c78
Parents:
edb30b66
Message:

Updated 2d data entry for test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/test/utest_averaging.py

    re84e1e6 rafab469  
    33 
    44from DataLoader.loader import  Loader 
    5 from DataLoader.manipulations import Ring, CircularAverage, SectorPhi, get_q 
     5from DataLoader.manipulations import Ring, CircularAverage, SectorPhi, get_q,reader2D_converter 
    66  
    77import os.path 
     
    2020        x_0  = numpy.ones([100,100]) 
    2121        dx_0 = numpy.ones([100,100]) 
    22         self.data = data_info.Data2D(x_0, dx_0) 
     22         
     23        self.data = data_info.Data2D(data=x_0, err_data=dx_0) 
    2324        detector = data_info.Detector() 
    24         detector.distance = 1000.0 
    25         detector.pixel_size.x = 1.0 
    26         detector.pixel_size.y = 1.0 
    27         detector.beam_center.x = 50 
    28         detector.beam_center.y = 50 
     25        detector.distance = 1000.0  #mm 
     26        detector.pixel_size.x = 1.0 #mm 
     27        detector.pixel_size.y = 1.0 #mm 
     28         
     29        # center in pixel position = (len(x_0)-1)/2 
     30        detector.beam_center.x = (len(x_0)-1)/2 #pixel number 
     31        detector.beam_center.y = (len(x_0)-1)/2 #pixel number 
    2932        self.data.detector.append(detector) 
    3033         
    3134        source = data_info.Source() 
    32         source.wavelength = 10.0 
     35        source.wavelength = 10.0 #A 
    3336        self.data.source = source 
    3437         
    35         self.qmin = get_q(1.0, 1.0, 1000.0, 10.0) 
    36          
     38        # get_q(dx, dy, det_dist, wavelength) where units are mm,mm,mm,and A respectively. 
     39        self.qmin = get_q(1.0, 1.0, detector.distance, source.wavelength) 
     40 
     41        self.qmax = get_q(49.5, 49.5, detector.distance, source.wavelength) 
     42         
     43        self.qstep = len(x_0) 
     44        x=  numpy.linspace(start= -1*self.qmax, 
     45                               stop= self.qmax, 
     46                               num= self.qstep, 
     47                               endpoint=True )   
     48        y = numpy.linspace(start= -1*self.qmax, 
     49                               stop= self.qmax, 
     50                               num= self.qstep, 
     51                               endpoint=True ) 
     52        self.data.x_bins=x 
     53        self.data.y_bins=y 
     54        self.data = reader2D_converter(self.data) 
     55             
    3756    def test_ring_flat_distribution(self): 
    3857        """ 
Note: See TracChangeset for help on using the changeset viewer.