Changeset 9a5097c in sasview for src/sas/sascalc/dataloader/readers/red2d_reader.py
- Timestamp:
- Mar 26, 2017 11:33:16 PM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- ed2276f
- Parents:
- 9146ed9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/red2d_reader.py
rb699768 r9a5097c 10 10 ###################################################################### 11 11 import os 12 import numpy 12 import numpy as np 13 13 import math 14 14 from sas.sascalc.dataloader.data_info import Data2D, Detector … … 198 198 break 199 199 # Make numpy array to remove header lines using index 200 lines_array = n umpy.array(lines)200 lines_array = np.array(lines) 201 201 202 202 # index for lines_array 203 lines_index = n umpy.arange(len(lines))203 lines_index = np.arange(len(lines)) 204 204 205 205 # get the data lines … … 225 225 226 226 # numpy array form 227 data_array = n umpy.array(data_list1)227 data_array = np.array(data_list1) 228 228 # Redimesion based on the row_num and col_num, 229 229 #otherwise raise an error. … … 235 235 ## Get the all data: Let's HARDcoding; Todo find better way 236 236 # Defaults 237 dqx_data = n umpy.zeros(0)238 dqy_data = n umpy.zeros(0)239 err_data = n umpy.ones(row_num)240 qz_data = n umpy.zeros(row_num)241 mask = n umpy.ones(row_num, dtype=bool)237 dqx_data = np.zeros(0) 238 dqy_data = np.zeros(0) 239 err_data = np.ones(row_num) 240 qz_data = np.zeros(row_num) 241 mask = np.ones(row_num, dtype=bool) 242 242 # Get from the array 243 243 qx_data = data_point[0] … … 254 254 dqy_data = data_point[(5 + ver)] 255 255 #if col_num > (6 + ver): mask[data_point[(6 + ver)] < 1] = False 256 q_data = n umpy.sqrt(qx_data*qx_data+qy_data*qy_data+qz_data*qz_data)256 q_data = np.sqrt(qx_data*qx_data+qy_data*qy_data+qz_data*qz_data) 257 257 258 258 # Extra protection(it is needed for some data files): … … 262 262 263 263 # Store limits of the image in q space 264 xmin = n umpy.min(qx_data)265 xmax = n umpy.max(qx_data)266 ymin = n umpy.min(qy_data)267 ymax = n umpy.max(qy_data)264 xmin = np.min(qx_data) 265 xmax = np.max(qx_data) 266 ymin = np.min(qy_data) 267 ymax = np.max(qy_data) 268 268 269 269 # units … … 287 287 288 288 # store x and y axis bin centers in q space 289 x_bins = n umpy.arange(xmin, xmax + xstep, xstep)290 y_bins = n umpy.arange(ymin, ymax + ystep, ystep)289 x_bins = np.arange(xmin, xmax + xstep, xstep) 290 y_bins = np.arange(ymin, ymax + ystep, ystep) 291 291 292 292 # get the limits of q values … … 300 300 output.data = data 301 301 if (err_data == 1).all(): 302 output.err_data = n umpy.sqrt(numpy.abs(data))302 output.err_data = np.sqrt(np.abs(data)) 303 303 output.err_data[output.err_data == 0.0] = 1.0 304 304 else: … … 335 335 # tranfer the comp. to cartesian coord. for newer version. 336 336 if ver != 1: 337 diag = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)337 diag = np.sqrt(qx_data * qx_data + qy_data * qy_data) 338 338 cos_th = qx_data / diag 339 339 sin_th = qy_data / diag 340 output.dqx_data = n umpy.sqrt((dqx_data * cos_th) * \340 output.dqx_data = np.sqrt((dqx_data * cos_th) * \ 341 341 (dqx_data * cos_th) \ 342 342 + (dqy_data * sin_th) * \ 343 343 (dqy_data * sin_th)) 344 output.dqy_data = n umpy.sqrt((dqx_data * sin_th) * \344 output.dqy_data = np.sqrt((dqx_data * sin_th) * \ 345 345 (dqx_data * sin_th) \ 346 346 + (dqy_data * cos_th) * \
Note: See TracChangeset
for help on using the changeset viewer.