Flipping the integrated histogram axes shifts the empirical CDF staircase

Open
#8,558 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Find integrated_histogram and inspect how it builds the staircase for cdf_on_x=True; the issue gives a two-observation example and the expected coordinate swap. Add a regression check comparing the flipped path with the default path's exchanged coordinates, then confirm the plotted step corners match.

Written by the indexing model from the issue text.

Description

triage/discuss

The integrated histogram documents cdf_on_x=True as flipping the axes. The plotted staircase also shifts by one observation. For two gate fidelities of 0.8 and 0.9, the default plot reaches probability 0.5 at fidelity 0.8. With the axes flipped, the horizontal segment from probability 0 to 0.5 sits at fidelity 0.

I called integrated_histogram with those two observations, a supplied Matplotlib axis, semilog=False, and median_line=False at revision 513daa38. Inspecting the line path (including step corners) gives:

  • Default: (0,0), (.8,0), (.8,.5), (.9,.5), (.9,1)
  • Flipped: (0,0), (.5,0), (.5,.8), (1,.8), (1,.9)
  • Coordinate swap of the default: (0,0), (0,.8), (.5,.8), (.5,.9), (1,.9)

Both orientations currently use post-step interpolation. A regression check comparing the flipped path with the default path's exchanged coordinates would catch this independently of image rendering or axis labels.

Dominant language
Python
Stars
5.1k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
48

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/Cirq

All issues in quantumlib/Cirq

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.