Ignore:
Timestamp:
Jan 20, 2017 5:45:03 AM (8 years ago)
Author:
jhbakker
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:
18501795
Parents:
b5db35d
Message:

Fixes based on Jeff's comments (20170119). Tested with 1D SESANS data on
Windows 10 machine. Needs to be tested with 1D and 2D SANS data.

File:
1 edited

Legend:

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

    rb5db35d r20522e1  
    489489    ## Loading errors 
    490490    errors = None 
     491    ## SESANS data check 
     492    isSesans = None 
     493 
    491494 
    492495    def __init__(self): 
     
    521524        ## Loading errors 
    522525        self.errors = [] 
     526        ## SESANS data check 
     527        self.isSesans = False 
    523528 
    524529    def append_empty_process(self): 
     
    694699    1D data class 
    695700    """ 
    696     def __init__(self, x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=False): 
    697         self.isSesans = isSesans 
     701    def __init__(self, x=None, y=None, dx=None, dy=None, lam=None, dlam=None, isSesans=None): 
    698702        DataInfo.__init__(self) 
    699703        plottable_1D.__init__(self, x, y, dx, dy,None, None, lam, dlam) 
    700         if self.isSesans: 
    701             x_unit = 'A' 
    702             y_unit = 'pol' 
    703         elif not self.isSesans: # it's SANS data! (Could also be simple else statement, but i prefer exhaustive conditionals...-JHB) 
    704             x_unit = '1/A' 
    705             y_unit = '1/cm' 
    706         else: # and if it's neither, you get punished! 
    707             raise(TypeError,'This is neither SANS nor SESANS data, what the hell are you doing??') 
     704        self.isSesans = isSesans 
     705        try: 
     706            if self.isSesans: # the data is SESANS 
     707                x_unit = 'A' 
     708                y_unit = 'pol' 
     709            elif not self.isSesans: # the data is SANS 
     710                x_unit = '1/A' 
     711                y_unit = '1/cm' 
     712        except: # the data is not recognized/supported, and the user is notified 
     713            raise(TypeError, 'data not recognized, check documentation for supported 1D data formats') 
    708714 
    709715    def __str__(self): 
     
    927933    def __init__(self, data=None, err_data=None, qx_data=None, 
    928934                 qy_data=None, q_data=None, mask=None, 
    929                  dqx_data=None, dqy_data=None): 
    930         self.y_bins = [] 
    931         self.x_bins = [] 
     935                 dqx_data=None, dqy_data=None, isSesans=None): 
    932936        DataInfo.__init__(self) 
    933937        plottable_2D.__init__(self, data, err_data, qx_data, 
    934938                              qy_data, q_data, mask, dqx_data, dqy_data) 
     939        self.y_bins = [] 
     940        self.x_bins = [] 
     941        self.isSesans=isSesans 
     942 
    935943        if len(self.detector) > 0: 
    936944            raise RuntimeError, "Data2D: Detector bank already filled at init" 
Note: See TracChangeset for help on using the changeset viewer.