#!/usr/bin/env python ############################################################################## # This software was developed by the University of Tennessee as part of the # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) # project funded by the US National Science Foundation. # # If you use DANSE applications to do scientific research that leads to # publication, we ask that you acknowledge the use of the software with the # following sentence: # # "This work benefited from DANSE software developed under NSF award DMR-0520547." # # copyright 2008, University of Tennessee ############################################################################## """ Provide functionality for a C extension model :WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\refl.h AND RE-RUN THE GENERATOR SCRIPT """ from sans.models.BaseComponent import BaseComponent from sans_extension.c_models import CReflModel import copy class ReflModel(CReflModel, BaseComponent): """ Class that evaluates a ReflModel model. This file was auto-generated from ..\c_extensions\refl.h. Refer to that file and the structure it contains for details of the model. List of default parameters: n_layers = 1.0 scale = 1.0 thick_inter0 = 1.0 [A] func_inter0 = 0.0 sld_sub0 = 2.07e-006 [1/A^(2)] sld_medium = 1e-006 [1/A^(2)] background = 0.0 sld_flat1 = 4e-006 [1/A^(2)] sld_flat2 = 3.5e-006 [1/A^(2)] sld_flat3 = 4e-006 [1/A^(2)] sld_flat4 = 3.5e-006 [1/A^(2)] sld_flat5 = 4e-006 [1/A^(2)] sld_flat6 = 3.5e-006 [1/A^(2)] sld_flat7 = 4e-006 [1/A^(2)] sld_flat8 = 3.5e-006 [1/A^(2)] sld_flat9 = 4e-006 [1/A^(2)] sld_flat10 = 3.5e-006 [1/A^(2)] thick_inter1 = 1.0 [A] thick_inter2 = 1.0 [A] thick_inter3 = 1.0 [A] thick_inter4 = 1.0 [A] thick_inter5 = 1.0 [A] thick_inter6 = 1.0 [A] thick_inter7 = 1.0 [A] thick_inter8 = 1.0 [A] thick_inter9 = 1.0 [A] thick_inter10 = 1.0 [A] thick_flat1 = 10.0 [A] thick_flat2 = 100.0 [A] thick_flat3 = 100.0 [A] thick_flat4 = 100.0 [A] thick_flat5 = 100.0 [A] thick_flat6 = 100.0 [A] thick_flat7 = 100.0 [A] thick_flat8 = 100.0 [A] thick_flat9 = 100.0 [A] thick_flat10 = 100.0 [A] func_inter1 = 0.0 func_inter2 = 0.0 func_inter3 = 0.0 func_inter4 = 0.0 func_inter5 = 0.0 func_inter6 = 0.0 func_inter7 = 0.0 func_inter8 = 0.0 func_inter9 = 0.0 func_inter10 = 0.0 sldIM_flat1 = 0.0 sldIM_flat2 = 0.0 sldIM_flat3 = 0.0 sldIM_flat4 = 0.0 sldIM_flat5 = 0.0 sldIM_flat6 = 0.0 sldIM_flat7 = 0.0 sldIM_flat8 = 0.0 sldIM_flat9 = 0.0 sldIM_flat10 = 0.0 sldIM_sub0 = 0.0 sldIM_medium = 0.0 """ def __init__(self): """ Initialization """ # Initialize BaseComponent first, then sphere BaseComponent.__init__(self) CReflModel.__init__(self) ## Name of the model self.name = "ReflModel" ## Model description self.description ="""Form factor of mutishells normalized by the volume. Here each shell is described by an exponential function; I) For A_shell != 0, f(r) = B*exp(A_shell*(r-r_in)/thick_shell)+C where B=(sld_out-sld_in)/(exp(A_shell)-1) C=sld_in-B. Note that in the above case, the function becomes a linear function as A_shell --> 0+ or 0-. II) For the exact point of A_shell == 0, f(r) = sld_in ,i.e., it crosses over flat function Note that the 'sld_out' becaomes NULL in this case. background:background, rad_core: radius of sphere(core) thick_shell#:the thickness of the shell# sld_core: the SLD of the sphere sld_solv: the SLD of the solvent sld_shell: the SLD of the shell# A_shell#: the coefficient in the exponential function""" ## Parameter details [units, min, max] self.details = {} self.details['n_layers'] = ['', None, None] self.details['scale'] = ['', None, None] self.details['thick_inter0'] = ['[A]', None, None] self.details['func_inter0'] = ['', None, None] self.details['sld_sub0'] = ['[1/A^(2)]', None, None] self.details['sld_medium'] = ['[1/A^(2)]', None, None] self.details['background'] = ['', None, None] self.details['sld_flat1'] = ['[1/A^(2)]', None, None] self.details['sld_flat2'] = ['[1/A^(2)]', None, None] self.details['sld_flat3'] = ['[1/A^(2)]', None, None] self.details['sld_flat4'] = ['[1/A^(2)]', None, None] self.details['sld_flat5'] = ['[1/A^(2)]', None, None] self.details['sld_flat6'] = ['[1/A^(2)]', None, None] self.details['sld_flat7'] = ['[1/A^(2)]', None, None] self.details['sld_flat8'] = ['[1/A^(2)]', None, None] self.details['sld_flat9'] = ['[1/A^(2)]', None, None] self.details['sld_flat10'] = ['[1/A^(2)]', None, None] self.details['thick_inter1'] = ['[A]', None, None] self.details['thick_inter2'] = ['[A]', None, None] self.details['thick_inter3'] = ['[A]', None, None] self.details['thick_inter4'] = ['[A]', None, None] self.details['thick_inter5'] = ['[A]', None, None] self.details['thick_inter6'] = ['[A]', None, None] self.details['thick_inter7'] = ['[A]', None, None] self.details['thick_inter8'] = ['[A]', None, None] self.details['thick_inter9'] = ['[A]', None, None] self.details['thick_inter10'] = ['[A]', None, None] self.details['thick_flat1'] = ['[A]', None, None] self.details['thick_flat2'] = ['[A]', None, None] self.details['thick_flat3'] = ['[A]', None, None] self.details['thick_flat4'] = ['[A]', None, None] self.details['thick_flat5'] = ['[A]', None, None] self.details['thick_flat6'] = ['[A]', None, None] self.details['thick_flat7'] = ['[A]', None, None] self.details['thick_flat8'] = ['[A]', None, None] self.details['thick_flat9'] = ['[A]', None, None] self.details['thick_flat10'] = ['[A]', None, None] self.details['func_inter1'] = ['', None, None] self.details['func_inter2'] = ['', None, None] self.details['func_inter3'] = ['', None, None] self.details['func_inter4'] = ['', None, None] self.details['func_inter5'] = ['', None, None] self.details['func_inter6'] = ['', None, None] self.details['func_inter7'] = ['', None, None] self.details['func_inter8'] = ['', None, None] self.details['func_inter9'] = ['', None, None] self.details['func_inter10'] = ['', None, None] self.details['sldIM_flat1'] = ['', None, None] self.details['sldIM_flat2'] = ['', None, None] self.details['sldIM_flat3'] = ['', None, None] self.details['sldIM_flat4'] = ['', None, None] self.details['sldIM_flat5'] = ['', None, None] self.details['sldIM_flat6'] = ['', None, None] self.details['sldIM_flat7'] = ['', None, None] self.details['sldIM_flat8'] = ['', None, None] self.details['sldIM_flat9'] = ['', None, None] self.details['sldIM_flat10'] = ['', None, None] self.details['sldIM_sub0'] = ['', None, None] self.details['sldIM_medium'] = ['', None, None] ## fittable parameters self.fixed=[] ## non-fittable parameters self.non_fittable=['n_layers', 'func_inter0', 'func_inter1', 'func_inter2', 'func_inter3', 'func_inter4', 'func_inter5', 'func_inter5', 'func_inter7', 'func_inter8', 'func_inter9', 'func_inter10'] ## parameters with orientation self.orientation_params =[] def clone(self): """ Return a identical copy of self """ return self._clone(ReflModel()) def __getstate__(self): """ return object state for pickling and copying """ model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} return self.__dict__, model_state def __setstate__(self, state): """ create object from pickled state :param state: the state of the current model """ self.__dict__, model_state = state self.params = model_state['params'] self.dispersion = model_state['dispersion'] self.log = model_state['log'] def run(self, x=0.0): """ Evaluate the model :param x: input q, or [q,phi] :return: scattering function P(q) """ return CReflModel.run(self, x) def runXY(self, x=0.0): """ Evaluate the model in cartesian coordinates :param x: input q, or [qx, qy] :return: scattering function P(q) """ return CReflModel.runXY(self, x) def evalDistribution(self, x=[]): """ Evaluate the model in cartesian coordinates :param x: input q[], or [qx[], qy[]] :return: scattering function P(q[]) """ return CReflModel.evalDistribution(self, x) def calculate_ER(self): """ Calculate the effective radius for P(q)*S(q) :return: the value of the effective radius """ return CReflModel.calculate_ER(self) def set_dispersion(self, parameter, dispersion): """ Set the dispersion object for a model parameter :param parameter: name of the parameter [string] :param dispersion: dispersion object of type DispersionModel """ return CReflModel.set_dispersion(self, parameter, dispersion.cdisp) # End of file