Changeset 3c567c6b in sasmodels


Ignore:
Timestamp:
Aug 12, 2016 6:52:30 AM (8 years ago)
Author:
wojciech
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:
40e415d
Parents:
9f60c06 (diff), fd19811 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
wpotrzebowski <Wojciech.Potrzebowski@…> (08/12/16 06:51:55)
git-committer:
wpotrzebowski <Wojciech.Potrzebowski@…> (08/12/16 06:52:30)
Message:

Magnetism help file moved to sasmodels - fixing ticket #607

Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/conversion_table.py

    rcbf4604 rc95dfc63  
    363363        } 
    364364    ], 
    365     "hardsphere2": [ 
    366         "HardsphereStructure", 
    367         {} 
    368     ], 
    369     "hardsphere3": [ 
    370         "HardsphereStructure", 
    371         {} 
    372     ], 
    373     "hardsphere4": [ 
    374         "HardsphereStructure", 
    375         {} 
    376     ], 
    377365    "hayter_msa": [ 
    378366        "HayterMSAStructure", 
  • sasmodels/sasview_model.py

    r9457498 rfd19811  
    1818 
    1919import numpy as np  # type: ignore 
    20  
    21 # Monkey patch sas.sascalc.fit as sas.models so that sas.models.pluginmodel 
    22 # is available to the plugin modules. 
    23 import sys 
    24 import sas 
    25 import sas.sascalc.fit 
    26 sys.modules['sas.models'] = sas.sascalc.fit 
    27 sas.models = sas.sascalc.fit 
    2820 
    2921from . import core 
     
    4638    pass 
    4739 
     40SUPPORT_OLD_STYLE_PLUGINS = True 
     41 
     42def _register_old_models(): 
     43    # type: () -> None 
     44    """ 
     45    Place the new models into sasview under the old names. 
     46 
     47    Monkey patch sas.sascalc.fit as sas.models so that sas.models.pluginmodel 
     48    is available to the plugin modules. 
     49    """ 
     50    import sys 
     51    import sas 
     52    import sas.sascalc.fit 
     53    sys.modules['sas.models'] = sas.sascalc.fit 
     54    sas.models = sas.sascalc.fit 
     55 
     56    import sas.models 
     57    from sasmodels.conversion_table import CONVERSION_TABLE 
     58    for new_name, conversion in CONVERSION_TABLE.items(): 
     59        old_name = conversion[0] 
     60        module_attrs = {old_name: find_model(new_name)} 
     61        ConstructedModule = type(old_name, (), module_attrs) 
     62        old_path = 'sas.models.' + old_name 
     63        setattr(sas.models, old_path, ConstructedModule) 
     64        sys.modules[old_path] = ConstructedModule 
     65 
    4866 
    4967# TODO: separate x_axis_label from multiplicity info 
     
    86104        except Exception: 
    87105            logging.error(traceback.format_exc()) 
     106    if SUPPORT_OLD_STYLE_PLUGINS: 
     107        _register_old_models() 
     108 
    88109    return models 
    89110 
     
    676697            raise 
    677698 
     699def test_old_name(): 
     700    # type: () -> None 
     701    """ 
     702    Load and run cylinder model from sas.models.CylinderModel 
     703    """ 
     704    if not SUPPORT_OLD_STYLE_PLUGINS: 
     705        return 
     706    try: 
     707        # if sasview is not on the path then don't try to test it 
     708        import sas 
     709    except ImportError: 
     710        return 
     711    load_standard_models() 
     712    from sas.models.CylinderModel import CylinderModel 
     713    CylinderModel().evalDistribution([0.1, 0.1]) 
     714 
    678715if __name__ == "__main__": 
    679716    print("cylinder(0.1,0.1)=%g"%test_model()) 
  • doc/ref/index.rst

    r7bb290c r9f60c06  
    88 
    99   intro.rst 
     10   magnetism.rst 
    1011   refs.rst 
  • doc/ref/intro.rst

    r61ba623 r9f60c06  
    4444($x$) axis of the plane of the detector. 
    4545 
    46 For information about polarised and magnetic scattering, see here_. 
     46For information about polarised and magnetic scattering, see :ref:`magnetism`. 
    4747 
    48  
    49 .. _here: polar_mag_help.html 
  • sasmodels/models/core_multi_shell.py

    r40a87fa r9f60c06  
    2626 
    2727For information about polarised and magnetic scattering, see 
    28 the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` documentation. 
     28the :ref:`magnetism` documentation. 
    2929 
    3030Our model uses the form factor calculations implemented in a c-library provided 
  • sasmodels/models/core_shell_sphere.py

    r40a87fa r9f60c06  
    44This model provides the form factor, $P(q)$, for a spherical particle with 
    55a core-shell structure. The form factor is normalized by the particle volume. 
     6 
     7For information about polarised and magnetic scattering, see 
     8the :ref:`magnetism` documentation. 
    69 
    710Definition 
  • sasmodels/models/cylinder.py

    r40a87fa r9f60c06  
    33r""" 
    44The form factor is normalized by the particle volume V = \piR^2L. 
     5For information about polarised and magnetic scattering, see 
     6the :ref:`magnetism` documentation. 
    57 
    68Definition 
  • sasmodels/models/fuzzy_sphere.py

    r40a87fa r9f60c06  
    11r""" 
    22For information about polarised and magnetic scattering, see 
    3 the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` 
     3the :ref:`magnetism` 
    44documentation. 
    55 
  • sasmodels/models/multilayer_vesicle.py

    r40a87fa r9f60c06  
    1313    Geometry of the multilayer_vesicle model. 
    1414 
    15 See the :ref:`core-shell` model for more documentation. 
     15See the :ref:`core-shell-sphere` model for more documentation. 
    1616 
    1717The 2D scattering intensity is the same as 1D, regardless of the orientation 
     
    2828 
    2929For information about polarised and magnetic scattering, see 
    30 the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` documentation. 
     30the :ref:`magnetism` documentation. 
    3131 
    3232This code is based on the form factor calculations implemented in the NIST 
  • sasmodels/models/parallelepiped.py

    r40a87fa r9f60c06  
    33r""" 
    44The form factor is normalized by the particle volume. 
     5For information about polarised and magnetic scattering, see 
     6the :ref:`magnetism` documentation. 
    57 
    68Definition 
  • sasmodels/models/sphere.py

    r40a87fa r9f60c06  
    11r""" 
    22For information about polarised and magnetic scattering, see 
    3 the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` 
     3the :ref:`magnetism` documentation. 
    44documentation. 
    55 
Note: See TracChangeset for help on using the changeset viewer.