Changeset ecfe6b6 in sasview for src/sas/qtgui/MainWindow


Ignore:
Timestamp:
Aug 13, 2018 10:02:02 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
799963c
Parents:
4e255d1 (diff), e752ab8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ESS_GUI_iss976' into ESS_GUI.

SASVIEW-976: Make intermediate data from product models (i.e. P(Q) and S(Q)) plottable.

Location:
src/sas/qtgui/MainWindow
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    rc7f259d recfe6b6  
    44import time 
    55import logging 
     6import re 
    67 
    78from PyQt5 import QtCore 
     
    3637    # The controller which is responsible for managing signal slots connections 
    3738    # for the gui and providing an interface to the data model. 
     39 
     40    # This matches the ID of a plot created using FittingLogic._create1DPlot, e.g. 
     41    # "5 [P(Q)] modelname" 
     42    # or 
     43    # "4 modelname". 
     44    # Useful for determining whether the plot in question is for an intermediate result, such as P(Q) or S(Q) in the 
     45    # case of a product model; the identifier for this is held in square brackets, as in the example above. 
     46    theory_plot_ID_pattern = re.compile(r"^([0-9]+)\s+(\[(.*)\]\s+)?(.*)$") 
    3847 
    3948    def __init__(self, parent=None, guimanager=None, manager=None): 
     
    525534                self.active_plots[plot_id].replacePlot(plot_id, plot) 
    526535            else: 
     536                # Don't plot intermediate results, e.g. P(Q), S(Q) 
     537                match = self.theory_plot_ID_pattern.match(plot_id) 
     538                # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 
     539                if match and match.groups()[1] != None: 
     540                    continue 
    527541                # 'sophisticated' test to generate standalone plot for residuals 
    528542                if 'esiduals' in plot.title: 
  • src/sas/qtgui/MainWindow/DataManager.py

    r0261bc1 r4e255d1  
    2424import json 
    2525import time 
    26 from io import StringIO 
     26from io import BytesIO 
    2727import numpy as np 
    2828 
     
    368368            # ndarray 
    369369            if isinstance(o, np.ndarray): 
    370                 buffer = StringIO() 
     370                buffer = BytesIO() 
    371371                np.save(buffer, o) 
    372372                buffer.seek(0) 
     
    435435            # ndarray 
    436436            if cls == np.ndarray: 
    437                 buffer = StringIO() 
     437                buffer = BytesIO() 
    438438                buffer.write(data['data'].encode('latin-1')) 
    439439                buffer.seek(0) 
Note: See TracChangeset for help on using the changeset viewer.