Changeset 1ddf8f0 in sasview
- Timestamp:
- Aug 18, 2016 2:56:48 AM (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.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1f6d293
- Parents:
- 88d85c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r88d85c6 r1ddf8f0 380 380 self.current_datainfo = DataInfo() 381 381 382 def write(self, dataset, filename , entry_attrs={ 'title':'', 'run_number':'', 'run_name':'' }):382 def write(self, dataset, filename): 383 383 """ 384 384 Write an array of Data1d or Data2D objects to a CanSAS 2.0 file, as … … 389 389 :param dataset: A list of Data1D or Data2D objects to write 390 390 :param filename: Where to write the CanSAS 2.0 file 391 :entry_attrs: A dictionary containing the attributes of the SASEntry392 391 """ 393 392 is_1d = all([isinstance(d, Data1D) for d in dataset]) … … 410 409 return np.array([np.string_(string)]) 411 410 411 # Get run name and number from first Data object 412 data_info = dataset[0] 413 run_number = '' 414 run_name = '' 415 if len(data_info.run) > 0: 416 run_number = data_info.run[0] 417 if len(data_info.run_name) > 0: 418 run_name = data_info.run_name[run_number] 419 412 420 f = h5py.File(filename, 'w') 413 421 sasentry = f.create_group('sasentry01') 414 422 sasentry['definition'] = _h5_string('NXcanSAS') 415 sasentry['run'] = _h5_string( entry_attrs['run_number'])416 sasentry['run'].attrs['name'] = entry_attrs['run_name']417 sasentry['title'] = _h5_string( entry_attrs['title'])423 sasentry['run'] = _h5_string(run_number) 424 sasentry['run'].attrs['name'] = run_name 425 sasentry['title'] = _h5_string(data_info.title) 418 426 sasentry.attrs['canSAS_class'] = 'SASentry' 419 427 sasentry.attrs['version'] = '1.0'
Note: See TracChangeset
for help on using the changeset viewer.