Changeset 54544637 in sasview
- Timestamp:
- Mar 9, 2017 10:43:25 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:
- c94280c
- Parents:
- 082239e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r082239e r54544637 55 55 ext = ['.h5', '.H5'] 56 56 # Flag to bypass extension check 57 allow_all = False57 allow_all = True 58 58 # List of files to return 59 59 output = None … … 193 193 continue 194 194 # Transmission Spectrum 195 elif key == u'T' and self.parent_class ==\196 u'SAStransmission_spectrum':195 elif (key == u'T') \ 196 and (self.parent_class == u'SAStransmission_spectrum'): 197 197 self.trans_spectrum.transmission = data_set.flatten() 198 198 continue 199 elif key == u'Tdev' and self.parent_class ==\200 u'SAStransmission_spectrum':199 elif (key == u'Tdev') \ 200 and (self.parent_class == u'SAStransmission_spectrum'): 201 201 self.trans_spectrum.transmission_deviation = \ 202 202 data_set.flatten() 203 203 continue 204 elif key == u'lambda' and self.parent_class ==\205 u'SAStransmission_spectrum':204 elif (key == u'lambda') \ 205 and (self.parent_class == u'SAStransmission_spectrum'): 206 206 self.trans_spectrum.wavelength = data_set.flatten() 207 207 continue … … 234 234 elif key == u'ID' and self.parent_class == u'SASsample': 235 235 self.current_datainfo.sample.name = data_point 236 elif key == u'thickness' and self.parent_class == \237 u'SASsample':236 elif (key == u'thickness') and (self.parent_class == 237 u'SASsample'): 238 238 self.current_datainfo.sample.thickness = data_point 239 elif key == u'temperature' and self.parent_class == \240 u'SASsample':239 elif (key == u'temperature') and (self.parent_class == 240 u'SASsample'): 241 241 self.current_datainfo.sample.temperature = data_point 242 elif key == u'transmission' and self.parent_class == \243 u'SASsample':242 elif (key == u'transmission') and (self.parent_class == 243 u'SASsample'): 244 244 self.current_datainfo.sample.transmission = data_point 245 elif key == u'x_position' and self.parent_class == \246 u'SASsample':245 elif (key == u'x_position') and (self.parent_class == 246 u'SASsample'): 247 247 self.current_datainfo.sample.position.x = data_point 248 elif key == u'y_position' and self.parent_class == \249 u'SASsample':248 elif (key == u'y_position') and (self.parent_class == 249 u'SASsample'): 250 250 self.current_datainfo.sample.position.y = data_point 251 251 elif key == u'pitch' and self.parent_class == u'SASsample': … … 255 255 elif key == u'roll' and self.parent_class == u'SASsample': 256 256 self.current_datainfo.sample.orientation.z = data_point 257 elif key == u'details' and self.parent_class == \258 u'SASsample':257 elif (key == u'details') and (self.parent_class == 258 u'SASsample'): 259 259 self.current_datainfo.sample.details.append(data_point) 260 260 261 261 # Instrumental Information 262 elif key == u'name' and self.parent_class == \263 u'SASinstrument':262 elif (key == u'name') and (self.parent_class == 263 u'SASinstrument'): 264 264 self.current_datainfo.instrument = data_point 265 265 elif key == u'name' and self.parent_class == u'SASdetector': … … 268 268 self.detector.distance = float(data_point) 269 269 self.detector.distance_unit = unit 270 elif key == u'slit_length' and self.parent_class == \271 u'SASdetector':270 elif (key == u'slit_length') and (self.parent_class == 271 u'SASdetector'): 272 272 self.detector.slit_length = float(data_point) 273 273 self.detector.slit_length_unit = unit 274 elif key == u'x_position' and self.parent_class == \275 u'SASdetector':274 elif (key == u'x_position') and (self.parent_class == 275 u'SASdetector'): 276 276 self.detector.offset.x = float(data_point) 277 277 self.detector.offset_unit = unit 278 elif key == u'y_position' and self.parent_class == \279 u'SASdetector':278 elif (key == u'y_position') and (self.parent_class == 279 u'SASdetector'): 280 280 self.detector.offset.y = float(data_point) 281 281 self.detector.offset_unit = unit 282 elif key == u'pitch' and self.parent_class == \283 u'SASdetector':282 elif (key == u'pitch') and (self.parent_class == 283 u'SASdetector'): 284 284 self.detector.orientation.x = float(data_point) 285 285 self.detector.orientation_unit = unit … … 290 290 self.detector.orientation.y = float(data_point) 291 291 self.detector.orientation_unit = unit 292 elif key == u'beam_center_x' and self.parent_class == \293 u'SASdetector':292 elif (key == u'beam_center_x') and (self.parent_class == 293 u'SASdetector'): 294 294 self.detector.beam_center.x = float(data_point) 295 295 self.detector.beam_center_unit = unit 296 elif key == u'beam_center_y' and self.parent_class == \297 u'SASdetector':296 elif (key == u'beam_center_y') and (self.parent_class == 297 u'SASdetector'): 298 298 self.detector.beam_center.y = float(data_point) 299 299 self.detector.beam_center_unit = unit 300 elif key == u'x_pixel_size' and self.parent_class == \301 u'SASdetector':300 elif (key == u'x_pixel_size') and (self.parent_class == 301 u'SASdetector'): 302 302 self.detector.pixel_size.x = float(data_point) 303 303 self.detector.pixel_size_unit = unit 304 elif key == u'y_pixel_size' and self.parent_class == \305 u'SASdetector':304 elif (key == u'y_pixel_size') and (self.parent_class == 305 u'SASdetector'): 306 306 self.detector.pixel_size.y = float(data_point) 307 307 self.detector.pixel_size_unit = unit 308 elif key == u'distance' and self.parent_class == \309 u'SAScollimation':308 elif (key == u'distance') and (self.parent_class == 309 u'SAScollimation'): 310 310 self.collimation.length = data_point 311 311 self.collimation.length_unit = unit 312 elif key == u'name' and self.parent_class == \313 u'SAScollimation':312 elif (key == u'name') and (self.parent_class == 313 u'SAScollimation'): 314 314 self.collimation.name = data_point 315 elif key == u'shape' and self.parent_class == \316 u'SASaperture':315 elif (key == u'shape') and (self.parent_class == 316 u'SASaperture'): 317 317 self.aperture.shape = data_point 318 elif key == u'x_gap' and self.parent_class == \319 u'SASaperture':318 elif (key == u'x_gap') and (self.parent_class == 319 u'SASaperture'): 320 320 self.aperture.size.x = data_point 321 elif key == u'y_gap' and self.parent_class == \322 u'SASaperture':321 elif (key == u'y_gap') and (self.parent_class == 322 u'SASaperture'): 323 323 self.aperture.size.y = data_point 324 324 325 325 # Process Information 326 elif key == u'Title' and self.parent_class == \327 u'SASprocess': # CanSAS 2.0 format326 elif (key == u'Title') and (self.parent_class == 327 u'SASprocess'): # CanSAS 2.0 328 328 self.process.name = data_point 329 elif key == u'name' and self.parent_class == \330 u'SASprocess': # NXcanSAS format329 elif (key == u'name') and (self.parent_class == 330 u'SASprocess'): # NXcanSAS 331 331 self.process.name = data_point 332 elif key == u'description' and self.parent_class == \333 u'SASprocess':332 elif (key == u'description') and (self.parent_class == 333 u'SASprocess'): 334 334 self.process.description = data_point 335 335 elif key == u'date' and self.parent_class == u'SASprocess': … … 341 341 342 342 # Source 343 elif key == u'wavelength' and self.parent_class == \344 u'SASdata':343 elif (key == u'wavelength') and (self.parent_class == 344 u'SASdata'): 345 345 self.current_datainfo.source.wavelength = data_point 346 346 self.current_datainfo.source.wavelength_unit = unit 347 elif key == u'incident_wavelength' and self.parent_class ==\348 u'SASsource':347 elif (key == u'incident_wavelength') and \ 348 (self.parent_class == 'SASsource'): 349 349 self.current_datainfo.source.wavelength = data_point 350 350 self.current_datainfo.source.wavelength_unit = unit 351 elif key == u'wavelength_max' and self.parent_class == \352 u'SASsource':351 elif (key == u'wavelength_max') and (self.parent_class == 352 u'SASsource'): 353 353 self.current_datainfo.source.wavelength_max = data_point 354 354 self.current_datainfo.source.wavelength_max_unit = unit 355 elif key == u'wavelength_min' and self.parent_class == \356 u'SASsource':355 elif (key == u'wavelength_min') and (self.parent_class == 356 u'SASsource'): 357 357 self.current_datainfo.source.wavelength_min = data_point 358 358 self.current_datainfo.source.wavelength_min_unit = unit 359 359 elif key == u'incident_wavelength_spread' and \ 360 self.parent_class == u'SASsource':360 (self.parent_class == u'SASsource'): 361 361 self.current_datainfo.source.wavelength_spread = \ 362 362 data_point 363 363 self.current_datainfo.source.wavelength_spread_unit = \ 364 364 unit 365 elif key == u'beam_size_x' and self.parent_class == \366 u'SASsource':365 elif (key == u'beam_size_x') and (self.parent_class == 366 u'SASsource'): 367 367 self.current_datainfo.source.beam_size.x = data_point 368 368 self.current_datainfo.source.beam_size_unit = unit 369 elif key == u'beam_size_y' and self.parent_class == \370 u'SASsource':369 elif (key == u'beam_size_y') and (self.parent_class == 370 u'SASsource'): 371 371 self.current_datainfo.source.beam_size.y = data_point 372 372 self.current_datainfo.source.beam_size_unit = unit 373 elif key == u'beam_shape' and self.parent_class == \374 u'SASsource':373 elif (key == u'beam_shape') and (self.parent_class == 374 u'SASsource'): 375 375 self.current_datainfo.source.beam_shape = data_point 376 elif key == u'radiation' and self.parent_class == \377 u'SASsource':376 elif (key == u'radiation') and (self.parent_class == 377 u'SASsource'): 378 378 self.current_datainfo.source.radiation = data_point 379 elif key == u'transmission' and self.parent_class == \380 u'SASdata':379 elif (key == u'transmission') and (self.parent_class == 380 u'SASdata'): 381 381 self.current_datainfo.sample.transmission = data_point 382 382 … … 477 477 try: 478 478 if dataset.q_data.size <= 1: 479 dataset.q_data = np.sqrt(dataset.qx_data * dataset.qx_data + 480 dataset.qy_data * dataset.qy_data) 479 dataset.q_data = np.sqrt(dataset.qx_data 480 * dataset.qx_data 481 + dataset.qy_data 482 * dataset.qy_data) 481 483 except: 482 484 dataset.q_data = None … … 594 596 """ 595 597 unit = value.attrs.get(u'units') 596 if unit ==None:598 if unit is None: 597 599 unit = value.attrs.get(u'unit') 598 600 # Convert the unit formats
Note: See TracChangeset
for help on using the changeset viewer.