Changeset 50b33d0 in sasview
- Timestamp:
- Mar 26, 2019 10:21:53 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl
- Children:
- c149fba
- Parents:
- 5123512 (diff), f5e2a10a (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. - git-author:
- Piotr Rozyczko <piotr.rozyczko@…> (03/26/19 10:21:53)
- git-committer:
- GitHub <noreply@…> (03/26/19 10:21:53)
- Location:
- src/sas
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
rb38c8c8 rf5e2a10a 590 590 xunit = model.details[name][0] 591 591 data1d.xaxis(r'\rm{{{}}}'.format(name.replace('_', '\_')), xunit) 592 data1d.yaxis(r'\rm{ weight}', 'normalized')592 data1d.yaxis(r'\rm{probability}', 'normalized') 593 593 data1d.scale = 'linear' 594 594 data1d.symbol = 'Line' -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rd4c9242 rf5e2a10a 2737 2737 self.Calc2DFinishedSignal.emit(return_data) 2738 2738 2739 def _appendPlotsPolyDisp(self, new_plots, return_data, fitted_data): 2740 """ 2741 Internal helper for 1D and 2D for creating plots of the polydispersity distribution for 2742 parameters which have a polydispersity enabled. 2743 """ 2744 for plot in FittingUtilities.plotPolydispersities(return_data.get('model', None)): 2745 data_id = fitted_data.id.split() 2746 plot.id = "{} [{}] {}".format(data_id[0], plot.name, " ".join(data_id[1:])) 2747 data_name = fitted_data.name.split() 2748 plot.name = " ".join([data_name[0], plot.name] + data_name[1:]) 2749 self.createNewIndex(plot) 2750 new_plots.append(plot) 2751 2739 2752 def complete1D(self, return_data): 2740 2753 """ … … 2769 2782 self.communicate.deleteIntermediateTheoryPlotsSignal.emit(self.kernel_module.id) 2770 2783 2771 # Create plots for parameters with enabled polydispersity 2772 for plot in FittingUtilities.plotPolydispersities(return_data.get('model', None)): 2773 data_id = fitted_data.id.split() 2774 plot.id = "{} [{}] {}".format(data_id[0], plot.name, " ".join(data_id[1:])) 2775 data_name = fitted_data.name.split() 2776 plot.name = " ".join([data_name[0], plot.name] + data_name[1:]) 2777 self.createNewIndex(plot) 2778 new_plots.append(plot) 2784 self._appendPlotsPolyDisp(new_plots, return_data, fitted_data) 2779 2785 2780 2786 # Create plots for intermediate product data … … 2813 2819 if residuals is not None: 2814 2820 new_plots.append(residuals) 2821 2822 self._appendPlotsPolyDisp(new_plots, return_data, fitted_data) 2815 2823 2816 2824 # Update/generate plots -
src/sas/qtgui/Calculators/SldPanel.py
r33c0561 r9f3db13 1 1 # global 2 import numpy as np 2 3 import logging 3 4 from PyQt5 import QtCore … … 32 33 ) 33 34 34 class SldResult(object): 35 def __init__(self, molecular_formula, mass_density, 36 neutron_wavelength, neutron_sld_real, neutron_sld_imag, 37 xray_wavelength, xray_sld_real, xray_sld_imag, 38 neutron_inc_xs, neutron_abs_xs, neutron_length): 39 40 self.molecular_formula = molecular_formula 41 self.mass_density = mass_density 35 class NeutronSldResult(object): 36 def __init__(self, neutron_wavelength, neutron_sld_real, 37 neutron_sld_imag, neutron_inc_xs, neutron_abs_xs, 38 neutron_length): 39 42 40 self.neutron_wavelength = neutron_wavelength 43 41 self.neutron_sld_real = neutron_sld_real 44 42 self.neutron_sld_imag = neutron_sld_imag 43 self.neutron_inc_xs = neutron_inc_xs 44 self.neutron_abs_xs = neutron_abs_xs 45 self.neutron_length = neutron_length 46 47 class XraySldResult(object): 48 def __init__(self, xray_wavelength, xray_sld_real, xray_sld_imag): 49 45 50 self.xray_wavelength = xray_wavelength 46 51 self.xray_sld_real = xray_sld_real 47 52 self.xray_sld_imag = xray_sld_imag 48 self.neutron_inc_xs = neutron_inc_xs 49 self.neutron_abs_xs = neutron_abs_xs 50 self.neutron_length = neutron_length 51 52 def sldAlgorithm(molecular_formula, mass_density, neutron_wavelength, xray_wavelength): 53 54 xray_sld_real, xray_sld_imag = xray_sld( 55 compound=molecular_formula, 56 density=mass_density, 57 wavelength=xray_wavelength) 53 54 def neutronSldAlgorithm(molecular_formula, mass_density, neutron_wavelength): 58 55 59 56 (neutron_sld_real, neutron_sld_imag, _), (_, neutron_abs_xs, neutron_inc_xs), neutron_length = \ … … 69 66 scaled_neutron_sld_imag = SCALE * abs(neutron_sld_imag) 70 67 68 return NeutronSldResult(neutron_wavelength, scaled_neutron_sld_real, 69 scaled_neutron_sld_imag, neutron_inc_xs, 70 neutron_abs_xs, neutron_length) 71 72 def xraySldAlgorithm(molecular_formula, mass_density, xray_wavelength): 73 74 xray_sld_real, xray_sld_imag = xray_sld( 75 compound=molecular_formula, 76 density=mass_density, 77 wavelength=xray_wavelength) 78 79 SCALE = 1e-6 80 71 81 # xray sld 72 82 scaled_xray_sld_real = SCALE * xray_sld_real … … 74 84 75 85 76 return SldResult( 77 molecular_formula, mass_density, 78 neutron_wavelength, scaled_neutron_sld_real, scaled_neutron_sld_imag, 79 xray_wavelength, scaled_xray_sld_real, scaled_xray_sld_imag, 80 neutron_inc_xs, neutron_abs_xs, neutron_length) 86 return XraySldResult(xray_wavelength, scaled_xray_sld_real, 87 scaled_xray_sld_imag) 81 88 82 89 … … 114 121 #self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula)) 115 122 123 # No need for recalculate 124 self.ui.recalculateButton.setVisible(False) 125 116 126 rx = QtCore.QRegExp("[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?") 117 127 self.ui.editMassDensity.setValidator(QtGui.QRegExpValidator(rx, self.ui.editMassDensity)) … … 137 147 self.model.setItem(key, QtGui.QStandardItem()) 138 148 139 self.model.dataChanged.connect(self.dataChanged)149 #self.model.dataChanged.connect(self.dataChanged) 140 150 141 151 self.ui.editMassDensity.textChanged.connect(self.recalculateSLD) … … 176 186 xrayWavelength = self.ui.editXrayWavelength.text() 177 187 178 if len(formula) > 0 and len(density) > 0 and len(neutronWavelength) > 0 and len(xrayWavelength) > 0: 179 try: 180 results = sldAlgorithm(str(formula), float(density), float(neutronWavelength), float(xrayWavelength)) 181 182 def format(value): 183 return ("%-5.3g" % value).strip() 184 185 self.model.item(MODEL.NEUTRON_SLD_REAL).setText(format(results.neutron_sld_real)) 186 self.model.item(MODEL.NEUTRON_SLD_IMAG).setText(format(results.neutron_sld_imag)) 187 188 self.model.item(MODEL.XRAY_SLD_REAL).setText(format(results.xray_sld_real)) 189 self.model.item(MODEL.XRAY_SLD_IMAG).setText(format(results.xray_sld_imag)) 190 191 self.model.item(MODEL.NEUTRON_INC_XS).setText(format(results.neutron_inc_xs)) 192 self.model.item(MODEL.NEUTRON_ABS_XS).setText(format(results.neutron_abs_xs)) 193 self.model.item(MODEL.NEUTRON_LENGTH).setText(format(results.neutron_length)) 194 195 return 196 197 except Exception as e: 198 pass 199 200 for key in list(self._getOutputs().keys()): 201 self.model.item(key).setText("") 188 if not formula or not density: 189 return 190 191 def format(value): 192 return ("%-5.3g" % value).strip() 193 194 if neutronWavelength and float(neutronWavelength) > np.finfo(float).eps: 195 results = neutronSldAlgorithm(str(formula), float(density), float(neutronWavelength)) 196 197 self.model.item(MODEL.NEUTRON_SLD_REAL).setText(format(results.neutron_sld_real)) 198 self.model.item(MODEL.NEUTRON_SLD_IMAG).setText(format(results.neutron_sld_imag)) 199 self.model.item(MODEL.NEUTRON_INC_XS).setText(format(results.neutron_inc_xs)) 200 self.model.item(MODEL.NEUTRON_ABS_XS).setText(format(results.neutron_abs_xs)) 201 self.model.item(MODEL.NEUTRON_LENGTH).setText(format(results.neutron_length)) 202 self.model.item(MODEL.NEUTRON_LENGTH).setEnabled(True) 203 self.ui.editNeutronSldReal.setEnabled(True) 204 self.ui.editNeutronSldImag.setEnabled(True) 205 self.ui.editNeutronIncXs.setEnabled(True) 206 self.ui.editNeutronLength.setEnabled(True) 207 self.ui.editNeutronAbsXs.setEnabled(True) 208 else: 209 self.model.item(MODEL.NEUTRON_SLD_REAL).setText("") 210 self.model.item(MODEL.NEUTRON_SLD_IMAG).setText("") 211 self.model.item(MODEL.NEUTRON_INC_XS).setText("") 212 self.model.item(MODEL.NEUTRON_ABS_XS).setText("") 213 self.model.item(MODEL.NEUTRON_LENGTH).setText("") 214 self.ui.editNeutronSldReal.setEnabled(False) 215 self.ui.editNeutronSldImag.setEnabled(False) 216 self.ui.editNeutronIncXs.setEnabled(False) 217 self.ui.editNeutronLength.setEnabled(False) 218 self.ui.editNeutronAbsXs.setEnabled(False) 219 220 if xrayWavelength and float(xrayWavelength) > np.finfo(float).eps: 221 results = xraySldAlgorithm(str(formula), float(density), float(xrayWavelength)) 222 223 self.model.item(MODEL.XRAY_SLD_REAL).setText(format(results.xray_sld_real)) 224 self.model.item(MODEL.XRAY_SLD_IMAG).setText(format(results.xray_sld_imag)) 225 self.ui.editXraySldReal.setEnabled(True) 226 self.ui.editXraySldImag.setEnabled(True) 227 else: 228 self.model.item(MODEL.XRAY_SLD_REAL).setText("") 229 self.model.item(MODEL.XRAY_SLD_IMAG).setText("") 230 self.ui.editXraySldReal.setEnabled(False) 231 self.ui.editXraySldImag.setEnabled(False) 202 232 203 233 def modelReset(self): -
src/sas/qtgui/Calculators/UI/SldPanel.ui
r5c0e717 r9f3db13 8 8 <y>0</y> 9 9 <width>490</width> 10 <height>4 90</height>10 <height>446</height> 11 11 </rect> 12 12 </property> … … 38 38 </spacer> 39 39 </item> 40 <item row="1" column="0"> 41 <widget class="QGroupBox" name="groupBoxOutput"> 42 <property name="title"> 43 <string>Output</string> 44 </property> 45 <layout class="QGridLayout" name="gridLayoutOutput"> 46 <item row="0" column="1"> 47 <widget class="QLineEdit" name="editNeutronSldReal"> 48 <property name="enabled"> 49 <bool>true</bool> 50 </property> 51 <property name="readOnly"> 52 <bool>true</bool> 53 </property> 54 </widget> 55 </item> 56 <item row="0" column="0"> 57 <widget class="QLabel" name="label_17"> 58 <property name="text"> 59 <string>Neutron SLD</string> 60 </property> 61 </widget> 62 </item> 63 <item row="5" column="0"> 64 <widget class="QLabel" name="label_3"> 65 <property name="text"> 66 <string>Neutron 1/e length</string> 67 </property> 68 </widget> 69 </item> 70 <item row="3" column="1"> 71 <widget class="QLineEdit" name="editNeutronIncXs"> 72 <property name="enabled"> 73 <bool>true</bool> 74 </property> 75 <property name="readOnly"> 76 <bool>true</bool> 77 </property> 78 </widget> 79 </item> 80 <item row="3" column="0"> 81 <widget class="QLabel" name="label_21"> 82 <property name="text"> 83 <string>Neutron Inc. Xs</string> 84 </property> 85 </widget> 86 </item> 87 <item row="0" column="2"> 88 <widget class="QLabel" name="label_18"> 89 <property name="text"> 90 <string>-i</string> 91 </property> 92 </widget> 93 </item> 94 <item row="1" column="2"> 95 <widget class="QLabel" name="label_20"> 96 <property name="text"> 97 <string>-i</string> 98 </property> 99 </widget> 100 </item> 101 <item row="0" column="3"> 102 <widget class="QLineEdit" name="editNeutronSldImag"> 103 <property name="enabled"> 104 <bool>true</bool> 105 </property> 106 <property name="readOnly"> 107 <bool>true</bool> 108 </property> 109 </widget> 110 </item> 111 <item row="5" column="2" colspan="2"> 112 <widget class="QLabel" name="label_4"> 113 <property name="text"> 114 <string>cm</string> 115 </property> 116 </widget> 117 </item> 118 <item row="5" column="1"> 119 <widget class="QLineEdit" name="editNeutronLength"> 120 <property name="enabled"> 121 <bool>true</bool> 122 </property> 123 <property name="readOnly"> 124 <bool>true</bool> 125 </property> 126 </widget> 127 </item> 128 <item row="4" column="2" colspan="2"> 129 <widget class="QLabel" name="label_24"> 130 <property name="text"> 131 <string>1/cm</string> 132 </property> 133 </widget> 134 </item> 135 <item row="4" column="1"> 136 <widget class="QLineEdit" name="editNeutronAbsXs"> 137 <property name="enabled"> 138 <bool>true</bool> 139 </property> 140 <property name="readOnly"> 141 <bool>true</bool> 142 </property> 143 </widget> 144 </item> 145 <item row="4" column="0"> 146 <widget class="QLabel" name="label_23"> 147 <property name="text"> 148 <string>Neutron Abs. Xs</string> 149 </property> 150 </widget> 151 </item> 152 <item row="3" column="2" colspan="2"> 153 <widget class="QLabel" name="label_22"> 154 <property name="text"> 155 <string>1/cm</string> 156 </property> 157 </widget> 158 </item> 159 <item row="1" column="4"> 160 <widget class="QLabel" name="label_6"> 161 <property name="text"> 162 <string>1/à 163 ²</string> 164 </property> 165 </widget> 166 </item> 167 <item row="1" column="0"> 168 <widget class="QLabel" name="label_19"> 169 <property name="text"> 170 <string>X-Ray SLD</string> 171 </property> 172 </widget> 173 </item> 174 <item row="0" column="4"> 175 <widget class="QLabel" name="label_5"> 176 <property name="text"> 177 <string>1/à 178 ²</string> 179 </property> 180 </widget> 181 </item> 182 <item row="2" column="0" colspan="5"> 183 <widget class="QFrame" name="frame"> 184 <property name="minimumSize"> 185 <size> 186 <width>0</width> 187 <height>5</height> 188 </size> 189 </property> 190 <property name="frameShape"> 191 <enum>QFrame::HLine</enum> 192 </property> 193 <property name="frameShadow"> 194 <enum>QFrame::Raised</enum> 195 </property> 196 <property name="lineWidth"> 197 <number>1</number> 198 </property> 199 <property name="midLineWidth"> 200 <number>0</number> 201 </property> 202 </widget> 203 </item> 204 <item row="1" column="1"> 205 <widget class="QLineEdit" name="editXraySldReal"> 206 <property name="enabled"> 207 <bool>true</bool> 208 </property> 209 <property name="readOnly"> 210 <bool>true</bool> 211 </property> 212 </widget> 213 </item> 214 <item row="1" column="3"> 215 <widget class="QLineEdit" name="editXraySldImag"> 216 <property name="enabled"> 217 <bool>true</bool> 218 </property> 219 <property name="readOnly"> 220 <bool>true</bool> 221 </property> 222 </widget> 223 </item> 224 </layout> 225 </widget> 226 </item> 227 <item row="0" column="0"> 228 <widget class="QGroupBox" name="groupBoxInput"> 229 <property name="title"> 230 <string>Input</string> 231 </property> 232 <layout class="QGridLayout" name="gridLayoutInput"> 233 <item row="1" column="0"> 234 <widget class="QLabel" name="label_8"> 235 <property name="text"> 236 <string>Mass Density</string> 237 </property> 238 </widget> 239 </item> 240 <item row="1" column="2"> 241 <widget class="QLabel" name="label_16"> 242 <property name="text"> 243 <string>g/cm³</string> 244 </property> 245 </widget> 246 </item> 247 <item row="0" column="2"> 248 <widget class="QLabel" name="label_10"> 249 <property name="text"> 250 <string>e.g. H2O</string> 251 </property> 252 </widget> 253 </item> 254 <item row="0" column="1"> 255 <widget class="QLineEdit" name="editMolecularFormula"/> 256 </item> 257 <item row="1" column="1"> 258 <widget class="QLineEdit" name="editMassDensity"/> 259 </item> 260 <item row="2" column="2"> 261 <widget class="QLabel" name="label_12"> 262 <property name="text"> 263 <string>à 264 </string> 265 </property> 266 </widget> 267 </item> 268 <item row="0" column="0"> 269 <widget class="QLabel" name="label_9"> 270 <property name="text"> 271 <string>Molecular Formula</string> 272 </property> 273 </widget> 274 </item> 275 <item row="2" column="0"> 276 <widget class="QLabel" name="label_11"> 277 <property name="text"> 278 <string>Neutron Wavelength</string> 279 </property> 280 </widget> 281 </item> 282 <item row="2" column="1"> 283 <widget class="QLineEdit" name="editNeutronWavelength"> 284 <property name="styleSheet"> 285 <string notr="true"/> 286 </property> 287 <property name="readOnly"> 288 <bool>false</bool> 289 </property> 290 </widget> 291 </item> 292 <item row="3" column="1"> 293 <widget class="QLineEdit" name="editXrayWavelength"/> 294 </item> 295 <item row="3" column="0"> 296 <widget class="QLabel" name="label_13"> 297 <property name="text"> 298 <string>X-Ray Wavelength</string> 299 </property> 300 </widget> 301 </item> 302 <item row="3" column="2"> 303 <widget class="QLabel" name="label"> 304 <property name="text"> 305 <string>à 306 </string> 307 </property> 308 </widget> 309 </item> 310 </layout> 311 </widget> 312 </item> 40 313 <item row="4" column="0"> 41 314 <widget class="QWidget" name="widget" native="true"> … … 46 319 </size> 47 320 </property> 48 <widget class="QPushButton" name="recalculateButton"> 49 <property name="geometry"> 50 <rect> 51 <x>0</x> 52 <y>0</y> 53 <width>114</width> 54 <height>32</height> 55 </rect> 56 </property> 57 <property name="text"> 58 <string>Recalculate</string> 59 </property> 60 </widget> 61 <widget class="QPushButton" name="helpButton"> 62 <property name="geometry"> 63 <rect> 64 <x>176</x> 65 <y>0</y> 66 <width>114</width> 67 <height>32</height> 68 </rect> 69 </property> 70 <property name="text"> 71 <string>Help</string> 72 </property> 73 </widget> 74 <widget class="QPushButton" name="closeButton"> 75 <property name="geometry"> 76 <rect> 77 <x>352</x> 78 <y>0</y> 79 <width>114</width> 80 <height>32</height> 81 </rect> 82 </property> 83 <property name="text"> 84 <string>Close</string> 85 </property> 86 </widget> 87 </widget> 88 </item> 89 <item row="0" column="0"> 90 <widget class="QGroupBox" name="groupBoxInput"> 91 <property name="title"> 92 <string>Input</string> 93 </property> 94 <layout class="QGridLayout" name="gridLayoutInput"> 95 <item row="1" column="0"> 96 <widget class="QLabel" name="label_8"> 97 <property name="text"> 98 <string>Mass Density</string> 99 </property> 100 </widget> 101 </item> 102 <item row="1" column="2"> 103 <widget class="QLabel" name="label_16"> 104 <property name="text"> 105 <string>g/cm³</string> 106 </property> 107 </widget> 321 <layout class="QGridLayout" name="gridLayout"> 322 <item row="0" column="0"> 323 <widget class="QPushButton" name="recalculateButton"> 324 <property name="enabled"> 325 <bool>true</bool> 326 </property> 327 <property name="text"> 328 <string>Recalculate</string> 329 </property> 330 </widget> 331 </item> 332 <item row="0" column="1"> 333 <spacer name="horizontalSpacer"> 334 <property name="orientation"> 335 <enum>Qt::Horizontal</enum> 336 </property> 337 <property name="sizeHint" stdset="0"> 338 <size> 339 <width>208</width> 340 <height>20</height> 341 </size> 342 </property> 343 </spacer> 108 344 </item> 109 345 <item row="0" column="2"> 110 <widget class="QLabel" name="label_10"> 111 <property name="text"> 112 <string>e.g. H2O</string> 113 </property> 114 </widget> 115 </item> 116 <item row="0" column="1"> 117 <widget class="QLineEdit" name="editMolecularFormula"/> 118 </item> 119 <item row="1" column="1"> 120 <widget class="QLineEdit" name="editMassDensity"/> 121 </item> 122 <item row="2" column="2"> 123 <widget class="QLabel" name="label_12"> 124 <property name="text"> 125 <string>à 126 </string> 127 </property> 128 </widget> 129 </item> 130 <item row="0" column="0"> 131 <widget class="QLabel" name="label_9"> 132 <property name="text"> 133 <string>Molecular Formula</string> 134 </property> 135 </widget> 136 </item> 137 <item row="2" column="0"> 138 <widget class="QLabel" name="label_11"> 139 <property name="text"> 140 <string>Neutron Wavelength</string> 141 </property> 142 </widget> 143 </item> 144 <item row="2" column="1"> 145 <widget class="QLineEdit" name="editNeutronWavelength"> 146 <property name="styleSheet"> 147 <string notr="true"/> 148 </property> 149 <property name="readOnly"> 150 <bool>false</bool> 151 </property> 152 </widget> 153 </item> 154 <item row="3" column="1"> 155 <widget class="QLineEdit" name="editXrayWavelength"/> 156 </item> 157 <item row="3" column="0"> 158 <widget class="QLabel" name="label_13"> 159 <property name="text"> 160 <string>X-Ray Wavelength</string> 161 </property> 162 </widget> 163 </item> 164 <item row="3" column="2"> 165 <widget class="QLabel" name="label"> 166 <property name="text"> 167 <string>à 168 </string> 169 </property> 170 </widget> 171 </item> 172 </layout> 173 </widget> 174 </item> 175 <item row="1" column="0"> 176 <widget class="QGroupBox" name="groupBoxOutput"> 177 <property name="title"> 178 <string>Output</string> 179 </property> 180 <layout class="QGridLayout" name="gridLayoutOutput"> 181 <item row="0" column="1"> 182 <widget class="QLineEdit" name="editNeutronSldReal"> 183 <property name="enabled"> 184 <bool>false</bool> 185 </property> 186 <property name="readOnly"> 187 <bool>true</bool> 188 </property> 189 </widget> 190 </item> 191 <item row="0" column="0"> 192 <widget class="QLabel" name="label_17"> 193 <property name="text"> 194 <string>Neutron SLD</string> 195 </property> 196 </widget> 197 </item> 198 <item row="5" column="0"> 199 <widget class="QLabel" name="label_3"> 200 <property name="text"> 201 <string>Neutron 1/e length</string> 202 </property> 203 </widget> 204 </item> 205 <item row="3" column="1"> 206 <widget class="QLineEdit" name="editNeutronIncXs"> 207 <property name="enabled"> 208 <bool>false</bool> 209 </property> 210 <property name="readOnly"> 211 <bool>true</bool> 212 </property> 213 </widget> 214 </item> 215 <item row="3" column="0"> 216 <widget class="QLabel" name="label_21"> 217 <property name="text"> 218 <string>Neutron Inc. Xs</string> 219 </property> 220 </widget> 221 </item> 222 <item row="0" column="2"> 223 <widget class="QLabel" name="label_18"> 224 <property name="text"> 225 <string>-i</string> 226 </property> 227 </widget> 228 </item> 229 <item row="1" column="2"> 230 <widget class="QLabel" name="label_20"> 231 <property name="text"> 232 <string>-i</string> 346 <widget class="QPushButton" name="closeButton"> 347 <property name="text"> 348 <string>Close</string> 233 349 </property> 234 350 </widget> 235 351 </item> 236 352 <item row="0" column="3"> 237 <widget class="QLineEdit" name="editNeutronSldImag"> 238 <property name="enabled"> 239 <bool>false</bool> 240 </property> 241 <property name="readOnly"> 242 <bool>true</bool> 243 </property> 244 </widget> 245 </item> 246 <item row="5" column="2" colspan="2"> 247 <widget class="QLabel" name="label_4"> 248 <property name="text"> 249 <string>cm</string> 250 </property> 251 </widget> 252 </item> 253 <item row="5" column="1"> 254 <widget class="QLineEdit" name="editNeutronLength"> 255 <property name="enabled"> 256 <bool>false</bool> 257 </property> 258 <property name="readOnly"> 259 <bool>true</bool> 260 </property> 261 </widget> 262 </item> 263 <item row="4" column="2" colspan="2"> 264 <widget class="QLabel" name="label_24"> 265 <property name="text"> 266 <string>1/cm</string> 267 </property> 268 </widget> 269 </item> 270 <item row="4" column="1"> 271 <widget class="QLineEdit" name="editNeutronAbsXs"> 272 <property name="enabled"> 273 <bool>false</bool> 274 </property> 275 <property name="readOnly"> 276 <bool>true</bool> 277 </property> 278 </widget> 279 </item> 280 <item row="4" column="0"> 281 <widget class="QLabel" name="label_23"> 282 <property name="text"> 283 <string>Neutron Abs. Xs</string> 284 </property> 285 </widget> 286 </item> 287 <item row="3" column="2" colspan="2"> 288 <widget class="QLabel" name="label_22"> 289 <property name="text"> 290 <string>1/cm</string> 291 </property> 292 </widget> 293 </item> 294 <item row="1" column="4"> 295 <widget class="QLabel" name="label_6"> 296 <property name="text"> 297 <string>1/à 298 ²</string> 299 </property> 300 </widget> 301 </item> 302 <item row="1" column="0"> 303 <widget class="QLabel" name="label_19"> 304 <property name="text"> 305 <string>X-Ray SLD</string> 306 </property> 307 </widget> 308 </item> 309 <item row="0" column="4"> 310 <widget class="QLabel" name="label_5"> 311 <property name="text"> 312 <string>1/à 313 ²</string> 314 </property> 315 </widget> 316 </item> 317 <item row="2" column="0" colspan="5"> 318 <widget class="QFrame" name="frame"> 319 <property name="minimumSize"> 320 <size> 321 <width>0</width> 322 <height>5</height> 323 </size> 324 </property> 325 <property name="frameShape"> 326 <enum>QFrame::HLine</enum> 327 </property> 328 <property name="frameShadow"> 329 <enum>QFrame::Raised</enum> 330 </property> 331 <property name="lineWidth"> 332 <number>1</number> 333 </property> 334 <property name="midLineWidth"> 335 <number>0</number> 336 </property> 337 </widget> 338 </item> 339 <item row="1" column="1"> 340 <widget class="QLineEdit" name="editXraySldReal"> 341 <property name="enabled"> 342 <bool>false</bool> 343 </property> 344 <property name="readOnly"> 345 <bool>true</bool> 346 </property> 347 </widget> 348 </item> 349 <item row="1" column="3"> 350 <widget class="QLineEdit" name="editXraySldImag"> 351 <property name="enabled"> 352 <bool>false</bool> 353 </property> 354 <property name="readOnly"> 355 <bool>true</bool> 353 <widget class="QPushButton" name="helpButton"> 354 <property name="text"> 355 <string>Help</string> 356 356 </property> 357 357 </widget> -
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
rdee9e5f r3beadede 7 7 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 8 8 as FigureCanvas 9 from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT 9 10 from matplotlib.figure import Figure 10 11 from numpy.linalg.linalg import LinAlgError … … 35 36 self.data = None 36 37 self.extrap = None 38 self.setMinimumSize(300, 300) 37 39 38 40 def draw_q_space(self): … … 49 51 self.axes.set_xscale("log") 50 52 self.axes.set_yscale("log") 53 self.axes.set_xlabel("Q [$\AA^{-1}$]") 54 self.axes.set_ylabel("I(Q) [cm$^{-1}$]") 55 self.axes.set_title("Scattering data") 56 self.fig.tight_layout() 51 57 52 58 qmin = float(self.model.item(W.W_QMIN).text()) … … 55 61 56 62 if self.data: 57 self.axes.plot(self.data.x, self.data.y) 63 # self.axes.plot(self.data.x, self.data.y, label="Experimental Data") 64 self.axes.errorbar(self.data.x, self.data.y, yerr=self.data.dy, label="Experimental Data") 58 65 self.axes.axvline(qmin) 59 66 self.axes.axvline(qmax1) … … 61 68 self.axes.set_xlim(min(self.data.x) / 2, 62 69 max(self.data.x) * 1.5 - 0.5 * min(self.data.x)) 70 self.axes.set_ylim(min(self.data.y) / 2, 71 max(self.data.y) * 1.5 - 0.5 * min(self.data.y)) 72 63 73 if self.extrap: 64 self.axes.plot(self.extrap.x, self.extrap.y) 74 self.axes.plot(self.extrap.x, self.extrap.y, label="Extrapolation") 75 76 if self.data or self.extrap: 77 self.axes.legend() 65 78 66 79 self.draw() … … 78 91 self.axes.set_xscale("linear") 79 92 self.axes.set_yscale("linear") 93 self.axes.set_xlabel("Z [$\AA$]") 94 self.axes.set_ylabel("Correlation") 95 self.axes.set_title("Real Space Correlations") 96 self.fig.tight_layout() 80 97 81 98 if self.data: … … 85 102 self.axes.plot(data_idf.x, data_idf.y, 86 103 label="Interface Distribution Function") 87 self.axes.set_xlim( min(data1.x), max(data1.x) / 4)104 self.axes.set_xlim(0, max(data1.x) / 4) 88 105 self.axes.legend() 89 106 … … 115 132 116 133 self._canvas = MyMplCanvas(self.model) 117 self.mainVerticalLayout.insertWidget(0, self._canvas) 134 self.plotLayout.insertWidget(0, self._canvas) 135 self.plotLayout.insertWidget(1, NavigationToolbar2QT(self._canvas, self)) 136 self._realplot = MyMplCanvas(self.model) 137 self.plotLayout.insertWidget(2, self._realplot) 138 self.plotLayout.insertWidget(3, NavigationToolbar2QT(self._realplot, self)) 139 140 self.gridLayout_8.setColumnStretch(0, 1) 141 self.gridLayout_8.setColumnStretch(1, 3) 118 142 119 143 # Connect buttons to slots. … … 238 262 self.model.setItem(W.W_POLY, QtGui.QStandardItem("{:.3g}".format(params['A']))) 239 263 self.model.setItem(W.W_PERIOD, QtGui.QStandardItem("{:.3g}".format(params['max']))) 240 #self._realplot.data = transforms264 self._realplot.data = transforms 241 265 242 266 self.update_real_space_plot(transforms) 243 267 244 #self._realplot.draw_real_space()268 self._realplot.draw_real_space() 245 269 246 270 def update_real_space_plot(self, datas): … … 358 382 self.cmdTransform.setEnabled(False) 359 383 360 #self._realplot.data = None361 #self._realplot.draw_real_space()384 self._realplot.data = None 385 self._realplot.draw_real_space() 362 386 363 387 def setClosable(self, value=True): -
src/sas/qtgui/Perspectives/Corfunc/UI/CorfuncPanel.ui
rcb4d219 r85503bc 18 18 <layout class="QVBoxLayout" name="mainVerticalLayout"> 19 19 <item> 20 <spacer name="verticalSpacer">21 <property name="orientation">22 <enum>Qt::Vertical</enum>23 </property>24 <property name="sizeHint" stdset="0">25 <size>26 <width>20</width>27 <height>38</height>28 </size>29 </property>30 </spacer>31 </item>32 <item>33 20 <widget class="QGroupBox" name="groupBox"> 34 21 <property name="title"> … … 322 309 </item> 323 310 <item row="0" column="1"> 324 <widget class="QLineEdit" name="txtLongPeriod"/> 311 <widget class="QLineEdit" name="txtLongPeriod" width="50"> 312 <property name="minimumSize" stdset="0"> 313 <size> 314 <width>60</width> 315 <height>20</height> 316 </size> 317 </property> 318 </widget> 325 319 </item> 326 320 <item row="0" column="2"> … … 332 326 </item> 333 327 <item row="0" column="3"> 334 <widget class="QLineEdit" name="txtAvgIntThick"/> 328 <widget class="QLineEdit" name="txtAvgIntThick"> 329 <property name="minimumSize" stdset="0"> 330 <size> 331 <width>60</width> 332 <height>20</height> 333 </size> 334 </property> 335 </widget> 335 336 </item> 336 337 <item row="1" column="0"> … … 417 418 </layout> 418 419 </item> 420 <item> 421 <spacer name="verticalSpacer"> 422 <property name="orientation"> 423 <enum>Qt::Vertical</enum> 424 </property> 425 <property name="sizeHint" stdset="0"> 426 <size> 427 <width>20</width> 428 <height>38</height> 429 </size> 430 </property> 431 </spacer> 432 </item> 433 </layout> 434 </item> 435 <item row="0" column="1"> 436 <layout class="QVBoxLayout" name="plotLayout"> 419 437 </layout> 420 438 </item> -
src/sas/qtgui/Plotting/Plotter.py
rd9e7792 r4c11b2a 420 420 This effectlvely refreshes the chart with changes to one of its plots 421 421 """ 422 423 # Pull the current transform settings from the old plot 424 selected_plot = self.plot_dict[id] 425 new_plot.xtransform = selected_plot.xtransform 426 new_plot.ytransform = selected_plot.ytransform 427 422 428 self.removePlot(id) 423 429 self.plot(data=new_plot) -
src/sas/sascalc/corfunc/transform_thread.py
ra859f99 rf7e6b30 45 45 # gamma3(R) = 1/R int_{0}^{R} gamma1(x) dx 46 46 # trapz uses the trapezium rule to calculate the integral 47 mask = xs <= 200.0 # Only calculate gamma3 up to x=200 (as this is all that's plotted)48 47 # gamma3 = [trapz(gamma1[:n], xs[:n])/xs[n-1] for n in range(2, len(xs[mask]) + 1)]j 49 48 # gamma3.insert(0, 1.0) # Gamma_3(0) is defined as 1 50 n = len(xs [mask])49 n = len(xs) 51 50 gamma3 = cumtrapz(gamma1[:n], xs[:n])/xs[1:n] 52 51 gamma3 = np.hstack((1.0, gamma3)) # Gamma_3(0) is defined as 1 … … 79 78 80 79 transform1 = Data1D(xs, gamma1) 81 transform3 = Data1D(xs [xs <= 200], gamma3)80 transform3 = Data1D(xs, gamma3) 82 81 idf = Data1D(xs, idf) 83 82
Note: See TracChangeset
for help on using the changeset viewer.