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

Add repr method for cuqi samples #472

Merged
merged 10 commits into from
Aug 26, 2024
Merged

Add repr method for cuqi samples #472

merged 10 commits into from
Aug 26, 2024

Conversation

chaozg
Copy link
Contributor

@chaozg chaozg commented Aug 11, 2024

Now when we evaluate/print a cuqi Samples, it will display something like:

CUQIpy Samples:
---------------

Ns (number of samples):
 2

Geometry:
 _DefaultGeometry1D(4,)

Shape:
 (4, 2)

Samples:
 [[ 1.38560564  0.53052923]
 [ 0.4737199   0.51313651]
 [-0.20398077 -1.29972158]
 [-2.48091298  0.27251739]]

Copy link
Contributor

@amal-ghamdi amal-ghamdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @chaozg for this nice addition :). I made a small comment here.

cuqi/samples/_samples.py Outdated Show resolved Hide resolved
cuqi/samples/_samples.py Outdated Show resolved Hide resolved
@chaozg chaozg changed the title Display shape information by default for cuqi samples Display shape information of cuqi samples and improve samples.plot Aug 12, 2024
Copy link
Collaborator

@nabriis nabriis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @chaozg. Thanks for working on these changes. I had some comments.

cuqi/geometry/_geometry.py Outdated Show resolved Hide resolved
cuqi/samples/_samples.py Outdated Show resolved Hide resolved
Copy link
Contributor

@amal-ghamdi amal-ghamdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @chaozg for the update. I have a small comment regarding the default geometry

cuqi/geometry/_geometry.py Outdated Show resolved Hide resolved
@chaozg chaozg changed the title Display shape information of cuqi samples and improve samples.plot Add repr method for cuqi samples Aug 21, 2024
Copy link
Contributor

@amal-ghamdi amal-ghamdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @chaozg, I like the updated print of the Samples object. And it is great that it is consistent with the CUQIarray print. Approved :)

Copy link
Collaborator

@nabriis nabriis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chaozg chaozg merged commit 0a3eb53 into main Aug 26, 2024
6 checks passed
@chaozg chaozg deleted the improve_samples branch August 26, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add method to display easy-to-read string for Samples object
3 participants