Ignore:
Timestamp:
Dec 19, 2016 7:23:36 AM (7 years ago)
Author:
GitHub <noreply@…>
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:
f2724b6
git-author:
jhbakker <j.h.bakker@…> (12/19/16 07:23:36)
git-committer:
GitHub <noreply@…> (12/19/16 07:23:36)
Message:

Revert "Jurtest2"

File:
1 edited

Legend:

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

    rc6728e1 r345e7e4  
    55#This software was developed by the University of Tennessee as part of the 
    66#Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    7 #project funded by the US National Science Foundation. 
     7#project funded by the US National Science Foundation.  
    88#See the license text in license.txt 
    99#copyright 2008, University of Tennessee 
     
    1313import logging 
    1414import sys 
    15 from sasmodels import sesans 
    16 import numpy as np  # type: ignore 
    17 from numpy import pi, exp  # type: ignore 
    1815 
    1916from sasmodels.resolution import Slit1D, Pinhole1D 
    20 from sasmodels.sesans import SESANS1D 
    2117from sasmodels.resolution2d import Pinhole2D 
    22 from src.sas.sascalc.data_util.nxsunit import Converter 
    23  
    2418 
    2519def smear_selection(data, model = None): 
     
    4236    # Sanity check. If we are not dealing with a SAS Data1D 
    4337    # object, just return None 
    44  
    45     # This checks for 2D data (does not throw exception because fail is common) 
    4638    if  data.__class__.__name__ not in ['Data1D', 'Theory1D']: 
    4739        if data == None: 
     
    5042            return None 
    5143        return Pinhole2D(data) 
    52     # This checks for 1D data with smearing info in the data itself (again, fail is likely; no exceptions) 
     44 
    5345    if  not hasattr(data, "dx") and not hasattr(data, "dxl")\ 
    5446         and not hasattr(data, "dxw"): 
     
    5648 
    5749    # Look for resolution smearing data 
    58     # This is the code that checks for SESANS data; it looks for the file loader 
    59     # TODO: change other sanity checks to check for file loader instead of data structure? 
    60     _found_sesans = False 
    61     #if data.dx is not None and data.meta_data['loader']=='SESANS': 
    62     if data.dx is not None and data.isSesans: 
    63         #if data.dx[0] > 0.0: 
    64         if numpy.size(data.dx[data.dx <= 0]) == 0: 
    65             _found_sesans = True 
    66         #if data.dx[0] <= 0.0: 
    67         if numpy.size(data.dx[data.dx <= 0]) > 0: 
    68             raise ValueError('one or more of your dx values are negative, please check the data file!') 
    69     if _found_sesans == True: 
    70         #Pre-compute the Hankel matrix (H) 
    71         qmax, qunits = data.sample.zacceptance 
    72         hankel=sesans.SesansTransform() 
    73         sesans.SesansTransform.set_transform(hankel, 
    74         SE = Converter(data._xunit)(data.x, "A"), 
    75         zaccept = Converter(qunits)(qmax, "1/A"), 
    76         Rmax = 10000000) 
    77         # Then return the actual transform, as if it were a smearing function 
    78         return PySmear(SESANS1D(data, hankel._H0, hankel._H, hankel.q), model) 
    79  
    8050    _found_resolution = False 
    8151    if data.dx is not None and len(data.dx) == len(data.x): 
     
    12292        self.model = model 
    12393        self.resolution = resolution 
    124         if hasattr(self.resolution, 'data'): 
    125             if self.resolution.data.meta_data['loader'] == 'SESANS': # Always True if file extension is '.ses'! 
    126                 self.offset = 0 
    127             # This is default behaviour, for future resolution/transform functions this needs to be revisited. 
    128             else: 
    129                 self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    130         else: 
    131             self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    132  
    133         #self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
     94        self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    13495 
    13596    def apply(self, iq_in, first_bin=0, last_bin=None): 
     
    165126        q[first:last+1]. 
    166127        """ 
    167  
    168128        q = self.resolution.q 
    169129        first = numpy.searchsorted(q, q_min) 
Note: See TracChangeset for help on using the changeset viewer.