Changeset 5ae40e7 in sasview for src


Ignore:
Timestamp:
Apr 9, 2017 5:08:48 AM (7 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:
f344f6c
Parents:
10ab40e
git-author:
Adam Washington <adam.washington@…> (04/09/17 05:01:01)
git-committer:
Adam Washington <adam.washington@…> (04/09/17 05:08:48)
Message:

Throw an exception if sesans file has conflicting units

We've decided to mandate identical units for the current file format
version to allow other programs to import the files more easily. This
may change in later versions

File:
1 edited

Legend:

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

    r10ab40e r5ae40e7  
    5151            _, extension = os.path.splitext(basename) 
    5252            if not (self.allow_all or extension.lower() in self.ext): 
    53                 raise RuntimeError("{} has an unrecognized file extension".format(path)) 
     53                raise RuntimeError( 
     54                    "{} has an unrecognized file extension".format(path)) 
    5455        else: 
    55             raise RunetimeError("{} is not a file".format(path)) 
     56            raise RuntimeError("{} is not a file".format(path)) 
    5657        with open(path, 'r') as input_f: 
    5758            # Read in binary mode since GRASP frequently has no-ascii 
     
    7071            if "Wavelength_unit" not in self.params: 
    7172                raise RuntimeError("Wavelength has no units") 
     73            if params["SpinEchoLength_unit"] != params["Wavelength_unit"]: 
     74                raise RuntimeError("The spin echo data has rudely used " 
     75                                   "different units for the spin echo length " 
     76                                   "and the wavelength.  While sasview could " 
     77                                   "handle this instance, it is a violation " 
     78                                   "of the file format and will not be " 
     79                                   "handled by other software.") 
    7280 
    7381            headers = input_f.readline().split() 
Note: See TracChangeset for help on using the changeset viewer.