source: sasview/sansmodels/src/sans/models/PowerLawAbsModel.py @ d7b7156

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 d7b7156 was 9ce41c6, checked in by Gervaise Alina <gervyh@…>, 15 years ago

wrote unittest for all model untested , haven' test critial point error handling

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[9ce41c6]1#!/usr/bin/env python
2"""
3    Provide F(x) = scale* (|x|)^(-m) + bkd
4    Power law function as a BaseComponent model
5"""
6
7from sans.models.PowerLawModel import PowerLawModel
8import math
9class PowerLawAbsModel(PowerLawModel):
10    """
11        Class that evaluates a absolute Power_Law model.
12       
13        F(x) = scale* (|x|)^(-m) + bkd
14       
15        The model has three parameters:
16            m     =  power
17            scale  =  scale factor
18            bkd    =  incoherent background
19    """
20   
21    def __init__(self):
22        """ Initialization """
23        # Initialize PowerLawAbsModel
24        PowerLawModel.__init__(self)
25        ## Name of the model
26        self.name = "Absolute Power_Law"
27        self.description=""" The Power_Law model.
28        F(x) = scale* (|x|)^(-m) + bkd
29       
30        The model has three parameters:
31        m     =  power
32        scale  =  scale factor
33        bkd    =  incoherent background"""
34       
35       
36    def _PowerLaw(self, x):
37        return PowerLawModel._PowerLaw(self, math.fabs(x))
38       
Note: See TracBrowser for help on using the repository browser.