Changeset 4853c04 in sasview
- Timestamp:
- Jan 15, 2009 5:16:20 PM (16 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 681f0dc
- Parents:
- c2a8523
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/manipulations.py
rc2a8523 r4853c04 805 805 806 806 # This If finds qmax within ROI defined by sector lines 807 if run.lower()=='q2'or run.lower()=='q': 808 tempq=0 #to find qmax within ROI 809 for i in range(numpy.size(data,1)): 810 dx = pixel_width_x*(i+0.5 - center_x) 811 for j in range(numpy.size(data,0)): 807 temp=0 #to find qmax within ROI or phimax and phimin 808 temp0=1000000 809 temp1=0 810 for i in range(numpy.size(data,1)): 811 dx = pixel_width_x*(i+0.5 - center_x) 812 for j in range(numpy.size(data,0)): 812 813 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 814 dy = pixel_width_y*(j+0.5 - center_y) 815 q_value = get_q(dx, dy, det_dist, wavelength) 816 # Compute phi and check whether it's within the limits 817 phi_value=math.atan2(dy,dx)+math.pi 818 if self.phi_max>2*math.pi: 819 self.phi_max=self.phi_max-2*math.pi 820 if self.phi_min<0: 821 self.phi_max=self.phi_max+2*math.pi 822 823 #In case of two ROI (symmetric major and minor regions)(for 'q2') 824 if run.lower()=='q2': 825 if ((self.phi_max>=0 and self.phi_max<math.pi)and (self.phi_min>=0 and self.phi_min<math.pi)): 826 temp_max=self.phi_max+math.pi 827 temp_min=self.phi_min+math.pi 828 else: 829 temp_max=self.phi_max 830 temp_min=self.phi_min 830 831 831 if ((temp_max>=math.pi and temp_max<2*math.pi)and (temp_min>=math.pi and temp_min<2*math.pi)): 832 if (phi_value<temp_min or phi_value>temp_max): 833 if (phi_value<temp_min-math.pi or phi_value>temp_max-math.pi): 834 continue 835 if (self.phi_max<self.phi_min): 836 tmp_max=self.phi_max+math.pi 837 tmp_min=self.phi_min-math.pi 838 else: 839 tmp_max=self.phi_max 840 tmp_min=self.phi_min 841 if (tmp_min<math.pi and tmp_max>math.pi): 842 if((phi_value>tmp_max and phi_value<tmp_min+math.pi)or (phi_value>tmp_max-math.pi and phi_value<tmp_min)): 843 continue 844 #In case of one ROI (major only)(i.e.,for 'q' and 'phi') 845 else: 846 if (self.phi_max>=self.phi_min): 847 if (phi_value<self.phi_min or phi_value>self.phi_max): 848 continue 849 else: 850 if (phi_value<self.phi_min and phi_value>self.phi_max): 851 continue 852 if tempq<q_value: 853 tempq=q_value 854 qmax=tempq 855 print "qmax=",qmax 856 832 if ((temp_max>=math.pi and temp_max<2*math.pi)and (temp_min>=math.pi and temp_min<2*math.pi)): 833 if (phi_value<temp_min or phi_value>temp_max): 834 if (phi_value<temp_min-math.pi or phi_value>temp_max-math.pi): 835 continue 836 if (self.phi_max<self.phi_min): 837 tmp_max=self.phi_max+math.pi 838 tmp_min=self.phi_min-math.pi 839 else: 840 tmp_max=self.phi_max 841 tmp_min=self.phi_min 842 if (tmp_min<math.pi and tmp_max>math.pi): 843 if((phi_value>tmp_max and phi_value<tmp_min+math.pi)or (phi_value>tmp_max-math.pi and phi_value<tmp_min)): 844 continue 845 #In case of one ROI (major only)(i.e.,for 'q' and 'phi') 846 elif run.lower()=='phi': 847 if q_value<qmin or q_value>qmax: 848 continue 849 else: 850 if (self.phi_max>=self.phi_min): 851 if (phi_value<self.phi_min or phi_value>self.phi_max): 852 continue 853 else: 854 if (phi_value<self.phi_min and phi_value>self.phi_max): 855 continue 856 if run.lower()=='phi': 857 if temp1<phi_value: 858 temp1=phi_value 859 if temp0>phi_value: 860 temp0=phi_value 861 elif temp<q_value: 862 temp=q_value 863 if run.lower()=='phi': 864 self.phi_max=temp1 865 self.phi_min=temp0 866 else: 867 qmax=temp 868 857 869 for i in range(numpy.size(data,1)): 858 870 dx = pixel_width_x*(i+0.5 - center_x) … … 930 942 if (phi_value<self.phi_min and phi_value>self.phi_max): 931 943 continue 944 #print "qmax=",qmax,qmin 945 946 if q_value<qmin or q_value>qmax: 947 continue 932 948 933 949 # Check which type of averaging we need … … 940 956 # the ring defined by q_min/q_max rather than the complete 941 957 # pixel 942 if q_value<qmin or q_value>qmax:943 continue944 958 i_bin = int(math.ceil(self.nbins*(q_value-qmin)/(qmax-qmin))) - 1 945 959
Note: See TracChangeset
for help on using the changeset viewer.