예제 #1
0
class TestCoreFourShellModel(unittest.TestCase):
    """ Unit tests for CoreFourShellModel """
    def setUp(self):
        from sas.models.CoreFourShellModel import CoreFourShellModel
        self.comp = CoreFourShellModel()

    def test1D(self):
        """ Test 1D model for a CoreFourShellModel """
        print "sldsolv", self.comp.getParam("sld_solv")
        self.assertAlmostEqual(self.comp.run(0.001), 3318.19548, 4)

    def test1D_2(self):
        """ Test 2D model for a CoreFourShellModel """
        self.assertAlmostEqual(self.comp.run([0.001, 0.2]), 3318.19548, 4)
예제 #2
0
class TestCoreFourShellModel(unittest.TestCase):
    """ Unit tests for CoreFourShellModel """
    
    def setUp(self):
        from sas.models.CoreFourShellModel import CoreFourShellModel
        self.comp = CoreFourShellModel()
        
    def test1D(self):
        """ Test 1D model for a CoreFourShellModel """
        print "sldsolv",self.comp.getParam("sld_solv")
        self.assertAlmostEqual(self.comp.run(0.001), 3318.19548, 4)
        
    def test1D_2(self):
        """ Test 2D model for a CoreFourShellModel """
        self.assertAlmostEqual(self.comp.run([0.001, 0.2]), 3318.19548, 4)
    def __init__(self, multfactor=1):
        BaseComponent.__init__(self)
        """
        :param n_shells: number of shells in the model, assumes 1<= n_shells <=4.
        """

        ## Setting  model name model description
        self.description = ""
        model = CoreFourShellModel()
        self.model = model
        self.name = "CoreMultiShellModel"
        self.description = ""
        self.n_shells = multfactor
        ## Define parameters
        self.params = {}

        ## Parameter details [units, min, max]
        self.details = {}

        # non-fittable parameters
        self.non_fittable = model.non_fittable

        ## dispersion
        self._set_dispersion()
        ## Define parameters
        self._set_params()

        ## Parameter details [units, min, max]
        self._set_details()

        #list of parameter that can be fitted
        self._set_fixed_params()
        self.orientation_params = []
        self.magnetic_params = []

        ## functional multiplicity info of the model
        # [int(maximum no. of functionality),"str(Titl),
        # [str(name of function0),...], [str(x-asix name of sld),...]]
        self.multiplicity_info = [
            max_nshells, "No. of Shells:", [], ['Radius']
        ]

        ## parameters with orientation: can be removed since there is no orientational params
        self._set_orientation_params()
예제 #4
0
 def setUp(self):
     from sas.models.CoreFourShellModel import CoreFourShellModel
     self.comp = CoreFourShellModel()