Ignore:
Timestamp:
Feb 6, 2017 3:02:46 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
68adf86
Parents:
ad4632c
Message:

simplify interface to sesans transform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/data_util/qsmearing.py

    r2a2b43a r157b716  
    1313import logging 
    1414import sys 
    15 from sasmodels import sesans 
    1615import numpy as np  # type: ignore 
    1716from numpy import pi, exp # type:ignore 
    1817from sasmodels.resolution import Slit1D, Pinhole1D 
    19 from sasmodels.sesans import SESANS1D 
     18from sasmodels.sesans import SesansTransform 
    2019from sasmodels.resolution2d import Pinhole2D 
    2120from src.sas.sascalc.data_util.nxsunit import Converter 
     
    6867        #Pre-compute the Hankel matrix (H) 
    6968        qmax, qunits = data.sample.zacceptance 
    70         hankel = sesans.SesansTransform(SE=Converter(data._xunit)(data.x, "A"), 
    71                                         zaccept=Converter(qunits)(qmax, "1/A"), 
    72                                         Rmax=10000000) 
     69        SElength = Converter(data._xunit)(data.x, "A") 
     70        zaccept = Converter(qunits)(qmax, "1/A"), 
     71        Rmax = 10000000 
     72        hankel = SesansTransform(data.x, SElength, zaccept, Rmax) 
    7373        # Then return the actual transform, as if it were a smearing function 
    74         return PySmear(SESANS1D(data, hankel.H0, hankel.H, hankel.q), model) 
     74        return PySmear(hankel, model, offset=0) 
    7575 
    7676    _found_resolution = False 
     
    115115    Wrapper for pure python sasmodels resolution functions. 
    116116    """ 
    117     def __init__(self, resolution, model): 
     117    def __init__(self, resolution, model, offset=None): 
    118118        self.model = model 
    119119        self.resolution = resolution 
    120  
    121         if hasattr(self.resolution, 'data'): 
    122             #if self.resolution.data.meta_data['loader'] == 'SESANS':  # Always True if file extension is '.ses'! 
    123             if self.resolution.data.isSesans: 
    124                 self.offset = 0 
    125             # This is default behaviour, for future resolution/transform functions this needs to be revisited. 
    126             else: 
    127                 self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    128         else: 
    129             self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    130  
    131         # self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
     120        if offset is None: 
     121            offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
     122        self.offset = offset 
    132123 
    133124    def apply(self, iq_in, first_bin=0, last_bin=None): 
Note: See TracChangeset for help on using the changeset viewer.