- Timestamp:
- Feb 17, 2015 3:46:30 AM (10 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 36c5910
- Parents:
- 920928f (diff), 5dfdfa7 (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:
-
- 4 added
- 3 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/data_util/nxsunit.py
r79492222 rb3efb7d 128 128 temperature = _build_metric_units('kelvin','K') 129 129 temperature.update(_build_metric_units('Kelvin','K')) 130 130 temperature.update(_build_metric_units('Celcius', 'C')) 131 temperature.update(_build_metric_units('celcius', 'C')) 132 131 133 charge = _build_metric_units('coulomb','C') 132 134 charge.update({'microAmp*hour':0.0036}) … … 146 148 """ 147 149 Unit converter for NeXus style units. 148 149 150 """ 150 151 # Define the units, using both American and European spelling. -
src/sas/dataloader/data_info.py
r79492222 rb3efb7d 338 338 ## Transmission [float] [fraction] 339 339 transmission = None 340 ## Temperature [float] [ C]340 ## Temperature [float] [No Default] 341 341 temperature = None 342 temperature_unit = 'C'342 temperature_unit = None 343 343 ## Position [Vector] [mm] 344 344 position = None -
src/sas/dataloader/readers/associations.py
rfd5ac0d r5dfdfa7 17 17 import sys 18 18 import logging 19 from lxml import etree 20 # Py2exe compatibility: import _elementpath to ensure that py2exe finds it 21 from lxml import _elementpath 19 import json 22 20 23 ## Format version for the XML settings file 24 VERSION = 'sasloader/1.0' 21 FILE_NAME = 'defaults.json' 25 22 26 27 def read_associations(loader, settings='defaults.xml'): 23 def read_associations(loader, settings=FILE_NAME): 28 24 """ 29 25 Read the specified settings file to associate … … 31 27 32 28 :param loader: Loader object 33 :param settings: path to the XMLsettings file [string]29 :param settings: path to the json settings file [string] 34 30 """ 35 31 reader_dir = os.path.dirname(__file__) … … 47 43 path = "./%s" % settings 48 44 if os.path.isfile(path): 49 tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 50 51 # Check the format version number 52 # Specifying the namespace will take care of the file format version 53 root = tree.getroot() 45 with open(path) as fh: 46 json_tree = json.load(fh) 54 47 55 48 # Read in the file extension associations 56 entry_list = root.xpath('/ns:SasLoader/ns:FileType', 57 namespaces={'ns': VERSION}) 49 entry_list = json_tree['SasLoader']['FileType'] 58 50 59 51 # For each FileType entry, get the associated reader and extension 60 52 for entry in entry_list: 61 reader = entry .get('reader')62 ext = entry .get('extension')53 reader = entry['-reader'] 54 ext = entry['-extension'] 63 55 64 56 if reader is not None and ext is not None: -
src/sas/dataloader/readers/cansas_reader.py
r79492222 rb3efb7d 307 307 if 'unit' in attr and new_current_level.get('unit') is not None: 308 308 try: 309 local_unit = attr['unit'] 309 310 if isinstance(node_value, float) is False: 310 311 exec("node_value = float({0})".format(node_value)) … … 312 313 unitname = new_current_level.get("unit") 313 314 exec "default_unit = data1d.{0}".format(unitname) 314 local_unit = attr['unit'] 315 if local_unit.lower() != default_unit.lower() and \ 316 local_unit is not None and local_unit.lower() != "none" \ 317 and default_unit is not None: 315 if local_unit is not None and default_unit is not None and \ 316 local_unit.lower() != default_unit.lower() \ 317 and local_unit.lower() != "none": 318 318 if HAS_CONVERTER == True: 319 try: 320 ## Check local units - bad units raise KeyError 321 Converter(local_unit) 322 data_conv_q = Converter(attr['unit']) 323 value_unit = default_unit 324 i_string = "node_value = data_conv_q" 325 i_string += "(node_value, units=data1d.{0})" 326 exec i_string.format(unitname) 327 except KeyError: 328 err_msg = "CanSAS reader: could not convert " 329 err_msg += "{0} unit {1}; " 330 err_msg = err_msg.format(tagname, local_unit) 331 intermediate = "err_msg += " + \ 332 "\"expecting [{1}] {2}\"" + \ 333 ".format(data1d.{0}, " + \ 334 "sys.exc_info()[1])" 335 exec intermediate.format(unitname, "{0}", "{1}") 336 self.errors.append(err_msg) 337 raise ValueError(err_msg) 338 except: 339 err_msg = \ 340 "CanSAS reader: could not convert the units" 341 self.errors.append(err_msg) 342 return 319 ## Check local units - bad units raise KeyError 320 data_conv_q = Converter(local_unit) 321 value_unit = default_unit 322 i_string = "node_value = data_conv_q" 323 i_string += "(node_value, units=data1d.{0})" 324 exec i_string.format(unitname) 343 325 else: 344 326 value_unit = local_unit 345 err_msg = "CanSAS reader: unrecognized %s unit [%s];"\ 346 % (node_value, default_unit) 347 err_msg += " expecting [%s]" % local_unit 327 err_msg = "Unit converter is not available.\n" 348 328 self.errors.append(err_msg) 349 raise ValueError, err_msg350 329 else: 351 330 value_unit = local_unit 331 except KeyError: 332 err_msg = "CanSAS reader: unexpected " 333 err_msg += "\"{0}\" unit [{1}]; " 334 err_msg = err_msg.format(tagname, local_unit) 335 intermediate = "err_msg += " + \ 336 "\"expecting [{1}]\"" + \ 337 ".format(data1d.{0})" 338 exec intermediate.format(unitname, "{0}", "{1}") 339 self.errors.append(err_msg) 340 value_unit = local_unit 352 341 except: 353 err_msg = "CanSAS reader: could not convert " 354 err_msg += "Q unit [%s]; " % attr['unit'] 355 intermediate = "err_msg += \"expecting [%s]\n %s\" % " + \ 356 "(data1d.{0}, sys.exc_info()[1])" 357 exec intermediate.format(unitname) 342 print sys.exc_info() 343 err_msg = "CanSAS reader: unknown error converting " 344 err_msg += "\"{0}\" unit [{1}]" 345 err_msg = err_msg.format(tagname, local_unit) 358 346 self.errors.append(err_msg) 359 raise ValueError, err_msg347 value_unit = local_unit 360 348 elif 'unit' in attr: 361 349 value_unit = attr['unit'] … … 488 476 data1d, tagname) 489 477 cansas_attrib = \ 490 cs_values.current_level.get("attributes").get(key)478 cs_values.current_level.get("attributes").get(key) 491 479 attrib_variable = cansas_attrib.get("variable") 492 480 if key == 'unit' and unit != '': -
src/sas/guiframe/gui_manager.py
rb9a5f0e r9bbb627 24 24 import logging 25 25 import httplib 26 import webbrowser 27 26 28 27 29 from sas.guiframe.events import EVT_CATEGORY … … 1325 1327 def _add_help_menu(self): 1326 1328 """ 1327 add help menu 1329 add help menu to menu bar. Includes welcome page, about page, 1330 tutorial PDF and documentation pages. 1328 1331 """ 1329 1332 # Help menu … … 1336 1339 id = wx.NewId() 1337 1340 self._help_menu.Append(id, '&Welcome', '') 1338 self._help_menu.AppendSeparator()1339 1341 wx.EVT_MENU(self, id, self.show_welcome_panel) 1340 1342 1341 # Look for help item in plug-ins 1342 for item in self.plugins: 1343 if hasattr(item, "help"): 1344 id = wx.NewId() 1345 self._help_menu.Append(id,'&%s Help' % item.sub_menu, '') 1346 wx.EVT_MENU(self, id, item.help) 1347 1348 # Only show new Sphinx docs link if version of wx supports displaying 1349 # it correctly. 1350 show_sphinx_docs = float(wx.__version__[:3]) >= 2.9 1351 if show_sphinx_docs: 1352 self._help_menu.AppendSeparator() 1353 id = wx.NewId() 1354 self._help_menu.Append(id, '&Sphinx Documentation', '') 1355 wx.EVT_MENU(self, id, self._onSphinxDocs) 1343 self._help_menu.AppendSeparator() 1344 id = wx.NewId() 1345 self._help_menu.Append(id, '&Documentation', '') 1346 wx.EVT_MENU(self, id, self._onSphinxDocs) 1356 1347 1357 1348 if config._do_tutorial and (IS_WIN or sys.platform =='darwin'): … … 2162 2153 def _onSphinxDocs(self, evt): 2163 2154 """ 2164 Pop up a Sphinx Documentation dialog. 2155 Bring up Sphinx Documentation. If Wx 2.9 or higher is installed 2156 with proper HTML support then Pop up a Sphinx Documentation dialog 2157 locally. If not pop up a new tab in the default system browser 2158 calling the documentation website. 2165 2159 2166 2160 :param evt: menu event … … 2168 2162 # Running SasView "in-place" using run.py means the docs will be in a 2169 2163 # different place than they would otherwise. 2170 SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 2171 if SPHINX_DOC_ENV in os.environ: 2172 docs_path = os.path.join(os.environ[SPHINX_DOC_ENV], "index.html") 2164 2165 show_sphinx_docs = float(wx.__version__[:3]) >= 2.9 2166 if show_sphinx_docs: 2167 SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 2168 if SPHINX_DOC_ENV in os.environ: 2169 docs_path = os.path.join(os.environ[SPHINX_DOC_ENV], "index.html") 2170 else: 2171 docs_path = os.path.join(PATH_APP, "..", "..", "doc", "index.html") 2172 2173 if os.path.exists(docs_path): 2174 from documentation_window import DocumentationWindow 2175 2176 sphinx_doc_viewer = DocumentationWindow(None, -1, docs_path) 2177 sphinx_doc_viewer.Show() 2178 else: 2179 logging.error("Could not find Sphinx documentation at '%' -- has it been built?" % docs_path) 2173 2180 else: 2174 docs_path = os.path.join(PATH_APP, "..", "..", "doc", "index.html") 2175 2176 if os.path.exists(docs_path): 2177 from documentation_window import DocumentationWindow 2178 2179 sphinx_doc_viewer = DocumentationWindow(None, -1, docs_path) 2180 sphinx_doc_viewer.Show() 2181 else: 2182 logging.error("Could not find Sphinx documentation at '%' -- has it been built?" % docs_path) 2181 #For red hat and maybe others who do not have Wx 3.0 2182 #just send to webpage of documentation 2183 webbrowser.open_new_tab('http://www.sasview.org/sasview') 2183 2184 2184 2185 def set_manager(self, manager): -
src/sas/guiframe/gui_statusbar.py
r79492222 rb3efb7d 315 315 if msg == "error": 316 316 e_msg = "Error(s) Occurred:\n" 317 e_msg += event.status 317 e_msg += "\t" + event.status + "\n\n" 318 e_msg += "Further information might be available in " 319 e_msg += "the Console log (bottom right corner)." 318 320 wx.MessageBox(e_msg, style=wx.ICON_ERROR) 319 321 -
src/sas/guiframe/local_perspectives/data_loader/data_loader.py
r7a04dbb rb3efb7d 171 171 file) for file in os.listdir(path)] 172 172 173 def _process_data_and_errors(self, item, p_file, output, message): 174 """ 175 Check to see if data set loaded with any errors. If so, append to 176 error message to be sure user knows the issue. 177 """ 178 data_error = False 179 for error_data in item.errors: 180 data_error = True 181 message += "\tError: {0}\n".format(error_data) 182 data = self.parent.create_gui_data(item, p_file) 183 output[data.id] = data 184 return output, message, data_error 185 173 186 def get_data(self, path, format=None): 174 187 """ … … 178 191 output = {} 179 192 any_error = False 193 data_error = False 180 194 error_message = "" 181 195 for p_file in path: 182 196 info = "info" 183 197 basename = os.path.basename(p_file) 184 root, extension = os.path.splitext(basename)198 _, extension = os.path.splitext(basename) 185 199 if extension.lower() in EXTENSIONS: 186 200 any_error = True … … 194 208 195 209 try: 210 message = "Loading Data... " + str(p_file) + "\n" 211 self.load_update(output=output, message=message, info=info) 196 212 temp = self.loader.load(p_file, format) 197 213 if temp.__class__.__name__ == "list": 198 214 for item in temp: 199 data = self.parent.create_gui_data(item, p_file) 200 output[data.id] = data 215 output, error_message, data_error = \ 216 self._process_data_and_errors(item, 217 p_file, 218 output, 219 error_message) 201 220 else: 202 data = self.parent.create_gui_data(temp, p_file) 203 output[data.id] = data 204 message = "Loading Data..." + str(p_file) + "\n" 205 self.load_update(output=output, message=message, info=info) 221 output, error_message, data_error = \ 222 self._process_data_and_errors(temp, 223 p_file, 224 output, 225 error_message) 206 226 except: 207 227 any_error = True 208 if error_message == "": 209 error = "Error: " + str(sys.exc_value) + "\n" 210 error += "while loading Data: \n%s\n" % str(p_file) 211 error_message = "The data file you selected could not be loaded.\n" 212 error_message += "Make sure the content of your file" 213 error_message += " is properly formatted.\n\n" 214 error_message += "When contacting the DANSE team, mention the" 215 error_message += " following:\n%s" % str(error) 216 else: 217 error_message += "%s\n"% str(p_file) 218 info = "error" 219 self.load_update(output=output, message=error_message, 228 if any_error or error_message != "": 229 if error_message == "": 230 error = "Error: " + str(sys.exc_value) + "\n" 231 error += "while loading Data: \n%s\n" % str(p_file) 232 error_message = "The data file you selected could not be loaded.\n" 233 error_message += "Make sure the content of your file" 234 error_message += " is properly formatted.\n\n" 235 error_message += "When contacting the DANSE team, mention the" 236 error_message += " following:\n%s" % str(error) 237 elif data_error: 238 base_message = "Errors occurred while loading {0}\n".format(p_file) 239 base_message += "The data file loaded but with errors.\n" 240 error_message = base_message + error_message 241 else: 242 error_message += "%s\n"% str(p_file) 243 info = "error" 244 self.load_update(output=output, message=error_message, 220 245 info=info) 221 246 222 message = "Loading Data Complete! " 247 else: 248 message = "Loading Data Complete! " 223 249 message += log_msg 224 if error_message != "":225 info = 'error'226 250 self.load_complete(output=output, error_message=error_message, 227 251 message=message, path=path, info=info) -
src/sas/models/c_extension/python_wrapper/modelTemplate.txt
rfd5ac0d r8836849 26 26 from sas.models.BaseComponent import BaseComponent 27 27 from sas.models.sas_extension.c_models import [CPYTHONCLASS] 28 from numpy import inf 28 29 29 30 def create_[PYTHONCLASS](): -
src/sas/models/include/cylinder.h
r79492222 r8836849 34 34 35 35 /// Radius of the cylinder [A] 36 // [DEFAULT]=radius=20.0 [A] 36 // [DEFAULT]=radius=20.0 [A] 0.0 inf 37 37 Parameter radius; 38 38 39 39 /// Length of the cylinder [A] 40 // [DEFAULT]=length=400.0 [A] 40 // [DEFAULT]=length=400.0 [A] 0.0 inf 41 41 Parameter length; 42 42 -
src/sas/perspectives/fitting/fitpage.py
rb9a5f0e r22ae2f7 1492 1492 after fitting 1493 1493 """ 1494 1494 1495 if self.is_mac: 1495 1496 return … … 1500 1501 for item in self.parameters: 1501 1502 if item[0].IsShown(): 1502 #Skip t ifhe angle parameters if 1D data1503 #Skip the angle parameters if 1D data 1503 1504 if self.data.__class__.__name__ != "Data2D" and \ 1504 1505 not self.enable2D: … … 1519 1520 for item in self.fittable_param: 1520 1521 if item[0].IsShown(): 1521 #Skip t ifhe angle parameters if 1D data1522 #Skip the angle parameters if 1D data 1522 1523 if self.data.__class__.__name__ != "Data2D" and \ 1523 1524 not self.enable2D: … … 2076 2077 2077 2078 """ 2079 2078 2080 # make sure stop button to fit button all the time 2079 2081 self._on_fit_complete() … … 2112 2114 i = 0 2113 2115 #Set the panel when fit result are list 2116 2114 2117 for item in self.param_toFit: 2115 2118 if len(item) > 5 and item != None: 2119 2116 2120 if item[0].IsShown(): 2117 2121 ## reset error value to initial state … … 2144 2148 item[3].Show(True) 2145 2149 item[4].Show(True) 2150 item[4].SetForegroundColour(wx.BLACK) 2151 item[4].SetValue(val_err) 2152 has_error = True 2153 else: 2154 val_err = 'NaN' 2155 if not self.is_mac: 2156 item[3].Show(True) 2157 item[4].Show(True) 2158 item[4].SetForegroundColour(wx.RED) 2146 2159 item[4].SetValue(val_err) 2147 2160 has_error = True … … 2831 2844 2832 2845 keys = self.model.getParamList() 2833 #list of dispersion paramaters 2846 2847 #list of dispersion parameters 2834 2848 self.disp_list = self.model.getDispParamList() 2835 2849 … … 2925 2939 CHECK_STATE = self.cb1.GetValue() 2926 2940 for item in keys: 2941 2927 2942 if not item in self.disp_list and not item in \ 2928 2943 self.model.orientation_params: … … 2998 3013 if not self.is_mac: 2999 3014 ctl2.Hide() 3000 3015 3001 3016 ix += 1 3002 3017 ctl3 = self.ModelTextCtrl(self, -1, … … 3004 3019 style=wx.TE_PROCESS_ENTER, 3005 3020 text_enter_callback=self._onparamRangeEnter) 3006 3021 min_bound = self.model.details[item][1] 3022 if min_bound is not None: 3023 ctl3.SetValue(format_number(min_bound, True)) 3024 3007 3025 sizer.Add(ctl3, (iy, ix), (1, 1), 3008 3026 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 3013 3031 style=wx.TE_PROCESS_ENTER, 3014 3032 text_enter_callback=self._onparamRangeEnter) 3033 max_bound = self.model.details[item][2] 3034 if max_bound is not None: 3035 ctl4.SetValue(format_number(max_bound, True)) 3015 3036 sizer.Add(ctl4, (iy, ix), (1, 1), 3016 3037 wx.EXPAND | wx.FIXED_MINSIZE, 0) -
src/sas/perspectives/fitting/pagestate.py
rb9a5f0e rd06ae30 472 472 Get the values (strings) from __str__ for report 473 473 """ 474 # Dictionary of t ehreport strings474 # Dictionary of the report strings 475 475 repo_time = "" 476 476 model_name = "" … … 508 508 if name == "value": 509 509 param_string += value + ',' 510 if name == "selected": 511 if value == u' False': 512 fixed_parameter = True 513 else: 514 fixed_parameter = False 510 515 if name == "error value": 511 param_string += value + ',' 516 if fixed_parameter: 517 param_string += '(fixed),' 518 else: 519 param_string += value + ',' 512 520 if name == "parameter unit": 513 521 param_string += value + ':' -
src/sas/perspectives/fitting/report_dialog.py
r79492222 rd06ae30 1 1 """ 2 2 Dialog report panel to show and summarize the results of 3 the invariantcalculation.3 the fitting calculation. 4 4 """ 5 5 ################################################################################ -
src/sas/calculator/media/density_calculator_help.rst
r0d66541 r920928f 1 .. density_calculator_help.rst1 .. density_calculator_help.rst 2 2 3 Placeholder for density calculator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Density/Volume Calculator Tool 7 ============================== 8 9 Description 10 ----------- 11 12 This tool is to calculate the mass density from the molar volume or vice 13 versa. To calculate the mass density, the chemical formula and molar volume 14 should be provided. 15 16 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 17 18 How To 19 ------ 20 21 1. Molecular Formula: The chemical formula of ONE molecule or ONE atom. For 22 mixtures, the ratio of the each molecules should be used; for example, 23 (H2O)0.5(D2O)0.5. 24 25 2. Select input (molar volume or mass density) from combobox. Then type in the 26 input value. 27 28 3. Click the 'Calculate' button to perform the calculation. 29 30 4. Outputs also include the molar mass (weight) that depends only on the 31 chemical formula 32 33 .. image:: density_tutor.gif -
src/sas/calculator/media/kiessig_calculator_help.rst
r0d66541 r920928f 1 .. kiessig_calculator_help.rst1 .. kiessig_calculator_help.rst 2 2 3 Placeholder for Kiessig calculator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Kiessig Thickness Calculator Tool 7 ================================= 8 9 Description 10 ----------- 11 12 This tool is to approximately estimate the thickness of a layer or the 13 diameter of particles from the Kiessig fringe in SAS/NR data, and using the 14 Kiessig relation 15 16 thickness = 2*Pi/fringe_width. 17 18 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 19 20 21 How To 22 ------ 23 24 To get a rough thickness or particle size, just type the Kiessig fringe width 25 (in units of 1/Angstrom) and click on the 'Compute' button. Then the output 26 value will be show up in the 'Thickness' text box. -
src/sas/calculator/media/resolution_calculator_help.rst
r0d66541 r920928f 1 .. resolution_calculator_help.rst1 .. resolution_calculator_help.rst 2 2 3 Placeholder for resolution calculator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Q Resolution Estimator 7 ====================== 8 9 Description 10 ----------- 11 12 This tool is to approximately estimate the resolution of Q based on the SAS 13 instrumental parameter values assuming that the detector is flat and vertical 14 to the incident beam direction. 15 16 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 17 18 How To 19 ------ 20 21 1. Select the source and source type (Monochromatic or TOF). Note that the 22 computational difference between the sources is only the gravitational 23 contribution due to the mass. 24 25 2. Change the default values of the instrumental parameters as desired. 26 27 3. The input formats of wavelength and its spread (=FWHM/wavelength) depend on 28 the source type.For monochromatic wave, the inputs are just one values as shown 29 with the defaults.For TOF, the min and max values should be separated by "-" 30 to describe the wavelength band range. Optionally, the input of the wavelength 31 (NOT of the wavelength spread) could be extended by adding "; --" where the -- 32 is the number of the bins for the numerical integration. Otherwise, the 33 default value "10" bins will be used. The same number of bins will be used 34 for the corresponding wavelength spread in either cases. 35 36 4. For TOF, the default wavelength spectrum is flat. The custom spectrum file 37 (with 2 column text: wavelength(A) vs. intensity) can also be loaded by 38 selecting "Add new" in the combobox. 39 40 5. Once set all the input values, click the compute button. Depending on 41 computation loads the calculation time will vary. 42 43 6. 1D and 2D dQ will be displayed in the text-box at the bottom of the panel. 44 Two dimensional resolution weight distribution (2D elliptical Gaussian 45 function) will also be displayed in the plot panel even if the Q inputs are 46 outside of the detector limit. The red lines indicate the limits of the 47 detector (if a green lines appear (for TOF), it indicates the limits of the 48 maximum q range for the largest wavelength due to the size of the detector). 49 Note that the effect from the beam block is ignored, so in the small q region 50 near the beam block 51 52 [ie., q<2*pi*(beam block diameter) / (sample to detector distance) / lamda_min] 53 54 the variance is slightly under estimated. 55 56 7. The summary can be accessed by clicking the 'light-bulb' icon at the bottom 57 of the SasView main window. 58 59 .. image:: resolution_tutor.gif 60 61 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 62 63 Theory 64 ------ 65 66 The scattering wave transfer vector is by definition 67 68 .. image:: q.gif 69 70 In the limit of the small angle, the variance of q in the first order 71 approximation is 72 73 .. image:: sigma_q.gif 74 75 In summary, the geometric and gravitational contributions depending on the 76 shape of each factors can be expressed as shown the table. 77 78 .. image:: sigma_table.gif 79 80 Finally, we use a Gaussian function to describe the 2D weighting distribution 81 of the uncertainty in q. 82 83 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 84 85 References 86 ---------- 87 D.F.R. Mildner and J.M. Carpenter, J. Appl. Cryst. 17, 249-256 (1984) 88 89 D.F.R. Mildner, J.M. Carpenter and D.L. Worcester, J. Appl. Cryst. 19, 311-319 90 (1986) -
src/sas/calculator/media/sas_calculator_help.rst
r0d66541 r920928f 1 .. sas_calculator_help.rst1 .. sas_calculator_help.rst 2 2 3 Placeholder for generic SAS calculator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 .. |beta| unicode:: U+03B2 7 .. |gamma| unicode:: U+03B3 8 .. |theta| unicode:: U+03B8 9 .. |mu| unicode:: U+03BC 10 .. |sigma| unicode:: U+03C3 11 .. |phi| unicode:: U+03C6 12 13 .. |equiv| unicode:: U+2261 14 .. |noteql| unicode:: U+2260 15 16 Generic Scattering Calculator Tool 17 ================================== 18 19 Polarization and Magnetic Scattering 20 21 Theory_ 22 GUI_ 23 PDB_Data_ 24 25 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 26 27 .. _Theory: 28 29 Theory 30 ------ 31 32 In general, a particle with a volume V can be described by an ensemble 33 containing N 3-dimensional rectangular pixels where each pixels are much 34 smaller than V. Assuming that all the pixel sizes are same, the elastic 35 scattering intensity by the particle 36 37 .. image:: gen_i.gif 38 39 where /beta/jand rj are the scattering length density and the position of the 40 j'th pixel respectively. And the total volume 41 42 .. image:: v_j.gif 43 44 for /beta/j/noteql/0 where vj is the volume of the j'th pixel (or the j'th 45 natural atomic volume (= atomic mass/natural molar density/Avogadro number) for 46 the atomic structures). The total volume V can be corrected by users. This 47 correction is useful especially for an atomic structure (taken from a pdb file) 48 to get the right normalization. Note that the /beta/j displayed in GUI may be 49 incorrect but will not affect the scattering computation if the correction of 50 the total volume is made. The scattering length density (SLD) of each pixel 51 where the SLD is uniform, is a combination of the nuclear and magnetic SLDs and 52 depends on the spin states of the neutrons as follows:For magnetic scattering, 53 only the magnetization component, *M*perp, perpendicular to the scattering 54 vector *Q* contributes to the the magnetic scattering length. (Figure below). 55 56 .. image:: mag_vector.bmp 57 58 The magnetic scattering length density is then 59 60 .. image:: dm_eq.gif 61 62 where /gamma/= -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0 is 63 the classical radius of electron, and */sigma/* is the Pauli spin. 64 65 For polarized neutron, the magnetic scattering is depending on the spin states. 66 67 Let's consider that the incident neutrons are polarised parallel (+)/ 68 anti-parallel (-) to the x' axis (See both Figures above). The possible 69 out-coming states then are + and - states for both incident states, where 70 71 - Non-spin flips: (+ +) and (- -) 72 - Spin flips: (+ -) and (- +) 73 74 .. image:: gen_mag_pic.bmp 75 76 Now, let's assume that the angles of the *Q* vector and the spin-axis (x') 77 from x-axis are /phi/ and /theta/up respectively (See Figure above). Then, 78 depending upon the polarization (spin) state of neutrons, the scattering 79 length densities, including the nuclear scattering length density (/beta/N) 80 are given as, for non-spin-flips 81 82 .. image:: sld1.gif 83 84 and for spin-flips 85 86 .. image:: sld2.gif 87 88 where 89 90 .. image:: mxp.gif 91 92 .. image:: myp.gif 93 94 .. image:: mzp.gif 95 96 .. image:: mqx.gif 97 98 .. image:: mqy.gif 99 100 Here, the M0x, M0yand M0zare the x, y and z components of the magnetisation 101 vector given in the xyz lab frame. 102 103 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 104 105 .. _GUI: 106 107 GUI 108 --- 109 110 .. image:: gen_gui_help.bmp 111 112 After the computation, the result will be listed in the 'Theory' box in the 113 data explorer panel on the main window.The 'Up_frac_in' and 'Up_frac_out' are 114 the ratio, (spin up) /(spin up + spin down) neutrons before the sample and at 115 the analyzer, respectively. 116 117 *Note I: The values of 'Up_frac_in' and 'Up_frac_out' must be in the range 118 between 0 and 1. For example, both values are 0.5 for unpolarized neutrons.* 119 120 *Note II: This computation is totally based on the pixel (or atomic) data 121 fixed in the xyz coordinates. Thus no angular orientational averaging is 122 considered.* 123 124 *Note III: For the nuclear scattering length density, only the real component 125 is taken account.* 126 127 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 128 129 .. _PDB_Data: 130 131 PDB Data 132 -------- 133 134 This Generic scattering calculator also supports some pdb files without 135 considering polarized/magnetic scattering so that the related parameters 136 such as Up_*** will be ignored (see the Picture below). The calculation for 137 fixed orientation uses (the first) Equation above resulting in a 2D output, 138 whileas the scattering calculation averaged over all the orientations uses 139 the Debye equation providing a 1D output 140 141 .. image:: gen_debye_eq.gif 142 143 where vj /beta/j /equiv/ bj the scattering length of the j'th atom. The resultant outputs 144 will be displayed in the DataExplorer for further uses. 145 146 .. image:: pdb_combo.jpg -
src/sas/calculator/media/slit_calculator_help.rst
r0d66541 r920928f 1 .. slit_calculator_help.rst1 .. slit_calculator_help.rst 2 2 3 Placeholder for slit calculator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Slit Size Calculator Tool 7 ========================= 8 9 Description 10 ----------- 11 This tool is for X-ray users to calculate the slit size (FWHM/2) for smearing 12 based on their half beam profile data (SAXSess). 13 14 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 15 16 How To 17 ------- 18 To calculate the slit size (FWHM/2), just load the beam profile data using the 19 browse button. 20 21 Once a data is loaded, the slit size will be computed and show up in the text 22 box. 23 24 Because the unit is not specified in the data file, we do not convert it into 25 1/Angstrom so users are responsible for converting the units of their data. 26 27 Note: This slit size calculator only works for beam profile data produced by 28 'SAXSess'. 29 30 To see the file format, check the file, 'beam profile.DAT', in the 'test' 31 folder of SasView. -
src/sas/data_util/media/data_operator_help.rst
r0d66541 r920928f 1 .. data_operator_help.rst1 .. data_operator_help.rst 2 2 3 Placeholder for data operator help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Data Operations Tool 7 ==================== 8 9 Description 10 ----------- 11 This dialog panel provides arithmetic operations between two data sets (the 12 last data set could be a number). 13 14 When data1 and data2 are selected, their x (or qx and qy for 2D) value(s) 15 must match with each other. 16 17 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 18 19 How To 20 ------ 21 1. Type the data name resulted from an operation. 22 23 2) Select a data/theory in the drop down menus. When data2 is set to number, 24 type a number in the text control box. 25 26 3) Select an arithmetic operator symbol; + (for addition), - (for subtraction), 27 * (for multiplication), / (for division), and | (for combination of two data 28 sets). 29 30 If two data sets do not match, the operation will fail and the background color 31 of the combo box items will turn to red (WIN only). 32 33 4) If the operation is successful, hit the Apply button to make the new data. 34 Then the data name will be shown up in the data box in the data explorer. 35 36 Note: Any errors and warnings will be displayed at the bottom of the SasView 37 window. 38 39 .. image:: data_oper_pic.png -
src/sas/fit/media/fitting_help.rst
r0d66541 r920928f 1 ..fitting_help.rst 2 3 Placeholder for fitting help 1 .. fitting_help.rst 2 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 .. |beta| unicode:: U+03B2 7 .. |gamma| unicode:: U+03B3 8 .. |mu| unicode:: U+03BC 9 .. |sigma| unicode:: U+03C3 10 .. |phi| unicode:: U+03C6 11 .. |theta| unicode:: U+03B8 12 13 Fitting Perspective 14 =================== 15 16 Load_a_File_ 17 18 Single_Fit_ 19 20 Simultaneous_Fitting_ 21 22 Batch_Fitting_ 23 24 Model_Selection_ 25 26 Model_Category_Manager_ 27 28 Model_Functions_ 29 30 Custom_Model_Editor_ 31 32 Polydispersity_Distributions_ 33 34 Smearing_Computation_ 35 36 Polarisation_Magnetic_Scattering_ 37 38 Key_Combinations_ 39 40 Status_Bar_Help_ 41 42 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 43 44 .. _Load_a_File: 45 46 Load a File 47 ----------- 48 49 From Menu go to *Data* -> *Load Data File(or Folder)* . Select a file/folder 50 from the menu bar and click on Open button. Data contained in the file will be 51 displayed. To cancel the loading click on *cancel* . In case a file can not be 52 loaded, an error message will be displayed on the statusbar. 53 54 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 55 56 .. _Single_Fit: 57 58 Single Fit 59 ---------- 60 61 One of two fit-engines can be chosen from the Fitting menu bar. The Simple Fit- 62 engine uses Scipy's leasqr and the Complex Fit-Engine is a custom optimizer 63 that provides a better chance to find the global minimum of the chi2 but that 64 requires longer computation time. In order to set a data to a control panel 65 (FitPage), see the "DataLoader Help". Once a data set to the FiPage, select a 66 model from the combo box. The default parameters of the model will be display. 67 Set initial parameters if need. Check and uncheck parameters to fit/fix. Click 68 the *'Fit'* button. When the fitting is finished, the resultant parameter 69 values will be displayed with the errors. If a error is missing, it generally 70 means that the corresponding parameter is not very depending on the model. The 71 chisq/Npt_fit and the plot associated with the fit operation will be also 72 updated. 73 74 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 75 76 .. _Simultaneous_Fitting: 77 78 Simultaneous Fitting 79 -------------------- 80 81 This fitting option enables to set a number of the constraints between the 82 parameters of fitting(s). It requires one or more FitPages with a data and a 83 model set for the fitting, and performs multiple fittings given by the 84 FitPage(s). The Complex (ParkMC) FitEngine will be used automatically. 85 86 Simultaneous Fit without Constraint 87 88 Assuming some FitPages are already set up, check the checkboxes of the 89 model_data rows to fit. And click the 'Fit' button. The results will return to 90 each FitPages. 91 92 Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits. If 93 one needs the chi2 value only for a page, click the 'Compute' button in the 94 FitPage to recalculate. 95 96 Simultaneous Fit with Constraint 97 98 Enter constraint in the text control next to *constraint fit* button. 99 Constraint should be of type model1 parameter name = f(model2 parameter name) 100 for example, M0.radius=2*M1.radius. Many constraints can be entered for a 101 single fit. Each of them should be separated by a newline charater or ";" 102 The easy setup can generate many constraint inputs easily when the selected 103 two models are the same type. 104 105 Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits. 106 If one needs the chi2 value only for one fit, click the 'Compute' button in 107 the FitPage to recalculate. 108 109 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 110 111 .. _Batch_Fitting: 112 113 Batch Fitting 114 ------------- 115 116 Batch_Fit_ 117 118 Batch_Window_ 119 120 Edit_Grid_ 121 122 Save_Grid_ 123 124 Open_Batch_Results_ 125 126 Plot_ 127 128 View_Column_Cell_ 129 130 .. _Batch_Fit: 131 132 Batch Fit 133 --------- 134 135 Create a *Batch Page* by selecting the *Batch* radio button on the DataExplorer 136 (see figure below) and for a new control page select 'New FitPage' in the 137 Fitting menubar. 138 139 .. image:: batch_button_area.bmp 140 141 Figure 1: MenuBar: 142 143 Load Data to the DataExplorer if not already loaded. 144 145 Select one or more data sets by checking the check boxes, and then make sure 146 that "Fitting" is selected in the dropdown menu next to the "Send To" button. 147 Once ready, click the 'Send To' button to set data to a BatchPage. If already 148 an empty batch page exists, it will be set there. Otherwise it will create a 149 new Batch Page. Set up the model and the parameter values as same as a single 150 fitting (see Single Fit help) <Single_Fit_>. Then use 'Fit' button to 151 perform the fitting. 152 153 Unlike a single fit, the results of the fittings will not return to the 154 BatchPage'. Instead, a Grid window will be provided once the fitting is 155 completed. The Grid window is also accessible from the 'View' menu 156 (see Figure 2). 157 158 Note that only one model is used for all the data. The initial parameter 159 values given in the control page will be used all the data fittings. If one 160 wants the FitEngine to use the initial values from the results of the 161 previous data fitting (if any), choose the 'Chain Fitting' option in the 162 Fitting menubar, which will speed up the fitting especially when you have 163 lots of, and similar, data sets. 164 165 .. _Batch_Window: 166 167 Batch Window 168 ------------ 169 Batch Window provides an easy way to view the fit results, i.e., plot data, 170 fits, and residuals. Batch window will be automatically shown after a batch 171 fit is finished. 172 173 Once closed, it can be opened anytime from the "View" menubar item (see 174 Figure 2). 175 176 .. image:: restore_batch_window.bmp 177 178 Figure 2: Edit Menu: 179 180 .. _Edit_Grid: 181 182 Edit Grid 183 --------- 184 185 Once a batch fit is completed, all fitted and fixed model parameters are 186 displayed to the current sheet of the batch window except the errors of the 187 parameters. To view the errors, click on a given column then under *Edit* 188 menubar item, and insert the desired parameter by selecting a menu item with 189 the appropriated label. Empty column can be inserted in the same way. A 190 column value can be customized by editing an existing empty column. 191 192 To Remove column from the grid, select it, choose edit menu, and click the 193 *'remove'* menu item. Any removed column should reinserted whenever needed. 194 195 All above options are also available when right clicking on a given column 196 label(see Figure 3). 197 198 *Note:* A column always needs to be selected in order to remove or insert a 199 column in the grid. 200 201 .. image:: edit_menu.bmp 202 203 Figure 3: Edit Menu: 204 205 .. _Save_Grid: 206 207 Save Grid 208 --------- 209 To save the current page on the batch window, select the *'File'* menubar 210 item(see Figure 4), then choose the *'Save as'* menu item to save it as a 211 .csv file. 212 213 *Note:* The grid doesn't save the data array, fits, and the array residuals. 214 As a result, the 'View (fit) Results' functionality will be lost when 215 reloading the saved file. 216 217 Warning! To ensure accuracy of saved fit results, it is recommended to save 218 the current grid before modifying it . 219 220 .. _Open_Batch_Results: 221 222 Open Batch Results 223 ------------------ 224 225 Any *csv* file can be opened in the grid by selecting the *'Open'* under 226 the *'File'* menu in the Grid Window(see Figure 4). All columns in the file 227 will be displayed but insertion will not available. Insertion will be 228 available only when at least one column will be removed from the grid. 229 230 .. image:: file_menu.bmp 231 232 Figure 4: MenuBar: 233 234 .. _Plot: 235 236 Plot 237 ---- 238 239 To *plot* a column versus another, select one column at the time, click the 240 *'Add'* button next to the text control of X/Y -axis *Selection Range* to 241 plot the value of this column on the X/Y axis. Alternatively, all available 242 range can be selected by clicking the column letter (eg. B). Repeat the same 243 procedure the next axis. Finally, click the *'Plot'* button. When clicking 244 on *Add* button, the grid will automatically fill the axis label, but 245 different labels and units can be entered in the correct controls before 246 clicking on the plot button. 247 248 *X/Y -Axis Selection Range* can be edited manually. These text controls 249 allow the following types of expression (operation can be + - * /, or pow) 250 251 1) if the current axis label range is a function of 1 or more columns, write 252 this type of expression 253 254 constant1 * column_name1 [minimum row index : maximum row index] operator 255 constant2 * column_name2 [minimum row index : maximum row index] 256 257 Example: radius [2 : 5] -3 * scale [2 : 5] 258 259 2) if only some values of a given column are need but the range between the 260 first row and the last row used is not continuous, write the following 261 expression in the text control 262 263 column_name1 [minimum row index1 : maximum row index1] , column_name1 264 [minimum row index2 : maximum row index2] 265 266 Example : radius [2 : 5] , radius [10 : 25] 267 268 Note: Both text controls ( X and Y-axis Selection Ranges) need to be filled 269 with valid entries for plotting to work. The dY-bar is optional (see Figure 5). 270 271 .. image:: plot_button.bmp 272 273 Figure 5: Plotting 274 275 .. _View_Column_Cell: 276 277 View Column/Cell(s) 278 ------------------- 279 280 Select 1 or more cells from the same column, click the 'View Fits' button to 281 display available curves. 282 283 For example, select the cells of the 'Chi2' column, then click the 'View Fits' 284 button. The plots generates will represent the residuals plots. 285 286 If you select any cells of the 'Data' column and click the 'View Fits' button. 287 It generates both data and fits in the graph (see Figure 6). 288 289 Alternatively, just click the column letter (eg. B) to choose all the 290 available data sets, then simply click the 'View Fits' button to plot the 291 data and fits. 292 293 .. image:: view_button.bmp 294 295 Figure 6: View Fits 296 297 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 298 299 .. _Model_Selection: 300 301 Model_Type_ 302 303 Change_Model_Parameters_ 304 305 Write_your_Own_Model_ 306 307 .. _Model_Type: 308 309 Model Type 310 ---------- 311 312 Models are grouped into three classes 313 314 * *Shapes* 315 * *Shape-Independent* 316 * *Uncategorised* 317 * *Customized Models* 318 * *Structure Factor* 319 320 .. _Change_Model_Parameters: 321 322 Change Model Parameters 323 ----------------------- 324 325 To visualize model in a different window, from menu click on *Model*. Select 326 a type of model and then the name of your model.A new window will appear with 327 the plot of your model with default values. Change model's parameters on 328 *model view* tab and view the plotted model with its new parameters. 329 330 .. _Write_your_Own_Model: 331 332 Write your Own Model 333 -------------------- 334 335 The custom model editors are provided from 'Fitting' menu in the menu bar. 336 See 'Custom model editor' in the side menu on left. Advanced users can write 337 your own model and save it (in .py format) into *plugin_models* directory in 338 .sasview of your home directory (eg., username\.sasview>\plugin_models). Your 339 plugin model will be added into "<>Customized Models" on the next model 340 selection. 341 342 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 343 344 .. _Model_Category_Manager: 345 346 Model Category Manager 347 ---------------------- 348 349 Our SAS models are, by default, classified into 5 categories; shapes, 350 shape-independent, structure factor, and customized models, where these 351 categories (except the customized models) can be reassigned, added, and 352 removed using 'Category Manager'. Each models can also be enabled(shown)/ 353 disabled(hidden) from the category that they belong. The Category Manager 354 panel is accessible from the model category 'Modify' button in the fitting 355 panel or the 'View/Category Manager' menu in the menu bar (Fig. 1). 356 357 1) Enable/Disable models: Check/uncheck the check boxes to enable/disable the 358 models (Fig. 2). 359 360 2) Change category: Highlight a model in the list by left-clicking and click 361 the 'Modify' button. In the 'Change Category' panel, one can create/use a 362 category for the model, then click the 'Add' button. In order to delete a 363 category, select a category name and click the 'Remove Selected' button 364 (Fig. 3). 365 366 3) To apply the changes made, hit the OK button. Otherwise, click the 'Cancel' 367 button (Fig. 2). 368 369 .. image:: cat_fig0.bmp 370 371 Fig.1 372 373 .. image:: cat_fig1.bmp 374 375 Fig.2 376 377 .. image:: cat_fig2.bmp 378 379 Fig.3 380 381 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 382 383 .. _Model_Functions: 384 385 Model Functions 386 --------------- 387 388 Model Documentation <models/model_functions> 389 390 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 391 392 .. _Custom_Model_Editor: 393 394 Custom Model Editor 395 ------------------- 396 397 Description_ 398 399 New_ 400 401 Sum_Multi_p1_p2_ 402 403 Advanced_ 404 405 Delete_ 406 407 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 408 409 .. _Description: 410 411 Description 412 ----------- 413 414 This menu (Fitting/Edit Custom Model in the menu bar) interface is to provide 415 you an easy way to write your own custom models. The changes in a model 416 function are effective after it is re-selected from the combo-box menu. 417 418 .. image:: edit_model_menu.bmp 419 420 .. _New: 421 422 New 423 --- 424 425 This option is used to make a new model. A model code generated by this option 426 can be viewed and further modified by the 'Advanced' option below. 427 428 .. image:: new_model.bmp 429 430 .. _Sum_Multi_p1_p2: 431 432 Sum|Multi(p1,p2) 433 ---------------- 434 435 This option create a new sum (or multiplication) model. Fill up the (sum 436 model function) name and the description. The description will show up on 437 details button in the application. Then select the p1 or p2 model for the 438 sum/multi model, select an operator as necessary and click the Apply button 439 for activation. Hit the 'Close' button when it's done. 440 441 .. image:: sum_model.bmp 442 443 .. _Advanced: 444 445 Advanced 446 -------- 447 448 The menu option shows all the files in the plugin_models folder. You can edit, 449 modify, and save it. It is recommended to modify only the lines with arrow 450 (-------). In the end of edit, 'Compile' and 'Run' from the menu bar to 451 activate or to see the model working properly. 452 453 .. _Delete: 454 455 Delete 456 ------ 457 458 The menu option is to delete the custom models. Just select the file name to 459 delete. 460 461 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 462 463 .. _Polydispersity_Distributions: 464 465 Polydispersity Distributions 466 ---------------------------- 467 468 Calculates the form factor for a polydisperse and/or angular population of 469 particles with uniform scattering length density. The resultant form factor 470 is normalized by the average particle volume such that 471 472 P(q) = scale*\<F*F\>/Vol + bkg 473 474 where F is the scattering amplitude and the\<\>denote an average over the size 475 distribution. Users should use PD (polydispersity: this definition is 476 different from the typical definition in polymer science) for a size 477 distribution and Sigma for an angular distribution (see below). 478 479 Note that this computation is very time intensive thus applying polydispersion/ 480 angular distrubtion for more than one paramters or increasing Npts values 481 might need extensive patience to complete the computation. Also note that 482 even though it is time consuming, it is safer to have larger values of Npts 483 and Nsigmas. 484 485 The following five distribution functions are provided 486 487 * *Rectangular_Distribution_* 488 * *Array_Distribution_* 489 * *Gaussian_Distribution_* 490 * *Lognormal_Distribution_* 491 * *Schulz_Distribution_* 492 493 .. _Rectangular_Distribution: 494 495 Rectangular Distribution 496 ------------------------ 497 498 .. image:: pd_image001.png 499 500 The xmean is the mean of the distribution, w is the half-width, and Norm is a 501 normalization factor which is determined during the numerical calculation. 502 Note that the Sigma and the half width *w* are different. 503 504 The standard deviation is 505 506 .. image:: pd_image002.png 507 508 The PD (polydispersity) is 509 510 .. image:: pd_image003.png 511 512 .. image:: pd_image004.jpg 513 514 .. _Array_Distribution: 515 516 Array Distribution 517 ------------------ 518 519 This distribution is to be given by users as a txt file where the array 520 should be defined by two columns in the order of x and f(x) values. The f(x) 521 will be normalized by SasView during the computation. 522 523 Example of an array in the file 524 525 30 0.1 526 32 0.3 527 35 0.4 528 36 0.5 529 37 0.6 530 39 0.7 531 41 0.9 532 533 We use only these array values in the computation, therefore the mean value 534 given in the control panel, for example âradius = 60â, will be ignored. 535 536 .. _Gaussian_Distribution: 537 538 Gaussian Distribution 539 --------------------- 540 541 .. image:: pd_image005.png 542 543 The xmean is the mean of the distribution and Norm is a normalization factor 544 which is determined during the numerical calculation. 545 546 The PD (polydispersity) is 547 548 .. image:: pd_image003.png 549 550 .. image:: pd_image006.jpg 551 552 .. _Lognormal_Distribution: 553 554 Lognormal Distribution 555 ---------------------- 556 557 .. image:: pd_image007.png 558 559 The /mu/=ln(xmed), xmed is the median value of the distribution, and Norm is a 560 normalization factor which will be determined during the numerical calculation. 561 The median value is the value given in the size parameter in the control panel, 562 for example, âradius = 60â. 563 564 The PD (polydispersity) is given by /sigma/ 565 566 .. image:: pd_image008.png 567 568 For the angular distribution 569 570 .. image:: pd_image009.png 571 572 The mean value is given by xmean=exp(/mu/+p2/2). The peak value is given by 573 xpeak=exp(/mu/-p2). 574 575 .. image:: pd_image010.jpg 576 577 This distribution function spreads more and the peak shifts to the left as the 578 p increases, requiring higher values of Nsigmas and Npts. 579 580 .. _Schulz_Distribution: 581 582 Schulz Distribution 583 ------------------- 584 585 .. image:: pd_image011.png 586 587 The xmean is the mean of the distribution and Norm is a normalization factor 588 which is determined during the numerical calculation. 589 590 The z = 1/p2â 1. 591 592 The PD (polydispersity) is 593 594 .. image:: pd_image012.png 595 596 Note that the higher PD (polydispersity) might need higher values of Npts and 597 Nsigmas. For example, at PD = 0.7 and radisus = 60 A, Npts >= 160, and 598 Nsigmas >= 15 at least. 599 600 .. image:: pd_image013.jpg 601 602 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 603 604 .. _Smearing_Computation: 605 606 Smearing Computation 607 -------------------- 608 609 Slit_Smearing_ 610 611 Pinhole_Smearing_ 612 613 2D_Smearing_ 614 615 .. _Slit_Smearing: 616 617 Slit Smearing 618 ------------- 619 620 The sit smeared scattering intensity for SAS is defined by 621 622 .. image:: sm_image002.gif 623 624 where Norm = 625 626 .. image:: sm_image003.gif 627 628 Equation 1 629 630 The functions .. image:: sm_image004.gif and .. image:: sm_image005.gif 631 refer to the slit width weighting function and the slit height weighting 632 determined at the q point, respectively. Here, we assumes that the weighting 633 function is described by a rectangular function, i.e., 634 635 .. image:: sm_image006.gif 636 637 Equation 2 638 639 and 640 641 .. image:: sm_image007.gif 642 643 Equation 3 644 645 so that .. image:: sm_image008.gif .. image:: sm_image009.gif for 646 .. image:: sm_image010.gif and u. 647 648 The .. image:: sm_image011.gif and .. image:: sm_image012.gif stand for 649 the slit height (FWHM/2) and the slit width (FWHM/2) in the q space. Now the 650 integral of Equation 1 is simplified to 651 652 .. image:: sm_image013.gif 653 654 Equation 4 655 656 Numerical Implementation of Equation 4 657 -------------------------------------- 658 659 Case 1 660 ------ 661 662 For .. image:: sm_image012.gif = 0 and .. image:: sm_image011.gif = 663 constant. 664 665 .. image:: sm_image016.gif 666 667 For discrete q values, at the q values from the data points and at the q 668 values extended up to qN= qi + .. image:: sm_image011.gif the smeared 669 intensity can be calculated approximately 670 671 .. image:: sm_image017.gif 672 673 Equation 5 674 675 .. image:: sm_image018.gif = 0 for *Is* in *j* < *i* or *j* > N-1*. 676 677 Case 2 678 ------ 679 680 For .. image:: sm_image012.gif = constant and 681 .. image:: sm_image011.gif = 0. 682 683 Similarly to Case 1, we get 684 685 .. image:: sm_image019.gif for qp= qi- .. image:: sm_image012.gif 686 687 and qN= qi+ .. image:: sm_image012.gif. .. image:: sm_image018.gif = 0 688 for *Is* in *j* < *p* or *j* > *N-1*. 689 690 Case 3 691 ------ 692 693 For .. image:: sm_image011.gif = constant and 694 .. image:: sm_image011.gif = constant. 695 696 In this case, the best way is to perform the integration, Equation 1, 697 numerically for both slit height and width. However, the numerical integration 698 is not correct enough unless given a large number of iteration, say at least 699 10000 by 10000 for each element of the matrix, W, which will take minutes and 700 minutes to finish the calculation for a set of typical SAS data. An 701 alternative way which is correct for slit width << slit hight, is used in 702 SasView. This method is a mixed method that combines method 1 with the 703 numerical integration for the slit width. 704 705 .. image:: sm_image020.gif 706 707 Equation 7 708 709 for qp= qi- .. image:: sm_image012.gif and 710 qN= qi+ .. image:: sm_image012.gif. .. image:: sm_image018.gif = 0 for 711 *Is* in *j* < *p* or *j* > *N-1*. 712 713 .. _Pinhole_Smearing: 714 715 Pinhole Smearing 716 ---------------- 717 718 The pinhole smearing computation is done similar to the case above except 719 that the weight function used is the Gaussian function, so that the Equation 6 720 for this case becomes 721 722 .. image:: sm_image021.gif 723 724 Equation 8 725 726 For all the cases above, the weighting matrix *W* is calculated when the 727 smearing is called at the first time, and it includes the ~ 60 q values 728 (finely binned evenly) below (\>0) and above the q range of data in order 729 to cover all data points of the smearing computation for a given model and 730 for a given slit size. The *Norm* factor is found numerically with the 731 weighting matrix, and considered on *Is* computation. 732 733 .. _2D_Smearing: 734 735 2D Smearing 736 ----------- 737 738 The 2D smearing computation is done similar to the 1D pinhole smearing above 739 except that the weight function used was the 2D elliptical Gaussian function 740 741 .. image:: sm_image022.gif 742 743 Equation 9 744 745 In Equation 9, x0 = qcos/theta/ and y0 = qsin/theta/, and the primed axes 746 are in the coordinate rotated by an angle /theta/ around the z-axis (below) 747 so that xâ0= x0cos/theta/+y0sin/theta/ and yâ0= -x0sin/theta/+y0cos/theta/. 748 749 Note that the rotation angle is zero for x-y symmetric elliptical Gaussian 750 distribution. The A is a normalization factor. 751 752 .. image:: sm_image023.gif 753 754 Now we consider a numerical integration where each bins in /theta/ and R are 755 *evenly* (this is to simplify the equation below) distributed by /delta//theta/ 756 and /delta/R, respectively, and it is assumed that I(xâ, yâ) is constant 757 within the bins which in turn becomes 758 759 .. image:: sm_image024.gif 760 761 Equation 10 762 763 Since we have found the weighting factor on each bin points, it is convenient 764 to transform xâ-yâ back to x-y coordinate (rotating it by -/theta/ around z 765 axis). Then, for the polar symmetric smear 766 767 .. image:: sm_image025.gif 768 769 Equation 11 770 771 where 772 773 .. image:: sm_image026.gif 774 775 while for the x-y symmetric smear 776 777 .. image:: sm_image027.gif 778 779 Equation 12 780 781 where 782 783 .. image:: sm_image028.gif 784 785 Here, the current version of the SasView uses Equation 11 for 2D smearing 786 assuming that all the Gaussian weighting functions are aligned in the polar 787 coordinate. 788 789 In the control panel, the higher accuracy indicates more and finer binnng 790 points so that it costs more in time. 791 792 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 793 794 .. _Polarisation_Magnetic_Scattering: 795 796 Polarisation/Magnetic Scattering 797 -------------------------------- 798 799 Magnetic scattering is implemented in five (2D) models 800 801 * *SphereModel* 802 * *CoreShellModel* 803 * *CoreMultiShellModel* 804 * *CylinderModel* 805 * *ParallelepipedModel* 806 807 In general, the scattering length density (SLD) in each regions where the 808 SLD (=/beta/) is uniform, is a combination of the nuclear and magnetic SLDs and 809 depends on the spin states of the neutrons as follows. For magnetic scattering, 810 only the magnetization component, *M*perp, perpendicular to the scattering 811 vector *Q* contributes to the the magnetic scattering length. 812 813 .. image:: mag_vector.bmp 814 815 The magnetic scattering length density is then 816 817 .. image:: dm_eq.gif 818 819 where /gamma/ = -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0 820 is the classical radius of electron, and */sigma/* is the Pauli spin. For 821 polarised neutron, the magnetic scattering is depending on the spin states. 822 823 Let's consider that the incident neutrons are polarized parallel (+)/ 824 anti-parallel (-) to the x' axis (See both Figures above). The possible 825 out-coming states then are + and - states for both incident states 826 827 Non-spin flips: (+ +) and (- -) 828 Spin flips: (+ -) and (- +) 829 830 .. image:: M_angles_pic.bmp 831 832 Now, let's assume that the angles of the *Q* vector and the spin-axis (x') 833 against x-axis are /phi/ and /theta/up, respectively (See Figure above). Then, 834 depending upon the polarisation (spin) state of neutrons, the scattering length 835 densities, including the nuclear scattering length density (/beta/N) are given 836 as, for non-spin-flips 837 838 .. image:: sld1.gif 839 840 for spin-flips 841 842 .. image:: sld2.gif 843 844 where 845 846 .. image:: mxp.gif 847 848 .. image:: myp.gif 849 850 .. image:: mzp.gif 851 852 .. image:: mqx.gif 853 854 .. image:: mqy.gif 855 856 Here, the M0x, M0y and M0z are the x, y and z components of the magnetization 857 vector given in the xyz lab frame. The angles of the magnetization, /theta/M 858 and /phi/M as defined in the Figure (above) 859 860 .. image:: m0x_eq.gif 861 862 .. image:: m0y_eq.gif 863 864 .. image:: m0z_eq.gif 865 866 The user input parameters are M0_sld = DMM0, Up_theta = /theta/up, 867 M_theta = /theta/M, and M_phi = /phi/M. The 'Up_frac_i' and 'Up_frac_f' are 868 the ratio 869 870 (spin up)/(spin up + spin down) 871 872 neutrons before the sample and at the analyzer, respectively. 873 874 *Note:* The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range 875 between 0 and 1. 876 877 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 878 879 .. _Key_Combinations: 880 881 Key Combinations 882 ---------------- 883 884 Copy_Paste_ 885 886 Bookmark_ 887 888 Graph_Context_Menu_ 889 890 FTolerance_ 891 892 .. _Copy_Paste: 893 894 Copy & Paste 895 ------------ 896 897 To copy the parameter values in a Fit(Model) panel to the clipboard: 898 899 *Ctrl(Cmd on MAC) + Left(Mouse)Click* on the panel. 900 901 To paste the parameter values to a Fit(Model)panel from the clipboard: 902 903 *Ctrl(Cmd on MAC) + Shift + Left(Mouse)Click* on the panel. 904 905 If this operation is successful, it will say so in the info line at the 906 bottom of the SasView window. 907 908 .. _Bookmark: 909 910 Bookmark 911 -------- 912 913 Bookmark of a fit-panel or model-panel status: 914 915 *(Mouse)Right-Click* and select the bookmark in the popup list. 916 917 .. _Graph_Context_Menu: 918 919 Graph Context Menu 920 ------------------ 921 922 To get the graph context menu to print, copy, save data, (2D)average, etc.: 923 924 *Locate the mouse point on the plot to highlight and *(Mouse) Right Click* 925 to bring up the full menu. 926 927 .. _FTolerance: 928 929 FTolerance (SciPy) 930 ------------------ 931 932 To change the ftol value of the Scipy FitEngine (leastsq): 933 934 First, make sure that the Fit panel has data and a model selected. 935 936 *Ctrl(Cmd on MAC) + Shift + Alt + Right(Mouse)Click* on the panel. 937 938 Then, set up the value in the dialog panel. 939 940 If this operation is successful, the new ftol value will be displayed in the 941 info line at the bottom of the SV window.Note that increasing the ftol value 942 may cause for the fitting to terminate with higher chisq. 943 944 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 945 946 .. _Status_Bar_Help: 947 948 Status Bar Help 949 --------------- 950 951 Message_Warning_Hint_ 952 953 Console_ 954 955 .. _Message_Warning_Hint: 956 957 Message/Warning/Hint 958 -------------------- 959 960 The status bar located at the bottom of the application frame, displays 961 messages, hints, warnings and errors. 962 963 .. _Console: 964 965 Console 966 ------- 967 968 Select *light bulb/info icon* button in the status bar at the bottom of the 969 application window to display available history. During a long task, the 970 console can also help users to understand the status in progressing. -
src/sas/guiframe/media/data_explorer_help.rst
r0d66541 r23a9beb 1 .. data_explorer_help.rst1 .. data_explorer_help.rst 2 2 3 Placeholder for data explorer help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Loading Data 7 ============ 8 9 Introduction_ 10 11 Load_Data_ 12 13 Handy_Menu_ 14 15 Activate_Data_ 16 17 Remove_Data_ 18 19 Append_Plot_to_Graph_ 20 21 Create_New_Plot_ 22 23 Freeze_Theory_ 24 25 Send_Data_to_Applications_ 26 27 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 28 29 .. _Introduction: 30 31 Introduction 32 ------------ 33 34 *Data Explorer* is a panel that allows the user more interactions with data. 35 Some functionalities provided by the Data Explorer are also available through 36 the context menu of plot panels or other menus of the applications.Under menu 37 *View* of the menubar, Data explorer can be toggled between Show and Hide by 38 clicking the menu *Show/Hide Data Explorer* . 39 40 *IMPORTANT!* When Data explorer is hidden, all the data loaded will be sent 41 directly to the current active application, if possible. When data Explorer is 42 shown data go first to the Data Explorer for the user to handle them later. 43 44 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 45 46 .. _Load_Data: 47 48 Load Data 49 --------- 50 51 To Load data, click the button *Load Data* , then select one or more (holding 52 Ctrl key) files to load into the application. In the list, the *Data* will be 53 displayed as the name of each selected file. Expending this data by clicking 54 the *+* symbol will display available information about the data such as data 55 title if exists. 56 57 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 58 59 .. _Handy_Menu: 60 61 Handy Menu 62 ---------- 63 64 For a quick Data-info/Save/Plot/3d-plot(2d only)/Edit-mask(2d only), 65 high-light the data/theory, right-click, and select a proper item from the 66 context menu. 67 68 .. image:: hand_menu.png 69 70 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 71 72 .. _Activate_Data: 73 74 Activate Data 75 ------------- 76 77 To interact with data, check a data label and click on a button. Checking Data 78 make them active for the button operation. Unchecking Data labels will 79 deactivate them. 80 81 There is a combo box labeled *Selection Options* that allows to activate or 82 select multiple data simultaneously. 83 84 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 85 86 .. _Remove_Data: 87 88 Remove Data 89 ----------- 90 91 Remove data button remove all reference of this data into the application. 92 93 *WARNING!* Remove data will stop any jobs currently using the selected data. 94 95 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 96 97 .. _Append_Plot_to_Graph: 98 99 Append Plot to Graph 100 -------------------- 101 102 Click on the button *Append To* to append selected Data to a plot panel on 103 focus. Next to this button is a combo box containing available panels names. 104 Selecting a name from this combo box will set the corresponding lot panel on 105 focus. If not plot panel is available, the combo box and button will be 106 disable. 2D Data cannot be appended to any plot panels . This operation can 107 only be performed on 1D data and plot panels currently containing 1D data. 108 109 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 110 111 .. _Create_New_Plot: 112 113 Create New Plot 114 --------------- 115 116 Click on *New Plot* button to create a new plot panel where selected data 117 will be plotted. 118 119 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 120 121 .. _Freeze_Theory: 122 123 Freeze Theory 124 ------------- 125 126 *Freeze Theory* button generate Data from selected theory. This operation can 127 only be performed when theory labels are selected. 128 129 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 130 131 .. _Send_Data_to_Applications: 132 133 Send to Application 134 ------------------- 135 136 Click on the button *Send To* to send Data to the current active control 137 page. One of the single/batch mode can be selected only for Fitting. The batch 138 mode provides serial (batch) fitting with one model, i.e., fitting one data by 139 another data. Note that only the Fitting allows more that one data to be sent. -
src/sas/guiframe/media/graph_help.rst
r0d66541 r23a9beb 1 ..graph_help.rst 2 3 Placeholder for graph help 1 .. graph_help.rst 2 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Plotting Data/Models 7 ==================== 8 9 Graph_Menu_ 10 11 2D_Data_Averaging_ 12 13 Key_Combinations_ 14 15 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 16 17 .. _Graph_Menu: 18 19 Graph Menu 20 ---------- 21 22 Introduction_ 23 24 Reset_Graph_ 25 26 Hide_Show_Delete_Graph_ 27 28 Data_Info_ 29 30 Save_Plot_Image_ 31 32 Save_Data_ 33 34 Drag_Plot_ 35 36 Zoom_In_Out_ 37 38 Remove_Data_ 39 40 Change_Scale_ 41 42 Linear_Fit_ 43 44 Other_Graph_Modifications_ 45 46 .. _Introduction: 47 48 Introduction 49 ------------ 50 51 Locating the pointer and right-clicking on a data/theory plot will bring a 52 context menu. On the menu, select a menu item. 53 54 .. _Reset_Graph: 55 56 Reset Graph 57 ----------- 58 59 To reset the graph's axis range, right click on the plot and the context menu 60 pops-up. Select *Reset Graph* and the plot will take its initial range. Also 61 the 'home' icon in tool bar will do the same. 62 63 .. _Hide_Show_Delete_Graph: 64 65 Hide/Show/Delete Graph 66 ---------------------- 67 68 To Hide, click the Hide (bar) button in the tool bar.To Show, select the the 69 'Show' menu item in the 'Graph' menu in the menu bar.To Delete, click the 'x' 70 button in the title bar. 71 72 Note: If a residuals graph (in Fitting) is hidden, it will not show up after 73 computation. 74 75 .. _Data_Info: 76 77 Data Info 78 --------- 79 80 From the context menu, select 'Data Info' to see the data information dialog 81 panel. 82 83 .. _Save_Plot_Image: 84 85 Save Plot Image 86 --------------- 87 88 Right click on plot. Context menu will pop-up select save image [file name]. 89 A dialog window opens and write a the name of the file to save and click on 90 *Save Image.* 91 92 .. _Save_Data: 93 94 Save Data 95 --------- 96 97 From the context menu, select 'Save points as a file' for 1D, or 'Save as a 98 file(DAT)' for 2D. Note that two formats, txt and xml, are available in 1D 99 saving. 100 101 .. _Drag_Plot: 102 103 Drag Plot 104 --------- 105 106 Select the *crossed arrows* button on the plot panel *toolbar* to drag the 107 plot. To disable dragging mode, unselect the same button on the toolbar. 108 109 .. _Zoom_In_Out: 110 111 Zoom In/Out 112 ----------- 113 114 Select the *rectangle* button on the plot panel *toolbar* to zoom in a 115 region of the plot. 116 117 To disable zoom mode, unselect the same button on the toolbar. After zoom in 118 a region, select *left arrow* or *right arrow* button on the toolbar to set 119 the graph the the previous size. If a mouse wheel button is available, 120 *zoom in/out* by scrolling the mouse wheel (see Key_Combinations_ help for 121 details). 122 123 .. _Remove_Data: 124 125 Remove Data from Plot 126 --------------------- 127 128 Highlight the plot and the context menu appears.Select *remove [file name]*. 129 The plot selected will disappear. 130 131 .. _Change_Scale: 132 133 Change Scale 134 ------------ 135 136 If the loaded data is a 1-D data changing scale or data representation will 137 work as follows. *Right click* on the plot window. A context menu pops-up and 138 select *Change Scale* . A dialog window titled *select the scale of the graph* 139 will pop-up then change the *x* , the *y* and the *view* values as wish. 140 141 The 'view' option includes the axis scale short-cuts such as Linear, Guinier, 142 Cross-sectional (XC) Guinier, and Porod plot scale. For a proper data set, 143 these axis scales can be used to estimate Rg, Rod diameter, or Background of 144 neutron scattering data respectively (via 'Linear Fit'; see below). For a 2D 145 image, *Right click* on the image to pop-up the context menu. Select to 146 switch from linear to log scale. The scale selected is printed on the status 147 bar. 148 149 If the loaded data is an image. *Right click* on the image to pop-up the 150 context menu. Select to switch from linear to log scale. The scale selected is 151 printed on the status bar. 152 153 .. _Linear_Fit: 154 155 Linear Fit 156 ---------- 157 158 Linear fit is to perform a line model fitting keeping the scale of the plot. 159 Highlight data to fit. From the context menu select *Linear Fit* . A dialog 160 window appears. Change model initial parameters, data limits and hit *fit* 161 button. New parameters values are displayed and the line with the new 162 parameters is added to the plot. Especially for Guinier, XC Guinier, and 163 Porod plot scale, this 'Linear Fit' will provides Rg, Rod diameter, and 164 background, respectively. The following figure shows an example for the 165 Guinier scale. 166 167 .. image:: guinier_fit.png 168 169 .. _Other_Graph_Modifications: 170 171 Other Graph Modifications 172 ------------------------- 173 174 Some custom modifications of the symbols, text, axis, etc of the graph are 175 provided. 176 177 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 178 179 .. _2D_Data_Averaging: 180 181 2D Data Averaging 182 ----------------- 183 184 Description_ 185 186 How_to_Average_ 187 188 Available_Averagings_ 189 190 Unmasked_Circular_Average_ 191 192 Masked_Circular_Average_ 193 194 Sector_Average_ 195 196 Annular_Average_ 197 198 Box_Sum_ 199 200 Box_Averaging_in_Qx_ 201 202 Box_Averaging_in_Qy_ 203 204 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 205 206 .. _Description: 207 208 Description 209 ----------- 210 211 This feature allows you to perform different types of averages on your data, 212 and allows you to see what regions of the detector will contribute to the 213 average. The region to be averaged will be drown and can be modified by 214 dragging the lines around. 215 216 .. _How_to_Average: 217 218 How to Average 219 -------------- 220 221 Right click on 2D data for the context menu to appear. Select one type of 222 averages among *"sector [Q view]", "Annulus [Phi view]", "Box sum", "Box 223 averaging in Qx ", "box averaging on Qy","Perform circular Average".* 224 225 A slicer will appear except for *"Perform circular Average"* that you can 226 drag by clicking on a slicer 's marker. When the marker is highlighted in red, 227 it means that the slicer can change size.You can also move some of the slicer 228 by simply drag its side when highlighted in red. the slicer size will be reset 229 to its previous size if the user try to select a region greater than the size 230 of the data. 231 232 The user can also select a region to average when a slicer has been selected 233 already by *right clicking* on the context menu and selecting *Edit Slicer 234 Parameters* . The dialog window will appears and the user can enter values to 235 selected a region or selected numbers of points to plot *nbins* . 236 237 For *Box sum* , when the user selects this option, a new panel is created 238 containing the result of average of the sum of every pixels contains on that 239 data.The user can also enter values to select a region. 240 241 .. _Available_Averagings: 242 243 Available Averagings 244 -------------------- 245 246 Some different types of averaging are provided for. 247 248 .. _Unmasked_Circular_Average: 249 250 Unmasked Circular Average 251 ------------------------- 252 253 This operation will perform and average in constant q-rings around the (x,y) pixel 254 location of the beam center. 255 256 .. _Masked_Circular_Average: 257 258 Masked Circular Average 259 ----------------------- 260 261 This operation is same as 'Masked Circular Average' except that the masked 262 region is excluded if masked. 263 264 .. _Sector_Average: 265 266 Sector Average [Q View] 267 ----------------------- 268 269 This operation averages in constant q-arcs. The width of the sector is specified in 270 degrees (+/- delta phi) each side of the central angle (phi). 271 272 .. _Annular_Average: 273 274 Annular Average [Phi View] 275 -------------------------- 276 277 It performs an average between two q-values centered in (0,0), and averaged 278 over a width of a specified number of pixels. The data is returned as a 279 function of angle (phi) in degrees. Moving one circle of this slicer to 280 radius of zero corresponding to a circular averaging on radius qmax , the 281 outer circle. The angle zero starts from the positive x-axis direction. 282 283 .. _Box_Sum: 284 285 Box Sum 286 ------- 287 288 Perform the sum of counts in a 2D region of interest.When editing the slicer, 289 the user can enter the length and the width the rectangle slicer and the 290 coordinates of the center of this rectangle. 291 292 .. _Box_Averaging_in_Qx: 293 294 Box Averaging in Qx 295 ------------------- 296 297 Computes average I(Qx) for a region of interest. When editing the slicer, the 298 user can control the length and the width the rectangle slicer. The averaged 299 output is calculated from the constant bins with rectangular shape. The 300 resultant q values are nominal values, i.e., the central values of each bins 301 on the x-axis. 302 303 .. _Box_Averaging_in_Qy: 304 305 Box Averaging in Qy 306 ------------------- 307 308 Computes average I(Qy) for a region of interest.When editing the slicer, the 309 user can control the length and the width the rectangle slicer. The averaged 310 output is calculated from the constant bins with rectangular shape. The 311 resultant q values are nominal values, i.e., the central values of each bins 312 on the y-axis. 313 314 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 315 316 .. _Key_Combinations: 317 318 Key Combination 319 --------------- 320 321 Floating_Panel_ 322 323 Graph_Context_Menu_ 324 325 Zoom_ 326 327 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 328 329 .. _Floating_Panel: 330 331 Floating Panel 332 -------------- 333 334 For a graph panel to float on the top of the SV window: 335 336 Press the *Ctrl(Cmd on MAC) key* on dragging and placing a panel. Or if you 337 want to make all plot panels float, select 'Float' from Graph/Preperences in 338 the menu bar. Otherwise choose 'Dock'. 339 340 .. _Graph_Context_Menu: 341 342 Graph Context Menu 343 ------------------ 344 345 To get the graph context menu to print, copy, save data, (2D)average, etc, 346 *locate the mouse point on the plot to highlight and *(Mouse) Right Click* 347 to bring up the full menu. 348 349 .. _Zoom: 350 351 Zoom In/Out 352 ----------- 353 354 To Zoom in or out the full plot, *locate the mouse point inside the graph 355 which will be the center of the zooming, then *rotate MouseWheel*. 356 357 *To Zoom in or out the plot in x or y direction, *locate (and click) the 358 mouse point near x (or y) axis just outside of the graph and then *rotate 359 MouseWheel* .* Note that this works only on the 1D plots. -
src/sas/invariant/media/invariant_help.rst
r0d66541 r23a9beb 1 .. invariant_help.rst1 .. invariant_help.rst 2 2 3 Placeholder for invariant help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 Invariant Calculation Perspective 7 ================================= 8 9 Scattering_Invariant_ 10 11 Volume_Fraction_ 12 13 Specific_Surface_Area_ 14 15 Definitions_ 16 17 Reference_ 18 19 How_to_Use_ 20 21 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 22 23 .. _Scattering_Invariant: 24 25 Scattering Invariant 26 -------------------- 27 28 The scattering invariant (Q*) is a model-independent quantity that can be 29 easily calculated from scattering data. 30 31 For two phase systems, the scattering invariant, Q*, is defined as the 32 integral of the square of the wave transfer (q) multiplied by the scattering 33 cross section over the full range of q. 34 35 Q* is given by the following equation 36 37 .. image:: image001.gif 38 39 This model independent quantity (Q*) is calculated from the scattering data 40 that can be used to determine the volume fraction and the specific area of the 41 sample under consideration. 42 43 These quantities are useful in their own right and can be used in further 44 analysis. With this scattering invariant module users will also be able to 45 determine the consistency of those properties between data. There is no real 46 data defined from zero to infinity, there usually have limited range. 47 48 Q* is not really computed from zero to infinity. Our maximum q range is 49 1e-5 ~ 10 (1/Angstrom). The lower and/or higher q range than data given can be 50 extrapolated by fitting some data nearby. 51 52 The scattering invariant is computed as follows 53 54 *I(q)* = *I(q)* w/o background : If the data includes a background, user sets 55 the value to subtract the background for the Q* computation. 56 57 Reset *I(q)* = *I(q)* scaling factor* , delta *I(q) =* delta *I(q)*scaling 58 factor* : If non-zero scaling factor is given, it will be considered. 59 60 Invariant 61 62 .. image:: image001.gif 63 64 where *g =q* for the pinhole geometry and *g =qv* (the slit height) for the 65 slit geometry which can be given in data or as a value. 66 67 Higher q-region (\>= qmax in data) 68 69 Power law (w/o background term) function = C/q4will be used 70 71 where the constant C(=2pi(delta(rho))Sv) is to be found by fitting part of 72 data with the range of qN-mto qN(m\<N). 73 74 Lower q-region (\<= qmin in data): 75 76 Guinier function = *I0exp(-Rg2q2/3)* where I0and Rgare obtained by fitting, 77 78 similarly to the high q region above. 79 80 Power law can also be used. 81 82 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 83 84 .. _Volume_Fraction: 85 86 Volume Fraction 87 --------------- 88 89 .. image:: image002.gif 90 91 where delta(rho) is the SLD contrast of which value is given by users. 92 93 .. image:: image003.gif 94 95 Thus 96 97 where 0 =\< *A* =\<1/4 in order for these values to be physically valid. 98 99 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 100 101 .. _Specific_Surface_Area: 102 103 Specific Surface Area 104 --------------------- 105 106 .. image:: image004.gif 107 108 where *A* and *Q** are obtained from previous sections, and the Porod 109 constant *Cp* is given by users. 110 111 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 112 113 .. _Definitions: 114 115 Definitions 116 ----------- 117 118 Q: the magnitude of neutron (or X-ray) momentum transfer vector. 119 120 I(Q): the scattering intensity as a function of the momentum transfer Q. 121 122 Invariant total is the sum of the invariant calculated from datas q range and 123 the invariant resulting from extrapolation at low q range and at high q range 124 if considered. 125 126 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 127 128 .. _Reference: 129 130 References 131 ---------- 132 133 Chapter 2 in O. Glatter and O. Kratky, "Small Angle X-Ray Scattering", Academic 134 Press, New York, 1982 135 136 http://physchem.kfunigraz.ac.at/sm/ 137 138 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 139 140 .. _How_to_Use: 141 142 How to Use 143 ---------- 144 145 1. Loading data to the panel: Open the data file from File in the menu bar. 146 Select loaded data from a plot panel by highlighting that it until its color 147 turns yellow. Then right click on that the data and selects the option Compute 148 Invariant. The application automatically computes the invariant value if the 149 data loaded is valid. 150 151 2. To subtract a background or/and to rescale the data, type the values in 152 Customized Input box. 153 154 3. If you want to calculate the volume fraction and the specific surface 155 area, type the optional inputs in the customized input box, and then press 156 'Compute' button. 157 158 4. The invariant can also be calculated including the outside of the data Q 159 range: To include the lower Q and/or the higher Q range, check in the enable 160 extrapolation check box in 'Extrapolation' box. If the power low is chosen, 161 the power (exponent) can be either held or fitted by checking the 162 corresponding radio button. The Npts that is being used for the extrapolation 163 can be specified. 164 165 5. If the invariant calculated from the extrapolated region is too large, it 166 will be warn in red at the top of the panel, which means that your data is not 167 proper to calculate the invariant. 168 169 6. The details of the calculation is available by clicking the 'Details' 170 button in the middle of the panel. 171 172 .. image:: image005.gif -
src/sas/invariant/media/pr_help.rst
r0d66541 r23a9beb 1 .. pr_help.rst1 .. pr_help.rst 2 2 3 Placeholder for P(r) help 3 .. This is a port of the original SasView html help file to ReSTructured text 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 6 .. |pi| unicode:: U+03C0 7 .. |chi| unicode:: U+03C7 8 9 P(r) Inversion Perspective 10 ========================== 11 12 The inversion approach is based on Moore, J. Appl. Cryst., (1980) 13, 168-175. 13 14 P(r) is set to be equal to an expansion of base functions of the type 15 phi_n(r) = 2 * r * sin(|pi| * n * r / D_max). 16 17 The coefficient of each base function in the expansion is found by performing 18 a least square fit with the following fit function: 19 20 |chi| ^2 = sum_i[ I_meas(q_i) - I_th(q_i) ]^2 / error^2 + Reg_term 21 22 where I_meas(q) is the measured scattering intensity and I_th(q) is the 23 prediction from the Fourier transform of the P(r) expansion. 24 25 The Reg_term term is a regularization term set to the second derivative 26 d^2 P(r) / dr^2 integrated over r. It is used to produce a smooth P(r) output. 27 28 The following are user inputs: 29 30 * Number of terms: the number of base functions in the P(r) expansion. 31 32 * Regularization constant: a multiplicative constant to set the size of 33 the regularization term. 34 35 * Maximum distance: the maximum distance between any two points in the 36 system.
Note: See TracChangeset
for help on using the changeset viewer.