Ignore:
Timestamp:
Jun 4, 2010 5:04:49 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
5062bbf
Parents:
7116b6e0
Message:

working on documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/dispersion_models.py

    rc9aa125 r79ac6f8  
    1 """ 
    2     This software was developed by the University of Tennessee as part of the 
    3     Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    4     project funded by the US National Science Foundation. 
    51 
    6     If you use DANSE applications to do scientific research that leads to 
    7     publication, we ask that you acknowledge the use of the software with the 
    8     following sentence: 
    9  
    10     "This work benefited from DANSE software developed under NSF award DMR-0520547." 
    11  
    12     copyright 2008, University of Tennessee 
    13 """ 
     2################################################################################ 
     3#This software was developed by the University of Tennessee as part of the 
     4#Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
     5#project funded by the US National Science Foundation. 
     6# 
     7#If you use DANSE applications to do scientific research that leads to 
     8#publication, we ask that you acknowledge the use of the software with the 
     9#following sentence: 
     10# 
     11#"This work benefited from DANSE software developed under NSF award DMR-0520547." 
     12# 
     13#copyright 2008, University of Tennessee 
     14################################################################################ 
    1415 
    1516""" 
    16     Class definitions for python dispersion model for  
    17     model parameters. These classes are bridges to the C++ 
    18     dispersion object. 
    19      
    20     The ArrayDispersion class takes in numpy arrays only. 
    21      
    22     Usage: 
    23     These classes can be used to set the dispersion model of a SANS model 
    24     parameter: 
    25      
    26         cyl = CylinderModel() 
    27         cyl.set_dispersion('radius', GaussianDispersion()) 
    28      
    29      
    30     After the dispersion model is set, you can access it's 
    31     parameter through the dispersion dictionary: 
    32      
    33         cyl.dispersion['radius']['width'] = 5.0 
    34      
    35     TODO: For backward compatibility, the model parameters are still kept in 
     17Class definitions for python dispersion model for  
     18model parameters. These classes are bridges to the C++ 
     19dispersion object. 
     20 
     21The ArrayDispersion class takes in numpy arrays only. 
     22 
     23Usage: 
     24These classes can be used to set the dispersion model of a SANS model 
     25parameter: 
     26 
     27    cyl = CylinderModel() 
     28    cyl.set_dispersion('radius', GaussianDispersion()) 
     29 
     30 
     31After the dispersion model is set, you can access it's 
     32parameter through the dispersion dictionary: 
     33 
     34    cyl.dispersion['radius']['width'] = 5.0 
     35 
     36:TODO: For backward compatibility, the model parameters are still kept in 
    3637    a dictionary. The next iteration of refactoring work should involve moving 
    3738    away from value-based parameters to object-based parameter. We want to 
     
    3940    dictionaries into a single dictionary of parameter objects that hold the 
    4041    complete information about the parameter (units, limits, dispersion model, etc...).   
    41      
     42 
    4243     
    4344""" 
     
    4849class DispersionModel: 
    4950    """ 
    50         Python bridge class for a basic dispersion model  
    51         class with a constant parameter value distribution 
     51    Python bridge class for a basic dispersion model  
     52    class with a constant parameter value distribution 
    5253    """ 
    5354    def __init__(self): 
     
    5657    def set_weights(self, values, weights): 
    5758        """ 
    58             Set the weights of an array dispersion 
     59        Set the weights of an array dispersion 
    5960        """ 
    6061        message = "set_weights is not available for DispersionModel.\n" 
     
    6465class GaussianDispersion(DispersionModel): 
    6566    """ 
    66         Python bridge class for a dispersion model based  
    67         on a Gaussian distribution. 
     67    Python bridge class for a dispersion model based  
     68    on a Gaussian distribution. 
    6869    """ 
    6970    def __init__(self): 
     
    8485    """ 
    8586    def __init__(self): 
     87        """ 
     88        """ 
    8689        self.cdisp = c_models.new_schulz_model() 
    8790         
    8891    def set_weights(self, values, weights): 
    8992        """ 
    90             Set the weights of an array dispersion 
     93        Set the weights of an array dispersion 
    9194        """ 
    9295        message = "set_weights is not available for SchulzDispersion.\n" 
     
    9699class LogNormalDispersion(DispersionModel): 
    97100    """ 
    98         Python bridge class for a dispersion model based  
    99         on a Log Normal distribution. 
     101    Python bridge class for a dispersion model based  
     102    on a Log Normal distribution. 
    100103    """ 
    101104    def __init__(self): 
     
    104107    def set_weights(self, values, weights): 
    105108        """ 
    106             Set the weights of an array dispersion 
     109        Set the weights of an array dispersion 
    107110        """ 
    108111        message = "set_weights is not available for LogNormalDispersion.\n" 
     
    112115class ArrayDispersion(DispersionModel): 
    113116    """ 
    114         Python bridge class for a dispersion model based on arrays. 
    115         The user has to set a weight distribution that 
    116         will be used in the averaging the model parameter 
    117         it is applied to.  
     117    Python bridge class for a dispersion model based on arrays. 
     118    The user has to set a weight distribution that 
     119    will be used in the averaging the model parameter 
     120    it is applied to.  
    118121    """ 
    119122    def __init__(self): 
     
    122125    def set_weights(self, values, weights): 
    123126        """ 
    124             Set the weights of an array dispersion 
    125             Only accept numpy arrays. 
    126             @param values: numpy array of values 
    127             @param weights: numpy array of weights for each value entry 
     127        Set the weights of an array dispersion 
     128        Only accept numpy arrays. 
     129         
     130        :param values: numpy array of values 
     131        :param weights: numpy array of weights for each value entry 
     132         
    128133        """ 
    129134        if len(values) != len(weights): 
Note: See TracChangeset for help on using the changeset viewer.