Changes in sasmodels/compare.py [5753e4e:e1ace4d] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    r5753e4e re1ace4d  
    130130    if name == 'capped_cylinder' and pars['cap_radius'] < pars['radius']: 
    131131        pars['radius'],pars['cap_radius'] = pars['cap_radius'],pars['radius'] 
     132    if name == 'barbell' and pars['bell_radius'] < pars['radius']: 
     133        pars['radius'],pars['bell_radius'] = pars['bell_radius'],pars['radius'] 
     134 
     135    # Limit guinier to an Rg such that Iq > 1e-30 (single precision cutoff) 
     136    if name == 'guinier': 
     137        #q_max = 0.2  # mid q maximum 
     138        q_max = 1.0  # high q maximum 
     139        rg_max = np.sqrt(90*np.log(10) + 3*np.log(pars['scale']))/q_max 
     140        pars['rg'] = min(pars['rg'],rg_max) 
    132141 
    133142    # These constraints are only needed for comparison to sasview 
     
    224233    model_definition = core.load_model_definition(name) 
    225234 
    226     view = 'linear' if '-linear' in opts else 'log' if '-log' in opts else 'q4' if '-q4' in opts else 'log' 
     235    view = ('linear' if '-linear' in opts 
     236            else 'log' if '-log' in opts 
     237            else 'q4' if '-q4' in opts 
     238            else 'log') 
    227239 
    228240    opt_values = dict(split 
     
    230242                      if len(split) == 2) 
    231243    # Sort out data 
    232     qmax = 10.0 if '-exq' in opts else 1.0 if '-highq' in opts else 0.2 if '-midq' in opts else 0.05 
     244    qmax = (10.0 if '-exq' in opts 
     245            else 1.0 if '-highq' in opts 
     246            else 0.2 if '-midq' in opts 
     247            else 0.05) 
    233248    Nq = int(opt_values.get('-Nq', '128')) 
    234249    res = float(opt_values.get('-res', '0')) 
     
    239254 
    240255    # modelling accuracy is determined by dtype and cutoff 
    241     dtype = 'double' if '-double' in opts else 'single' 
     256    dtype = ('longdouble' if '-quad' in opts 
     257             else 'double' if '-double' in opts 
     258             else 'single') 
    242259    cutoff = float(opt_values.get('-cutoff','1e-5')) 
    243260 
     
    247264        seed = int(opt_values['-random']) if '-random' in opt_values else None 
    248265        pars, seed = randomize_model(pars, seed=seed) 
    249         constrain_pars(model_definition, pars) 
    250266        print "Randomize using -random=%i"%seed 
    251267    pars.update(set_pars)  # set value after random to control value 
     268    constrain_pars(model_definition, pars) 
    252269 
    253270    # parameter selection 
     
    362379 
    363380    -plot*/-noplot plots or suppress the plot of the model 
    364     -single*/-double uses double precision for comparison 
     381    -single*/-double/-quad use single/double/quad precision for comparison 
    365382    -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 
    366383    -Nq=128 sets the number of Q points in the data set 
     
    386403NAME_OPTIONS = set([ 
    387404    'plot','noplot', 
    388     'single','double', 
     405    'single','double','longdouble', 
    389406    'lowq','midq','highq','exq', 
    390407    '2d','1d', 
Note: See TracChangeset for help on using the changeset viewer.