Skip to content

feat: Implement AbstractLattice and initial GeneralLattice #17

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

Closed

Conversation

Stellogic
Copy link
Contributor

Hi @yutuer21,

Following your guidance and the excellent framework you provided, I've created this initial PR to establish the foundation for the new lattice module for my OSPP project.

Key Contributions:

  1. AbstractLattice Base Class: Implemented the complete skeleton for the abstract base class, defining the core API for all future lattice structures.
  2. GeneralLattice Initial Implementation: Provided a preliminary, functional version of GeneralLattice that can be instantiated from user-defined coordinates and identifiers.
  3. Visualization: Added a basic show() method to GeneralLattice for visualizing the lattice sites, which I have tested locally.

This PR sets the stage for implementing more complex periodic lattices next. Thank you for reviewing!

@Stellogic
Copy link
Contributor Author

I noticed the black linter check failed on the previous commit. I've now installed black locally, reformatted the code, and pushed the fix. The CI should pass this step now. Thanks!

mypy.ini Outdated
@@ -21,3 +21,6 @@ ignore_errors = True
;; unless you enjoy writting sth worse than C
;; both the establish status of mypy and support from other packages are just wasting your time
;; GET AWAY MYPY AND TYPE ANNOTATION !!! WRITTING PYTHON AS IT IS !!!

[tensorcircuit.templates.lattice]
Copy link
Member

Choose a reason for hiding this comment

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

you cannot add disable error here unless you have sufficient reason, please revert

@Stellogic Stellogic closed this Jul 4, 2025
@Stellogic Stellogic force-pushed the feat/add-lattice-placeholder branch from 5af61a3 to 48c3726 Compare July 4, 2025 09:01
@Stellogic Stellogic reopened this Jul 4, 2025
@Stellogic
Copy link
Contributor Author

Stellogic commented Jul 4, 2025

Hi @refraction-ray, thank you for the feedback! I've removed the global ignore rule from mypy.ini and instead used a more specific # type: ignore[arg-type] on the lines related to matplotlib.text. Locally, mypy still reports this specific error, which seems to be a stubborn issue with the tool's interaction with matplotlib in my environment. However, I thought all other local checks pass, and most importantly, all pytest tests for the lattice module are successful. Thanks for reviewing again!

mypy response like this “tensorcircuit\templates\lattice.py:345: error: Argument 4 to "text" of "Axes" has incompatible type "str"; expected "dict[str, Any] | None" [arg-type]”

@Stellogic Stellogic closed this Jul 4, 2025
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.

2 participants