Ignore:
Timestamp:
Apr 9, 2017 5:24:21 AM (8 years ago)
Author:
Adam Washington <adam.washington@…>
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
35cf5c0
Parents:
a81af92
Message:

Test that SESANS files insist on proper headers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/sesans_reader.py

    ra81af92 re801a4e  
    8686            headers = input_f.readline().split() 
    8787 
     88            self._insist_header(headers, "SpinEchoLength") 
     89            self._insist_header(headers, "Depolarisation") 
     90            self._insist_header(headers, "Depolarisation_error") 
     91            self._insist_header(headers, "Wavelength") 
     92 
    8893            data = np.loadtxt(input_f) 
    8994            if data.size < 1: 
     
    141146 
    142147    @staticmethod 
     148    def _insist_header(headers, name): 
     149        if name not in headers: 
     150            raise RuntimeError( 
     151                "Missing {} column in spin echo data".format(name)) 
     152 
     153    @staticmethod 
    143154    def _unit_conversion(value, value_unit, default_unit): 
    144155        """ 
Note: See TracChangeset for help on using the changeset viewer.