Changeset a859f99 in sasview


Ignore:
Timestamp:
Sep 19, 2017 10:32:43 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1f21a43
Parents:
5e2267e
Message:

use cumtrapz instead of iterated trapz

Location:
src/sas/sascalc/corfunc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/corfunc/corfunc_calculator.py

    rc728295 ra859f99  
    141141        :param extrap_fn: A callable function representing the extraoplated data 
    142142        :param completefn: The function to call when the transform calculation 
    143             is complete` 
     143            is complete 
    144144        :param updatefn: The function to call to update the GUI with the status 
    145145            of the transform calculation 
  • src/sas/sascalc/corfunc/transform_thread.py

    r5e2267e ra859f99  
    4646            # trapz uses the trapezium rule to calculate the integral 
    4747            mask = xs <= 200.0 # Only calculate gamma3 up to x=200 (as this is all that's plotted) 
    48             from scipy.integrate import cumtrapz 
    49             n = len(xs[mask]) + 1 
    50             gamma3 = cumtrapz(gamma1[:n], xs[:n]) 
     48            # gamma3 = [trapz(gamma1[:n], xs[:n])/xs[n-1] for n in range(2, len(xs[mask]) + 1)]j 
     49            # gamma3.insert(0, 1.0) # Gamma_3(0) is defined as 1 
     50            n = len(xs[mask]) 
     51            gamma3 = cumtrapz(gamma1[:n], xs[:n])/xs[1:n] 
    5152            gamma3 = np.hstack((1.0, gamma3)) # Gamma_3(0) is defined as 1 
    5253 
Note: See TracChangeset for help on using the changeset viewer.