Changeset 0e0c645 in sasview


Ignore:
Timestamp:
Mar 26, 2019 3:35:43 PM (4 months ago)
Author:
Jeff Krzywon <jkrzywon@…>
Branches:
ticket-1243
Children:
cc2cd5a
Parents:
2b3eb3d
Message:

Fix for loading 2D saved projects and small clean up of cansas XML reader.

Location:
src/sas/sascalc/dataloader
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/data_info.py

    r4fdcc65 r0e0c645  
    11881188        final_dataset.yaxis(data._yaxis, data._yunit) 
    11891189        final_dataset.zaxis(data._zaxis, data._zunit) 
    1190         final_dataset.y_bins = data.y_bins 
    1191         final_dataset.x_bins = data.x_bins 
    11921190    else: 
    11931191        return_string = ("Should Never Happen: _combine_data_info_with_plottabl" 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r2b3eb3d r0e0c645  
    1717# For saving individual sections of data 
    1818from ..data_info import Data1D, Data2D, DataInfo, plottable_1D, plottable_2D, \ 
    19     Collimation, TransmissionSpectrum, Detector, Process, Aperture, \ 
    20     combine_data_info_with_plottable as combine_data 
     19    Collimation, TransmissionSpectrum, Detector, Process, Aperture 
    2120from ..loader_exceptions import FileContentsException, DefaultReaderException, \ 
    2221    DataReaderException 
    2322from . import xml_reader 
    2423from .xml_reader import XMLreader 
    25 from .cansas_constants import CansasConstants, CurrentLevel 
     24from .cansas_constants import CansasConstants 
    2625 
    2726logger = logging.getLogger(__name__) 
     
    5958    type = ["XML files (*.xml)|*.xml", "SasView Save Files (*.svs)|*.svs"] 
    6059    # List of allowed extensions 
    61     ext = ['.xml', '.XML', '.svs', '.SVS'] 
     60    ext = ['.xml', '.svs'] 
    6261    # Flag to bypass extension check 
    6362    allow_all = True 
     
    8180        self.encoding = None 
    8281 
    83     def read(self, xml_file, schema_path="", invalid=True): 
     82    def _read(self, xml_file, schema_path="", invalid=True): 
    8483        if schema_path != "" or not invalid: 
    8584            # read has been called from self.get_file_contents because xml file doens't conform to schema 
     
    9089        return super(XMLreader, self).read(xml_file) 
    9190 
    92     def get_file_contents(self, xml_file=None, schema_path="", invalid=True): 
     91    def get_file_contents(self): 
     92        return self._get_file_contents(xml_file=None, schema_path="", invalid=True) 
     93 
     94    def _get_file_contents(self, xml_file=None, schema_path="", invalid=True): 
    9395        # Reset everything since we're loading a new file 
    9496        self.reset_state() 
     
    124126                try: 
    125127                    # Load data with less strict schema 
    126                     self.read(xml_file, invalid_schema, False) 
     128                    self._get_file_contents(xml_file, invalid_schema, False) 
    127129 
    128130                    # File can still be read but doesn't match schema, so raise exception 
Note: See TracChangeset for help on using the changeset viewer.