Changes in / [1dbdb83:e89aed5] in sasview
- Files:
-
- 22 added
- 68 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rdf332d8 re04f87b 8 8 # generated. 9 9 # 10 # Feel free to add more stuff to this as and when it becomes an issue. 10 # Feel free to add more stuff to this as and when it becomes an issue. 11 11 12 12 .project … … 50 50 /test/sasdataloader/test/plugins.zip 51 51 /test/sasdataloader/test/test_log.txt 52 /test/sasdataloader/test/isis_1_0_write_test.xml53 /test/sasdataloader/test/isis_1_1_write_test.xml54 /test/sasdataloader/test/write_test.xml55 52 56 53 # autogenerated scripts 57 54 /sasview/installer.iss 55 -
build_tools/requirements.txt
rbe4cb41 r785cc657 11 11 bumps==0.7.5.9 12 12 # numpy==1.6.1 13 scipy>=0.18.0 13 # scipy==0.10.1 14 14 # wx==2.8.12.1 15 15 # matplotlib==1.1.0 -
docs/sphinx-docs/build_sphinx.py
r578a11d r8096b446 35 35 #/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 36 36 SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 37 SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans")38 37 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 39 38 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") … … 72 71 SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 73 72 SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 74 SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user")75 73 76 74 BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", … … 192 190 shutil.copy(fromhere,tohere) 193 191 194 if os.path.exists(SASMODELS_SOURCE_SESANS):195 print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS196 if os.path.exists(SPHINX_SOURCE_USER):197 print "Found docs folder SPHINX_SOURCE_USER at ", SPHINX_SOURCE_USER198 print "Copying sasmodels sesans files..."199 for files in os.listdir(SASMODELS_SOURCE_SESANS):200 if files.endswith(".rst"):201 fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files)202 tohere=os.path.join(SPHINX_SOURCE_USER,files)203 shutil.copy(fromhere,tohere)204 205 192 if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 206 193 print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM -
docs/sphinx-docs/source/user/analysis.rst
rec860a8f r8f46df7 1 .. _analysis:2 3 1 Types of Analysis 4 2 ================= … … 8 6 .. toctree:: 9 7 :maxdepth: 1 10 8 11 9 Model Fitting <sasgui/perspectives/fitting/fitting> 12 10 13 11 P(r) Inversion <sasgui/perspectives/pr/pr_help> 14 12 15 13 Invariant Calculation <sasgui/perspectives/invariant/invariant_help> 16 17 Correlation Function <sasgui/perspectives/corfunc/corfunc_help> -
docs/sphinx-docs/source/user/tools.rst
rec860a8f r8f46df7 1 .. _tools:2 3 1 Tools 4 2 ===== … … 10 8 11 9 Data Operations Utility <sasgui/perspectives/calculator/data_operator_help> 12 10 13 11 Density/Volume Calculator <sasgui/perspectives/calculator/density_calculator_help> 14 12 15 13 Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 16 14 17 15 Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 18 16 19 17 Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 20 18 21 19 SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 22 20 23 21 Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 24 22 25 23 Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 26 24 27 25 Python Shell <sasgui/perspectives/calculator/python_shell_help> 28 29 File Converter <sasgui/perspectives/file_converter/file_converter_help> 26 -
docs/sphinx-docs/source/user/tutorial.rst
rec860a8f r13161ac 1 1 .. tutorial.rst 2 3 .. _tutorial:4 2 5 3 Tutorial -
docs/sphinx-docs/source/user/working.rst
r578a11d rc43953ef 19 19 Computations with a GPU <gpu_computations> 20 20 21 Converting SANS to SESANS <sans_to_sesans>22 -
run.py
r18e7309 r832fea2 72 72 platform = '%s-%s'%(get_platform(),sys.version[:3]) 73 73 build_path = joinpath(root, 'build','lib.'+platform) 74 75 # Notify the help menu that the Sphinx documentation is in a different 74 75 # Notify the help menu that the Sphinx documentation is in a different 76 76 # place than it otherwise would be. 77 77 os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") … … 123 123 # Compiled modules need to be pulled from the build directory. 124 124 # Some packages are not where they are needed, so load them explicitly. 125 import sas.sascalc.file_converter126 sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core',127 joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))128 129 # Compiled modules need to be pulled from the build directory.130 # Some packages are not where they are needed, so load them explicitly.131 125 import sas.sascalc.calculator 132 126 sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', -
sasview/local_config.py
rc1fdf84 rc1fdf84 95 95 GUIFRAME_WIDTH = 1150 96 96 GUIFRAME_HEIGHT = 840 97 PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv' , '.cor']97 PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv'] 98 98 PLUGINS_WLIST = ['Fitting files (*.fitv)|*.fitv', 99 99 'Invariant files (*.inv)|*.inv', 100 'P(r) files (*.prv)|*.prv', 101 'Corfunc files (*.cor)|*.cor'] 100 'P(r) files (*.prv)|*.prv'] 102 101 PLOPANEL_WIDTH = 415 103 102 PLOPANEL_HEIGTH = 370 -
sasview/sasview.py
rcde6e52 rcde6e52 148 148 logging.error(traceback.format_exc()) 149 149 150 # Corfunc perspective151 try:152 import sas.sasgui.perspectives.corfunc as module153 corfunc_plug = module.Plugin()154 self.gui.add_perspective(corfunc_plug)155 except:156 logging.error("Unable to load corfunc module")157 158 150 #Calculator perspective 159 151 try: … … 163 155 except: 164 156 logging.error("%s: could not find Calculator plug-in module"% \ 165 APP_NAME)166 logging.error(traceback.format_exc())167 168 # File converter tool169 try:170 import sas.sasgui.perspectives.file_converter as module171 converter_plug = module.Plugin()172 self.gui.add_perspective(converter_plug)173 except:174 logging.error("%s: could not find File Converter plug-in module"% \175 157 APP_NAME) 176 158 logging.error(traceback.format_exc()) -
sasview/test/README.txt
r850a498 rd4c88e24 1 Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data (ie, I(Q)), 2D data (ie, I(Qx,Qy)), coordinate data (eg, PDB files), image data (eg, TIFF files), SasView saved states, SESANS data, and data in formats that are not yet implemented but which are in the works for future releases. 2 3 1D data sets EITHER a) have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis, OR b) have I and Q in separate files. Data in the latter format need to be converted to a single file format with the File Converter tool before SasView will analyse them. 4 5 2D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and metadata may also be available. 6 7 Coordinate data sets are designed to be read by the Generic Scattering Calculator tool. 8 9 Image data sets are designed to be read by the Image Viewer tool. 10 1 Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data, 2D data, SASVIEW saved states, and data in formats that are not yet implemented but are in the works for future versions. 2 1D data sets have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis. 2D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and meta data may also be available. 11 3 Save states are projects and analyses saved by the SASVIEW program. A single analysis file contains the data and parameters for a single fit (.fit), p(r) inversion (.pr), or invariant calculation (.inv). A project file (.svs) contains the results for every active analysis. 12 13 SESANS data sets primarily contain the neutron polarisation as a function of the spin-echo length. -
setup.py
r18e7309 rdb74ee8 9 9 from distutils.command.build_ext import build_ext 10 10 from distutils.core import Command 11 import numpy12 11 13 12 # Manage version number ###################################### … … 55 54 print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 56 55 shutil.rmtree(SASVIEW_BUILD) 57 56 58 57 # 'sys.maxsize' and 64bit: Not supported for python2.5 59 58 is_64bits = False 60 59 if sys.version_info >= (2, 6): 61 60 is_64bits = sys.maxsize > 2**32 62 61 63 62 enable_openmp = False 64 63 … … 119 118 c = self.compiler.compiler_type 120 119 print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 121 120 122 121 # OpenMP build options 123 122 if enable_openmp: … … 128 127 for e in self.extensions: 129 128 e.extra_link_args = lopt[ c ] 130 129 131 130 # Platform-specific build options 132 131 if platform_lopt.has_key(c): … … 206 205 ) 207 206 208 207 209 208 # sas.sascalc.pr 210 209 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") … … 218 217 include_dirs=[], 219 218 ) ) 220 221 # sas.sascalc.file_converter 222 mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 223 package_dir["sas.sascalc.file_converter.core"] = mydir 224 package_dir["sas.sascalc.file_converter"] = os.path.join("src","sas", "sascalc", "file_converter") 225 packages.extend(["sas.sascalc.file_converter","sas.sascalc.file_converter.core"]) 226 ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 227 sources = [os.path.join(mydir, "bsl_loader.c")], 228 include_dirs=[numpy.get_include()], 229 ) ) 230 219 231 220 # sas.sascalc.fit 232 221 package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") … … 250 239 packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 251 240 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 252 241 253 242 # Data util 254 243 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") … … 305 294 'test/2d_data/*', 306 295 'test/save_states/*', 307 'test/upcoming_formats/*', 296 'test/upcoming_formats/*', 308 297 'default_categories.json'] 309 298 packages.append("sas.sasview") … … 327 316 required.extend(['pillow']) 328 317 329 # Set up SasView 318 # Set up SasView 330 319 setup( 331 320 name="sasview", … … 352 341 'docs': BuildSphinxCommand, 353 342 'disable_openmp': DisableOpenMPCommand} 354 ) 343 ) -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r654e8e0 r654e8e0 1177 1177 written = written | self.write_node(pix, "z", item.pixel_size.z, 1178 1178 {"unit": item.pixel_size_unit}) 1179 written = written | self.write_node(det, "slit_length", 1180 item.slit_length, 1181 {"unit": item.slit_length_unit}) 1179 1182 if written == True: 1180 1183 self.append(pix, det) 1181 self.write_node(det, "slit_length", item.slit_length,1182 {"unit": item.slit_length_unit})1183 1184 1184 1185 1185 def _write_process_notes(self, datainfo, entry_node): -
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r5e906207 r479799c 23 23 24 24 Any number of SASdata sets may be present in a SASentry and the data within can be either 1D I(Q) or 2D I(Qx, Qy). 25 26 Also supports reading NXcanSAS formatted HDF5 files27 25 28 26 :Dependencies: … … 78 76 ## Add the last data set to the list of outputs 79 77 self.add_data_set() 80 ## Close the data file81 self.raw_data.close()82 78 ## Return data set(s) 83 79 return self.output … … 187 183 elif key == u'run': 188 184 self.current_datainfo.run.append(data_point) 189 try:190 run_name = value.attrs['name']191 run_dict = {data_point: run_name}192 self.current_datainfo.run_name = run_dict193 except:194 pass195 185 elif key == u'title': 196 186 self.current_datainfo.title = data_point … … 199 189 200 190 ## Sample Information 201 elif key == u'Title' and self.parent_class == u'SASsample': # CanSAS 2.0 format 202 self.current_datainfo.sample.name = data_point 203 elif key == u'ID' and self.parent_class == u'SASsample': # NXcanSAS format 191 elif key == u'Title' and self.parent_class == u'SASsample': 204 192 self.current_datainfo.sample.name = data_point 205 193 elif key == u'thickness' and self.parent_class == u'SASsample': … … 207 195 elif key == u'temperature' and self.parent_class == u'SASsample': 208 196 self.current_datainfo.sample.temperature = data_point 209 elif key == u'transmission' and self.parent_class == u'SASsample':210 self.current_datainfo.sample.transmission = data_point211 elif key == u'x_position' and self.parent_class == u'SASsample':212 self.current_datainfo.sample.position.x = data_point213 elif key == u'y_position' and self.parent_class == u'SASsample':214 self.current_datainfo.sample.position.y = data_point215 elif key == u'polar_angle' and self.parent_class == u'SASsample':216 self.current_datainfo.sample.orientation.x = data_point217 elif key == u'azimuthal_angle' and self.parent_class == u'SASsample':218 self.current_datainfo.sample.orientation.z = data_point219 elif key == u'details' and self.parent_class == u'SASsample':220 self.current_datainfo.sample.details.append(data_point)221 197 222 198 ## Instrumental Information … … 228 204 self.detector.distance = float(data_point) 229 205 self.detector.distance_unit = unit 230 elif key == u'slit_length' and self.parent_class == u'SASdetector':231 self.detector.slit_length = float(data_point)232 self.detector.slit_length_unit = unit233 elif key == u'x_position' and self.parent_class == u'SASdetector':234 self.detector.offset.x = float(data_point)235 self.detector.offset_unit = unit236 elif key == u'y_position' and self.parent_class == u'SASdetector':237 self.detector.offset.y = float(data_point)238 self.detector.offset_unit = unit239 elif key == u'polar_angle' and self.parent_class == u'SASdetector':240 self.detector.orientation.x = float(data_point)241 self.detector.orientation_unit = unit242 elif key == u'azimuthal_angle' and self.parent_class == u'SASdetector':243 self.detector.orientation.z = float(data_point)244 self.detector.orientation_unit = unit245 elif key == u'beam_center_x' and self.parent_class == u'SASdetector':246 self.detector.beam_center.x = float(data_point)247 self.detector.beam_center_unit = unit248 elif key == u'beam_center_y' and self.parent_class == u'SASdetector':249 self.detector.beam_center.y = float(data_point)250 self.detector.beam_center_unit = unit251 elif key == u'x_pixel_size' and self.parent_class == u'SASdetector':252 self.detector.pixel_size.x = float(data_point)253 self.detector.pixel_size_unit = unit254 elif key == u'y_pixel_size' and self.parent_class == u'SASdetector':255 self.detector.pixel_size.y = float(data_point)256 self.detector.pixel_size_unit = unit257 206 elif key == u'SSD' and self.parent_class == u'SAScollimation': 258 207 self.collimation.length = data_point … … 264 213 elif key == u'name' and self.parent_class == u'SASprocess': 265 214 self.process.name = data_point 266 elif key == u'Title' and self.parent_class == u'SASprocess': # CanSAS 2.0 format 267 self.process.name = data_point 268 elif key == u'name' and self.parent_class == u'SASprocess': # NXcanSAS format 215 elif key == u'Title' and self.parent_class == u'SASprocess': 269 216 self.process.name = data_point 270 217 elif key == u'description' and self.parent_class == u'SASprocess': … … 283 230 self.trans_spectrum.wavelength.append(data_point) 284 231 285 ## Source232 ## Other Information 286 233 elif key == u'wavelength' and self.parent_class == u'SASdata': 287 234 self.current_datainfo.source.wavelength = data_point 288 self.current_datainfo.source.wavelength_unit = unit 289 elif key == u'incident_wavelength' and self.parent_class == u'SASsource': 290 self.current_datainfo.source.wavelength = data_point 291 self.current_datainfo.source.wavelength_unit = unit 292 elif key == u'wavelength_max' and self.parent_class == u'SASsource': 293 self.current_datainfo.source.wavelength_max = data_point 294 self.current_datainfo.source.wavelength_max_unit = unit 295 elif key == u'wavelength_min' and self.parent_class == u'SASsource': 296 self.current_datainfo.source.wavelength_min = data_point 297 self.current_datainfo.source.wavelength_min_unit = unit 298 elif key == u'wavelength_spread' and self.parent_class == u'SASsource': 299 self.current_datainfo.source.wavelength_spread = data_point 300 self.current_datainfo.source.wavelength_spread_unit = unit 301 elif key == u'beam_size_x' and self.parent_class == u'SASsource': 302 self.current_datainfo.source.beam_size.x = data_point 303 self.current_datainfo.source.beam_size_unit = unit 304 elif key == u'beam_size_y' and self.parent_class == u'SASsource': 305 self.current_datainfo.source.beam_size.y = data_point 306 self.current_datainfo.source.beam_size_unit = unit 307 elif key == u'beam_shape' and self.parent_class == u'SASsource': 308 self.current_datainfo.source.beam_shape = data_point 235 self.current_datainfo.source.wavelength.unit = unit 309 236 elif key == u'radiation' and self.parent_class == u'SASsource': 310 237 self.current_datainfo.source.radiation = data_point … … 449 376 self.current_datainfo = DataInfo() 450 377 451 452 378 def _initialize_new_data_set(self, parent_list = None): 453 379 """ -
src/sas/sasgui/guiframe/events.py
r6ffa0dd rd85c194 8 8 # plot Qrange 9 9 (PlotQrangeEvent, EVT_PLOT_QRANGE) = wx.lib.newevent.NewEvent() 10 # set plot limits11 (PlotLimitEvent, EVT_PLOT_LIM) = wx.lib.newevent.NewEvent()12 10 # print the messages on statusbar 13 11 (StatusEvent, EVT_STATUS) = wx.lib.newevent.NewEvent() 14 #create a panel slicer 12 #create a panel slicer 15 13 (SlicerPanelEvent, EVT_SLICER_PANEL) = wx.lib.newevent.NewEvent() 16 #print update paramaters for panel slicer 14 #print update paramaters for panel slicer 17 15 (SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE) = wx.lib.newevent.NewEvent() 18 #update the slicer from the panel 16 #update the slicer from the panel 19 17 (SlicerParameterEvent, EVT_SLICER_PARS) = wx.lib.newevent.NewEvent() 20 18 #slicer event -
src/sas/sasgui/guiframe/gui_statusbar.py
r3a22ce7 rd85c194 6 6 import sys 7 7 import logging 8 import datetime9 8 from wx import StatusBar as wxStatusB 10 9 from wx.lib import newevent … … 47 46 48 47 self.msg_txt.SetEditable(False) 49 timestamp = datetime.datetime.now() 50 status = '{:%Y-%m-%d %H:%M:%S} : No message available'.format(timestamp) 51 self.msg_txt.SetValue(status) 48 self.msg_txt.SetValue('No message available') 52 49 self.sizer.Add(self.msg_txt, 1, wx.EXPAND|wx.ALL, 10) 53 50 self.SetSizer(self.sizer) … … 63 60 if status.strip() == "": 64 61 return 65 # Add timestamp66 timestamp = datetime.datetime.now()67 status = '{:%Y-%m-%d %H:%M:%S} : '.format(timestamp) + status68 62 color = (0, 0, 0) #black 69 63 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r245ae18 r895c9cb 95 95 self.parent.SetFocus() 96 96 97 # If true, there are 3 qrange bars98 self.is_corfunc = False99 100 97 101 98 def get_symbol_label(self): … … 217 214 if active_ctrl == None: 218 215 return 219 if hasattr(event, 'is_corfunc'):220 self.is_corfunc = event.is_corfunc221 216 if event.id in self.plots.keys(): 222 217 ctrl = event.ctrl … … 227 222 values = [max(x_data.min(), float(ctrl[0].GetValue())), 228 223 min(x_data.max(), float(ctrl[1].GetValue()))] 229 if len(ctrl) == 3:230 colors.append('purple')231 values.append(min(x_data.max(), float(ctrl[2].GetValue())))232 224 if self.ly == None: 233 225 self.ly = [] … … 240 232 xval = float(active_ctrl.GetValue()) 241 233 position = self.get_data_xy_vals(xval) 242 if position != None and not self.is_corfunc:234 if position != None: 243 235 wx.PostEvent(self.parent, StatusEvent(status=position)) 244 236 except: … … 301 293 ly0x = ly[0].get_xdata() 302 294 ly1x = ly[1].get_xdata() 303 ly2x = None304 if self.is_corfunc: ly2x = ly[2].get_xdata()305 295 self.q_ctrl[0].SetBackgroundColour('white') 306 296 self.q_ctrl[1].SetBackgroundColour('white') … … 316 306 self.q_ctrl[0].SetValue(str(pos_x)) 317 307 self.q_ctrl[1].SetBackgroundColour('pink') 318 elif ly2x is not None and ly1x >= ly2x:319 if self.vl_ind == 1:320 ly[2].set_xdata(posx)321 ly[2].set_zorder(nop)322 self.q_ctrl[2].SetValue(str(pos_x))323 elif self.vl_ind == 2:324 ly[1].set_xdata(posx)325 ly[1].set_zorder(nop)326 self.q_ctrl[1].SetValue(str(pos_x))327 328 308 329 309 def _get_cusor_lines(self, event): … … 345 325 dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 346 326 dqmax = math.fabs(event.xdata - self.ly[1].get_xdata()) 347 if not self.is_corfunc: 348 is_qmax = dqmin > dqmax 349 if is_qmax: 350 self.vl_ind = 1 351 else: 352 self.vl_ind = 0 327 is_qmax = dqmin > dqmax 328 if is_qmax: 329 self.vl_ind = 1 353 330 else: 354 dqmax2 = math.fabs(event.xdata - self.ly[2].get_xdata()) 355 closest = min(dqmin, dqmax, dqmax2) 356 self.vl_ind = { dqmin: 0, dqmax: 1, dqmax2: 2 }.get(closest) 331 self.vl_ind = 0 357 332 358 333 def cusor_line(self, event): -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
r6ffa0dd rd85c194 16 16 from sas.sasgui.guiframe.events import EVT_NEW_PLOT 17 17 from sas.sasgui.guiframe.events import EVT_PLOT_QRANGE 18 from sas.sasgui.guiframe.events import EVT_PLOT_LIM19 18 from sas.sasgui.guiframe.events import DeletePlotPanelEvent 20 19 from sas.sasgui.guiframe.plugin_base import PluginBase … … 80 79 self.parent.Bind(EVT_NEW_PLOT, self._on_plot_event) 81 80 self.parent.Bind(EVT_PLOT_QRANGE, self._on_plot_qrange) 82 self.parent.Bind(EVT_PLOT_LIM, self._on_plot_lim)83 81 # We have no initial panels for this plug-in 84 82 return [] … … 97 95 return 98 96 panel.on_plot_qrange(event) 99 100 def _on_plot_lim(self, event=None):101 if event == None:102 return103 if event.id in self.plot_panels.keys():104 panel = self.plot_panels[event.id]105 elif event.group_id in self.plot_panels.keys():106 panel = self.plot_panels[event.group_id]107 else:108 return109 if hasattr(event, 'xlim'):110 panel.subplot.set_xlim(event.xlim)111 if hasattr(event, 'ylim'):112 panel.subplot.set_ylim(event.ylim)113 114 97 115 98 def _on_show_panel(self, event): … … 329 312 new_panel = self.create_2d_panel(data, group_id) 330 313 self.create_panel_helper(new_panel, data, group_id, title) 331 if hasattr(event, 'xlim'):332 new_panel.subplot.set_xlim(event.xlim)333 if hasattr(event, 'ylim'):334 new_panel.subplot.set_ylim(event.ylim)335 314 return -
src/sas/sasgui/guiframe/media/data_formats_help.rst
r280f929 rd85c194 3 3 .. This is a port of the original SasView html help file to ReSTructured text 4 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 .. WG Bouwman, DUT, added during CodeCamp-V in Oct 2016 the SESANS data format6 5 7 6 .. _Formats: … … 10 9 ============ 11 10 12 SasView reads several different 1D (I(Q) vs Q), 2D SANS(I(Qx,Qy) vs (Qx,Qy)) 13 and SESANS (P(z) vs z) 11 SasView reads several different 1D (I(Q) vs Q) and 2D (I(Qx,Qy) vs (Qx,Qy)) 14 12 data files. But please note that SasView does not at present load data where 15 13 the Q and I(Q) data are in separate files. 16 14 17 1D Formats SANS18 ---------- -----15 1D Formats 16 ---------- 19 17 20 18 SasView will read files with 2 to 4 columns of numbers in the following order: … … 48 46 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 49 47 50 2D Formats SANS51 ---------- -----48 2D Formats 49 ---------- 52 50 53 51 SasView will only read files in the NIST 2D format with the extensions … … 62 60 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 63 61 64 SESANS Format 65 ------------- 66 67 The current file extension is .ses or .sesans (not case sensitive). 68 69 The file format is to have a list of name-value pairs as a header at the top of the file, detailing general experimental parameters necessary for fitting and analyzing data. This list should contain all information necessary for the file to be 'portable' between users. 70 71 Following that is a 6 column list of instrument experimental variables: 72 73 - Spin echo length (z, in Angstroms) 74 - Spin echo length error (:math:`\Delta` z, in Angstroms) (experimental resolution) 75 - neutron wavelength (:math:`\lambda`, in Angstroms) (essential for ToF instruments) 76 - neutron wavelength error (:math:`\Delta \lambda`, in Angstroms) 77 - Normalized polarization (:math:`P/P_0`, unitless) 78 - Normalized polarization error (:math:`\Delta(P/P_0)`, unitless) (measurement error) 79 80 81 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 82 83 .. note:: This help document was last changed by Wim Bouwman, 05Oct2016 62 .. note:: This help document was last changed by Steve King, 01May2015 -
src/sas/sasgui/perspectives/calculator/pyconsole.py
rf1cbae7 r7673ecd 9 9 import wx 10 10 from wx.lib.dialogs import ScrolledMessageDialog 11 from wx.lib import layoutf12 13 11 import wx.py.editor as editor 14 12 … … 65 63 title, icon = "Info", wx.ICON_INFORMATION 66 64 text = "\n".join(parts) 67 dlg = ResizableScrolledMessageDialog(parent, text, title, size=((550, 250)))65 dlg = ScrolledMessageDialog(parent, text, title, size=((550, 250))) 68 66 fnt = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL) 69 67 dlg.GetChildren()[0].SetFont(fnt) … … 72 70 dlg.Destroy() 73 71 return errmsg is None 74 75 class ResizableScrolledMessageDialog(wx.Dialog):76 """77 Custom version of wx ScrolledMessageDialog, allowing border resize78 """79 def __init__(self, parent, msg, caption,80 pos=wx.DefaultPosition, size=(500,300),81 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER ):82 # Notice, that style can be overrriden in the caller.83 wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)84 x, y = pos85 if x == -1 and y == -1:86 self.CenterOnScreen(wx.BOTH)87 88 text = wx.TextCtrl(self, -1, msg, style=wx.TE_MULTILINE | wx.TE_READONLY)89 ok = wx.Button(self, wx.ID_OK, "OK")90 91 # Mysterious constraint layouts from92 # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html93 lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok))94 text.SetConstraints(lc)95 lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,))96 ok.SetConstraints(lc)97 98 self.SetAutoLayout(1)99 self.Layout()100 72 101 73 class PyConsole(editor.EditorNotebookFrame): -
src/sas/sasgui/perspectives/fitting/basepage.py
r4c3be25 rc65a265 143 143 self.theory_qmin_x = None 144 144 self.theory_qmax_x = None 145 self.cb1 = None 145 146 self.btEditMask = None 146 147 self.btFit = None … … 1196 1197 # set data, etc. from the state 1197 1198 # reset page between theory and fitting from bookmarking 1199 #if state.data == None: 1200 # data = None 1201 #else: 1198 1202 data = state.data 1199 1203 … … 1221 1225 self.disp_cb_dict = state.disp_cb_dict 1222 1226 self.disp_list = state.disp_list 1227 1228 ## set the state of the radio box 1229 #self.shape_rbutton.SetValue(state.shape_rbutton) 1230 #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 1231 #self.struct_rbutton.SetValue(state.struct_rbutton) 1232 #self.plugin_rbutton.SetValue(state.plugin_rbutton) 1223 1233 1224 1234 ## fill model combobox … … 1276 1286 else: 1277 1287 self.model_view.SetLabel("1D Mode") 1288 1289 ## set the select all check box to the a given state 1290 self.cb1.SetValue(state.cb1) 1278 1291 1279 1292 ## reset state of checkbox,textcrtl and regular parameters value … … 1405 1418 except Exception: 1406 1419 logging.error(traceback.format_exc()) 1420 1421 # Make sure the check box updated when all checked 1422 if self.cb1.GetValue(): 1423 self.select_all_param(None) 1407 1424 1408 1425 def _selectDlg(self): … … 2540 2557 item[2].Enable() 2541 2558 2542 # Make sure the check box updated 2543 self.get_all_checked_params() 2559 # Make sure the check box updated when all checked 2560 if self.cb1.GetValue(): 2561 #self.select_all_param(None) 2562 self.get_all_checked_params() 2544 2563 2545 2564 # update params … … 3696 3715 call back for model selection if implemented 3697 3716 """ 3717 def select_all_param(self, event): 3718 """ 3719 set to true or false all checkBox if implemented 3720 """ 3698 3721 def get_weight_flag(self): 3699 3722 """ -
src/sas/sasgui/perspectives/fitting/fitpage.py
r4c3be25 r6c382da 624 624 ## fill a sizer with the combobox to select dispersion type 625 625 model_disp = wx.StaticText(self, wx.ID_ANY, 'Function') 626 CHECK_STATE = False626 CHECK_STATE = self.cb1.GetValue() 627 627 628 628 ix = 0 … … 969 969 self.state.model = self.model.clone() 970 970 ## save state into 971 self.state.cb1 = self.cb1.GetValue() 971 972 self._copy_parameters_state(self.parameters, self.state.parameters) 972 973 self._copy_parameters_state(self.orientation_params_disp, … … 979 980 StatusEvent(status=" Selected Distribution: Gaussian")) 980 981 #Fill the list of fittable parameters 982 #self.select_all_param(event=None) 981 983 self.get_all_checked_params() 982 984 self.Layout() … … 2693 2695 self._manager.set_param2fit(self.uid, param2fit) 2694 2696 2697 def select_all_param(self, event): 2698 """ 2699 set to true or false all checkBox given the main checkbox value cb1 2700 """ 2701 self.param_toFit = [] 2702 if self.parameters != []: 2703 if self.cb1.GetValue(): 2704 for item in self.parameters: 2705 if item[0].IsShown(): 2706 ## for data2D select all to fit 2707 if self.data.__class__.__name__ == "Data2D" or \ 2708 self.enable2D: 2709 item[0].SetValue(True) 2710 self.param_toFit.append(item) 2711 else: 2712 ## for 1D all parameters except orientation 2713 if not item in self.orientation_params: 2714 item[0].SetValue(True) 2715 self.param_toFit.append(item) 2716 else: 2717 item[0].SetValue(False) 2718 #if len(self.fittable_param)>0: 2719 for item in self.fittable_param: 2720 if item[0].IsShown(): 2721 if self.data.__class__.__name__ == "Data2D" or \ 2722 self.enable2D: 2723 item[0].SetValue(True) 2724 self.param_toFit.append(item) 2725 try: 2726 if len(self.values[item[1]]) > 0: 2727 item[0].SetValue(False) 2728 except: 2729 pass 2730 2731 else: 2732 ## for 1D all parameters except orientation 2733 if not item in self.orientation_params_disp: 2734 item[0].SetValue(True) 2735 self.param_toFit.append(item) 2736 try: 2737 if len(self.values[item[1]]) > 0: 2738 item[0].SetValue(False) 2739 except: 2740 pass 2741 else: 2742 item[0].SetValue(False) 2743 2744 else: 2745 for item in self.parameters: 2746 item[0].SetValue(False) 2747 for item in self.fittable_param: 2748 item[0].SetValue(False) 2749 self.param_toFit = [] 2750 2751 self.save_current_state_fit() 2752 2753 if event != None: 2754 #self._undo.Enable(True) 2755 ## post state to fit panel 2756 event = PageInfoEvent(page=self) 2757 wx.PostEvent(self.parent, event) 2758 param2fit = [] 2759 for item in self.param_toFit: 2760 if item[0] and item[0].IsShown(): 2761 param2fit.append(item[1]) 2762 self.parent._manager.set_param2fit(self.uid, param2fit) 2763 2695 2764 def select_param(self, event): 2696 2765 """ … … 2739 2808 if len(self.fittable_param) > 0: 2740 2809 len_orient_para *= 2 2810 #Set the value of checkbox that selected every checkbox or not 2811 if len(self.parameters) + len(self.fittable_param) - len_orient_para \ 2812 == len(self.param_toFit): 2813 self.cb1.SetValue(True) 2814 else: 2815 self.cb1.SetValue(False) 2741 2816 2742 2817 self.save_current_state_fit() … … 2840 2915 iy = 0 2841 2916 ix = 0 2842 sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Parameter'), 2843 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2917 select_text = "Select All" 2918 self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10)) 2919 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 2920 self.cb1.SetToolTipString("To check/uncheck all the boxes below.") 2921 self.cb1.SetValue(True) 2922 2923 sizer.Add(self.cb1, (iy, ix), (1, 1), \ 2924 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2844 2925 ix += 1 2845 2926 self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value') … … 2868 2949 self.text2_4.Hide() 2869 2950 2870 CHECK_STATE = False2951 CHECK_STATE = self.cb1.GetValue() 2871 2952 for item in keys: 2872 2953 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
rb2a3814 rcbbb6a4 3 3 Writing a Plugin Model 4 4 ====================== 5 6 .. note:: If some code blocks are not readable, expand the documentation window7 5 8 6 Overview
Note: See TracChangeset
for help on using the changeset viewer.