PhaseFitEstimator cannot fit the signal from its own reduced sampling grid

Open Beginner friendly
#1,479 0 comments 0 reactions 0 assignees View on GitHub

@madcpf is already working on this.

Since Dec 4, 2026.

  • #1482 by @madcpf — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with PhaseFitEstimator.get_simulation_points and the amplitude fit in openfermion/measurements/vpe_estimators.py; the issue identifies a mismatch between the reduced grid and the fit's default four-point grid. Extend the existing Pauli sampling test to exercise the fit on the two-point grid and confirm it returns the expected 0.6 value without a broadcasting error.

Written by the indexing model from the issue text.

Description

For a two-eigenvalue Hamiltonian, PhaseFitEstimator.get_simulation_points(safe=False) returns two times, but the estimator cannot fit a signal measured at those times. Its amplitude fit reconstructs the default four-point grid, so even noiseless measurements fail when applying the reference phase shift.

import numpy as np
from openfermion.measurements.vpe_estimators import PhaseFitEstimator

energies = np.array([-1., 1.])
est = PhaseFitEstimator(energies)
for safe in (True, False):
    t = est.get_simulation_points(safe=safe)
    signal = np.exp(1j * np.outer(t, energies)) @ [0.2, 0.8]
    print(est.get_expectation_value(signal))

At 34adf319 the four-point grid returns 0.6000000000000001, as expected from -1 × 0.2 + 1 × 0.8. The two-point grid raises ValueError: operands could not be broadcast together with shapes (2,) (4,). The two-point system here is full rank. The existing Pauli sampling test already checks that the reduced grid is [0, π/2]; extending coverage through the fit would catch the mismatch. It would be helpful for callers to be able to pass the sampled times (or the same sampling mode) into the fit.

Dominant language
Python
Stars
1.7k
Forks
438
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/OpenFermion

All issues in quantumlib/OpenFermion

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.