Ignore:
Timestamp:
Oct 8, 2016 2:13:22 PM (8 years ago)
Author:
ajj
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:
b61bd57
Parents:
24f6f4a
Message:

changes to qsmearing to try to accommodate sesans

File:
1 edited

Legend:

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

    r87b9447 rf7bc948  
    1313import logging 
    1414import sys 
     15import sasmodels.sesans 
    1516 
    16 from sasmodels.resolution import Slit1D, Pinhole1D 
     17from sasmodels.resolution import Slit1D, Pinhole1D, SESANS1D 
    1718from sasmodels.resolution2d import Pinhole2D 
    18 from sasmodels import sesans 
    1919 
    2020def smear_selection(data, model = None): 
     
    4848        return None 
    4949 
    50     # Look for sesans 
     50    # Look for resolution smearing data 
    5151    _found_sesans = False 
    52     if hasattr(data,'lam') : 
    53         _found_sesans = True 
    54         logging.info("Found SESANS data!!") 
     52    if data.dx is not None and data.lam is not None: 
     53        if data.dx[0] > 0.0: 
     54            _found_sesans = True 
    5555 
    56     # If we found sesans data, do the necessary jiggery pokery 
    5756    if _found_sesans == True: 
    5857        return sesans_smear(data, model) 
    5958 
    60     # Look for resolution smearing data 
    6159    _found_resolution = False 
    6260    if data.dx is not None and len(data.dx) == len(data.x): 
     
    9391    if _found_slit == True: 
    9492        return slit_smear(data, model) 
    95  
    9693    return None 
    97  
    98 def sesans_smear(data, model=None): 
    99     q = sesans.make_q(data.sample.zacceptance, data.Rmax) 
    100     index = slice(None, None) 
    101     res = None 
    102     if data.y is not None: 
    103         Iq, dIq = data.y, data.dy 
    104     else: 
    105         Iq, dIq = None, None 
    106     #self._theory = np.zeros_like(q) 
    107     q_vectors = [q] 
    108     q_mono = sesans.make_all_q(data) 
    109     Iq = model.evalDistribution(q_mono) 
    110  
    111     return sesans.transform(data, q, Iq, 0, 0) 
    11294 
    11395 
     
    169151    width = data.dx if data.dx is not None else 0 
    170152    return PySmear(Pinhole1D(q, width), model) 
     153 
     154def sesans_smear(data, model=None): 
     155    #This should be calculated characteristic length scale 
     156    #Probably not a data prameter either 
     157    #Need function to calculate this based on model 
     158    #Here assume a number 
     159    Rmax = 50000 
     160    q_calc = sesans.make_q(data.sample.z, Rmax) 
     161    return PySmear(SESANS1D(data,q_calc),model) 
Note: See TracChangeset for help on using the changeset viewer.