44 p.setRenderHint(QPainter::Antialiasing,
true);
45 p.fillRect(rect(), QColor(10, 14, 20));
50 p.setPen(QColor(225, 235, 244));
51 p.drawText(QRect(12, 7, width() - 24, 24), Qt::AlignLeft | Qt::AlignVCenter,
52 QStringLiteral(
"Quantum backflow — positive momentum, negative probability current"));
56 p.setPen(QColor(150, 166, 180));
57 p.drawText(QRect(20, 50, width() - 40, height() - 70),
58 Qt::AlignCenter | Qt::TextWordWrap,
59 QStringLiteral(
"Load Quantum Backflow and press Play"));
65 const auto &last = s.back();
71 const int bottomH = 155;
72 QRect currentR(left, top, std::max(140, width() - left - right),
73 std::max(145, height() - top - gap - bottomH - 30));
74 QRect probR(left, currentR.bottom() + gap, currentR.width(),
75 std::max(110, height() - (currentR.bottom() + gap) - 28));
77 p.setPen(QColor(55, 72, 88));
78 p.setBrush(QColor(5, 9, 15));
82 const double tmax = std::max(cfg.analysisEndTime, last.time);
83 auto tx = [&](
double t) {
84 return currentR.left() + t / std::max(1.0e-12, tmax) * currentR.width();
87 double maxAbsJ = 1.0e-6;
88 for (
const auto &a : s) maxAbsJ = std::max(maxAbsJ, std::abs(a.detectorCurrent));
90 auto jy = [&](
double j) {
91 return currentR.center().y() - j / maxAbsJ * (0.46 * currentR.height());
94 const double zeroY = jy(0.0);
95 p.setPen(QPen(QColor(90, 105, 120), 1.0, Qt::DashLine));
96 p.drawLine(QPointF(currentR.left(), zeroY), QPointF(currentR.right(), zeroY));
100 p.setBrush(QColor(220, 70, 95, 40));
101 for (std::size_t i = 1; i < s.size(); ++i) {
102 if (s[i - 1].detectorCurrent < 0.0 || s[i].detectorCurrent < 0.0) {
103 const double xa = tx(s[i - 1].time);
104 const double xb = tx(s[i].time);
105 p.drawRect(QRectF(std::min(xa, xb), currentR.top(), std::abs(xb - xa) + 1.0, currentR.height()));
109 QPainterPath currentPath;
110 for (std::size_t i = 0; i < s.size(); ++i) {
111 QPointF q(tx(s[i].time), jy(s[i].detectorCurrent));
112 if (i == 0) currentPath.moveTo(q);
else currentPath.lineTo(q);
114 p.setPen(QPen(QColor(105, 220, 255), 2.1));
115 p.drawPath(currentPath);
117 auto py = [&](
double v) {
118 return probR.bottom() - std::max(0.0, std::min(1.0, v)) * probR.height();
121 auto fy = [&](
double v) {
122 return probR.bottom() - std::max(0.0, v) / maxFlux * (0.45 * probR.height());
125 QPainterPath leftPath, fluxPath;
126 for (std::size_t i = 0; i < s.size(); ++i) {
127 QPointF a(tx(s[i].time), py(s[i].probabilityLeft));
128 QPointF b(tx(s[i].time), fy(s[i].cumulativeBackwardFlux));
129 if (i == 0) { leftPath.moveTo(a); fluxPath.moveTo(b); }
130 else { leftPath.lineTo(a); fluxPath.lineTo(b); }
132 p.setPen(QPen(QColor(120, 235, 160), 2.0));
133 p.drawPath(leftPath);
134 p.setPen(QPen(QColor(255, 209, 102), 1.8));
135 p.drawPath(fluxPath);
138 p.setPen(QColor(180, 198, 212));
139 p.drawText(QRect(currentR.left(), currentR.bottom() + 3, currentR.width(), 20), Qt::AlignCenter,
140 QStringLiteral(
"time cyan: integrated Jx at detector red shade: Jx < 0"));
141 p.drawText(QRect(probR.left(), probR.bottom() + 4, probR.width(), 20), Qt::AlignCenter,
142 QStringLiteral(
"green: P(x < detector) yellow: accumulated backward flux"));
144 p.setPen(QColor(232, 238, 244));
145 const QString state = last.detectorCurrent < 0.0 ? QStringLiteral(
"BACKFLOW") : QStringLiteral(
"forward flow");
146 p.drawText(QRect(currentR.left() + 8, currentR.top() + 5, currentR.width() - 16, 22),
147 Qt::AlignLeft | Qt::AlignVCenter,
148 QStringLiteral(
"p_x>0 fraction=%1 Jmin=%2 backflow=%3 now: %4")
const std::vector< QuantumBackflowSample2D > & samples() const noexcept
Samples s.