Changeset c138211 in sasmodels


Ignore:
Timestamp:
Dec 21, 2015 9:32:08 AM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
4c2c535
Parents:
5258859
Message:

return NAN to signal invalid kernel parameters

Location:
sasmodels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_template.c

    r062c56d rc138211  
    125125    if (weight > cutoff) { 
    126126      const double scattering = Iq(qi, IQ_PARAMETERS); 
    127       //if (scattering >= 0.0) { // scattering cannot be negative 
     127      // allow kernels to exclude invalid regions by returning NaN 
     128      if (!isnan(scattering)) { 
    128129        ret += weight*scattering; 
    129130        norm += weight; 
     
    133134        norm_vol += vol_weight; 
    134135      #endif 
    135       //} 
     136      } 
    136137    //else { printf("exclude qx,qy,I:%%g,%%g,%%g\n",qi,scattering); } 
    137138    } 
  • sasmodels/models/barbell.c

    r0706431 rc138211  
    5151    double sn, cn; // slots to hold sincos function output 
    5252 
    53     if (bell_radius < radius) return -1.0; 
     53    if (bell_radius < radius) return NAN; 
    5454 
    5555    const double lower = 0.0; 
     
    9595 
    9696    // Exclude invalid inputs. 
    97     if (bell_radius < radius) return -1.0; 
     97    if (bell_radius < radius) return NAN; 
    9898 
    9999    // Compute angle alpha between q and the cylinder axis 
  • sasmodels/models/capped_cylinder.c

    r34756fd rc138211  
    8888 
    8989    // Exclude invalid inputs. 
    90     if (cap_radius < radius) return -1.0; 
     90    if (cap_radius < radius) return NAN; 
    9191 
    9292    const double lower = 0.0; 
     
    138138 
    139139    // Exclude invalid inputs. 
    140     if (cap_radius < radius) return -1.0; 
     140    if (cap_radius < radius) return NAN; 
    141141 
    142142    // Compute angle alpha between q and the cylinder axis 
  • sasmodels/models/triaxial_ellipsoid.c

    r1ec7efa rc138211  
    1717    double rpolar) 
    1818{ 
    19     // if (req_minor > req_major || req_major > rpolar) return -1.0;  // Exclude invalid region 
     19    // if (req_minor > req_major || req_major > rpolar) return NAN;  // Exclude invalid region 
    2020 
    2121    double sn, cn; 
     
    6262    double psi) 
    6363{ 
    64     // if (req_minor > req_major || req_major > rpolar) return -1.0;  // Exclude invalid region 
     64    // if (req_minor > req_major || req_major > rpolar) return NAN;  // Exclude invalid region 
    6565 
    6666    double stheta, ctheta; 
Note: See TracChangeset for help on using the changeset viewer.