qutip / qutip-qip

The QuTiP quantum information processing package
https://qutip-qip.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
113 stars 63 forks source link

Add `about()` function #51

Open quantshah opened 3 years ago

quantshah commented 3 years ago

Since we are branching out and making qutip_qip a separate library, it might be beneficial to have something like qutip.about for qip. The about() function could list out the QuTiP version that the code is run with and help in debugging in the future.

Here is how the about function in QuTiP is written:

"""
Command line output of information on QuTiP and dependencies.
"""
__all__ = ['about']

import sys
import os
import platform
import numpy
import scipy
import inspect
from qutip.utilities import _blas_info
import qutip.settings
from qutip.hardware_info import hardware_info

def about():
    """
    About box for QuTiP. Gives version numbers for QuTiP, NumPy, SciPy, Cython,
    and MatPlotLib.
    """
    print("")
    print("QuTiP: Quantum Toolbox in Python")
    print("================================")
    print("Copyright (c) QuTiP team 2011 and later.")
    print(
        "Current admin team: Alexander Pitchford, "
        "Nathan Shammah, Shahnawaz Ahmed, Neill Lambert, Eric Giguère, "
        "Boxi Li, Jake Lishman and Simon Cross."
    )
    print(
        "Board members: Daniel Burgarth, Robert Johansson, Anton F. Kockum, "
        "Franco Nori and Will Zeng."
    )
    print("Original developers: R. J. Johansson & P. D. Nation.")
    print("Previous lead developers: Chris Granade & A. Grimsmo.")
    print("Currently developed through wide collaboration. "
          "See https://github.com/qutip for details.")
    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 ImportError:
        cython_ver = 'None'
    print("Cython Version:     %s" % cython_ver)
    try:
        import matplotlib
        matplotlib_ver = matplotlib.__version__
    except ImportError:
        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 = "=" * 80
    cite_msg = "For your convenience a bibtex reference can be easily"
    cite_msg += " generated using `qutip.cite()`"
    print(longbar)
    print("Please cite QuTiP in your publication.")
    print(longbar)
    print(cite_msg)

if __name__ == "__main__":
    about()
BoxiLi commented 3 years ago

Thanks for the suggestion @quantshah. I think for the versions we only need to keep qutip-qip, qutip, numpy, scipy, matplotlib. Maybe we can also add our preprint to the citation, replacing the qutip ones?

BoxiLi commented 3 years ago

Maybe a better idea is to modify qutip.about() to include qutip-qip version if installed. And we just import that function? This can be generalized to qutip-control etc.

paniash commented 3 years ago

Hi! Can I take up this issue?

BoxiLi commented 3 years ago

@paniash Sure, thanks! How do would you like to proceed?

claretgrace0801 commented 2 years ago

Hey @BoxiLi @quantshah , I'm interested in contributing to QuTiP and doing a project for GSoC '22 I would like to take up this issue.

Approach: Add a caller argument to qutip's about function (defaulting to "qutip"). Modify qutip.about to handle the case when caller is "qutip_qip" (qutip_qip.about()). This can also be generalised to other qutip libraries.

Anika-Roy commented 1 year ago

Hello! is this still open?