- Timestamp:
- Jul 14, 2016 3:56:03 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:
- da19985
- Parents:
- 711e157 (diff), 0f1e140 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas
- Files:
-
- 14 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_constants.py
rb699768 rd398285 106 106 "unit" : "x_unit", 107 107 "attributes" : {"unit" : 108 {"variable" : "{0}. _xunit = \"{1}\"",108 {"variable" : "{0}.xaxis(\"Q\", \'{1}\')", 109 109 "storeas" : "content" 110 110 } … … 114 114 "unit" : "y_unit", 115 115 "attributes" : {"unit" : 116 {"variable" : "{0}. _yunit = \"{1}\"",116 {"variable" : "{0}.yaxis(\"Intensity\", \'{1}\')", 117 117 "storeas" : "content" 118 118 } -
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
rad52d31 rd398285 109 109 attr_keys = value.attrs.keys() 110 110 attr_values = value.attrs.values() 111 class_name = value.attrs.get(u'NX_class') 111 if value.attrs.get(u'canSAS_class') is not None: 112 class_name = value.attrs.get(u'canSAS_class') 113 else: 114 class_name = value.attrs.get(u'NX_class') 112 115 if class_name is not None: 113 116 class_prog = re.compile(class_name) … … 131 134 for data_point in data_set: 132 135 ## Top Level Meta Data 136 unit = self._get_unit(value) 133 137 if key == u'definition': 134 138 self.current_dataset.meta_data['reader'] = data_point … … 142 146 ## I and Q Data 143 147 elif key == u'I': 144 i_unit = value.attrs.get(u'unit')145 148 if type(self.current_dataset) is Data2D: 146 149 self.current_dataset.data = np.append(self.current_dataset.data, data_point) 147 self.current_dataset.zaxis("Intensity (%s)" % (i_unit), i_unit)150 self.current_dataset.zaxis("Intensity", unit) 148 151 else: 149 152 self.current_dataset.y = np.append(self.current_dataset.y, data_point) 150 self.current_dataset.yaxis("Intensity (%s)" % (i_unit), i_unit)153 self.current_dataset.yaxis("Intensity", unit) 151 154 elif key == u'Idev': 152 155 if type(self.current_dataset) is Data2D: … … 155 158 self.current_dataset.dy = np.append(self.current_dataset.dy, data_point) 156 159 elif key == u'Q': 157 q_unit = value.attrs.get(u'unit') 158 self.current_dataset.xaxis("Q (%s)" % (q_unit), q_unit) 160 self.current_dataset.xaxis("Q", unit) 159 161 if type(self.current_dataset) is Data2D: 160 162 self.current_dataset.q = np.append(self.current_dataset.q, data_point) … … 162 164 self.current_dataset.x = np.append(self.current_dataset.x, data_point) 163 165 elif key == u'Qy': 164 q_unit = value.attrs.get(u'unit') 165 self.current_dataset.yaxis("Q (%s)" % (q_unit), q_unit) 166 self.current_dataset.yaxis("Q_y", unit) 166 167 self.current_dataset.qy_data = np.append(self.current_dataset.qy_data, data_point) 167 168 elif key == u'Qydev': 168 169 self.current_dataset.dqy_data = np.append(self.current_dataset.dqy_data, data_point) 169 170 elif key == u'Qx': 170 q_unit = value.attrs.get(u'unit') 171 self.current_dataset.xaxis("Q (%s)" % (q_unit), q_unit) 171 self.current_dataset.xaxis("Q_x", unit) 172 172 self.current_dataset.qx_data = np.append(self.current_dataset.qx_data, data_point) 173 173 elif key == u'Qxdev': … … 191 191 elif key == u'SDD' and parent == u'SASdetector': 192 192 self.detector.distance = data_point 193 self.detector.distance_unit = value.attrs.get(u'unit')193 self.detector.distance_unit = unit 194 194 elif key == u'SSD' and parent == u'SAScollimation': 195 195 self.collimation.length = data_point 196 self.collimation.length_unit = value.attrs.get(u'unit')196 self.collimation.length_unit = unit 197 197 elif key == u'name' and parent == u'SAScollimation': 198 198 self.collimation.name = data_point … … 221 221 elif key == u'wavelength' and parent == u'SASdata': 222 222 self.source.wavelength = data_point 223 self.source.wavelength.unit = value.attrs.get(u'unit')223 self.source.wavelength.unit = unit 224 224 elif key == u'radiation' and parent == u'SASsource': 225 225 self.source.radiation = data_point … … 426 426 name = self._create_unique_key(dictionary, name, numb) 427 427 return name 428 429 def _get_unit(self, value): 430 """ 431 Find the unit for a particular value within the h5py dictionary 432 433 :param value: attribute dictionary for a particular value set 434 :return: 435 """ 436 unit = value.attrs.get(u'units') 437 if unit == None: 438 unit = value.attrs.get(u'unit') 439 440 ## Convert the unit formats 441 if unit == "1/A": 442 unit = "A^{-1}" 443 elif unit == "1/cm": 444 unit = "cm^{-1}" 445 446 return unit -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
rd85c194 r5a54aa4 95 95 self.parent.SetFocus() 96 96 97 # If true, there are 3 qrange bars 98 self.is_corfunc = False 99 97 100 98 101 def get_symbol_label(self): … … 214 217 if active_ctrl == None: 215 218 return 219 if hasattr(event, 'is_corfunc'): 220 self.is_corfunc = event.is_corfunc 216 221 if event.id in self.plots.keys(): 217 222 ctrl = event.ctrl … … 222 227 values = [max(x_data.min(), float(ctrl[0].GetValue())), 223 228 min(x_data.max(), float(ctrl[1].GetValue()))] 229 if len(ctrl) == 3: 230 colors.append('purple') 231 values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 224 232 if self.ly == None: 225 233 self.ly = [] … … 293 301 ly0x = ly[0].get_xdata() 294 302 ly1x = ly[1].get_xdata() 303 ly2x = None 304 if self.is_corfunc: ly2x = ly[2].get_xdata() 295 305 self.q_ctrl[0].SetBackgroundColour('white') 296 306 self.q_ctrl[1].SetBackgroundColour('white') … … 306 316 self.q_ctrl[0].SetValue(str(pos_x)) 307 317 self.q_ctrl[1].SetBackgroundColour('pink') 318 elif ly2x is not None and ly1x >= ly2x: 319 if self.vl_ind == 1: 320 ly[2].set_xdata(posx) 321 ly[2].set_zorder(nop) 322 self.q_ctrl[2].SetValue(str(pos_x)) 323 elif self.vl_ind == 2: 324 ly[1].set_xdata(posx) 325 ly[1].set_zorder(nop) 326 self.q_ctrl[1].SetValue(str(pos_x)) 327 308 328 309 329 def _get_cusor_lines(self, event): … … 325 345 dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 326 346 dqmax = math.fabs(event.xdata - self.ly[1].get_xdata()) 327 is_qmax = dqmin > dqmax 328 if is_qmax: 329 self.vl_ind = 1 347 if not self.is_corfunc: 348 is_qmax = dqmin > dqmax 349 if is_qmax: 350 self.vl_ind = 1 351 else: 352 self.vl_ind = 0 330 353 else: 331 self.vl_ind = 0 354 dqmax2 = math.fabs(event.xdata - self.ly[2].get_xdata()) 355 closest = min(dqmin, dqmax, dqmax2) 356 self.vl_ind = { dqmin: 0, dqmax: 1, dqmax2: 2 }.get(closest) 332 357 333 358 def cusor_line(self, event):
Note: See TracChangeset
for help on using the changeset viewer.