source: sasmodels/fit.py @ 473183c

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 473183c was d772f5d, checked in by HMP1 <helen.park@…>, 10 years ago

Added 1D Fit, fixed fitting error

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[5378e40]1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4from bumps.names import *
[d772f5d]5from code_cylinder import GpuCylinder, OneDGpuCylinder
[2de9a5e]6from code_lamellar import GpuLamellar
7from code_ellipse import GpuEllipse
8from code_coreshellcyl import GpuCoreShellCylinder
9from code_capcyl import GpuCapCylinder
10from code_triaxialellipse import GpuTriEllipse
[09e15be]11from sasmodel import SasModel, load_data, set_beam_stop, set_half
[d772f5d]12import numpy as np
13
14""" IMPORT THE DATA USED """
15
16data = load_data('December/Tangential/Sector0/DEC07133.ABS')
17#data = load_data('December/DEC07133.DAT')
18
19""" SET INNER BEAM STOP, OUTER RING, AND MASK HALF OF THE DATA """
20set_beam_stop(data, 0.0052)#, outer=0.025)
21#set_half(data, 'left')
22
23
24
25model = SasModel(data, OneDGpuCylinder,
26scale=0.0013,
27radius=105,
28length=1000,
29background=21,
30sldCyl=.291e-6,sldSolv=5.77e-6,
31radius_pd=0.1,radius_pd_n=10,radius_pd_nsigma=0,
32length_pd=0.1,length_pd_n=5,length_pd_nsigma=0,
33bolim=0.0,
34uplim=90) #bottom limit, upper limit of angle integral
[5378e40]35
36
[496b252]37"""
[09e15be]38model = SasModel(data, GpuEllipse,
[d772f5d]39scale=0.0011,
40radius_a=100, radius_b=800.8,
41sldEll=.291e-6, sldSolv=7.105e-6,
42background=8.30161,
43axis_theta=0, axis_phi=0,
44axis_theta_pd=20, axis_theta_pd_n=40, axis_theta_pd_nsigma=3,
45radius_a_pd=0.222296, radius_a_pd_n=1, radius_a_pd_nsigma=0,
46radius_b_pd=.000128, radius_b_pd_n=1, radius_b_pd_nsigma=0,
47axis_phi_pd=2.63698e-05, axis_phi_pd_n=20, axis_phi_pd_nsigma=0,
48dtype='float')
49
50
51# SET THE FITTING PARAMETERS
[09e15be]52model.radius_a.range(15, 1000)
[d772f5d]53model.radius_b.range(15, 1000)
[09e15be]54#model.axis_theta_pd.range(0, 360)
55#model.background.range(0,1000)
56model.scale.range(0, 1)
57"""
[d772f5d]58
[09e15be]59"""
[d772f5d]60model = SasModel(data, GpuLamellar,
61scale=0.70,
62bi_thick=5,
63sld_bi=.291e-6,sld_sol=5.77e-6,
64background=85.23,
65bi_thick_pd= 0.0013, bi_thick_pd_n=5, bi_thick_pd_nsigma=3,
66dtype='float')
67
68# SET THE FITTING PARAMETERS
[79fcc40]69model.bi_thick.range(0, 1000)
[09e15be]70model.scale.range(0, 1)
71#model.bi_thick_pd.range(0, 1000)
[79fcc40]72#model.background.range(0, 1000)
[496b252]73"""
[d772f5d]74
75
76
77"""
78model = SasModel(data, GpuCylinder,
79scale=0.0013, radius=105, length=1000,
80sldCyl=.291e-6, sldSolv=5.77e-6, background=21,
81cyl_theta=90, cyl_phi=0,
82cyl_theta_pd=534, cyl_theta_pd_n=40, cyl_theta_pd_nsigma=3,
83
84# SET THE FITTING PARAMETERS
85radius_pd=0.1, radius_pd_n=10, radius_pd_nsigma=0,
86length_pd=0.1, length_pd_n=5, length_pd_nsigma=0,
87cyl_phi_pd=0.1, cyl_phi_pd_n=4, cyl_phi_pd_nsigma=0,
88dtype='float')
89#model.radius.range(0, 1000)
90#model.length.range(0, 1000)
91#model.cyl_theta_pd.range(0,90)
92model.scale.range(0, 1)
93model.background.range(0, 1000)
94"""
95
[8a21ba3]96"""
[09e15be]97model = SasModel(data, GpuCoreShellCylinder,
[d772f5d]98                 scale= 0.08, radius=200, thickness=30, length=2000,
99                 core_sld=7e-6, shell_sld=.291e-6, solvent_sld=7.105e-6,
100                 background=0, axis_theta=0, axis_phi=0,
[09e15be]101
[d772f5d]102                 radius_pd=0.38, radius_pd_n=10, radius_pd_nsigma=3,
103                 length_pd=.9, length_pd_n=10, length_pd_nsigma=3,
[09e15be]104                 thickness_pd=0.1, thickness_pd_n=1, thickness_pd_nsigma=0,
[d772f5d]105                 axis_theta_pd=10, axis_theta_pd_n=40, axis_theta_pd_nsigma=3,
106                 axis_phi_pd=0.1, axis_phi_pd_n=1, axis_phi_pd_nsigma=0,
[09e15be]107                 dtype='float')
108
[d772f5d]109# SET THE FITTING PARAMETERS
[09e15be]110model.radius.range(15, 1000)
111#model.length.range(0, 1000)
112#model.thickness.range(20, 50)
113#model.axis_phi.range(0, 90)
114#model.radius_pd.range(0, 1)
115#model.radius_b_pd.range(0, 1)
116#model.axis_theta_pd.range(0, 360)
117#model.axis_phi_pd.range(0, 360)
118#model.background.range(0,1000)
119model.scale.range(0, 1)
[8a21ba3]120"""
[8faffcd]121
[496b252]122"""
[d772f5d]123
[2de9a5e]124model = SasModel(data, GpuCapCylinder, scale=1, rad_cyl=20, rad_cap=40, length=400, sld_capcyl=1e-6, sld_solv=6.3e-6,
125                 background=0, theta=0, phi=0, rad_cyl_pd=.1, rad_cyl_pd_n=10, rad_cyl_nsigma=3, rad_cap_pd=.1, rad_cap_pd_n=1,
126                 rad_cap_pd_nsigma=3, length_pd=.1, length_pd_n=10, length_pd_nsigma=3, theta_pd=.1, theta_pd_n=4,
[496b252]127                 theta_pd_nsigma=3, phi_pd=.1, phi_pd_n=4, phi_pd_nsigma=3, dtype='float')
128"""
[d772f5d]129"""
[09e15be]130
131model = SasModel(data, GpuTriEllipse,
[79fcc40]132                 scale=0.0036, axisA=118, axisB=70, axisC=800,
[09e15be]133                 sldEll=7.105e-6, sldSolv=.291e-6,
134                 background=15, theta=90, phi=0, psi=0,
[79fcc40]135                 theta_pd=22, theta_pd_n=40, theta_pd_nsigma=3,
[09e15be]136                 phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0,
137                 psi_pd=30, psi_pd_n=1, psi_pd_nsigma=0,
138                 axisA_pd=.1, axisA_pd_n=1, axisA_pd_nsigma=0,
139                 axisB_pd=.1, axisB_pd_n=1, axisB_pd_nsigma=0,
140                 axisC_pd=.1, axisC_pd_n=1, axisC_pd_nsigma=0, dtype='float')
[79fcc40]141
[d772f5d]142# SET THE FITTING PARAMETERS
143model.axisA.range(15, 1000)
144model.axisB.range(15, 1000)
[09e15be]145#model.axisC.range(15, 1000)
146#model.background.range(0,1000)
147model.scale.range(0, 1)
[79fcc40]148#model.theta_pd.range(0, 360)
[09e15be]149#model.phi_pd.range(0, 360)
150#model.psi_pd.range(0, 360)
151
152
[d772f5d]153"""
[5378e40]154
155problem = FitProblem(model)
156
Note: See TracBrowser for help on using the repository browser.