Skip to content

Add AnalogTrajectory and FreqMap #7437

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

Merged
merged 14 commits into from
Jun 26, 2025
Merged

Conversation

BichengYing
Copy link
Collaborator

@BichengYing BichengYing commented Jun 25, 2025

Add FreqMap and AnalogTrajectory into cirq_google.experiments.

In this PR, two major differences compared with Trond did before.

  1. AnalogTrajectory initialized with classmethod so that the class member is always full_trajectory
  2. Add the resolving ability in the FreqMap so that we can provide the symbol into it and plot it with resolver like pulse_plot

New usage example

traj1 = (20 * tu.ns, {"q0_1": 5 * tu.GHz}, {})
traj2 = (sympy.Symbol("t1"), {"q0_2": 8 * tu.GHz}, {})
traj3 = (
    40 * tu.ns,
    {"q0_0": 8 * tu.GHz, "q0_1": None, "q0_2": None},
    {("q0_0", "q0_1"): 5 * tu.MHz, ("q0_1", "q0_2"): 8 * tu.MHz},
)
trajs = [traj1, traj2, traj3]

analog_traj = AnalogTrajectory.from_sparse_trajecotry(trajs)
analog_traj.plot(resolver={"t1": 50*tu.ns})

@github-actions github-actions bot added size: L 250< lines changed <1000 size: XL lines changed >1000 and removed size: L 250< lines changed <1000 labels Jun 25, 2025
In order to keep using unit-style input, I have hacked the
_resolve_parameters_ function a little bit. Assume all inputs should
either be tunit value or sympy.Symbol. (I.e. no sympy expression is
allowed). I have to add this since we don't have SymbolFunc or ExprFunc
in cirq world.
@github-actions github-actions bot added size: L 250< lines changed <1000 and removed size: XL lines changed >1000 labels Jun 25, 2025
@BichengYing BichengYing marked this pull request as ready for review June 25, 2025 23:17
@BichengYing BichengYing requested review from wcourtney, vtomole, verult and a team as code owners June 25, 2025 23:17
@BichengYing BichengYing requested a review from dstrain115 June 25, 2025 23:17
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.69%. Comparing base (66b582f) to head (66d4904).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7437      +/-   ##
==========================================
- Coverage   98.70%   98.69%   -0.01%     
==========================================
  Files        1114     1119       +5     
  Lines       98301    98438     +137     
==========================================
+ Hits        97024    97156     +132     
- Misses       1277     1282       +5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@trondandersen trondandersen left a comment

Choose a reason for hiding this comment

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

LGTM! Is this a stage where we should start thinking about hiding the qubit frequency itself (and only refer to shifts from some hidden value), or do we want to keep it visible for now?

"""Folder for Running Analog experiments."""

from cirq_google.experimental.analog_experiments.analog_trajectory_util import (
FreqMap as FreqMap,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be called FrequencyMap to avoid abbreviations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


import cirq
from cirq_google.experimental.analog_experiments import symbol_util as su
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about the dependency graph here. I don't think we want to import experimental from a non-experimental file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ParamResolver is under the cirq/study so I move this util file into cirq_google/study. Is that good?

Copy link
Collaborator

Choose a reason for hiding this comment

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

SGTM

@BichengYing BichengYing requested a review from dstrain115 June 26, 2025 18:21
@BichengYing BichengYing added this pull request to the merge queue Jun 26, 2025
Merged via the queue into quantumlib:main with commit 5c96d02 Jun 26, 2025
35 checks passed
@BichengYing BichengYing deleted the analog_traj branch June 26, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants