Ignore:
Timestamp:
Apr 10, 2017 9:45:27 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
costrafo411
Children:
7b15990
Parents:
ba91f71 (diff), d26f025 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into costrafo411

File:
1 edited

Legend:

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

    rba91f71 r9f59333  
    99#copyright 2008, University of Tennessee 
    1010###################################################################### 
    11 import numpy 
    1211import math 
    1312import logging 
     
    4342    # This checks for 2D data (does not throw exception because fail is common) 
    4443    if  data.__class__.__name__ not in ['Data1D', 'Theory1D']: 
    45         if data == None: 
     44        if data is None: 
    4645            return None 
    47         elif data.dqx_data == None or data.dqy_data == None: 
     46        elif data.dqx_data is None or data.dqy_data is None: 
    4847            return None 
    4948        return PySmear2D(data) 
     
    6059    if data.dx is not None and data.isSesans: 
    6160        #if data.dx[0] > 0.0: 
    62         if numpy.size(data.dx[data.dx <= 0]) == 0: 
     61        if np.size(data.dx[data.dx <= 0]) == 0: 
    6362            _found_sesans = True 
    6463        # if data.dx[0] <= 0.0: 
    65         if numpy.size(data.dx[data.dx <= 0]) > 0: 
     64        if np.size(data.dx[data.dx <= 0]) > 0: 
    6665            raise ValueError('one or more of your dx values are negative, please check the data file!') 
    6766 
     
    126125        self.resolution = resolution 
    127126        if offset is None: 
    128             offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
     127            offset = np.searchsorted(self.resolution.q_calc, self.resolution.q[0]) 
    129128        self.offset = offset 
    130129 
     
    140139        """ 
    141140        q_calc = self.resolution.q_calc 
    142         if isinstance(q_calc, tuple): 
    143             # We are 2D -> 1D! 
    144             iq_calc = self.model.evalDistribution(q_calc) 
    145         else: 
    146             if last_bin is None: last_bin = len(iq_in) 
    147             start, end = first_bin + self.offset, last_bin + self.offset 
    148             iq_calc = numpy.empty_like(q_calc) 
    149             if start > 0: 
    150                 iq_calc[:start] = self.model.evalDistribution(q_calc[:start]) 
    151             if end+1 < len(q_calc): 
    152                 iq_calc[end+1:] = self.model.evalDistribution(q_calc[end+1:]) 
    153             iq_calc[start:end+1] = iq_in[first_bin:last_bin+1] 
     141        iq_calc = np.empty_like(q_calc) 
     142        if start > 0: 
     143            iq_calc[:start] = self.model.evalDistribution(q_calc[:start]) 
     144        if end+1 < len(q_calc): 
     145            iq_calc[end+1:] = self.model.evalDistribution(q_calc[end+1:]) 
     146        iq_calc[start:end+1] = iq_in[first_bin:last_bin+1] 
    154147        smeared = self.resolution.apply(iq_calc) 
    155148        return smeared 
     
    166159        """ 
    167160        q = self.resolution.q 
    168         first = numpy.searchsorted(q, q_min) 
    169         last = numpy.searchsorted(q, q_max) 
     161        first = np.searchsorted(q, q_min) 
     162        last = np.searchsorted(q, q_max) 
    170163        return first, min(last,len(q)-1) 
    171164 
     
    256249            val = self.model.evalDistribution(q_calc) 
    257250            return val 
    258  
Note: See TracChangeset for help on using the changeset viewer.