Changeset 44aa1ed in sasview for sansmodels/src/sans/models


Ignore:
Timestamp:
Aug 21, 2009 4:14:53 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:
2339ff1e
Parents:
14c3887
Message:

corrected axis input mistake

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_extensions/ellipsoid.c

    rae3ce4e r44aa1ed  
    1111/** 
    1212 * Test kernel for validation 
    13  *  
     13 * 
    1414 * @param q: q-value 
    1515 * @param r_small: small axis length 
     
    2323        double cos_alpha; 
    2424        double sph_func; 
    25          
     25 
    2626        sin_alpha = sin(angle); 
    2727        cos_alpha = cos(angle); 
    28          
     28 
    2929        // Modified length for phase 
    30         length = r_small*sqrt(sin_alpha*sin_alpha +  
     30        length = r_small*sqrt(sin_alpha*sin_alpha + 
    3131                        r_long*r_long/(r_small*r_small)*cos_alpha*cos_alpha); 
    32          
     32 
    3333        // Spherical scattering ampliture, with modified length for ellipsoid 
    3434        sph_func = 3*( sin(q*length) - q*length*cos(q*length) ) / (q*q*q*length*length*length); 
    35          
     35 
    3636        return sph_func*sph_func; 
    3737} 
     
    4545double ellipsoid_analytical_1D(EllipsoidParameters *pars, double q) { 
    4646        double dp[5]; 
    47          
     47 
    4848        dp[0] = pars->scale; 
    4949        dp[1] = pars->radius_a; 
     
    5151        dp[3] = pars->contrast; 
    5252        dp[4] = pars->background; 
    53          
     53 
    5454        return EllipsoidForm(dp, q); 
    5555} 
    56      
     56 
    5757/** 
    5858 * Function to evaluate 2D scattering function 
     
    6565        q = sqrt(qx*qx+qy*qy); 
    6666    return ellipsoid_analytical_2D_scaled(pars, q, qx/q, qy/q); 
    67 }  
     67} 
    6868 
    6969/** 
     
    7676double ellipsoid_analytical_2D(EllipsoidParameters *pars, double q, double phi) { 
    7777    return ellipsoid_analytical_2D_scaled(pars, q, cos(phi), sin(phi)); 
    78 }  
     78} 
    7979 
    8080/** 
     
    9191        double theta, alpha, f, vol, sin_val, cos_val; 
    9292        double answer; 
    93          
     93 
    9494    // Ellipsoid orientation 
    9595    cyl_x = sin(pars->axis_theta) * cos(pars->axis_phi); 
    9696    cyl_y = sin(pars->axis_theta) * sin(pars->axis_phi); 
    9797    cyl_z = cos(pars->axis_theta); 
    98       
     98 
    9999    // q vector 
    100100    q_z = 0; 
    101          
     101 
    102102    // Compute the angle btw vector q and the 
    103103    // axis of the cylinder 
    104104    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z; 
    105      
     105 
    106106    // The following test should always pass 
    107107    if (fabs(cos_val)>1.0) { 
     
    109109        return 0; 
    110110    } 
    111      
     111 
    112112    // Angle between rotation axis and q vector 
    113113        alpha = acos( cos_val ); 
    114          
     114 
    115115        // Call the IGOR library function to get the kernel 
    116         answer = EllipsoidKernel(q, pars->radius_b, pars->radius_a, cos_val); 
    117          
     116        answer = EllipsoidKernel(q, pars->radius_a, pars->radius_b, cos_val); 
     117 
    118118        // Multiply by contrast^2 
    119119        answer *= pars->contrast*pars->contrast; 
    120          
     120 
    121121        //normalize by cylinder volume 
    122122    vol = 4.0/3.0 * acos(-1.0) * pars->radius_b * pars->radius_b * pars->radius_a; 
    123123        answer *= vol; 
    124          
     124 
    125125        //convert to [cm-1] 
    126126        answer *= 1.0e8; 
    127          
     127 
    128128        //Scale 
    129129        answer *= pars->scale; 
    130          
     130 
    131131        // add in the background 
    132132        answer += pars->background; 
    133          
     133 
    134134        return answer; 
    135135} 
Note: See TracChangeset for help on using the changeset viewer.