Changes in / [fb39f28:21e71f1] in sasview
- Files:
-
- 3 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
rf1b696d r5f9e874 30 30 SPHINX_BUILD = joinpath(SPHINX_ROOT, "build") 31 31 SPHINX_SOURCE = joinpath(SPHINX_ROOT, "source-temp") 32 SPHINX_PERSPECTIVES = joinpath(SPHINX_SOURCE, "user", "qtgui", " perspectives")32 SPHINX_PERSPECTIVES = joinpath(SPHINX_SOURCE, "user", "qtgui", "Perspectives") 33 33 34 34 # sasview paths … … 51 51 SASMODELS_DEV_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasmodels-dev") 52 52 SASMODELS_GUIDE_SOURCE = joinpath(SASMODELS_DOCS, "guide") 53 SASMODELS_GUIDE_TARGET = joinpath(SPHINX_PERSPECTIVES, " fitting")53 SASMODELS_GUIDE_TARGET = joinpath(SPHINX_PERSPECTIVES, "Fitting") 54 54 SASMODELS_GUIDE_EXCLUDE = [ 55 55 "index.rst", "install.rst", "intro.rst", … … 59 59 BUMPS_DOCS = joinpath(SASVIEW_ROOT, "..", "bumps", "doc") 60 60 BUMPS_SOURCE = joinpath(BUMPS_DOCS, "guide") 61 BUMPS_TARGET = joinpath(SPHINX_PERSPECTIVES, " fitting")61 BUMPS_TARGET = joinpath(SPHINX_PERSPECTIVES, "Fitting") 62 62 63 63 run = imp.load_source('run', joinpath(SASVIEW_ROOT, 'run.py')) -
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
r133812c7 r8c85ac1 661 661 data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 662 662 data.yaxis('\\rm{Intensity}', 'cm^{-1}') 663 plot1D = Plotter(self, quickplot=True) 664 plot1D.plot(data) 665 plot1D.show() 663 666 664 self.graph_num += 1 667 # TODO668 print('TRANSFER OF DATA TO MAIN PANEL TO BE IMPLEMENTED')669 return plot1D670 665 else: 671 666 numpy.nan_to_num(self.data_to_plot) … … 679 674 data.title = "GenSAS {} #{} 2D".format(self.file_name, 680 675 int(self.graph_num)) 681 plot2D = Plotter2D(self, quickplot=True)682 plot2D.plot(data)683 plot2D.show() 676 zeros = numpy.ones(data.data.size, dtype=bool) 677 data.mask = zeros 678 684 679 self.graph_num += 1 685 680 # TODO 686 print('TRANSFER OF DATA TO MAIN PANEL TO BE IMPLEMENTED')687 return plot2D688 681 new_item = GuiUtils.createModelItemWithPlot(data, name=data.title) 682 self.communicator.updateModelFromPerspectiveSignal.emit(new_item) 683 self.communicator.forcePlotDisplaySignal.emit([new_item, data]) 689 684 690 685 class Plotter3DWidget(PlotterBase): -
src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py
r53c771e rba400d1 1 1 # global 2 import os 2 3 from PyQt5 import QtCore 3 4 from PyQt5 import QtGui … … 58 59 filenames=[] 59 60 for url in event.mimeData().urls(): 60 filenames.append(url.toLocalFile()) 61 files = url.toLocalFile() 62 if os.path.isdir(files): 63 # get content of dir into a list 64 content = [os.path.join(os.path.abspath(files), filename) 65 for filename in os.listdir(files)] 66 filenames += content 67 else: 68 filenames.append(files) 61 69 self.communicator.fileReadSignal.emit(filenames) 62 70 event.accept() -
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r442a9ae r442a9ae 1 1 import logging 2 import copy 2 3 3 4 from twisted.internet import threads … … 407 408 408 409 # Show the grid panel 409 self.parent.communicate.sendDataToGridSignal.emit(result[0]) 410 page_name = "ConstSimulPage" 411 results = copy.deepcopy(result[0]) 412 results.append(page_name) 413 self.parent.communicate.sendDataToGridSignal.emit(results) 410 414 411 415 msg = "Fitting completed successfully in: %s s.\n" % GuiUtils.formatNumber(elapsed) -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r65759c7 r7f41584 368 368 cbox = createFixedChoiceComboBox(par, row) 369 369 370 # Apply combobox if required 371 if None not in (view, cbox): 372 # set the min/max cell to be empty 373 item3.setText("") 374 item4.setText("") 375 370 376 # Always add to the model 371 377 if row_num is None: … … 375 381 row_num += 1 376 382 377 # Apply combobox if required 378 if None not in (view, cbox): 383 if cbox is not None: 379 384 view.setIndexWidget(item2.index(), cbox) 380 385 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r442a9ae r7f41584 1595 1595 1596 1596 # Show the grid panel 1597 self.communicate.sendDataToGridSignal.emit(result[0]) 1597 page_name = "BatchPage" + str(self.tab_id) 1598 results = copy.deepcopy(result[0]) 1599 results.append(page_name) 1600 self.communicate.sendDataToGridSignal.emit(results) 1598 1601 1599 1602 elapsed = result[1] … … 2656 2659 2657 2660 # Disable buttons/table 2658 self.disableInteractiveElements ()2661 self.disableInteractiveElementsOnCalculate() 2659 2662 # Awful API to a backend method. 2660 2663 calc_thread = self.methodCalculateForData()(data=data, … … 3191 3194 # cell 3: min value 3192 3195 item3 = QtGui.QStandardItem() 3196 # set the cell to be non-editable 3197 item3.setFlags(item3.flags() ^ QtCore.Qt.ItemIsEditable) 3193 3198 3194 3199 # cell 4: max value 3195 3200 item4 = QtGui.QStandardItem() 3201 # set the cell to be non-editable 3202 item4.setFlags(item4.flags() ^ QtCore.Qt.ItemIsEditable) 3196 3203 3197 3204 # cell 4: SLD button … … 3233 3240 # no info about limits 3234 3241 pass 3242 except OverflowError: 3243 # Try to limit shell_par, if possible 3244 if float(shell_par.limits[1])==np.inf: 3245 shell_max = 9 3246 logging.warning("Limiting shell count to 9.") 3235 3247 except Exception as ex: 3236 3248 logging.error("Badly defined multiplicity: "+ str(ex)) … … 3374 3386 self.cmdFit.setStyleSheet('QPushButton {color: red;}') 3375 3387 self.cmdFit.setText('Stop fit') 3388 self.setInteractiveElements(False) 3389 3390 def disableInteractiveElementsOnCalculate(self): 3391 """ 3392 Set buttion caption on fitting/calculate start 3393 Disable the param table(s) 3394 """ 3395 # Notify the user that fitting is being run 3396 # Allow for stopping the job 3397 self.cmdFit.setStyleSheet('QPushButton {color: red;}') 3398 self.cmdFit.setText('Running...') 3376 3399 self.setInteractiveElements(False) 3377 3400 -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
r722b7d6 r7f41584 95 95 # Set some columns uneditable 96 96 return None 97 if index.column() in (self.param_min, self.param_max): 98 # Check if the edit role is set 99 if not (index.flags() & QtCore.Qt.ItemIsEditable): 100 return None 97 101 98 102 return super(ModelViewDelegate, self).createEditor(widget, option, index) -
src/sas/qtgui/Perspectives/Fitting/media/fitting_help.rst
r00a40bd r3b0b17e 125 125 126 126 For a complete list of all the library models available in SasView, see 127 the `Model Documentation < ../../../index.html>`_ .127 the `Model Documentation <models/index.html>`_ . 128 128 129 129 It is also possible to add your own models. -
src/sas/qtgui/Plotting/Plotter.py
r3b95b3b rc30822c 600 600 except: 601 601 self.position = None 602 603 x_str = GuiUtils.formatNumber(self.x_click) 604 y_str = GuiUtils.formatNumber(self.y_click) 605 coord_str = "x: {}, y: {}".format(x_str, y_str) 606 self.manager.communicator.statusBarUpdateSignal.emit(coord_str) 602 607 603 608 def onMplMouseUp(self, event): -
src/sas/qtgui/Plotting/Plotter2D.py
r133812c7 rc30822c 107 107 zmax=zmax_2D_temp, show_colorbar=show_colorbar, 108 108 update=update) 109 110 self.updateCircularAverage() 109 111 110 112 def calculateDepth(self): … … 240 242 self.slicer_widget.show() 241 243 242 def onCircularAverage(self):243 """ 244 Perform circular averaging on Data2D244 def circularAverage(self): 245 """ 246 Calculate the circular average and create the Data object for it 245 247 """ 246 248 # Find the best number of bins … … 281 283 new_plot.id = "Circ avg " + self.data.name 282 284 new_plot.is_data = True 285 286 return new_plot 287 288 def onCircularAverage(self): 289 """ 290 Perform circular averaging on Data2D 291 """ 292 new_plot = self.circularAverage() 293 283 294 item = self._item 284 295 if self._item.parent() is not None: 285 296 item = self._item.parent() 297 286 298 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 287 299 300 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 301 self.manager.communicator.forcePlotDisplaySignal.emit([item, new_plot]) 302 303 def updateCircularAverage(self): 304 """ 305 Update circular averaging plot on Data2D change 306 """ 307 if not hasattr(self,'_item'): return 308 item = self._item 309 if self._item.parent() is not None: 310 item = self._item.parent() 311 312 # Get all plots for current item 313 plots = GuiUtils.plotsFromModel("", item) 314 if plots is None: return 315 ca_caption = '2daverage'+self.data.name 316 # See if current item plots contain 2D average plot 317 has_plot = False 318 for plot in plots: 319 if plot.group_id is None: continue 320 if ca_caption in plot.group_id: has_plot=True 321 # return prematurely if no circular average plot found 322 if not has_plot: return 323 324 # Create a new plot 325 new_plot = self.circularAverage() 326 327 # Overwrite existing plot 328 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 329 # Show the new plot, if already visible 288 330 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 289 331 … … 536 578 self.plot(data=new_plot) 537 579 580 def onMplMouseDown(self, event): 581 """ 582 Display x/y/intensity on click 583 """ 584 # Check that the LEFT button was pressed 585 if event.button != 1: 586 return 587 588 if event.inaxes is None: 589 return 590 x_click = 0.0 591 y_click = 0.0 592 try: 593 x_click = float(event.xdata) # / size_x 594 y_click = float(event.ydata) # / size_y 595 except: 596 self.position = None 597 x_str = GuiUtils.formatNumber(x_click) 598 y_str = GuiUtils.formatNumber(y_click) 599 coord_str = "x: {}, y: {}".format(x_str, y_str) 600 self.manager.communicator.statusBarUpdateSignal.emit(coord_str) 538 601 539 602 class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): -
src/sas/qtgui/Utilities/GridPanel.py
r75906a1 rc4c4957 126 126 return 127 127 128 def addTabPage(self ):128 def addTabPage(self, name=None): 129 129 """ 130 130 Add new tab page with QTableWidget … … 141 141 # However, some models have LONG names, which doesn't look well on the tab bar. 142 142 self.tab_number += 1 143 tab_name = "Tab " + str(self.tab_number) 143 if name is not None: 144 tab_name = name 145 else: 146 tab_name = "Tab " + str(self.tab_number) 144 147 # each table needs separate slots. 145 148 tab_widget.customContextMenuRequested.connect(self.showContextMenu) … … 153 156 Create a new tab with batch fitting results 154 157 """ 158 # pull out page name from results 159 page_name = None 160 if len(results)>=2: 161 if isinstance(results[-1], str): 162 page_name = results[-1] 163 _ = results.pop(-1) 164 155 165 if self.has_data: 156 self.addTabPage() 166 self.addTabPage(name=page_name) 167 else: 168 self.tabWidget.setTabText(0, page_name) 157 169 # Update the new widget 158 170 # Fill in the table from input data in the last/newest page -
src/sas/sascalc/dataloader/file_reader_base_class.py
rb8080e1 rbe7c981 276 276 dataset.xmax = np.max(dataset.qx_data) 277 277 dataset.ymin = np.min(dataset.qy_data) 278 dataset.ymax = np.max(dataset.q x_data)278 dataset.ymax = np.max(dataset.qy_data) 279 279 280 280 def format_unit(self, unit=None): -
src/sas/sascalc/pr/fit/BumpsFitting.py
r9a5097c r57a91fc 2 2 BumpsFitting module runs the bumps optimizer. 3 3 """ 4 from __future__ import division 5 4 6 import os 5 7 from datetime import timedelta, datetime … … 34 36 class Progress(object): 35 37 def __init__(self, history, max_step, pars, dof): 36 remaining_time = int(history.time[0]*( float(max_step)/history.step[0]-1))38 remaining_time = int(history.time[0]*(max_step/history.step[0]-1)) 37 39 # Depending on the time remaining, either display the expected 38 40 # time of completion, or the amount of time remaining. Use precision -
src/sas/sascalc/pr/fit/Loader.py
r574adc7 r57a91fc 1 """ 2 class Loader to load any kind of file 3 """ 4 1 5 from __future__ import print_function 2 6 3 # class Loader to load any king of file4 #import wx5 #import string6 7 import numpy as np 7 8 -
src/sas/sascalc/pr/invertor.py
raed159f r57a91fc 6 6 FIXME: The way the Invertor interacts with its C component should be cleaned up 7 7 """ 8 from __future__ import division 8 9 9 10 import numpy as np … … 423 424 A[i][j] = (Fourier transformed base function for point j) 424 425 425 We the mchoose a number of r-points, n_r, to evaluate the second426 We then choose a number of r-points, n_r, to evaluate the second 426 427 derivative of P(r) at. This is used as our regularization term. 427 428 For a vector r of length n_r, the following n_r rows are set to :: … … 480 481 481 482 # Perform the inversion (least square fit) 482 c, chi2, _, _ = lstsq(a, b )483 c, chi2, _, _ = lstsq(a, b, rcond=-1) 483 484 # Sanity check 484 485 try: … … 503 504 try: 504 505 cov = np.linalg.pinv(inv_cov) 505 err = math.fabs(chi2 / float(npts - nfunc)) * cov506 except :506 err = math.fabs(chi2 / (npts - nfunc)) * cov 507 except Exception as exc: 507 508 # We were not able to estimate the errors 508 509 # Return an empty error matrix … … 548 549 try: 549 550 return estimator.num_terms(isquit_func) 550 except :551 except Exception as exc: 551 552 # If we fail, estimate alpha and return the default 552 553 # number of terms -
src/sas/sascalc/pr/num_term.py
rb8080e1 r57a91fc 1 from __future__ import print_function 1 from __future__ import print_function, division 2 2 3 3 import math … … 51 51 osc = self.sort_osc() 52 52 dv = len(osc) 53 med = float(dv) / 2.053 med = 0.5*dv 54 54 odd = self.is_odd(dv) 55 55 medi = 0 … … 140 140 nts = self.compare_err() 141 141 div = len(nts) 142 tem = float(div) / 2.0142 tem = 0.5*div 143 143 if self.is_odd(div): 144 144 nt = nts[int(tem)]
Note: See TracChangeset
for help on using the changeset viewer.