source: sasview/sansmodels/src/sans/models/CylinderModel.py @ 9316609

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 9316609 was 9316609, checked in by Gervaise Alina <gervyh@…>, 16 years ago

added description to model

  • Property mode set to 100644
File size: 2.8 KB
Line 
1#!/usr/bin/env python
2""" Provide functionality for a C extension model
3
4        WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
5                 DO NOT MODIFY THIS FILE, MODIFY Cylinder.h
6                 AND RE-RUN THE GENERATOR SCRIPT
7
8    @author: Mathieu Doucet / UTK
9    @contact: mathieu.doucet@nist.gov
10"""
11
12from sans.models.BaseComponent import BaseComponent
13from sans_extension.c_models import CCylinderModel
14import copy   
15   
16class CylinderModel(CCylinderModel, BaseComponent):
17    """ Class that evaluates a CylinderModel model.
18        This file was auto-generated from Cylinder.h.
19        Refer to that file and the structure it contains
20        for details of the model.
21        List of default parameters:
22         scale           = 1.0
23         radius          = 20.0 A
24         length          = 400.0 A
25         contrast        = 3e-006 A-2
26         background      = 0.0 cm-1
27         cyl_theta       = 1.0 rad
28         cyl_phi         = 1.0 rad
29
30    """
31       
32    def __init__(self):
33        """ Initialization """
34       
35        # Initialize BaseComponent first, then sphere
36        BaseComponent.__init__(self)
37        CCylinderModel.__init__(self)
38       
39        ## Name of the model
40        self.name = "CylinderModel"
41        self.description= """P(q,alpha)= scale/V*f(q)^(2)+bkg
42                f(q)= 2*(scatter_sld - solvent_sld)*V*sin(qLcos(alpha/2))/[qLcos(alpha/2)]*
43                J1(qRsin(alpha/2))/[qRsin(alpha)]
44                V: Volume of the cylinder
45                R: Radius of the cylinder
46                L: Length of the cylinder
47                J1: The bessel function
48                alpha: angle betweenthe axis of the cylinder and the q-vector
49                for 1D:the ouput is P(q)=scale/V*integral from pi/2 to zero of f(q)^(2)*
50                sin(alpha)*dalpha+ bkg"""
51                ## Parameter details [units, min, max]
52        self.details = {}
53        self.details['scale'] = ['', None, None]
54        self.details['radius'] = ['A', None, None]
55        self.details['length'] = ['A', None, None]
56        self.details['contrast'] = ['A-2', None, None]
57        self.details['background'] = ['cm-1', None, None]
58        self.details['cyl_theta'] = ['rad', None, None]
59        self.details['cyl_phi'] = ['rad', None, None]
60
61   
62    def clone(self):
63        """ Return a identical copy of self """
64        obj = CylinderModel()
65        obj.params = copy.deepcopy(self.params)
66        return obj   
67   
68    def run(self, x = 0.0):
69        """ Evaluate the model
70            @param x: input q, or [q,phi]
71            @return: scattering function P(q)
72        """
73       
74        return CCylinderModel.run(self, x)
75   
76    def runXY(self, x = 0.0):
77        """ Evaluate the model in cartesian coordinates
78            @param x: input q, or [qx, qy]
79            @return: scattering function P(q)
80        """
81       
82        return CCylinderModel.runXY(self, x)
83   
84# End of file
Note: See TracBrowser for help on using the repository browser.