Changeset 22b3fe1 in sasview
- Timestamp:
- Mar 2, 2011 3:43:45 PM (14 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:
- 5c4b674
- Parents:
- 053c769
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/readers/red2d_reader.py
rec02ddd r22b3fe1 138 138 #Read Header and find the dimensions of 2D data 139 139 line_num = 0 140 # Old version NIST files: 0 141 ver = 0 140 142 for line in lines: 141 143 line_num += 1 … … 188 190 if line.count("BCENT") > 0: 189 191 isCenter = True 190 192 # Check version 193 if line.count("Data columns") > 0: 194 if line.count("err(I)") > 0: 195 ver = 1 191 196 # Find data start 192 if line.count(" Data columns") or line.count("ASCII data") > 0:197 if line.count("ASCII data") > 0: 193 198 dataStarted = True 194 199 continue … … 229 234 #data_list = map(float,data_list) 230 235 data_list1 = map(check_point,data_list) 231 236 232 237 # numpy array form 233 238 data_array = numpy.array(data_list1) … … 239 244 msg = "red2d_reader: Can't read this file: Not a proper file format" 240 245 raise ValueError, msg 241 242 246 ## Get the all data: Let's HARDcoding; Todo find better way 243 247 # Defaults 244 248 dqx_data = numpy.zeros(0) 245 249 dqy_data = numpy.zeros(0) 250 err_data = numpy.ones(row_num) 246 251 qz_data = numpy.zeros(row_num) 247 252 mask = numpy.ones(row_num,dtype=bool) … … 250 255 qy_data = data_point[1] 251 256 data = data_point[2] 252 if col_num > 3: qz_data = data_point[3] 253 if col_num > 4: dqx_data = data_point[4] 254 if col_num > 5: dqy_data = data_point[5] 255 if col_num > 6: mask[data_point[6] < 1] = False 257 if ver == 1: 258 if col_num > (2 + ver): err_data = data_point[(2 + ver)] 259 if col_num > (3 + ver): qz_data = data_point[(3 + ver)] 260 if col_num > (4 + ver): dqx_data = data_point[(4 + ver)] 261 if col_num > (5 + ver): dqy_data = data_point[(5 + ver)] 262 #if col_num > (6 + ver): mask[data_point[(6 + ver)] < 1] = False 256 263 q_data = numpy.sqrt(qx_data*qx_data+qy_data*qy_data+qz_data*qz_data) 257 264 … … 259 266 # If all mask elements are False, put all True 260 267 if not mask.any(): mask[mask==False] = True 261 268 262 269 # Store limits of the image in q space 263 270 xmin = numpy.min(qx_data) … … 298 305 #TODO: Check the lengths 299 306 output.data = data 300 output.err_data = numpy.sqrt(numpy.abs(data)) 307 if (err_data == 1).all(): 308 output.err_data = numpy.sqrt(numpy.abs(data)) 309 output.err_data[output.err_data == 0.0] = 1.0 310 else: 311 output.err_data = err_data 312 301 313 output.qx_data = qx_data 302 314 output.qy_data = qy_data … … 326 338 #(1 axis dq is not supported yet). 327 339 if len(dqy_data) == len(qy_data) and dqy_data.any()!=0: 328 output.dqx_data = dqx_data 329 output.dqy_data = dqy_data 330 340 # Currently we do not support dq parr, perp. 341 # tranfer the comp. to cartesian coord. for newer version. 342 if ver == 1: 343 diag = numpy.sqrt(qx_data * qx_data + qy_data * qy_data) 344 cos_th = qx_data / diag 345 sin_th = qy_data / diag 346 output.dqx_data = numpy.sqrt((dqx_data * cos_th) * \ 347 (dqx_data * cos_th) \ 348 + ( dqy_data * sin_th) * \ 349 ( dqy_data * sin_th)) 350 output.dqy_data = numpy.sqrt((dqx_data * sin_th) * \ 351 (dqx_data * sin_th) \ 352 + ( dqy_data * cos_th) * \ 353 ( dqy_data * cos_th)) 354 else: 355 output.dqx_data = dqx_data 356 output.dqy_data = dqy_data 357 331 358 # Units of axes 332 359 if data_conv_q is not None:
Note: See TracChangeset
for help on using the changeset viewer.