Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial docstring improvement #551

Draft
wants to merge 36 commits into
base: develop
Choose a base branch
from
Draft

Conversation

arsalan-motamedi
Copy link
Collaborator

Context:
Docstrings miss things.

Description of the Change:
Improving docstrings (initial attempt).

Benefits:
Clear

Possible Drawbacks:
None.

Related GitHub Issues:
None.

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.55%. Comparing base (1d414cc) to head (2e57290).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #551      +/-   ##
===========================================
+ Coverage    90.52%   90.55%   +0.03%     
===========================================
  Files          102      102              
  Lines         6186     6186              
===========================================
+ Hits          5600     5602       +2     
+ Misses         586      584       -2     
Files with missing lines Coverage Δ
...ustard/lab_dev/circuit_components_utils/b_to_ps.py 100.00% <ø> (ø)
...mustard/lab_dev/circuit_components_utils/b_to_q.py 100.00% <ø> (ø)
...tard/lab_dev/circuit_components_utils/trace_out.py 100.00% <ø> (ø)
mrmustard/lab_dev/states/bargmann_eigenstate.py 100.00% <ø> (ø)
mrmustard/lab_dev/states/base.py 96.66% <ø> (ø)
mrmustard/lab_dev/states/coherent.py 100.00% <ø> (ø)
mrmustard/lab_dev/states/displaced_squeezed.py 100.00% <ø> (ø)
mrmustard/lab_dev/states/dm.py 95.65% <100.00%> (ø)
mrmustard/lab_dev/states/gaussian_state.py 100.00% <ø> (ø)
mrmustard/lab_dev/states/ket.py 98.51% <100.00%> (ø)
... and 5 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d414cc...2e57290. Read the comment docs.

@arsalan-motamedi arsalan-motamedi added the no changelog Pull request does not require a CHANGELOG entry label Feb 10, 2025
@Ganar-lab
Copy link
Collaborator

Hey Arsalan, I spotted that the signature and docstring of this function is incorrect: link

def vacuum_means(num_modes: int) -> tuple[Matrix, Vector]:
    r"""Returns the real covariance matrix and real means vector of the vacuum state.

    Args:
        num_modes (int): number of modes

    Returns:
        Matrix, Vector: thermal state covariance matrix or means vector
    """
    return displacement(
        math.zeros(num_modes, dtype="float64"),
        math.zeros(num_modes, dtype="float64"),
    )

It only returns the means vector of the vacuum. Also, not of a thermal state.

@arsalan-motamedi
Copy link
Collaborator Author

Hey Arsalan, I spotted that the signature and docstring of this function is incorrect: link

def vacuum_means(num_modes: int) -> tuple[Matrix, Vector]:
    r"""Returns the real covariance matrix and real means vector of the vacuum state.

    Args:
        num_modes (int): number of modes

    Returns:
        Matrix, Vector: thermal state covariance matrix or means vector
    """
    return displacement(
        math.zeros(num_modes, dtype="float64"),
        math.zeros(num_modes, dtype="float64"),
    )

It only returns the means vector of the vacuum. Also, not of a thermal state.

Great catch! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Pull request does not require a CHANGELOG entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants