Changes in / [e89aed5:1dbdb83] in sasview
- Files:
-
- 68 added
- 22 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
re04f87b rdf332d8 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.xml 53 /test/sasdataloader/test/isis_1_1_write_test.xml 54 /test/sasdataloader/test/write_test.xml 52 55 53 56 # autogenerated scripts 54 57 /sasview/installer.iss 55 -
build_tools/requirements.txt
r785cc657 rbe4cb41 11 11 bumps==0.7.5.9 12 12 # numpy==1.6.1 13 # scipy==0.10.1 13 scipy>=0.18.0 14 14 # wx==2.8.12.1 15 15 # matplotlib==1.1.0 -
docs/sphinx-docs/build_sphinx.py
r8096b446 r578a11d 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") 37 38 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 38 39 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") … … 71 72 SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 72 73 SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 74 SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user") 73 75 74 76 BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", … … 190 192 shutil.copy(fromhere,tohere) 191 193 194 if os.path.exists(SASMODELS_SOURCE_SESANS): 195 print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS 196 if os.path.exists(SPHINX_SOURCE_USER): 197 print "Found docs folder SPHINX_SOURCE_USER at ", SPHINX_SOURCE_USER 198 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 192 205 if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 193 206 print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM -
docs/sphinx-docs/source/user/analysis.rst
r8f46df7 rec860a8f 1 .. _analysis: 2 1 3 Types of Analysis 2 4 ================= … … 6 8 .. toctree:: 7 9 :maxdepth: 1 8 10 9 11 Model Fitting <sasgui/perspectives/fitting/fitting> 10 12 11 13 P(r) Inversion <sasgui/perspectives/pr/pr_help> 12 14 13 15 Invariant Calculation <sasgui/perspectives/invariant/invariant_help> 16 17 Correlation Function <sasgui/perspectives/corfunc/corfunc_help> -
docs/sphinx-docs/source/user/tools.rst
r8f46df7 rec860a8f 1 .. _tools: 2 1 3 Tools 2 4 ===== … … 8 10 9 11 Data Operations Utility <sasgui/perspectives/calculator/data_operator_help> 10 12 11 13 Density/Volume Calculator <sasgui/perspectives/calculator/density_calculator_help> 12 14 13 15 Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 14 16 15 17 Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 16 18 17 19 Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 18 20 19 21 SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 20 22 21 23 Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 22 24 23 25 Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 24 26 25 27 Python Shell <sasgui/perspectives/calculator/python_shell_help> 26 28 29 File Converter <sasgui/perspectives/file_converter/file_converter_help> -
docs/sphinx-docs/source/user/tutorial.rst
r13161ac rec860a8f 1 1 .. tutorial.rst 2 3 .. _tutorial: 2 4 3 5 Tutorial -
docs/sphinx-docs/source/user/working.rst
rc43953ef r578a11d 19 19 Computations with a GPU <gpu_computations> 20 20 21 Converting SANS to SESANS <sans_to_sesans> 22 -
run.py
r832fea2 r18e7309 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_converter 126 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. 125 131 import sas.sascalc.calculator 126 132 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' ]97 PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv', '.cor'] 98 98 PLUGINS_WLIST = ['Fitting files (*.fitv)|*.fitv', 99 99 'Invariant files (*.inv)|*.inv', 100 'P(r) files (*.prv)|*.prv'] 100 'P(r) files (*.prv)|*.prv', 101 'Corfunc files (*.cor)|*.cor'] 101 102 PLOPANEL_WIDTH = 415 102 103 PLOPANEL_HEIGTH = 370 -
sasview/sasview.py
rcde6e52 rcde6e52 148 148 logging.error(traceback.format_exc()) 149 149 150 # Corfunc perspective 151 try: 152 import sas.sasgui.perspectives.corfunc as module 153 corfunc_plug = module.Plugin() 154 self.gui.add_perspective(corfunc_plug) 155 except: 156 logging.error("Unable to load corfunc module") 157 150 158 #Calculator perspective 151 159 try: … … 155 163 except: 156 164 logging.error("%s: could not find Calculator plug-in module"% \ 165 APP_NAME) 166 logging.error(traceback.format_exc()) 167 168 # File converter tool 169 try: 170 import sas.sasgui.perspectives.file_converter as module 171 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"% \ 157 175 APP_NAME) 158 176 logging.error(traceback.format_exc()) -
sasview/test/README.txt
rd4c88e24 r850a498 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. 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 3 11 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
rdb74ee8 r18e7309 9 9 from distutils.command.build_ext import build_ext 10 10 from distutils.core import Command 11 import numpy 11 12 12 13 # Manage version number ###################################### … … 54 55 print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 55 56 shutil.rmtree(SASVIEW_BUILD) 56 57 57 58 # 'sys.maxsize' and 64bit: Not supported for python2.5 58 59 is_64bits = False 59 60 if sys.version_info >= (2, 6): 60 61 is_64bits = sys.maxsize > 2**32 61 62 62 63 enable_openmp = False 63 64 … … 118 119 c = self.compiler.compiler_type 119 120 print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 120 121 121 122 # OpenMP build options 122 123 if enable_openmp: … … 127 128 for e in self.extensions: 128 129 e.extra_link_args = lopt[ c ] 129 130 130 131 # Platform-specific build options 131 132 if platform_lopt.has_key(c): … … 205 206 ) 206 207 207 208 208 209 # sas.sascalc.pr 209 210 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") … … 217 218 include_dirs=[], 218 219 ) ) 219 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 220 231 # sas.sascalc.fit 221 232 package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") … … 239 250 packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 240 251 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 241 252 242 253 # Data util 243 254 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") … … 294 305 'test/2d_data/*', 295 306 'test/save_states/*', 296 'test/upcoming_formats/*', 307 'test/upcoming_formats/*', 297 308 'default_categories.json'] 298 309 packages.append("sas.sasview") … … 316 327 required.extend(['pillow']) 317 328 318 # Set up SasView 329 # Set up SasView 319 330 setup( 320 331 name="sasview", … … 341 352 'docs': BuildSphinxCommand, 342 353 'disable_openmp': DisableOpenMPCommand} 343 ) 354 ) -
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})1182 1179 if written == True: 1183 1180 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
r479799c r5e906207 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 files 25 27 26 28 :Dependencies: … … 76 78 ## Add the last data set to the list of outputs 77 79 self.add_data_set() 80 ## Close the data file 81 self.raw_data.close() 78 82 ## Return data set(s) 79 83 return self.output … … 183 187 elif key == u'run': 184 188 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_dict 193 except: 194 pass 185 195 elif key == u'title': 186 196 self.current_datainfo.title = data_point … … 189 199 190 200 ## Sample Information 191 elif key == u'Title' and self.parent_class == u'SASsample': 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 192 204 self.current_datainfo.sample.name = data_point 193 205 elif key == u'thickness' and self.parent_class == u'SASsample': … … 195 207 elif key == u'temperature' and self.parent_class == u'SASsample': 196 208 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_point 211 elif key == u'x_position' and self.parent_class == u'SASsample': 212 self.current_datainfo.sample.position.x = data_point 213 elif key == u'y_position' and self.parent_class == u'SASsample': 214 self.current_datainfo.sample.position.y = data_point 215 elif key == u'polar_angle' and self.parent_class == u'SASsample': 216 self.current_datainfo.sample.orientation.x = data_point 217 elif key == u'azimuthal_angle' and self.parent_class == u'SASsample': 218 self.current_datainfo.sample.orientation.z = data_point 219 elif key == u'details' and self.parent_class == u'SASsample': 220 self.current_datainfo.sample.details.append(data_point) 197 221 198 222 ## Instrumental Information … … 204 228 self.detector.distance = float(data_point) 205 229 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 = unit 233 elif key == u'x_position' and self.parent_class == u'SASdetector': 234 self.detector.offset.x = float(data_point) 235 self.detector.offset_unit = unit 236 elif key == u'y_position' and self.parent_class == u'SASdetector': 237 self.detector.offset.y = float(data_point) 238 self.detector.offset_unit = unit 239 elif key == u'polar_angle' and self.parent_class == u'SASdetector': 240 self.detector.orientation.x = float(data_point) 241 self.detector.orientation_unit = unit 242 elif key == u'azimuthal_angle' and self.parent_class == u'SASdetector': 243 self.detector.orientation.z = float(data_point) 244 self.detector.orientation_unit = unit 245 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 = unit 248 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 = unit 251 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 = unit 254 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 = unit 206 257 elif key == u'SSD' and self.parent_class == u'SAScollimation': 207 258 self.collimation.length = data_point … … 213 264 elif key == u'name' and self.parent_class == u'SASprocess': 214 265 self.process.name = data_point 215 elif key == u'Title' and self.parent_class == u'SASprocess': 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 216 269 self.process.name = data_point 217 270 elif key == u'description' and self.parent_class == u'SASprocess': … … 230 283 self.trans_spectrum.wavelength.append(data_point) 231 284 232 ## Other Information285 ## Source 233 286 elif key == u'wavelength' and self.parent_class == u'SASdata': 234 287 self.current_datainfo.source.wavelength = data_point 235 self.current_datainfo.source.wavelength.unit = unit 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 236 309 elif key == u'radiation' and self.parent_class == u'SASsource': 237 310 self.current_datainfo.source.radiation = data_point … … 376 449 self.current_datainfo = DataInfo() 377 450 451 378 452 def _initialize_new_data_set(self, parent_list = None): 379 453 """ -
src/sas/sasgui/guiframe/events.py
rd85c194 r6ffa0dd 8 8 # plot Qrange 9 9 (PlotQrangeEvent, EVT_PLOT_QRANGE) = wx.lib.newevent.NewEvent() 10 # set plot limits 11 (PlotLimitEvent, EVT_PLOT_LIM) = wx.lib.newevent.NewEvent() 10 12 # print the messages on statusbar 11 13 (StatusEvent, EVT_STATUS) = wx.lib.newevent.NewEvent() 12 #create a panel slicer 14 #create a panel slicer 13 15 (SlicerPanelEvent, EVT_SLICER_PANEL) = wx.lib.newevent.NewEvent() 14 #print update paramaters for panel slicer 16 #print update paramaters for panel slicer 15 17 (SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE) = wx.lib.newevent.NewEvent() 16 #update the slicer from the panel 18 #update the slicer from the panel 17 19 (SlicerParameterEvent, EVT_SLICER_PARS) = wx.lib.newevent.NewEvent() 18 20 #slicer event -
src/sas/sasgui/guiframe/gui_statusbar.py
rd85c194 r3a22ce7 6 6 import sys 7 7 import logging 8 import datetime 8 9 from wx import StatusBar as wxStatusB 9 10 from wx.lib import newevent … … 46 47 47 48 self.msg_txt.SetEditable(False) 48 self.msg_txt.SetValue('No message available') 49 timestamp = datetime.datetime.now() 50 status = '{:%Y-%m-%d %H:%M:%S} : No message available'.format(timestamp) 51 self.msg_txt.SetValue(status) 49 52 self.sizer.Add(self.msg_txt, 1, wx.EXPAND|wx.ALL, 10) 50 53 self.SetSizer(self.sizer) … … 60 63 if status.strip() == "": 61 64 return 65 # Add timestamp 66 timestamp = datetime.datetime.now() 67 status = '{:%Y-%m-%d %H:%M:%S} : '.format(timestamp) + status 62 68 color = (0, 0, 0) #black 63 69 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r895c9cb r245ae18 95 95 self.parent.SetFocus() 96 96 97 # If true, there are 3 qrange bars 98 self.is_corfunc = False 99 97 100 98 101 def get_symbol_label(self): … … 214 217 if active_ctrl == None: 215 218 return 219 if hasattr(event, 'is_corfunc'): 220 self.is_corfunc = event.is_corfunc 216 221 if event.id in self.plots.keys(): 217 222 ctrl = event.ctrl … … 222 227 values = [max(x_data.min(), float(ctrl[0].GetValue())), 223 228 min(x_data.max(), float(ctrl[1].GetValue()))] 229 if len(ctrl) == 3: 230 colors.append('purple') 231 values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 224 232 if self.ly == None: 225 233 self.ly = [] … … 232 240 xval = float(active_ctrl.GetValue()) 233 241 position = self.get_data_xy_vals(xval) 234 if position != None :242 if position != None and not self.is_corfunc: 235 243 wx.PostEvent(self.parent, StatusEvent(status=position)) 236 244 except: … … 293 301 ly0x = ly[0].get_xdata() 294 302 ly1x = ly[1].get_xdata() 303 ly2x = None 304 if self.is_corfunc: ly2x = ly[2].get_xdata() 295 305 self.q_ctrl[0].SetBackgroundColour('white') 296 306 self.q_ctrl[1].SetBackgroundColour('white') … … 306 316 self.q_ctrl[0].SetValue(str(pos_x)) 307 317 self.q_ctrl[1].SetBackgroundColour('pink') 318 elif ly2x is not None and ly1x >= ly2x: 319 if self.vl_ind == 1: 320 ly[2].set_xdata(posx) 321 ly[2].set_zorder(nop) 322 self.q_ctrl[2].SetValue(str(pos_x)) 323 elif self.vl_ind == 2: 324 ly[1].set_xdata(posx) 325 ly[1].set_zorder(nop) 326 self.q_ctrl[1].SetValue(str(pos_x)) 327 308 328 309 329 def _get_cusor_lines(self, event): … … 325 345 dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 326 346 dqmax = math.fabs(event.xdata - self.ly[1].get_xdata()) 327 is_qmax = dqmin > dqmax 328 if is_qmax: 329 self.vl_ind = 1 347 if not self.is_corfunc: 348 is_qmax = dqmin > dqmax 349 if is_qmax: 350 self.vl_ind = 1 351 else: 352 self.vl_ind = 0 330 353 else: 331 self.vl_ind = 0 354 dqmax2 = math.fabs(event.xdata - self.ly[2].get_xdata()) 355 closest = min(dqmin, dqmax, dqmax2) 356 self.vl_ind = { dqmin: 0, dqmax: 1, dqmax2: 2 }.get(closest) 332 357 333 358 def cusor_line(self, event): -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
rd85c194 r6ffa0dd 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_LIM 18 19 from sas.sasgui.guiframe.events import DeletePlotPanelEvent 19 20 from sas.sasgui.guiframe.plugin_base import PluginBase … … 79 80 self.parent.Bind(EVT_NEW_PLOT, self._on_plot_event) 80 81 self.parent.Bind(EVT_PLOT_QRANGE, self._on_plot_qrange) 82 self.parent.Bind(EVT_PLOT_LIM, self._on_plot_lim) 81 83 # We have no initial panels for this plug-in 82 84 return [] … … 95 97 return 96 98 panel.on_plot_qrange(event) 99 100 def _on_plot_lim(self, event=None): 101 if event == None: 102 return 103 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 return 109 if hasattr(event, 'xlim'): 110 panel.subplot.set_xlim(event.xlim) 111 if hasattr(event, 'ylim'): 112 panel.subplot.set_ylim(event.ylim) 113 97 114 98 115 def _on_show_panel(self, event): … … 312 329 new_panel = self.create_2d_panel(data, group_id) 313 330 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) 314 335 return -
src/sas/sasgui/guiframe/media/data_formats_help.rst
rd85c194 r280f929 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 format 5 6 6 7 .. _Formats: … … 9 10 ============ 10 11 11 SasView reads several different 1D (I(Q) vs Q) and 2D (I(Qx,Qy) vs (Qx,Qy)) 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) 12 14 data files. But please note that SasView does not at present load data where 13 15 the Q and I(Q) data are in separate files. 14 16 15 1D Formats 16 ---------- 17 1D Formats SANS 18 --------------- 17 19 18 20 SasView will read files with 2 to 4 columns of numbers in the following order: … … 46 48 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 47 49 48 2D Formats 49 ---------- 50 2D Formats SANS 51 --------------- 50 52 51 53 SasView will only read files in the NIST 2D format with the extensions … … 60 62 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 61 63 62 .. note:: This help document was last changed by Steve King, 01May2015 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 -
src/sas/sasgui/perspectives/calculator/pyconsole.py
r7673ecd rf1cbae7 9 9 import wx 10 10 from wx.lib.dialogs import ScrolledMessageDialog 11 from wx.lib import layoutf 12 11 13 import wx.py.editor as editor 12 14 … … 63 65 title, icon = "Info", wx.ICON_INFORMATION 64 66 text = "\n".join(parts) 65 dlg = ScrolledMessageDialog(parent, text, title, size=((550, 250)))67 dlg = ResizableScrolledMessageDialog(parent, text, title, size=((550, 250))) 66 68 fnt = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL) 67 69 dlg.GetChildren()[0].SetFont(fnt) … … 70 72 dlg.Destroy() 71 73 return errmsg is None 74 75 class ResizableScrolledMessageDialog(wx.Dialog): 76 """ 77 Custom version of wx ScrolledMessageDialog, allowing border resize 78 """ 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 = pos 85 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 from 92 # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 93 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() 72 100 73 101 class PyConsole(editor.EditorNotebookFrame): -
src/sas/sasgui/perspectives/fitting/basepage.py
rc65a265 r4c3be25 143 143 self.theory_qmin_x = None 144 144 self.theory_qmax_x = None 145 self.cb1 = None146 145 self.btEditMask = None 147 146 self.btFit = None … … 1197 1196 # set data, etc. from the state 1198 1197 # reset page between theory and fitting from bookmarking 1199 #if state.data == None:1200 # data = None1201 #else:1202 1198 data = state.data 1203 1199 … … 1225 1221 self.disp_cb_dict = state.disp_cb_dict 1226 1222 self.disp_list = state.disp_list 1227 1228 ## set the state of the radio box1229 #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)1233 1223 1234 1224 ## fill model combobox … … 1286 1276 else: 1287 1277 self.model_view.SetLabel("1D Mode") 1288 1289 ## set the select all check box to the a given state1290 self.cb1.SetValue(state.cb1)1291 1278 1292 1279 ## reset state of checkbox,textcrtl and regular parameters value … … 1418 1405 except Exception: 1419 1406 logging.error(traceback.format_exc()) 1420 1421 # Make sure the check box updated when all checked1422 if self.cb1.GetValue():1423 self.select_all_param(None)1424 1407 1425 1408 def _selectDlg(self): … … 2557 2540 item[2].Enable() 2558 2541 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() 2542 # Make sure the check box updated 2543 self.get_all_checked_params() 2563 2544 2564 2545 # update params … … 3715 3696 call back for model selection if implemented 3716 3697 """ 3717 def select_all_param(self, event):3718 """3719 set to true or false all checkBox if implemented3720 """3721 3698 def get_weight_flag(self): 3722 3699 """ -
src/sas/sasgui/perspectives/fitting/fitpage.py
r6c382da r4c3be25 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 = self.cb1.GetValue()626 CHECK_STATE = False 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()972 971 self._copy_parameters_state(self.parameters, self.state.parameters) 973 972 self._copy_parameters_state(self.orientation_params_disp, … … 980 979 StatusEvent(status=" Selected Distribution: Gaussian")) 981 980 #Fill the list of fittable parameters 982 #self.select_all_param(event=None)983 981 self.get_all_checked_params() 984 982 self.Layout() … … 2695 2693 self._manager.set_param2fit(self.uid, param2fit) 2696 2694 2697 def select_all_param(self, event):2698 """2699 set to true or false all checkBox given the main checkbox value cb12700 """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 fit2707 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 orientation2713 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 pass2730 2731 else:2732 ## for 1D all parameters except orientation2733 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 pass2741 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 panel2756 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 2764 2695 def select_param(self, event): 2765 2696 """ … … 2808 2739 if len(self.fittable_param) > 0: 2809 2740 len_orient_para *= 2 2810 #Set the value of checkbox that selected every checkbox or not2811 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)2816 2741 2817 2742 self.save_current_state_fit() … … 2915 2840 iy = 0 2916 2841 ix = 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) 2842 sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Parameter'), 2843 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2925 2844 ix += 1 2926 2845 self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value') … … 2949 2868 self.text2_4.Hide() 2950 2869 2951 CHECK_STATE = self.cb1.GetValue()2870 CHECK_STATE = False 2952 2871 for item in keys: 2953 2872 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
rcbbb6a4 rb2a3814 3 3 Writing a Plugin Model 4 4 ====================== 5 6 .. note:: If some code blocks are not readable, expand the documentation window 5 7 6 8 Overview
Note: See TracChangeset
for help on using the changeset viewer.