- Timestamp:
- Jul 9, 2018 2:57:09 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 02c1608e
- Parents:
- cf820f5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/file_converter/nxcansas_writer.py
r574adc7 rf5483ef 254 254 data_entry.attrs['signal'] = 'I' 255 255 data_entry.attrs['I_axes'] = 'Q' 256 data_entry.attrs['I_uncertainties'] = 'Idev'257 256 data_entry.attrs['Q_indicies'] = 0 258 259 dI = data_obj.dy 260 if dI is None: 261 dI = np.zeros((data_obj.y.shape)) 262 263 data_entry.create_dataset('Q', data=data_obj.x) 264 data_entry.create_dataset('I', data=data_obj.y) 265 data_entry.create_dataset('Idev', data=dI) 257 q_entry = data_entry.create_dataset('Q', data=data_obj.x) 258 q_entry.attrs['units'] = data_obj.x_unit 259 i_entry = data_entry.create_dataset('I', data=data_obj.y) 260 i_entry.attrs['units'] = data_obj.y_unit 261 if data_obj.dy is not None: 262 i_entry.attrs['uncertainties'] = 'Idev' 263 i_dev_entry = data_entry.create_dataset('Idev', data=data_obj.dy) 264 i_dev_entry.attrs['units'] = data_obj.y_unit 265 if data_obj.dx is not None: 266 q_entry.attrs['uncertainties'] = 'dQ' 267 dq_entry = data_entry.create_dataset('dQ', data=data_obj.dx) 268 dq_entry.attrs['units'] = data_obj.x_unit 269 elif data_obj.dxl is not None: 270 q_entry.attrs['uncertainties'] = 'dQl,dQw' 271 dql_entry = data_entry.create_dataset('dQl', data=data_obj.dxl) 272 dql_entry.attrs['units'] = data_obj.x_unit 273 dqw_entry = data_entry.create_dataset('dQw', data=data_obj.dxw) 274 dqw_entry.attrs['units'] = data_obj.x_unit 266 275 267 276 def _write_2d_data(self, data, data_entry): … … 273 282 """ 274 283 data_entry.attrs['signal'] = 'I' 275 data_entry.attrs['I_axes'] = 'Q,Q' 276 data_entry.attrs['I_uncertainties'] = 'Idev' 284 data_entry.attrs['I_axes'] = 'Qx,Qy' 277 285 data_entry.attrs['Q_indicies'] = [0,1] 278 286 … … 288 296 raise ValueError("Unable to calculate dimensions of 2D data") 289 297 290 I= np.reshape(data.data, (n_rows, n_cols))291 d I = np.zeros((n_rows, n_cols))298 intensity = np.reshape(data.data, (n_rows, n_cols)) 299 d_i = None 292 300 if not all(data.err_data == [None]): 293 d I= np.reshape(data.err_data, (n_rows, n_cols))294 qx = 301 d_i = np.reshape(data.err_data, (n_rows, n_cols)) 302 qx = np.reshape(data.qx_data, (n_rows, n_cols)) 295 303 qy = np.reshape(data.qy_data, (n_rows, n_cols)) 296 304 297 I_entry = data_entry.create_dataset('I', data=I) 298 I_entry.attrs['units'] = data.I_unit 299 Qx_entry = data_entry.create_dataset('Qx', data=qx) 300 Qx_entry.attrs['units'] = data.Q_unit 301 Qy_entry = data_entry.create_dataset('Qy', data=qy) 302 Qy_entry.attrs['units'] = data.Q_unit 303 Idev_entry = data_entry.create_dataset('Idev', data=dI) 304 Idev_entry.attrs['units'] = data.I_unit 305 i_entry = data_entry.create_dataset('I', data=intensity) 306 i_entry.attrs['units'] = data.I_unit 307 qx_entry = data_entry.create_dataset('Qx', data=qx) 308 qx_entry.attrs['units'] = data.Q_unit 309 qy_entry = data_entry.create_dataset('Qy', data=qy) 310 qy_entry.attrs['units'] = data.Q_unit 311 if d_i: 312 i_entry.attrs['uncertainties'] = 'Idev' 313 i_dev_entry = data_entry.create_dataset('Idev', data=d_i) 314 i_dev_entry.attrs['units'] = data.I_unit 315 if not all(data.dqx_data == [None]): 316 qx_entry.attrs['uncertainties'] = 'dQx' 317 dqx_entry = data_entry.create_dataset('dQx', data=data.dqx_data) 318 dqx_entry.attrs['units'] = data.Q_unit 319 if not all(data.dqy_data == [None]): 320 qy_entry.attrs['uncertainties'] = 'dQx' 321 dqy_entry = data_entry.create_dataset('dQx', data=data.dqy_data) 322 dqy_entry.attrs['units'] = data.Q_unit
Note: See TracChangeset
for help on using the changeset viewer.