source: trunk/GSASIIsasd.py @ 1233

Last change on this file since 1233 was 1233, checked in by vondreele, 8 years ago

replace wx.Align_CENTER_VERTICAL with WACV in G2pwdGUI & G2phsGUI
start on SASD modelling

File size: 2.7 KB
Line 
1#/usr/bin/env python
2# -*- coding: utf-8 -*-
3'''
4*GSASII small angle calculation module*
5==================================
6
7'''
8########### SVN repository information ###################
9# $Date: 2014-01-09 11:09:53 -0600 (Thu, 09 Jan 2014) $
10# $Author: vondreele $
11# $Revision: 1186 $
12# $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASIIsasd.py $
13# $Id: GSASIIsasd.py 1186 2014-01-09 17:09:53Z vondreele $
14########### SVN repository information ###################
15import sys
16import math
17import time
18
19import numpy as np
20import scipy as sp
21import numpy.linalg as nl
22from numpy.fft import ifft, fft, fftshift
23import scipy.interpolate as si
24import scipy.stats as st
25import scipy.optimize as so
26
27import GSASIIpath
28GSASIIpath.SetVersionNumber("$Revision: 1186 $")
29import GSASIIlattice as G2lat
30import GSASIIspc as G2spc
31import GSASIIElem as G2elem
32import GSASIIgrid as G2gd
33import GSASIIIO as G2IO
34import GSASIImath as G2mth
35import pypowder as pyd
36
37# trig functions in degrees
38sind = lambda x: math.sin(x*math.pi/180.)
39asind = lambda x: 180.*math.asin(x)/math.pi
40tand = lambda x: math.tan(x*math.pi/180.)
41atand = lambda x: 180.*math.atan(x)/math.pi
42atan2d = lambda y,x: 180.*math.atan2(y,x)/math.pi
43cosd = lambda x: math.cos(x*math.pi/180.)
44acosd = lambda x: 180.*math.acos(x)/math.pi
45rdsq2d = lambda x,p: round(1.0/math.sqrt(x),p)
46#numpy versions
47npsind = lambda x: np.sin(x*np.pi/180.)
48npasind = lambda x: 180.*np.arcsin(x)/math.pi
49npcosd = lambda x: np.cos(x*math.pi/180.)
50npacosd = lambda x: 180.*np.arccos(x)/math.pi
51nptand = lambda x: np.tan(x*math.pi/180.)
52npatand = lambda x: 180.*np.arctan(x)/np.pi
53npatan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi
54npT2stl = lambda tth, wave: 2.0*npsind(tth/2.0)/wave
55npT2q = lambda tth,wave: 2.0*np.pi*npT2stl(tth,wave)
56   
57###############################################################################
58#### Particle form factors & volumes
59###############################################################################
60
61def SpheroidFF(Q,R,AR):
62    '''
63    '''
64    QR = Q*R
65    if 0.98 < AR < 1.02:
66        return (3./(QR**3))*(np.sin(QR)-(QR*np.cos(QR)))
67       
68   
69def SpheroidVol(R,AR):
70    ''' Compute volume of cylindrically symmetric ellipsoid (spheroid)
71    - can use numpy arrays for R & AR; will return corresponding numpy array
72    param float R: radius along 2 axes of spheroid
73    param float AR: aspect ratio so 3rd axis = R*AR
74    returns float: volume
75    '''
76    return AR*(4./3.)*np.pi*R**3
77   
78def SizeDistribution(Profile,Limits,Substances,Sample,data):
79    print data['Size']
80#    print Limits
81#    print Substances
82#    print Sample
83#    print Profile
84   
Note: See TracBrowser for help on using the repository browser.