Changeset 388bd51 in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Apr 4, 2017 9:21:31 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 09a0be5
- Parents:
- def97a0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/sesans_reader.py
rdef97a0 r388bd51 74 74 dy = data[:, 2] 75 75 76 lam_unit = _header_fetch(headers, "wavelength")76 lam_unit = self._header_fetch(headers, "wavelength") 77 77 if lam_unit == "AA": 78 78 lam_unit = "A" … … 80 80 x, x_unit = self._unit_conversion( 81 81 x, lam_unit, 82 _fetch_unit(headers, "spin echo length"))82 self._fetch_unit(headers, "spin echo length")) 83 83 dx, dx_unit = self._unit_conversion( 84 84 dx, lam_unit, 85 _fetch_unit(headers, "error SEL"))85 self._fetch_unit(headers, "error SEL")) 86 86 dlam, dlam_unit = self._unit_conversion( 87 87 dlam, lam_unit, 88 _fetch_unit(headers, "error wavelength"))88 self._fetch_unit(headers, "error wavelength")) 89 89 y_unit = r'\AA^{-2} cm^{-1}' 90 90 … … 101 101 102 102 output.sample.zacceptance = ( 103 float( _header_fetch(params, "Q_zmax")),104 _fetch_unit(params, "Q_zmax"))103 float(self._header_fetch(params, "Q_zmax")), 104 self._fetch_unit(params, "Q_zmax")) 105 105 106 106 output.sample.yacceptance = ( 107 float( _header_fetch(params, "Q_ymax")),108 _fetch_unit(params, "Q_ymax"))107 float(self._header_fetch(params, "Q_ymax")), 108 self._fetch_unit(params, "Q_ymax")) 109 109 110 110 if len(output.x) < 1: … … 125 125 return value, new_unit 126 126 127 def _header_fetch(self, headers, key): 128 index = [k for k in headers.keys() 129 if k.startswith(key)][0] 130 return headers[index] 127 131 128 def _header_fetch(headers, key): 129 index = [k for k in headers.keys() 130 if k.startswith(key)][0] 131 return headers[index] 132 133 134 def _fetch_unit(params, key): 135 index = [k for k in params.keys() 136 if k.startswith(key)][0] 137 unit = index.strip().split()[-1][1:-1] 138 if unit.startswith(r"\A"): 139 unit = "1/A" 140 return unit 132 def _fetch_unit(self, params, key): 133 index = [k for k in params.keys() 134 if k.startswith(key)][0] 135 unit = index.strip().split()[-1][1:-1] 136 if unit.startswith(r"\A"): 137 unit = "1/A" 138 return unit
Note: See TracChangeset
for help on using the changeset viewer.