Changeset a01af35 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Nov 13, 2016 6:04:05 AM (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:
55db501, a5b8253
Parents:
f5e226c9
Message:

Hankel trafo optimized, sesans_reader code cleaned up, hankel matrix constructor
code moved from sasview/qsmearing to sasmodels/sesans

Location:
src/sas/sascalc
Files:
2 edited

Legend:

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

    rf5e226c9 ra01af35  
    1818import numpy as np  # type: ignore 
    1919from numpy import pi, exp  # type: ignore 
    20 from scipy.special import jv as besselj 
     20#from scipy.special import j as besselj 
    2121 
    2222from sasmodels.resolution import Slit1D, Pinhole1D, SESANS1D 
     
    6666 
    6767    if _found_sesans == True: 
    68         #Pre-computing the Hankel matrix (H) 
    69  
    70         Rmax = 1000000 
    71         q_calc = sesans.make_q(data.sample.zacceptance, Rmax) 
    72         SElength = Converter(data._xunit)(data.x, "A") 
    73         dq = q_calc[1] - q_calc[0] 
    74         H0 = dq / (2 * pi) * q_calc 
    75         repSE, repq = np.meshgrid(SElength,q_calc) 
    76         hankelt=time.time() 
    77         H = dq / (2 * pi) * besselj(0, np.outer(q_calc, SElength))*repq 
    78         hankelt=time.time()-hankelt 
    79         print("Hankel transform took "+str(hankelt)+" s") 
     68        #Pre-compute the Hankel matrix (H) 
     69        H0,H, q_calc = sesans.Hankelconstructor(data) 
     70        # Then return the actual transform, as if it were a smearing function 
    8071        return PySmear(SESANS1D(data, H0, H, q_calc), model) 
    8172 
  • src/sas/sascalc/dataloader/readers/sesans_reader.py

    r392056d ra01af35  
    5959                    raise  RuntimeError, "sesans_reader: cannot open %s" % path 
    6060                buff = input_f.read() 
    61 #                print buff 
    6261                lines = buff.splitlines() 
    63 #                print lines 
    64                 #Jae could not find python universal line spliter: 
    65                 #keep the below for now 
    66                 # some ascii data has \r line separator, 
    67                 # try it when the data is on only one long line 
    68 #                if len(lines) < 2 : 
    69 #                    lines = buff.split('\r') 
    70                   
    7162                x  = numpy.zeros(0) 
    7263                y  = numpy.zeros(0) 
     
    8374                tdlam = numpy.zeros(0) 
    8475                tdx = numpy.zeros(0) 
    85 #                print "all good" 
    8676                output = Data1D(x=x, y=y, lam=lam, dy=dy, dx=dx, dlam=dlam, isSesans=True ) 
    87 #                print output                 
    8877                self.filename = output.filename = basename 
    8978 
    90 #                #Initialize counters for data lines and header lines. 
    91 #                is_data = False  # Has more than 5 lines 
    92 #                # More than "5" lines of data is considered as actual 
    93 #                # data unless that is the only data 
    94 #                mum_data_lines = 5 
    95 #                # To count # of current data candidate lines 
    96 #                i = -1 
    97 #                # To count total # of previous data candidate lines 
    98 #                i1 = -1 
    99 #                # To count # of header lines 
    100 #                j = -1 
    101 #                # Helps to count # of header lines 
    102 #                j1 = -1 
    103 #                #minimum required number of columns of data; ( <= 4). 
    104 #                lentoks = 2 
    10579                paramnames=[] 
    10680                paramvals=[] 
     
    11185                Pvals=[] 
    11286                dPvals=[] 
    113 #                print x 
    114 #                print zvals 
    11587                for line in lines: 
    11688                    # Initial try for CSV (split on ,) 
     
    12193                        paramvals.append(toks[1]) 
    12294                    if len(toks)>5: 
    123                        #zvals.append(toks[0]) 
    124                         #dzvals.append(toks[1]) 
    125                         #lamvals.append(toks[2]) 
    126                         #dlamvals.append(toks[3]) 
    127                         #Pvals.append(toks[4]) 
    128                         #dPvals.append(toks[5]) 
    129  
    13095                        zvals.append(toks[0]) 
    13196                        dzvals.append(toks[3]) 
Note: See TracChangeset for help on using the changeset viewer.