Changes in / [21e71f1:fb39f28] in sasview
- Files:
-
- 3 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r5f9e874 rf1b696d 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
r8c85ac1 r133812c7 661 661 data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 662 662 data.yaxis('\\rm{Intensity}', 'cm^{-1}') 663 663 plot1D = Plotter(self, quickplot=True) 664 plot1D.plot(data) 665 plot1D.show() 664 666 self.graph_num += 1 667 # TODO 668 print('TRANSFER OF DATA TO MAIN PANEL TO BE IMPLEMENTED') 669 return plot1D 665 670 else: 666 671 numpy.nan_to_num(self.data_to_plot) … … 674 679 data.title = "GenSAS {} #{} 2D".format(self.file_name, 675 680 int(self.graph_num)) 676 zeros = numpy.ones(data.data.size, dtype=bool)677 data.mask = zeros678 681 plot2D = Plotter2D(self, quickplot=True) 682 plot2D.plot(data) 683 plot2D.show() 679 684 self.graph_num += 1 680 685 # TODO 681 new_item = GuiUtils.createModelItemWithPlot(data, name=data.title)682 self.communicator.updateModelFromPerspectiveSignal.emit(new_item)683 self.communicator.forcePlotDisplaySignal.emit([new_item, data]) 686 print('TRANSFER OF DATA TO MAIN PANEL TO BE IMPLEMENTED') 687 return plot2D 688 684 689 685 690 class Plotter3DWidget(PlotterBase): -
src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py
rba400d1 r53c771e 1 1 # global 2 import os3 2 from PyQt5 import QtCore 4 3 from PyQt5 import QtGui … … 59 58 filenames=[] 60 59 for url in event.mimeData().urls(): 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) 60 filenames.append(url.toLocalFile()) 69 61 self.communicator.fileReadSignal.emit(filenames) 70 62 event.accept() -
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r442a9ae r442a9ae 1 1 import logging 2 import copy3 2 4 3 from twisted.internet import threads … … 408 407 409 408 # Show the grid panel 410 page_name = "ConstSimulPage" 411 results = copy.deepcopy(result[0]) 412 results.append(page_name) 413 self.parent.communicate.sendDataToGridSignal.emit(results) 409 self.parent.communicate.sendDataToGridSignal.emit(result[0]) 414 410 415 411 msg = "Fitting completed successfully in: %s s.\n" % GuiUtils.formatNumber(elapsed) -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r7f41584 r65759c7 368 368 cbox = createFixedChoiceComboBox(par, row) 369 369 370 # Apply combobox if required371 if None not in (view, cbox):372 # set the min/max cell to be empty373 item3.setText("")374 item4.setText("")375 376 370 # Always add to the model 377 371 if row_num is None: … … 381 375 row_num += 1 382 376 383 if cbox is not None: 377 # Apply combobox if required 378 if None not in (view, cbox): 384 379 view.setIndexWidget(item2.index(), cbox) 385 380 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r7f41584 r442a9ae 1595 1595 1596 1596 # Show the grid panel 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) 1597 self.communicate.sendDataToGridSignal.emit(result[0]) 1601 1598 1602 1599 elapsed = result[1] … … 2659 2656 2660 2657 # Disable buttons/table 2661 self.disableInteractiveElements OnCalculate()2658 self.disableInteractiveElements() 2662 2659 # Awful API to a backend method. 2663 2660 calc_thread = self.methodCalculateForData()(data=data, … … 3194 3191 # cell 3: min value 3195 3192 item3 = QtGui.QStandardItem() 3196 # set the cell to be non-editable3197 item3.setFlags(item3.flags() ^ QtCore.Qt.ItemIsEditable)3198 3193 3199 3194 # cell 4: max value 3200 3195 item4 = QtGui.QStandardItem() 3201 # set the cell to be non-editable3202 item4.setFlags(item4.flags() ^ QtCore.Qt.ItemIsEditable)3203 3196 3204 3197 # cell 4: SLD button … … 3240 3233 # no info about limits 3241 3234 pass 3242 except OverflowError:3243 # Try to limit shell_par, if possible3244 if float(shell_par.limits[1])==np.inf:3245 shell_max = 93246 logging.warning("Limiting shell count to 9.")3247 3235 except Exception as ex: 3248 3236 logging.error("Badly defined multiplicity: "+ str(ex)) … … 3386 3374 self.cmdFit.setStyleSheet('QPushButton {color: red;}') 3387 3375 self.cmdFit.setText('Stop fit') 3388 self.setInteractiveElements(False)3389 3390 def disableInteractiveElementsOnCalculate(self):3391 """3392 Set buttion caption on fitting/calculate start3393 Disable the param table(s)3394 """3395 # Notify the user that fitting is being run3396 # Allow for stopping the job3397 self.cmdFit.setStyleSheet('QPushButton {color: red;}')3398 self.cmdFit.setText('Running...')3399 3376 self.setInteractiveElements(False) 3400 3377 -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
r7f41584 r722b7d6 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 set99 if not (index.flags() & QtCore.Qt.ItemIsEditable):100 return None101 97 102 98 return super(ModelViewDelegate, self).createEditor(widget, option, index) -
src/sas/qtgui/Perspectives/Fitting/media/fitting_help.rst
r3b0b17e r00a40bd 125 125 126 126 For a complete list of all the library models available in SasView, see 127 the `Model Documentation < models/index.html>`_ .127 the `Model Documentation <../../../index.html>`_ . 128 128 129 129 It is also possible to add your own models. -
src/sas/qtgui/Plotting/Plotter.py
rc30822c r3b95b3b 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)607 602 608 603 def onMplMouseUp(self, event): -
src/sas/qtgui/Plotting/Plotter2D.py
rc30822c r133812c7 107 107 zmax=zmax_2D_temp, show_colorbar=show_colorbar, 108 108 update=update) 109 110 self.updateCircularAverage()111 109 112 110 def calculateDepth(self): … … 242 240 self.slicer_widget.show() 243 241 244 def circularAverage(self):245 """ 246 Calculate the circular average and create the Data object for it242 def onCircularAverage(self): 243 """ 244 Perform circular averaging on Data2D 247 245 """ 248 246 # Find the best number of bins … … 283 281 new_plot.id = "Circ avg " + self.data.name 284 282 new_plot.is_data = True 285 286 return new_plot287 288 def onCircularAverage(self):289 """290 Perform circular averaging on Data2D291 """292 new_plot = self.circularAverage()293 294 283 item = self._item 295 284 if self._item.parent() is not None: 296 285 item = self._item.parent() 297 298 286 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 299 287 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 change306 """307 if not hasattr(self,'_item'): return308 item = self._item309 if self._item.parent() is not None:310 item = self._item.parent()311 312 # Get all plots for current item313 plots = GuiUtils.plotsFromModel("", item)314 if plots is None: return315 ca_caption = '2daverage'+self.data.name316 # See if current item plots contain 2D average plot317 has_plot = False318 for plot in plots:319 if plot.group_id is None: continue320 if ca_caption in plot.group_id: has_plot=True321 # return prematurely if no circular average plot found322 if not has_plot: return323 324 # Create a new plot325 new_plot = self.circularAverage()326 327 # Overwrite existing plot328 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id)329 # Show the new plot, if already visible330 288 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 331 289 … … 578 536 self.plot(data=new_plot) 579 537 580 def onMplMouseDown(self, event):581 """582 Display x/y/intensity on click583 """584 # Check that the LEFT button was pressed585 if event.button != 1:586 return587 588 if event.inaxes is None:589 return590 x_click = 0.0591 y_click = 0.0592 try:593 x_click = float(event.xdata) # / size_x594 y_click = float(event.ydata) # / size_y595 except:596 self.position = None597 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)601 538 602 539 class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): -
src/sas/qtgui/Utilities/GridPanel.py
rc4c4957 r75906a1 126 126 return 127 127 128 def addTabPage(self , name=None):128 def addTabPage(self): 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 if name is not None: 144 tab_name = name 145 else: 146 tab_name = "Tab " + str(self.tab_number) 143 tab_name = "Tab " + str(self.tab_number) 147 144 # each table needs separate slots. 148 145 tab_widget.customContextMenuRequested.connect(self.showContextMenu) … … 156 153 Create a new tab with batch fitting results 157 154 """ 158 # pull out page name from results159 page_name = None160 if len(results)>=2:161 if isinstance(results[-1], str):162 page_name = results[-1]163 _ = results.pop(-1)164 165 155 if self.has_data: 166 self.addTabPage(name=page_name) 167 else: 168 self.tabWidget.setTabText(0, page_name) 156 self.addTabPage() 169 157 # Update the new widget 170 158 # Fill in the table from input data in the last/newest page -
src/sas/sascalc/dataloader/file_reader_base_class.py
rbe7c981 rb8080e1 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 y_data)278 dataset.ymax = np.max(dataset.qx_data) 279 279 280 280 def format_unit(self, unit=None): -
src/sas/sascalc/pr/fit/BumpsFitting.py
r57a91fc r9a5097c 2 2 BumpsFitting module runs the bumps optimizer. 3 3 """ 4 from __future__ import division5 6 4 import os 7 5 from datetime import timedelta, datetime … … 36 34 class Progress(object): 37 35 def __init__(self, history, max_step, pars, dof): 38 remaining_time = int(history.time[0]*( max_step/history.step[0]-1))36 remaining_time = int(history.time[0]*(float(max_step)/history.step[0]-1)) 39 37 # Depending on the time remaining, either display the expected 40 38 # time of completion, or the amount of time remaining. Use precision -
src/sas/sascalc/pr/fit/Loader.py
r57a91fc r574adc7 1 """2 class Loader to load any kind of file3 """4 5 1 from __future__ import print_function 6 2 3 # class Loader to load any king of file 4 #import wx 5 #import string 7 6 import numpy as np 8 7 -
src/sas/sascalc/pr/invertor.py
r57a91fc raed159f 6 6 FIXME: The way the Invertor interacts with its C component should be cleaned up 7 7 """ 8 from __future__ import division9 8 10 9 import numpy as np … … 424 423 A[i][j] = (Fourier transformed base function for point j) 425 424 426 We the nchoose a number of r-points, n_r, to evaluate the second425 We them choose a number of r-points, n_r, to evaluate the second 427 426 derivative of P(r) at. This is used as our regularization term. 428 427 For a vector r of length n_r, the following n_r rows are set to :: … … 481 480 482 481 # Perform the inversion (least square fit) 483 c, chi2, _, _ = lstsq(a, b , rcond=-1)482 c, chi2, _, _ = lstsq(a, b) 484 483 # Sanity check 485 484 try: … … 504 503 try: 505 504 cov = np.linalg.pinv(inv_cov) 506 err = math.fabs(chi2 / (npts - nfunc)) * cov507 except Exception as exc:505 err = math.fabs(chi2 / float(npts - nfunc)) * cov 506 except: 508 507 # We were not able to estimate the errors 509 508 # Return an empty error matrix … … 549 548 try: 550 549 return estimator.num_terms(isquit_func) 551 except Exception as exc:550 except: 552 551 # If we fail, estimate alpha and return the default 553 552 # number of terms -
src/sas/sascalc/pr/num_term.py
r57a91fc rb8080e1 1 from __future__ import print_function , division1 from __future__ import print_function 2 2 3 3 import math … … 51 51 osc = self.sort_osc() 52 52 dv = len(osc) 53 med = 0.5*dv53 med = float(dv) / 2.0 54 54 odd = self.is_odd(dv) 55 55 medi = 0 … … 140 140 nts = self.compare_err() 141 141 div = len(nts) 142 tem = 0.5*div142 tem = float(div) / 2.0 143 143 if self.is_odd(div): 144 144 nt = nts[int(tem)]
Note: See TracChangeset
for help on using the changeset viewer.