Changeset 51a4d78 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Oct 8, 2016 3:33:04 PM (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:
1fac6c0
Parents:
7988501 (diff), f7bc948 (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 'ajj_sesans' into Jurrian1D

Location:
src/sas/sascalc
Files:
5 edited

Legend:

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

    rf8aa738 rf7bc948  
    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 
     15import sasmodels.sesans 
    1516 
    16 from sasmodels.resolution import Slit1D, Pinhole1D 
     17from sasmodels.resolution import Slit1D, Pinhole1D, SESANS1D 
    1718from sasmodels.resolution2d import Pinhole2D 
    1819 
     
    4849 
    4950    # Look for resolution smearing data 
     51    _found_sesans = False 
     52    if data.dx is not None and data.lam is not None: 
     53        if data.dx[0] > 0.0: 
     54            _found_sesans = True 
     55 
     56    if _found_sesans == True: 
     57        return sesans_smear(data, model) 
     58 
    5059    _found_resolution = False 
    5160    if data.dx is not None and len(data.dx) == len(data.x): 
     
    142151    width = data.dx if data.dx is not None else 0 
    143152    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) 
  • src/sas/sascalc/dataloader/data_info.py

    r7988501 r51a4d78  
    797797                raise ValueError, msg 
    798798            # Here we could also extrapolate between data points 
    799             ZERO = 1.0e-12 
     799            TOLERANCE = 0.01 
    800800            for i in range(len(self.x)): 
    801                 if math.fabs(self.x[i] - other.x[i]) > ZERO: 
     801                if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE: 
    802802                    msg = "Incompatible data sets: x-values do not match" 
    803803                    raise ValueError, msg 
     
    10091009        """ 
    10101010        err_other = None 
     1011        TOLERANCE = 0.01 
    10111012        if isinstance(other, Data2D): 
    10121013            # Check that data lengths are the same 
     
    10171018                raise ValueError, msg 
    10181019            for ind in range(len(self.data)): 
    1019                 if self.qx_data[ind] != other.qx_data[ind]: 
    1020                     msg = "Incompatible data sets: qx-values do not match" 
     1020                if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE: 
     1021                    msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind]) 
    10211022                    raise ValueError, msg 
    1022                 if self.qy_data[ind] != other.qy_data[ind]: 
    1023                     msg = "Incompatible data sets: qy-values do not match" 
     1023                if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE: 
     1024                    msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind]) 
    10241025                    raise ValueError, msg 
    10251026 
  • src/sas/sascalc/dataloader/readers/sesans_reader.py

    r1c0e3b0 r1b82623  
    88import numpy 
    99import os 
    10 from sas.sascalc.dataloader.data_info import SESANSData1D 
     10from sas.sascalc.dataloader.data_info import Data1D 
    1111 
    1212# Check whether we have a converter available 
     
    8484                tdx = numpy.zeros(0) 
    8585#                print "all good" 
    86                 output = SESANSData1D(x=x, y=y, lam=lam, dy=dy, dx=dx, dlam=dlam) 
     86                output = Data1D(x=x, y=y, lam=lam, dy=dy, dx=dx, dlam=dlam) 
    8787#                print output                 
    8888                self.filename = output.filename = basename 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    rfc18690 r7988501  
    131131        a way to get residuals from data. 
    132132    """ 
    133     def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None): 
     133    def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None, lam=None, dlam=None): 
    134134        """ 
    135135            :param smearer: is an object of class QSmearer or SlitSmearer 
     
    152152                 
    153153        """ 
    154         Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 
     154        Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy, lam=lam,dlam=dlam) 
    155155        self.num_points = len(x) 
    156156        self.sas_data = data 
  • src/sas/sascalc/fit/BumpsFitting.py

    rb699768 r7988501  
    2626from bumps import parameter 
    2727from bumps.fitproblem import FitProblem 
    28  
    2928 
    3029from sas.sascalc.fit.AbstractFitEngine import FitEngine 
Note: See TracChangeset for help on using the changeset viewer.