Changeset 8e0dcac in sasview


Ignore:
Timestamp:
Apr 6, 2017 9:13:06 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:
857cc58
Parents:
d01b55c
Message:

Handle missing columns in .ses format

The uncertainties on spin echo length and lambda aren't strictly
required, so we should handle files that do not have them. SasView?
seems to be unhappy with an uncertainty of zero, so we've put in a
small default value. If the user isn't happy with the default value,
then they should have measured the real one.

File:
1 edited

Legend:

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

    r0ac6e11 r8e0dcac  
    7171                raise RuntimeError("{} is empty".format(path)) 
    7272            x = data[:, headers.index("SpinEchoLength")] 
    73             dx = data[:, headers.index("SpinEchoLength_error")] 
     73            if "SpinEchoLength_error" in headers: 
     74                dx = data[:, headers.index("SpinEchoLength_error")] 
     75            else: 
     76                dx = x*0.05 
    7477            lam = data[:, headers.index("Wavelength")] 
    75             dlam = data[:, headers.index("Wavelength_error")] 
     78            if "Wavelength_error" in headers: 
     79                dlam = data[:, headers.index("Wavelength_error")] 
     80            else: 
     81                dlam = lam*0.05 
    7682            y = data[:, headers.index("Depolarisation")] 
    7783            dy = data[:, headers.index("Depolarisation_error")] 
Note: See TracChangeset for help on using the changeset viewer.