Changeset 13e120a in sasview for sansview/perspectives


Ignore:
Timestamp:
Feb 9, 2009 3:22:03 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
d0eac66
Parents:
fd25fb0
Message:

adding x_bins and y_bins to model after plotting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fitting.py

    rfd25fb0 r13e120a  
    767767        #print "complete",output, model,qmin, qmax 
    768768        data = output 
    769         theory= Data2D(data) 
    770         #print data.detector 
    771         #theory.detector= data.detector 
     769        temp= numpy.zeros(numpy.shape(data)) 
     770        temp[temp==0]=1 
     771        theory= Data2D(image=data, err_image=temp) 
     772     
    772773        from DataLoader.data_info import Detector, Source 
    773774         
     
    783784        theory.source= Source() 
    784785        theory.source.wavelength= 2*math.pi/1e+12#8.4 
    785          
     786        theory.x_bins =[] 
     787        theory.y_bins =[] 
     788        # compute x_bins and y_bins 
     789        # Qx and Qy vectors 
     790     
     791        distance   = theory.detector[0].distance 
     792        pixel      = qstep/2-1 
     793        theta      = pixel / distance / 100.0 
     794        wavelength = theory.source.wavelength 
     795        pixel_width_x = theory.detector[0].pixel_size.x 
     796        pixel_width_y = theory.detector[0].pixel_size.y 
     797        center_x      = theory.detector[0].beam_center.x/pixel_width_x 
     798        center_y      = theory.detector[0].beam_center.y/pixel_width_y 
     799         
     800         
     801        size_x, size_y= numpy.shape(theory.data) 
     802        #print "size_x,size_y",size_x, size_y 
     803        for i_x in range(size_x): 
     804            theta = (i_x-center_x+1)*pixel_width_x / distance / size_x#100.0 
     805            qx = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
     806            theory.x_bins.append(qx)     
     807        for i_y in range(size_y): 
     808            theta = (i_y-center_y+1)*pixel_width_y / distance / size_y#100.0 
     809            qy = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
     810            theory.y_bins.append(qy) 
     811            
     812        #theory.err_data= numpy.     
    786813        theory.name= model.name 
    787814        theory.group_id ="Model" 
Note: See TracChangeset for help on using the changeset viewer.