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

2189 remove unused folding functions #2289

Merged
merged 21 commits into from
Apr 25, 2024

Conversation

jordandsullivan
Copy link
Contributor

@jordandsullivan jordandsullivan commented Apr 12, 2024

Description

  • Removed zne.scaling.fold_gates_from_left and zne.scaling.fold_gates_from_right as they have not been widely used by the community.
  • Commented out calls to these functions and added a deprecation notice in the
  • Removed any imports and tests using these functions.
  • Modified tests which used parameterized inputs which included these functions.

Remaining question: do we want to eliminate the 'fold_method' argument from zne.scaling.folding._create_fold_mask function as explained in this comment?


License

  • I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.

Before opening the PR, please ensure you have completed the following where appropriate.

@jordandsullivan jordandsullivan linked an issue Apr 12, 2024 that may be closed by this pull request
Copy link

codecov bot commented Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.30%. Comparing base (35139fe) to head (9220809).
Report is 9 commits behind head on main.

❗ Current head 9220809 differs from pull request most recent head ded961c. Consider uploading reports for the commit ded961c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2289      +/-   ##
==========================================
+ Coverage   98.28%   98.30%   +0.02%     
==========================================
  Files          90       90              
  Lines        4263     4260       -3     
==========================================
- Hits         4190     4188       -2     
+ Misses         73       72       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mitiq/zne/scaling/folding.py Show resolved Hide resolved

+++ {"id": "DRplhovffVfk"}

<!-- #region id="DRplhovffVfk" -->
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why there is so much noise in the diff of this file. It would be nice to have only a diff that matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not an expert in Myst, but perhaps it's because I converted this to a jupyter notebook to run it and then converted it back to .md using jupytext? @natestemen Do you have insight on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds like a good explanation.

I have never modified any of them myself, but I think it's worth putting some effort into finding (and documenting) a workflow that doesn't create this clutter. It will make reviews easier.

Copy link
Member

Choose a reason for hiding this comment

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

Your theory aligns with what I've seen in the past working with jupytext. If you wouldn't mind removing the unnecessary differences in this PR as a temporary workaround, it would be appreciated.

Copy link
Contributor Author

@jordandsullivan jordandsullivan Apr 17, 2024

Choose a reason for hiding this comment

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

Correct me if I'm wrong here, but it looks like the .md version of this notebook in main is actually also messed up?

That is, it's displaying the info about Jupytext versions at the top and includes a bunch of lines like
+++ {"id": "DRplhovffVfk"}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2024-04-17 at 1 35 44 PM Also has collab info. Do we want all this present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@natestemen This item should be the last thing. Not sure if we want to include fixing the formatting on this notebook in this PR or not, since it's present in main. The functional part is done.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like you've done a bit of clean up in this PR, but lets keep the rest in a subsequent PR. Even though the markdown does render a little strangely here on GitHub, it looks fine on the live documentation, which is what matters most.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. In that case should be ready to merge.

Copy link
Member

Choose a reason for hiding this comment

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

A formal approval is needed before merging. Now that you've added more commits since the first review, typically a second round of review would be initiated to ensure the new additions look good as well. To initiate another round of review you can request it using the "Re-request review" feature.

Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Looking good! A few minor comments, but all the important stuff is done.

BTW can you ensure your GitHub commits are affiliated with your GitHub user?

docs/source/examples/mitiq-paper/mitiq-paper-codeblocks.md Outdated Show resolved Hide resolved
docs/source/examples/mitiq-paper/mitiq-paper-codeblocks.md Outdated Show resolved Hide resolved
docs/source/examples/mitiq-paper/mitiq-paper-codeblocks.md Outdated Show resolved Hide resolved
docs/source/guide/zne-3-options.md Outdated Show resolved Hide resolved
mitiq/zne/scaling/tests/test_folding.py Outdated Show resolved Hide resolved
mitiq/zne/scaling/folding.py Outdated Show resolved Hide resolved
@jordandsullivan
Copy link
Contributor Author

