question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsisten naming between mesolve and propagator.

See original GitHub issue

Describe the issue Currently mesolve and propagator have different names for the same argument. mesolve uses c_ops whereas propagator uses c_op_list. This can lead to confusion (as seen in the google group discussion). It would probably be best to be consistent with the naming.

A possible solution We could deprecate c_op_list and use c_ops instead (or the other way around). We could also raise a deprecation warning:

 if 'c_op_list' in kwargs:
        warnings.warn("c_op_list argument name has been deprecated in favor of c_ops for consistency in the library. This will be remover in future versions.",
                      category=DeprecationWarning)
       c_ops = c_op_list

To be honest, it looks like kwargs in mesolve should not be an option. It is only used to retrieve the num_cpus input from it. I would suggest deprecating it too and just add a new argument, num_cpus that is properly documented.

To Reproduce

a = qutip.destroy(10)
H = a.dag() * a
c_ops = [a]
psi0 = qutip.coherent(10, 0.1)
t_list = np.linspace(0, 25.0, 1001)


# This works
result = qutip.mesolve(H, psi0, t_list, c_ops=c_ops, e_ops=[a]) 

# This works and can be used to reproduce the above result. Note the kwarg is c_ops_list instead
# of c_ops as in mesolve.
U = qutip.propagator(H, t_list, c_op_list=c_ops)

# This does not work as intended but it gets executed. That is because c_ops in interpreted as being part of kwargs. 
# The biggest issue is that no error is raised.
U1 = qutip.propagator(H, t_list, c_ops=c_ops)

Expected behavior Functions in QuTiP should use the same name for the argument c_ops.

Your Environment

QuTiP: Quantum Toolbox in Python
================================
Copyright (c) QuTiP team 2011 and later.
Current admin team: Alexander Pitchford, Nathan Shammah, Shahnawaz Ahmed, Neill Lambert, Eric Giguère, Boxi Li, Jake Lishman and Simon Cross.
Board members: Daniel Burgarth, Robert Johansson, Anton F. Kockum, Franco Nori and Will Zeng.
Original developers: R. J. Johansson & P. D. Nation.
Previous lead developers: Chris Granade & A. Grimsmo.
Currently developed through wide collaboration. See https://github.com/qutip for details.

QuTiP Version:      4.7.0.dev0+5c73300
Numpy Version:      1.21.2
Scipy Version:      1.7.1
Cython Version:     0.29.23
Matplotlib Version: 3.3.4
Python Version:     3.9.5
Number of CPUs:     4
BLAS Info:          OPENBLAS
OPENMP Installed:   False
INTEL MKL Ext:      False
Platform Info:      Linux (x86_64)
Installation path:  /home/kaladin/Documents/git/qutip/qutip4/qutip
================================================================================
Please cite QuTiP in your publication.
================================================================================
For your convenience a bibtex reference can be easily generated using `qutip.cite()`

Additional context See https://groups.google.com/g/qutip/c/GPm8e702HN4 for the full discussion. There may also be other functions in QuTiP that suffer from the same inconsistency problem.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RobHam99commented, Nov 19, 2021

Hello, I would like to attempt this issue. It will be my first QuTip contribution.

0reactions
AGaliciaMartinezcommented, Nov 29, 2021

Hey @RobHam99. I have talked today with @hodgestar and we agreed that, since **kwargs is only used to pass the argument num_cpus, we think it is best to raise an error (TypeError) when kwargs contains a key that is not num_cpus. This should hopefully avoid the same confusion to happen again with propagator, but we should definitely try to get the naming consistent for the new QuTiP version that is under active development.

@RobHam99, are you still interested in opening a Pull Request for this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consistent change propagation within models | SpringerLink
We speak of consistent change propagation. As an example, imagine that a message is passed among two components and the name of this...
Read more >
Plug-in generation and propagation for V7, V8 and V8.5 - IBM
Incorrect or inconsistent plugin-cfg.xml. Diagnosing The Problem. Steps to help resolve plug-in generation and propagation problems.
Read more >
Finding solutions by finding inconsistencies
Abstract. In continuous constraint programming, the solving process alternates propagation steps, which reduce the search space according.
Read more >
The Art of the Propagator - Research
We develop a programming model built on the idea that the basic computational elements are autonomous machines interconnected by shared cells ...
Read more >
Inconsistent naming convention for record results in no output
First, I ran the following string where 2B_TopHat1.reads.pair.1.list.junctions.bed is the output from the TopHat alignment we did. sed 's/,/\t/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found