Changeset 9a11937 in sasview
- Timestamp:
- May 21, 2008 9:29:23 AM (17 years ago)
- 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 119a11d
- Parents:
- c14c503
- Location:
- pr_inversion
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pr_inversion/__init__.py
r9e8dc22 r9a11937 1 """ 2 P(r) inversion for SANS 3 """ 4 ## \mainpage P(r) inversion for SANS 5 # 6 # \section intro_sec Introduction 7 # This module provides calculations to transform scattering intensity data 8 # I(q) into distance distribution function P(r). A description of the 9 # technique can be found elsewhere [1-5]. The module is useable as a 10 # standalone application but its functionality is meant to be presented 11 # to end-users through the user interface developed as part of the SANS 12 # flagship application. 13 # 14 # Procedure: We will follow the procedure of Moore [1]. 15 # 16 # [1] P.B. Moore, J.Appl. Cryst (1980) 13, 168-175. 17 # [2] O. Glatter, J.Appl. Cryst (1977) 10, 415-421. 18 # [3] D.I. Svergun, J.Appl. Cryst (1991) 24, 485-492. 19 # [4] D.I. Svergun, J.Appl. Cryst (1992) 25, 495-503. 20 # [5] S. Hansen and J. Skov Pedersen, J.Appl. Cryst (1991) 24, 541-548. 21 # 22 # 23 # \section install_sec Installation 24 # 25 # \subsection obtain Obtaining the Code 26 # 27 # The code is available here: 28 # \verbatim 29 #$ svn co svn://danse.us/sans/pr_inversion 30 # \endverbatim 31 # 32 # \subsection depends External Dependencies 33 # scipy, numpy, pylab 34 # 35 # \subsection build Building the code 36 # The standard python package can be built with distutils. 37 # \verbatim 38 #$ python setup.py build 39 #$ python setup.py install 40 # \endverbatim 41 # 42 # 43 # Examples are available as unit tests under sans.pr_inversion.test. 44 # 45 # \section help_sec Contact Info 46 # Code and Documentation produced as part of the DANSE project. 47 48 __author__ = 'University of Tennessee' -
pr_inversion/invertor.py
rf71287f4 r9a11937 3 3 import sys 4 4 5 def help(): 6 """ 7 Provide general online help text 8 """ 9 info_txt = "The inversion approach is based on Moore, J. Appl. Cryst. (1980) 13, 168-175.\n\n" 10 info_txt += "P(r) is set to be equal to an expansion of base functions of the type " 11 info_txt += "phi_n(r) = 2*r*sin(pi*n*r/D_max). The coefficient of each base functions " 12 info_txt += "in the expansion is found by performing a least square fit with the " 13 info_txt += "following fit function:\n\n" 14 info_txt += "chi**2 = sum_i[ I_meas(q_i) - I_th(q_i) ]**2/error**2 + Reg_term\n\n" 15 info_txt += "where I_meas(q) is the measured scattering intensity and I_th(q) is " 16 info_txt += "the prediction from the Fourier transform of the P(r) expansion. " 17 info_txt += "The Reg_term term is a regularization term set to the second derivative " 18 info_txt += "d**2P(r)/dr**2 integrated over r. It is used to produce a smooth P(r) output.\n\n" 19 info_txt += "The following are user inputs:\n\n" 20 info_txt += " - Number of terms: the number of base functions in the P(r) expansion.\n\n" 21 info_txt += " - Regularization constant: a multiplicative constant to set the size of " 22 info_txt += "the regularization term.\n\n" 23 info_txt += " - Maximum distance: the maximum distance between any two points in the system.\n" 24 25 return info_txt 26 27 5 28 class Invertor(Cinvertor): 6 29 """ 30 Invertor class to perform P(r) inversion 31 32 TODO: explain the maths 33 """ 7 34 ## Chisqr of the last computation 8 35 chi2 = 0 … … 191 218 # blah = numpy.ascontiguousarray(blah_original) 192 219 # ... before passing it to C 193 220 """ 221 TODO: Document this 222 """ 194 223 import math 195 224 from scipy.linalg.basic import lstsq … … 410 439 411 440 file.close() 441 412 442 413 443 def from_file(self, path):
Note: See TracChangeset
for help on using the changeset viewer.