Ignore:
Timestamp:
Aug 9, 2016 6:23:08 AM (8 years ago)
Author:
lewis
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
dc8a553
Parents:
b7c21a7
Message:

Add more descriptive error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/file_converter/otoko_loader.py

    rba65aff r9c500ab  
    11""" 
    22Here we handle loading of "OTOKO" data (for more info about this format see 
    3 the comment in load_bsl_data).  Given the paths of header and data files, we 
     3the comment in load_otoko_data).  Given the paths of header and data files, we 
    44aim to load the data into numpy arrays for use later. 
    55""" 
     
    2929        self.data_path = data_path 
    3030 
    31     def load_bsl_data(self): 
     31    def load_otoko_data(self): 
    3232        """ 
    3333        Loads "OTOKO" data, which is a format that stores each axis separately. 
     
    4242        http://www.diamond.ac.uk/Home/Beamlines/small-angle/SAXS-Software/CCP13/ 
    4343        XOTOKO.html 
    44  
    45         The BSL format, which is based on OTOKO, is also supported.  Find out more 
    46         about the BSL format at http://www.diamond.ac.uk/Home/Beamlines/small-angle 
    47         /SAXS-Software/CCP13/BSL.html. 
    4844        """ 
    49         q_axis    = self._load_bsl_axis(self.qaxis_path) 
    50         data_axis = self._load_bsl_axis(self.data_path) 
     45        q_axis    = self._load_otoko_axis(self.qaxis_path) 
     46        data_axis = self._load_otoko_axis(self.data_path) 
    5147 
    5248        return OTOKOData(q_axis, data_axis) 
    5349 
    54     def _load_bsl_axis(self, header_path): 
     50    def _load_otoko_axis(self, header_path): 
    5551        """ 
    5652        Loads an "OTOKO" axis, given the header file path.  Essentially, the 
     
    107103                    last_file  = int(indicators[9]) == 0 # We don't use this. 
    108104                ) 
     105                if binary_file_info.dimensions != 1: 
     106                    msg = "File {} has {} dimensions, expected 1. Is it a BSL file?" 
     107                    raise OTOKOParsingError(msg.format(filename.strip(), 
     108                        binary_file_info.dimensions)) 
     109 
    109110                binary_file_info_list.append(binary_file_info) 
    110111 
Note: See TracChangeset for help on using the changeset viewer.