Changeset ac38ab4 in sasview
- Timestamp:
- Jul 11, 2018 11:33:00 AM (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:
- 7fd5e2a
- Parents:
- b799f09
- Location:
- src/sas/sascalc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r02c1608e rac38ab4 420 420 :param key: class name data_point was taken from 421 421 """ 422 term_match = re.compile(u'^term[0-9]+$') 422 423 if key == u'Title': # CanSAS 2.0 423 424 self.process.name = data_point … … 428 429 elif key == u'date': 429 430 self.process.date = data_point 430 elif key == u'term':431 self.process.term = data_point431 elif term_match.match(key): 432 self.process.term.append(data_point) 432 433 else: 433 434 self.process.notes.append(data_point) … … 473 474 spectrum_list = [] 474 475 for spectrum in self.current_datainfo.trans_spectrum: 475 spectrum.transmission = np.delete(spectrum.transmission, [0])476 476 spectrum.transmission = spectrum.transmission.astype(np.float64) 477 spectrum.transmission_deviation = np.delete(478 spectrum.transmission_deviation, [0])479 477 spectrum.transmission_deviation = \ 480 478 spectrum.transmission_deviation.astype(np.float64) 481 spectrum.wavelength = np.delete(spectrum.wavelength, [0])482 479 spectrum.wavelength = spectrum.wavelength.astype(np.float64) 483 480 if len(spectrum.transmission) > 0: -
src/sas/sascalc/file_converter/nxcansas_writer.py
rfc51d06 rac38ab4 175 175 names=['beam_size_x', 'beam_size_y'], 176 176 units=data_info.source.beam_size_unit, write_fn=_write_h5_float) 177 178 177 179 178 # Collimation metadata … … 232 231 detector_entry.attrs['name'] = '' 233 232 233 # Process meta data 234 if len(data_info.process) > 0 and not data_info.process[0].is_empty(): 235 i = 1 236 for process in data_info.process: 237 process_entry = sasentry.create_group( 238 'sasprocess{0:0=2d}'.format(i)) 239 process_entry.attrs['canSAS_class'] = 'SASprocess' 240 if process.name: 241 name = _h5_string(process.name) 242 process_entry.create_dataset('name', data=name) 243 if process.date: 244 date = _h5_string(process.date) 245 process_entry.create_dataset('date', data=date) 246 if process.description: 247 desc = _h5_string(process.description) 248 process_entry.create_dataset('description', data=desc) 249 j = 1 250 for term in process.term: 251 if term: 252 h5_term = _h5_string(term) 253 process_entry.create_dataset('term{0:0=2d}'.format(j), 254 data=h5_term) 255 j += 1 256 j = 1 257 for note in process.notes: 258 if note: 259 h5_note = _h5_string(note) 260 process_entry.create_dataset('note{0:0=2d}'.format(j), 261 data=h5_note) 262 j += 1 263 i += 1 264 265 # Transmission Spectrum 266 if len(data_info.trans_spectrum) > 0: 267 i = 1 268 for trans in data_info.trans_spectrum: 269 trans_entry = sasentry.create_group( 270 'sastransmission_spectrum{0:0=2d}'.format(i)) 271 trans_entry.attrs['canSAS_class'] = 'SAStransmission_spectrum' 272 trans_entry.attrs['signal'] = 'T' 273 trans_entry.attrs['T_axes'] = 'T' 274 trans_entry.attrs['name'] = trans.name 275 if trans.timestamp is not '': 276 trans_entry.attrs['timestamp'] = trans.timestamp 277 transmission = trans_entry.create_dataset( 278 'T', data=trans.transmission) 279 transmission.attrs['unertainties'] = 'Tdev' 280 trans_entry.create_dataset('Tdev', 281 data = trans.transmission_deviation) 282 trans_entry.create_dataset('lambda', data=trans.wavelength) 283 234 284 note_entry = sasentry.create_group('sasnote'.format(i)) 235 285 note_entry.attrs['canSAS_class'] = 'SASnote'
Note: See TracChangeset
for help on using the changeset viewer.