Ignore:
Timestamp:
Aug 4, 2009 4:02:28 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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:
8dc0b746
Parents:
b341b16
Message:

added 2D and model descpt.

Location:
sansmodels/src/sans/models/c_models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp

    r27a0771 r96b59384  
    102102        self->model->deltaH.dispersion->accept_as_source(visitor, self->model->deltaH.dispersion, disp_dict); 
    103103        PyDict_SetItemString(self->dispersion, "deltaH", disp_dict); 
     104        disp_dict = PyDict_New(); 
     105        self->model->spacing.dispersion->accept_as_source(visitor, self->model->spacing.dispersion, disp_dict); 
     106        PyDict_SetItemString(self->dispersion, "spacing", disp_dict); 
    104107 
    105108 
     
    171174    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH"); 
    172175    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict); 
     176    disp_dict = PyDict_GetItemString(self->dispersion, "spacing"); 
     177    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 
    173178 
    174179         
     
    239244    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH"); 
    240245    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict); 
     246    disp_dict = PyDict_GetItemString(self->dispersion, "spacing"); 
     247    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 
    241248 
    242249         
     
    298305    } else    if (!strcmp(par_name, "deltaH")) { 
    299306        self->model->deltaH.dispersion = dispersion; 
     307    } else    if (!strcmp(par_name, "spacing")) { 
     308        self->model->spacing.dispersion = dispersion; 
    300309    } else { 
    301310            PyErr_SetString(CLamellarPSHGModelError, 
  • sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp

    r27a0771 r96b59384  
    3535LamellarPSHGModel :: LamellarPSHGModel() { 
    3636        scale      = Parameter(1.0); 
    37         spacing    = Parameter(40.0); 
     37        spacing    = Parameter(40.0, true); 
     38        spacing.set_min(0.0); 
    3839        deltaT     = Parameter(10.0, true); 
    3940        deltaT.set_min(0.0); 
     
    6970        dp[7] = n_plates(); 
    7071        dp[8] = caille(); 
    71         dp[9] = background(); 
    72          
     72        dp[9] = 0.0; 
     73 
    7374 
    7475        // Get the dispersion points for (deltaT) thickness of the tail 
    7576        vector<WeightPoint> weights_deltaT; 
    7677        deltaT.get_weights(weights_deltaT); 
    77          
     78 
    7879        // Get the dispersion points for (deltaH) thickness of the head 
    7980        vector<WeightPoint> weights_deltaH; 
    8081        deltaH.get_weights(weights_deltaH); 
    8182 
     83        // Get the dispersion points for spacing 
     84        vector<WeightPoint> weights_spacing; 
     85        spacing.get_weights(weights_spacing); 
     86 
    8287        // Perform the computation, with all weight points 
    8388        double sum = 0.0; 
    8489        double norm = 0.0; 
    85          
     90 
    8691        // Loop over deltaT  weight points 
    8792        for(int i=0; i< (int)weights_deltaT.size(); i++) { 
     
    9196                for(int j=0; j< (int)weights_deltaH.size(); j++) { 
    9297                        dp[3] = weights_deltaH[j].value; 
     98                        // Loop over spacing weight points 
     99                        for(int k=0; k< (int)weights_spacing.size(); k++) { 
     100                                dp[1] = weights_spacing[k].value; 
    93101 
    94                         sum += weights_deltaT[i].weight * weights_deltaH[j].weight *LamellarPS_HG(dp, q); 
    95                         norm += weights_deltaT[i].weight * weights_deltaH[j].weight; 
     102                                sum += weights_deltaT[i].weight * weights_deltaH[j].weight *weights_spacing[k].weight 
     103                                                                *LamellarPS_HG(dp, q); 
     104                                norm += weights_deltaT[i].weight * weights_deltaH[j].weight * weights_spacing[k].weight; 
     105                        } 
    96106                } 
    97                                  
    98107        } 
    99108        return sum/norm + background(); 
     
    105114 * @return: function value 
    106115 */ 
     116double LamellarPSHGModel :: operator()(double qx, double qy) { 
     117        double q = sqrt(qx*qx + qy*qy); 
     118        return (*this).operator()(q); 
     119} 
     120 
     121/** 
     122 * Function to evaluate 2D scattering function 
     123 * @param pars: parameters of the lamellarPS_HG 
     124 * @param q: q-value 
     125 * @param phi: angle phi 
     126 * @return: function value 
     127 */ 
     128double LamellarPSHGModel :: evaluate_rphi(double q, double phi) { 
     129        return (*this).operator()(q); 
     130} 
     131 
     132/* 
    107133double LamellarPSHGModel :: operator()(double qx, double qy) { 
    108134        LamellarPSHGParameters dp; 
     
    118144        dp.caille = caille(); 
    119145        dp.background    = background(); 
    120          
     146 
    121147        // Get the dispersion points for the deltaT 
    122148        vector<WeightPoint> weights_deltaT; 
     
    134160        for(int i=0; i< (int)weights_deltaT.size(); i++) { 
    135161                dp.deltaT = weights_deltaT[i].value; 
    136                  
     162 
    137163                // Loop over deltaH weight points 
    138164                for(int j=0; j< (int)weights_deltaH.size(); j++) { 
    139165                        dp.deltaH = weights_deltaH[j].value; 
    140166 
    141                         sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy);   
    142                         norm += weights_deltaT[i].weight * weights_deltaH[j].weight;     
     167                        sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy); 
     168                        norm += weights_deltaT[i].weight * weights_deltaH[j].weight; 
    143169                } 
    144170        } 
    145171        return sum/norm + background(); 
    146172} 
     173*/ 
    147174 
    148175 
    149 /** 
    150  * Function to evaluate 2D scattering function 
    151  * @param pars: parameters of the lamellar 
    152  * @param q: q-value 
    153  * @param phi: angle phi 
    154  * @return: function value 
    155  */ 
    156 double LamellarPSHGModel :: evaluate_rphi(double q, double phi) { 
    157         double qx = q*cos(phi); 
    158         double qy = q*sin(phi); 
    159         return (*this).operator()(qx, qy); 
    160 } 
  • sansmodels/src/sans/models/c_models/oblate.cpp

    r27a0771 r96b59384  
    4545        sld_solvent = Parameter(6.3e-6); 
    4646        background = Parameter(0.0); 
    47         axis_theta  = Parameter(0.0, true); 
    48         axis_phi    = Parameter(0.0, true); 
    4947} 
    5048 
     
    6765        dp[5] = contrast(); 
    6866        dp[6] = sld_solvent(); 
    69         dp[7] = background(); 
    70          
     67        dp[7] = 0.0; 
     68 
    7169        // Get the dispersion points for the major core 
    7270        vector<WeightPoint> weights_major_core; 
     
    106104                                        dp[4] = weights_minor_shell[l].value; 
    107105 
    108                                         sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight  
     106                                        sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
    109107                                                * weights_minor_shell[l].weight * OblateForm(dp, q); 
    110                                         norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight  
     108                                        norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
    111109                                                        * weights_minor_shell[l].weight; 
    112110                                } 
     
    123121 * @return: function value 
    124122 */ 
     123 
    125124double OblateModel :: operator()(double qx, double qy) { 
     125        double q = sqrt(qx*qx + qy*qy); 
     126 
     127        return (*this).operator()(q); 
     128} 
     129 
     130 
     131/** 
     132 * Function to evaluate 2D scattering function 
     133 * @param pars: parameters of the oblate 
     134 * @param q: q-value 
     135 * @param phi: angle phi 
     136 * @return: function value 
     137 */ 
     138double OblateModel :: evaluate_rphi(double q, double phi) { 
     139        return (*this).operator()(q); 
     140} 
     141 
     142/* disable below for now 
     143double OblateShellModel :: operator()(double qx, double qy) { 
    126144        OblateParameters dp; 
    127145        // Fill parameter array 
     
    215233        return sum/norm + background(); 
    216234} 
    217  
    218 /** 
    219  * Function to evaluate 2D scattering function 
    220  * @param pars: parameters of the oblate 
    221  * @param q: q-value 
    222  * @param phi: angle phi 
    223  * @return: function value 
    224  */ 
    225 double OblateModel :: evaluate_rphi(double q, double phi) { 
    226         double qx = q*cos(phi); 
    227         double qy = q*sin(phi); 
    228         return (*this).operator()(qx, qy); 
    229 } 
     235*/// 
Note: See TracChangeset for help on using the changeset viewer.