Changeset 3857


Ignore:
Timestamp:
Mar 18, 2019 12:09:57 PM (4 years ago)
Author:
toby
Message:

Fix scriptable to work w/o wx & mpl; reorg of docs

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r3842 r3857  
    2626import GSASIIpath
    2727GSASIIpath.SetVersionNumber("$Revision$")
    28 import GSASIIplot as G2plt
     28try:
     29    import GSASIIplot as G2plt
     30except ImportError, ModuleNotFoundError: # expected in scriptable w/o matplotlib and/or wx
     31    pass
    2932import GSASIIlattice as G2lat
    3033import GSASIIpwd as G2pwd
  • trunk/GSASIIscriptable.py

    r3849 r3857  
    10681068    gsasii_version = str(GSASIIpath.GetVersionNumber())
    10691069    LoadG2fil()
    1070     import matplotlib as mpl
    1071     python_library_versions = G2fil.get_python_versions([mpl, np, sp])
     1070    try:
     1071        import matplotlib as mpl
     1072        python_library_versions = G2fil.get_python_versions([mpl, np, sp])
     1073    except ModuleNotFoundError:
     1074        python_library_versions = G2fil.get_python_versions([np, sp])
    10721075
    10731076    controls_data = dict(G2obj.DefaultControls)
     
    28122815        try:
    28132816            import matplotlib.pyplot as plt
    2814             data = self.data['data'][1]
    2815             if Yobs:
    2816                 plt.plot(data[0], data[1], label='Yobs')
    2817             if Ycalc:
    2818                 plt.plot(data[0], data[3], label='Ycalc')
    2819             if Background:
    2820                 plt.plot(data[0], data[4], label='Background')
    2821             if Residual:
    2822                 plt.plot(data[0], data[5], label="Residual")
    28232817        except ImportError:
    2824             pass
     2818            print('Unable to import matplotlib, skipping plot')
     2819            return
     2820        data = self.data['data'][1]
     2821        if Yobs:
     2822            plt.plot(data[0], data[1], label='Yobs')
     2823        if Ycalc:
     2824            plt.plot(data[0], data[3], label='Ycalc')
     2825        if Background:
     2826            plt.plot(data[0], data[4], label='Background')
     2827        if Residual:
     2828            plt.plot(data[0], data[5], label="Residual")
    28252829
    28262830    def get_wR(self):
  • trunk/docs/source/index.rst

    r3288 r3857  
    55=================================
    66
     7The following documentation is intended for those wishing to code
     8withing the GSAS-II framework, those planning to understand how
     9GSAS-II works or for people wishing to develop scripting applications
     10using the API (:mod:`GSASIIscriptable`).
     11
     12Contents
     13---------
     14
    715.. toctree::
    816
     17  packages.rst
    918  GSASII.rst
    1019  GSASIIobj.rst
     
    2534  exports.rst
    2635
    27 *Required packages*
    28 --------------------
    29 
    30 GSAS-II requires a standard Python interpreter to be installed, as
    31 well as several separately-developed packages. GSAS-II is being
    32 developed using both Python 2.7 and Python 3.6, but some sections of
    33 the code have not been exercised in Python 3 so bugs are to be
    34 expected (please report them). Our
    35 goal is to keep the code compliant with both Python 2.7 and 3.x for
    36 the immediate future.
    37 
    38 Note that GSAS-II requires the Python extension packages
    39 
    40 * wxPython (http://wxpython.org/docs/api/). Note that GSAS-II has been tested with wxPython >=2.8, 3.0.x and 4.0.x
    41 * NumPy (http://docs.scipy.org/doc/numpy/reference/),
    42 * SciPy (http://docs.scipy.org/doc/scipy/reference/),
    43 * matplotlib (http://matplotlib.org/contents.html)  and
    44 * PyOpenGL (http://pyopengl.sourceforge.net/documentation). Note: a copy of this is distributed with GSAS-II (at present) and will be installed if the Python setuptools package is present.
    45 
    46 Several packages are used by some parts of the code, but are not
    47 required. If these packages are not present warning messages may be
    48 generated when needed, but the vast bulk of GSAS-II will function normally.
    49 
    50 * PIL (http://www.pythonware.com/products/pil/) or Pillow (https://pillow.readthedocs.org). This is used to save
    51   and read certain types of images.
    52 * h5py is the HDF5 interface and hdf5 is the support package. These
    53   packages are (not surprisingly) required
    54   to import images from HDF5 files. If these libraries are not present,
    55   the HDF5 importer(s) will not appear in the import menu and a
    56   warning message appears on GSAS-II startup.
    57 * imageio is used to make movies.
    58 * svn: When using Anaconda we also encourage installation of the
    59   svn (subversion) conda package. This is not actually part of Python
    60   and can be installed directly into your system's configuration. It is used by
    61   GSAS-II to download updates to our code.
    62 
    63 Note that the packages listed above are not distributed as part of the Python standard
    64 library. We use the free Anaconda Python (https://www.anaconda.com/)
    65 distribution (and provide installers based on that), but there are
    66 many other fine distributions, such as Enthought Inc.'s Canopy and
    67 Python(x,y), see here: https://www.python.org/download/alternatives/.
    68 We do some testing using the older Enthought Python Distribution
    69 (EPD); this is known to have some problems with reading CIFs and
    70 encourage updating from that.
Note: See TracChangeset for help on using the changeset viewer.