Changeset f55af70 in sasview for DataLoader/readers
- Timestamp:
- Jan 20, 2009 9:54:56 AM (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:
- fbd0bece
- Parents:
- d9629c53
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/readers/IgorReader.py
rb99ac227 rf55af70 52 52 if len(output.detector)>0: print str(output.detector[0]) 53 53 output.detector.append(detector) 54 55 size_x = 128 56 size_y = 128 57 output.data = numpy.zeros([size_x,size_y]) 58 output.err_data = numpy.zeros([size_x,size_y]) 59 54 55 # Get content 56 dataStarted = False 57 58 59 lines = buf.split('\n') 60 itot = 0 61 x = [] 62 y = [] 63 64 ncounts = 0 65 66 xmin = None 67 xmax = None 68 ymin = None 69 ymax = None 70 71 i_x = 0 72 i_y = -1 73 i_tot_row = 0 74 75 isInfo = False 76 isCenter = False 77 60 78 data_conv_q = None 61 79 data_conv_i = None … … 70 88 # Test it 71 89 data_conv_i(1.0, output.I_unit) 72 73 74 # Get content 75 dataStarted = False 76 77 78 lines = buf.split('\n') 79 itot = 0 80 x = [] 81 y = [] 82 83 ncounts = 0 84 85 xmin = None 86 xmax = None 87 ymin = None 88 ymax = None 89 90 i_x = 0 91 i_y = -1 92 93 isInfo = False 94 isCenter = False 90 95 91 for line in lines: 96 92 … … 104 100 except: 105 101 raise ValueError,"IgorReader: can't read this file, missing wavelength" 102 103 #Find # of bins in a row assuming the detector is square. 104 if dataStarted == True: 105 try: 106 value = float(line) 107 except: 108 # Found a non-float entry, skip it 109 continue 110 111 # Get total bin number 112 113 i_tot_row += 1 114 i_tot_row=math.ceil(math.sqrt(i_tot_row))-1 115 #print "i_tot", i_tot_row 116 size_x = i_tot_row#192#128 117 size_y = i_tot_row#192#128 118 output.data = numpy.zeros([size_x,size_y]) 119 output.err_data = numpy.zeros([size_x,size_y]) 120 121 #Read Header and 2D data 122 for line in lines: 123 # Find setup info line 124 if isInfo: 125 isInfo = False 126 line_toks = line.split() 127 # Wavelength in Angstrom 128 try: 129 wavelength = float(line_toks[1]) 130 except: 131 raise ValueError,"IgorReader: can't read this file, missing wavelength" 106 132 # Distance in meters 107 133 try: … … 115 141 except: 116 142 raise ValueError,"IgorReader: can't read this file, missing transmission" 117 143 118 144 if line.count("LAMBDA")>0: 119 145 isInfo = True … … 150 176 151 177 # Get bin number 152 if math.fmod(itot, 128)==0:178 if math.fmod(itot, i_tot_row)==0: 153 179 i_x = 0 154 180 i_y += 1
Note: See TracChangeset
for help on using the changeset viewer.