Changeset 5e906207 in sasview
- Timestamp:
- Aug 23, 2016 10:06:09 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:
- b61bd57
- Parents:
- f00691d4
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (08/23/16 09:45:23)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (08/23/16 10:06:09)
- Location:
- src/sas/sascalc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
rbe88076 r5e906207 23 23 24 24 Any number of SASdata sets may be present in a SASentry and the data within can be either 1D I(Q) or 2D I(Qx, Qy). 25 26 Also supports reading NXcanSAS formatted HDF5 files 25 27 26 28 :Dependencies: … … 205 207 elif key == u'temperature' and self.parent_class == u'SASsample': 206 208 self.current_datainfo.sample.temperature = data_point 209 elif key == u'transmission' and self.parent_class == u'SASsample': 210 self.current_datainfo.sample.transmission = data_point 211 elif key == u'x_position' and self.parent_class == u'SASsample': 212 self.current_datainfo.sample.position.x = data_point 213 elif key == u'y_position' and self.parent_class == u'SASsample': 214 self.current_datainfo.sample.position.y = data_point 215 elif key == u'polar_angle' and self.parent_class == u'SASsample': 216 self.current_datainfo.sample.orientation.x = data_point 217 elif key == u'azimuthal_angle' and self.parent_class == u'SASsample': 218 self.current_datainfo.sample.orientation.z = data_point 219 elif key == u'details' and self.parent_class == u'SASsample': 220 self.current_datainfo.sample.details.append(data_point) 207 221 208 222 ## Instrumental Information … … 214 228 self.detector.distance = float(data_point) 215 229 self.detector.distance_unit = unit 230 elif key == u'slit_length' and self.parent_class == u'SASdetector': 231 self.detector.slit_length = float(data_point) 232 self.detector.slit_length_unit = unit 233 elif key == u'x_position' and self.parent_class == u'SASdetector': 234 self.detector.offset.x = float(data_point) 235 self.detector.offset_unit = unit 236 elif key == u'y_position' and self.parent_class == u'SASdetector': 237 self.detector.offset.y = float(data_point) 238 self.detector.offset_unit = unit 239 elif key == u'polar_angle' and self.parent_class == u'SASdetector': 240 self.detector.orientation.x = float(data_point) 241 self.detector.orientation_unit = unit 242 elif key == u'azimuthal_angle' and self.parent_class == u'SASdetector': 243 self.detector.orientation.z = float(data_point) 244 self.detector.orientation_unit = unit 245 elif key == u'beam_center_x' and self.parent_class == u'SASdetector': 246 self.detector.beam_center.x = float(data_point) 247 self.detector.beam_center_unit = unit 248 elif key == u'beam_center_y' and self.parent_class == u'SASdetector': 249 self.detector.beam_center.y = float(data_point) 250 self.detector.beam_center_unit = unit 251 elif key == u'x_pixel_size' and self.parent_class == u'SASdetector': 252 self.detector.pixel_size.x = float(data_point) 253 self.detector.pixel_size_unit = unit 254 elif key == u'y_pixel_size' and self.parent_class == u'SASdetector': 255 self.detector.pixel_size.y = float(data_point) 256 self.detector.pixel_size_unit = unit 216 257 elif key == u'SSD' and self.parent_class == u'SAScollimation': 217 258 self.collimation.length = data_point … … 242 283 self.trans_spectrum.wavelength.append(data_point) 243 284 244 ## Other Information285 ## Source 245 286 elif key == u'wavelength' and self.parent_class == u'SASdata': 246 287 self.current_datainfo.source.wavelength = data_point 247 self.current_datainfo.source.wavelength.unit = unit 288 self.current_datainfo.source.wavelength_unit = unit 289 elif key == u'incident_wavelength' and self.parent_class == u'SASsource': 290 self.current_datainfo.source.wavelength = data_point 291 self.current_datainfo.source.wavelength_unit = unit 292 elif key == u'wavelength_max' and self.parent_class == u'SASsource': 293 self.current_datainfo.source.wavelength_max = data_point 294 self.current_datainfo.source.wavelength_max_unit = unit 295 elif key == u'wavelength_min' and self.parent_class == u'SASsource': 296 self.current_datainfo.source.wavelength_min = data_point 297 self.current_datainfo.source.wavelength_min_unit = unit 298 elif key == u'wavelength_spread' and self.parent_class == u'SASsource': 299 self.current_datainfo.source.wavelength_spread = data_point 300 self.current_datainfo.source.wavelength_spread_unit = unit 301 elif key == u'beam_size_x' and self.parent_class == u'SASsource': 302 self.current_datainfo.source.beam_size.x = data_point 303 self.current_datainfo.source.beam_size_unit = unit 304 elif key == u'beam_size_y' and self.parent_class == u'SASsource': 305 self.current_datainfo.source.beam_size.y = data_point 306 self.current_datainfo.source.beam_size_unit = unit 307 elif key == u'beam_shape' and self.parent_class == u'SASsource': 308 self.current_datainfo.source.beam_shape = data_point 248 309 elif key == u'radiation' and self.parent_class == u'SASsource': 249 310 self.current_datainfo.source.radiation = data_point -
src/sas/sascalc/file_converter/nxcansas_writer.py
r7fce2bc r5e906207 139 139 if data_info.sample.details is not None\ 140 140 and data_info.sample.details != []: 141 details = reduce(lambda x,y: x + "\n" + y, data_info.sample.details) 142 sample_entry['details'] = _h5_string(details) 141 details = None 142 if len(data_info.sample.details) > 1: 143 details = [np.string_(d) for d in data_info.sample.details] 144 details = np.array(details) 145 elif data_info.sample.details != []: 146 details = _h5_string(data_info.sample.details[0]) 147 if details is not None: 148 sample_entry.create_dataset('details', data=details) 143 149 144 150 # Instrumment metadata
Note: See TracChangeset
for help on using the changeset viewer.