Ejemplo n.º 1
0
def about():
    """
    About box for QuTiP. Gives version numbers for
    QuTiP, NumPy, SciPy, Cython, and MatPlotLib.
    """
    print("")
    print("QuTiP: Quantum Toolbox in Python")
    print("Copyright (c) 2011 and later.")
    print("Alexander Pitchford, Chris Granade, Paul D. Nation & Robert J. Johansson")
    print("")
    print("QuTiP Version:      %s" % qutip.__version__)
    print("Numpy Version:      %s" % numpy.__version__)
    print("Scipy Version:      %s" % scipy.__version__)
    try:
        import Cython
        cython_ver = Cython.__version__
    except:
        cython_ver = 'None'
    print("Cython Version:     %s" % cython_ver)
    try:
        import matplotlib
        matplotlib_ver = matplotlib.__version__
    except:
        matplotlib_ver = 'None'
    print("Matplotlib Version: %s" % matplotlib_ver)
    print("Python Version:     %d.%d.%d" % sys.version_info[0:3])
    print("Number of CPUs:     %s" % hardware_info()['cpus'])
    print("BLAS Info:          %s" % _blas_info())
    print("INTEL MKL Ext:      %s" % str(qutip.settings.has_mkl))
    print("Platform Info:      %s (%s)" % (platform.system(),
                                           platform.machine()))
    qutip_install_path = os.path.dirname(inspect.getsourcefile(qutip))
    print("Installation path:  %s" % qutip_install_path)
    print("")
Ejemplo n.º 2
0
def version_table(verbose=False):
    """
    Print an HTML-formatted table with version numbers for QuTiP and its
    dependencies. Use it in a IPython notebook to show which versions of
    different packages that were used to run the notebook. This should make it
    possible to reproduce the environment and the calculation later on.


    Returns
    --------
    version_table: string
        Return an HTML-formatted string containing version information for
        QuTiP dependencies.

    """

    html = "<table>"
    html += "<tr><th>Software</th><th>Version</th></tr>"

    packages = [("QuTiP", qutip.__version__),
                ("Numpy", numpy.__version__),
                ("SciPy", scipy.__version__),
                ("matplotlib", matplotlib.__version__),
                ("Cython", Cython.__version__),
                ("Number of CPUs", qutip.hardware_info.hardware_info()['cpus']),
                ("BLAS Info", _blas_info()),
                ("IPython", IPython.__version__),
                ("Python", sys.version),
                ("OS", "%s [%s]" % (os.name, sys.platform))
                ]

    for name, version in packages:
        html += "<tr><td>%s</td><td>%s</td></tr>" % (name, version)

    if verbose:
        html += "<tr><th colspan='2'>Additional information</th></tr>"
        qutip_install_path = os.path.dirname(inspect.getsourcefile(qutip))
        html += ("<tr><td>Installation path</td><td>%s</td></tr>" %
                 qutip_install_path)
        try:
            import getpass
            html += ("<tr><td>User</td><td>%s</td></tr>" %
                     getpass.getuser())
        except:
            pass

    html += "<tr><td colspan='2'>%s</td></tr>" % time.strftime(
        '%a %b %d %H:%M:%S %Y %Z')
    html += "</table>"

    return HTML(html)
Ejemplo n.º 3
0
def _set_mkl():
    """
    Finds the MKL runtime library for the 
    Anaconda and Intel Python distributions.
    
    """
    if _blas_info() == 'INTEL MKL':
        plat = sys.platform
        python_dir = os.path.dirname(sys.executable)
        if plat in ['darwin','linux2', 'linux']:
            python_dir = os.path.dirname(python_dir)

        if plat == 'darwin':
            lib = '/libmkl_rt.dylib'
        elif plat == 'win32':
            lib = '\\mkl_rt.dll'
        elif plat in ['linux2', 'linux']:
            lib = '/libmkl_rt.so'
        else:
            raise Exception('Unknown platfrom.')
        
        if plat in ['darwin','linux2', 'linux']:
            lib_dir = '/lib'
        else:
            lib_dir = '\Library\\bin'
        
        # Try in default Anaconda location first
        try:
            qset.mkl_lib = cdll.LoadLibrary(python_dir+lib_dir+lib)
            qset.has_mkl = True
        except:
            pass
        
        # Look in Intel Python distro location
        if not qset.has_mkl:
            if plat in ['darwin','linux2', 'linux']:
                lib_dir = '/ext/lib'
            else:
                lib_dir = '\ext\\lib'
            try:
                qset.mkl_lib = cdll.LoadLibrary(python_dir+lib_dir+lib)
                qset.has_mkl = True
            except:
                pass
    else:
        pass
Ejemplo n.º 4
0
def about():
    """
    About box for QuTiP. Gives version numbers for
    QuTiP, NumPy, SciPy, Cython, and MatPlotLib.
    """
    print("")
    print("QuTiP: Quantum Toolbox in Python")
    print("Copyright (c) 2011 and later.")
    print(("A. J. Pitchford, P. D. Nation, "
            "R. J. Johansson, A. Grimsmo, "
            "and C. Granade"))
    print("")
    print("QuTiP Version:      %s" % qutip.__version__)
    print("Numpy Version:      %s" % numpy.__version__)
    print("Scipy Version:      %s" % scipy.__version__)
    try:
        import Cython
        cython_ver = Cython.__version__
    except:
        cython_ver = 'None'
    print("Cython Version:     %s" % cython_ver)
    try:
        import matplotlib
        matplotlib_ver = matplotlib.__version__
    except:
        matplotlib_ver = 'None'
    print("Matplotlib Version: %s" % matplotlib_ver)
    print("Python Version:     %d.%d.%d" % sys.version_info[0:3])
    print("Number of CPUs:     %s" % hardware_info()['cpus'])
    print("BLAS Info:          %s" % _blas_info())
    print("OPENMP Installed:   %s" % str(qutip.settings.has_openmp))
    print("INTEL MKL Ext:      %s" % str(qutip.settings.has_mkl))
    print("Platform Info:      %s (%s)" % (platform.system(),
                                           platform.machine()))
    qutip_install_path = os.path.dirname(inspect.getsourcefile(qutip))
    print("Installation path:  %s" % qutip_install_path)

    # citation
    longbar = "=============================================================="
    longbar += "================"
    cite_msg = "For your convenience a bibtex reference can be easily generated"
    cite_msg += " using `qutip.cite()`"
    print(longbar)
    print("Please cite QuTiP in your publication.")
    print(longbar)
    print(cite_msg)