Looking good! A few minor comments, but all the important stuff is done.

BTW can you ensure your GitHub commits are affiliated with your GitHub user?

Screen Shot 2024-04-17 at 12 23 38 PM Is this what you mean? If so, I'm not sure how it didn't get associated. It seems to still have my name but not be clickable?

@natestemen
Copy link
Member

Yup exactly. Compare your screenshot to these commits.

From inspecting the commits on this branch it seems that you are using your UF email for email config which is a great idea, but it looks like GitHub does not that jordan@unitary.fund corresponds to @jordandsullivan. Once you add your UF email to GitHub [docs], then this should be sorted.

Here's one of the commits from this branch which you can see from running git log.

commit b72adf36e76190d3cd751c609cee0aa1a52c6e8c
Author: jordandsullivan <jordan@unitary.fund>
Date:   Thu Apr 11 13:51:12 2024 -0700
...

@jordandsullivan
Copy link
Contributor Author

Yup exactly. Compare your screenshot to these commits.

From inspecting the commits on this branch it seems that you are using your UF email for email config which is a great idea, but it looks like GitHub does not that jordan@unitary.fund corresponds to @jordandsullivan. Once you add your UF email to GitHub [docs], then this should be sorted.

Here's one of the commits from this branch which you can see from running git log.

commit b72adf36e76190d3cd751c609cee0aa1a52c6e8c
Author: jordandsullivan <jordan@unitary.fund>
Date:   Thu Apr 11 13:51:12 2024 -0700
...

Gotcha thanks, I added my UF email address to my Github account so it should all be linked now.

@cosenal
Copy link
Contributor

cosenal commented Apr 18, 2024

<commercial break>
I see validate checks are failing. This could mean that you haven't installed the ✨ fabulous mitiq git hooks ✨. You should! It's as easy as

make install-hooks

from your mitiq local folder.
<end of commercial break>

@jordandsullivan
Copy link
Contributor Author

<commercial break> I see validate checks are failing. This could mean that you haven't installed the ✨ fabulous mitiq git hooks ✨. You should! It's as easy as

make install-hooks

from your mitiq local folder. <end of commercial break>

Ah, why thank you! I didn't realize you needed to install the hooks as well as having them in your .git-hooks file.

@jordandsullivan jordandsullivan added this to the v0.36.0 milestone Apr 19, 2024
Copy link
Contributor

@cosenal cosenal left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@jordandsullivan jordandsullivan merged commit 42779ed into main Apr 25, 2024
14 of 15 checks passed
@jordandsullivan jordandsullivan deleted the 2189-remove-unused-folding-functions branch April 25, 2024 21:13
@FarLab FarLab removed this from the v0.36.0 milestone Apr 26, 2024
cosenal pushed a commit that referenced this pull request Jun 26, 2024
* Removed all instances of fold_from_left and fold_from_right in the zne.scaling subpackage and in tests

* Updating typo in .gitignore

* Formatting

* removed remaining instances of fold_gates_from_left and fold_gates_from_right in testing

* reverted accidentally modified .md notebook

* formatting

* Formatting for notebook md to myst

* Remove fold_method as parameter for test

* Update docstring to acurately reflect how folding indices are chosen (i.e. randomly)

* Uncomment fold_gates_from_left call, as using directives now

Co-authored-by: nate stemen <nate@unitary.fund>

* Replace note with note directive

Co-authored-by: nate stemen <nate@unitary.fund>

* Removing the id outputs

* Switching wording 'deprecated' to 'removed'

* Remove parameterization for tests with only one test case, remove unused arguments for fold_method

* Formatting

* Remove fold_gates_from_left from pennylane demo

* Previous commit msg was in error. This commit updates the pennylane example not to use fold_gates_from_left

* Change notes to warnings, uncomment fold_gates_from_left and right code

* Remove fold_gates_from_right from vqe-pennylane example, formatting

* remove folding_method as optional argument to _create_fold_mask

---------

Co-authored-by: nate stemen <nate@unitary.fund>
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.

Remove unused folding functions
5 participants