Changeset 310ddcb in sasmodels for sasmodels/convert.py


Ignore:
Timestamp:
Mar 16, 2016 3:31:02 PM (8 years ago)
Author:
richardh
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:
3a45c2c
Parents:
cb97bff
Message:

fix convert for new structure_factor flag in model_info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r667a6f2 r310ddcb  
    44import warnings 
    55 
    6 STRUCTURE_FACTORS = [ 
    7     'hardsphere', 
    8     'stickyhardsphere', 
    9     'squarewell', 
    10     'HayterMSAsq' 
    11 ] 
    126# List of models which SasView versions don't contain the explicit 'scale' argument. 
    137# When converting such a model, please update this list. 
    14 MODELS_WITHOUT_SCALE = STRUCTURE_FACTORS + [ 
     8MODELS_WITHOUT_SCALE = [ 
    159    'teubner_strey', 
    1610    'broad_peak', 
     
    2721# List of models which SasView versions don't contain the explicit 'background' argument. 
    2822# When converting such a model, please update this list. 
    29 MODELS_WITHOUT_BACKGROUND = STRUCTURE_FACTORS + [ 
     23MODELS_WITHOUT_BACKGROUND = [ 
    3024    'guinier', 
    3125] 
     
    128122    # Note: update compare.constrain_pars to match 
    129123    name = model_info['id'] 
    130     if name in MODELS_WITHOUT_SCALE: 
     124    if name in MODELS_WITHOUT_SCALE or model_info['structure_factor']: 
    131125        if oldpars.pop('scale', 1.0) != 1.0: 
    132126            warnings.warn("parameter scale not used in sasview %s"%name) 
    133     if name in MODELS_WITHOUT_BACKGROUND: 
     127    if name in MODELS_WITHOUT_BACKGROUND or model_info['structure_factor']: 
    134128        if oldpars.pop('background', 0.0) != 0.0: 
    135129            warnings.warn("parameter background not used in sasview %s"%name) 
     
    161155    name = model_info['id'] 
    162156    # Note: update convert.revert_model to match 
    163     if name in MODELS_WITHOUT_SCALE: 
     157    if name in MODELS_WITHOUT_SCALE or model_info['structure_factor']: 
    164158        pars['scale'] = 1 
    165     if name in MODELS_WITHOUT_BACKGROUND: 
     159    if name in MODELS_WITHOUT_BACKGROUND or model_info['structure_factor']: 
    166160        pars['background'] = 0 
    167161    # sasview multiplies background by structure factor 
Note: See TracChangeset for help on using the changeset viewer.