Skip to content

Commit bce9e79

Browse files
committed
Merge branch 'pedro_symmetries' into devel
2 parents 9e0f67c + f0b8c4e commit bce9e79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1787
-645
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
[![DOI](https://zenodo.org/badge/500850617.svg)](https://zenodo.org/badge/latestdoi/500850617)
22

33
# Inflation
4-
Inflation is a Python package that implements inflation algorithms for causal inference. In causal inference, the main task is to determine which causal relationships can exist between different observed random variables. Inflation algorithms are a class of techniques designed to solve the causal compatibility problem, that is, test compatibility between some observed data and a given causal relationship.
4+
Inflation is a package, written in Python, that implements inflation algorithms for causal inference. In causal inference, the main task is to determine which causal relationships can exist between different observed random variables. Inflation algorithms are a class of techniques designed to solve the causal compatibility problem, that is, test compatibility between some observed data and a given causal relationship.
55

6-
The first version of this package implements the inflation technique for quantum causal compatibility. For details, see [Physical Review X 11 (2), 021043 (2021)](https://journals.aps.org/prx/abstract/10.1103/PhysRevX.11.021043). The inflation technique for classical causal compatibility will be implemented in a future update.
6+
This package implements the inflation technique for classical, quantum, and post-quantum causal compatibility. By relaxing independence constraints to symmetries on larger graphs, it develops hierarchies of relaxations of the causal compatibility problem that can be solved using linear and semidefinite programming. For details, see [Wolfe et al. “The inflation technique for causal inference with latent variables.” Journal of Causal Inference 7 (2), 2017-0020 (2019)](https://www.degruyter.com/document/doi/10.1515/jci-2017-0020/html), [Wolfe et al. “Quantum inflation: A general approach to quantum causal compatibility.” Physical Review X 11 (2), 021043 (2021)](https://journals.aps.org/prx/abstract/10.1103/PhysRevX.11.021043), and references therein.
77

88
Examples of use of this package include:
99

10+
- Causal compatibility with classical, quantum, non-signaling, and hybrid models.
1011
- Feasibility problems and extraction of certificates.
1112
- Optimization of Bell operators.
12-
- Optimisation over classical distributions.
13+
- Optimization over classical distributions.
14+
- Handling of bilayer (i.e., networks) and multilayer causal structures.
1315
- Standard [Navascués-Pironio-Acín hierarchy](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.98.010401).
1416
- Scenarios with partial information.
1517
- Possibilistic compatibility with a causal network.

docs/_build/html/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 5ac241c6c147f17086ae747d1ca39b93
3+
config: 3499f0084671aa32dd3b76f6907174da
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/_build/html/_modules/index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1+
2+
13
<!DOCTYPE html>
2-
<html class="writer-html5" lang="en" >
4+
<html class="writer-html5" lang="en" data-content_root="../">
35
<head>
46
<meta charset="utf-8" />
57
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Overview: module code &mdash; Inflation 2.0.2 documentation</title>
7-
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
8-
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
9-
<link rel="stylesheet" href="../_static/copybutton.css" type="text/css" />
10-
<!--[if lt IE 9]>
11-
<script src="../_static/js/html5shiv.min.js"></script>
12-
<![endif]-->
8+
<title>Overview: module code &mdash; Inflation 2.0.1 documentation</title>
9+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=92fd9be5" />
10+
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" />
11+
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
12+
1313

14-
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
15-
<script src="../_static/jquery.js"></script>
16-
<script src="../_static/underscore.js"></script>
17-
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
18-
<script src="../_static/doctools.js"></script>
19-
<script src="../_static/clipboard.min.js"></script>
20-
<script src="../_static/copybutton.js"></script>
21-
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
14+
<script src="../_static/jquery.js?v=5d32c60e"></script>
15+
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
16+
<script src="../_static/documentation_options.js?v=f5cff4aa"></script>
17+
<script src="../_static/doctools.js?v=9a2dae69"></script>
18+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
19+
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
20+
<script src="../_static/copybutton.js?v=a56c686a"></script>
21+
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
2222
<script src="../_static/js/theme.js"></script>
2323
<link rel="index" title="Index" href="../genindex.html" />
2424
<link rel="search" title="Search" href="../search.html" />
@@ -33,7 +33,7 @@
3333
</a>
3434
<div role="search">
3535
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
36-
<input type="text" name="q" placeholder="Search docs" />
36+
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
3737
<input type="hidden" name="check_keywords" value="yes" />
3838
<input type="hidden" name="area" value="default" />
3939
</form>
@@ -64,8 +64,8 @@
6464
<div class="rst-content">
6565
<div role="navigation" aria-label="Page navigation">
6666
<ul class="wy-breadcrumbs">
67-
<li><a href="../contents.html" class="icon icon-home"></a> &raquo;</li>
68-
<li>Overview: module code</li>
67+
<li><a href="../contents.html" class="icon icon-home" aria-label="Home"></a></li>
68+
<li class="breadcrumb-item active">Overview: module code</li>
6969
<li class="wy-breadcrumbs-aside">
7070
</li>
7171
</ul>

docs/_build/html/_modules/inflation/InflationProblem.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ <h1>Source code for inflation.InflationProblem</h1><div class="highlight"><pre>
9292
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">Dict</span>
9393
<span class="kn">from</span> <span class="nn">warnings</span> <span class="kn">import</span> <span class="n">warn</span>
9494

95+
<span class="kn">import</span> <span class="nn">networkx</span> <span class="k">as</span> <span class="nn">nx</span>
9596
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
9697
<span class="kn">import</span> <span class="nn">sympy</span>
9798
<span class="kn">from</span> <span class="nn">tqdm</span> <span class="kn">import</span> <span class="n">tqdm</span>

docs/_build/html/_static/_sphinx_javascript_frameworks_compat.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
/*
2-
* _sphinx_javascript_frameworks_compat.js
3-
* ~~~~~~~~~~
4-
*
5-
* Compatability shim for jQuery and underscores.js.
6-
*
7-
* WILL BE REMOVED IN Sphinx 6.0
8-
* xref RemovedInSphinx60Warning
1+
/* Compatability shim for jQuery and underscores.js.
92
*
3+
* Copyright Sphinx contributors
4+
* Released under the two clause BSD licence
105
*/
116

12-
/**
13-
* select a different prefix for underscore
14-
*/
15-
$u = _.noConflict();
16-
17-
187
/**
198
* small helper function to urldecode strings
209
*

docs/_build/html/_static/copybutton.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ div.highlight {
3535
position: relative;
3636
}
3737

38-
.highlight:hover button.copybtn {
38+
/* Show the copybutton */
39+
.highlight:hover button.copybtn, button.copybtn.success {
3940
opacity: 1;
4041
}
4142

docs/_build/html/_static/copybutton.js

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const messages = {
2020
},
2121
'fr' : {
2222
'copy': 'Copier',
23-
'copy_to_clipboard': 'Copié dans le presse-papier',
23+
'copy_to_clipboard': 'Copier dans le presse-papier',
2424
'copy_success': 'Copié !',
2525
'copy_failure': 'Échec de la copie',
2626
},
@@ -102,18 +102,25 @@ const clearSelection = () => {
102102
}
103103
}
104104

105-
// Changes tooltip text for two seconds, then changes it back
105+
// Changes tooltip text for a moment, then changes it back
106+
// We want the timeout of our `success` class to be a bit shorter than the
107+
// tooltip and icon change, so that we can hide the icon before changing back.
108+
var timeoutIcon = 2000;
109+
var timeoutSuccessClass = 1500;
110+
106111
const temporarilyChangeTooltip = (el, oldText, newText) => {
107112
el.setAttribute('data-tooltip', newText)
108113
el.classList.add('success')
109-
setTimeout(() => el.setAttribute('data-tooltip', oldText), 2000)
110-
setTimeout(() => el.classList.remove('success'), 2000)
114+
// Remove success a little bit sooner than we change the tooltip
115+
// So that we can use CSS to hide the copybutton first
116+
setTimeout(() => el.classList.remove('success'), timeoutSuccessClass)
117+
setTimeout(() => el.setAttribute('data-tooltip', oldText), timeoutIcon)
111118
}
112119

113120
// Changes the copy button icon for two seconds, then changes it back
114121
const temporarilyChangeIcon = (el) => {
115122
el.innerHTML = iconCheck;
116-
setTimeout(() => {el.innerHTML = iconCopy}, 2000)
123+
setTimeout(() => {el.innerHTML = iconCopy}, timeoutIcon)
117124
}
118125

119126
const addCopyButtonToCodeCells = () => {
@@ -125,7 +132,8 @@ const addCopyButtonToCodeCells = () => {
125132
}
126133

127134
// Add copybuttons to all of our code cells
128-
const codeCells = document.querySelectorAll('div.highlight pre')
135+
const COPYBUTTON_SELECTOR = 'div.highlight pre';
136+
const codeCells = document.querySelectorAll(COPYBUTTON_SELECTOR)
129137
codeCells.forEach((codeCell, index) => {
130138
const id = codeCellId(index)
131139
codeCell.setAttribute('id', id)
@@ -141,10 +149,25 @@ function escapeRegExp(string) {
141149
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
142150
}
143151

152+
/**
153+
* Removes excluded text from a Node.
154+
*
155+
* @param {Node} target Node to filter.
156+
* @param {string} exclude CSS selector of nodes to exclude.
157+
* @returns {DOMString} Text from `target` with text removed.
158+
*/
159+
function filterText(target, exclude) {
160+
const clone = target.cloneNode(true); // clone as to not modify the live DOM
161+
if (exclude) {
162+
// remove excluded nodes
163+
clone.querySelectorAll(exclude).forEach(node => node.remove());
164+
}
165+
return clone.innerText;
166+
}
167+
144168
// Callback when a copy button is clicked. Will be passed the node that was clicked
145169
// should then grab the text and replace pieces of text that shouldn't be used in output
146170
function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {
147-
148171
var regexp;
149172
var match;
150173

@@ -199,7 +222,12 @@ function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onl
199222

200223
var copyTargetText = (trigger) => {
201224
var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);
202-
return formatCopyText(target.innerText, '$ ', false, true, true, true, '', '')
225+
226+
// get filtered text
227+
let exclude = '.linenos';
228+
229+
let text = filterText(target, exclude);
230+
return formatCopyText(text, '$ ', false, true, true, true, '', '')
203231
}
204232

205233
// Initialize with a callback so we can modify the text before copy

docs/_build/html/_static/copybutton_funcs.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@ function escapeRegExp(string) {
22
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
33
}
44

5+
/**
6+
* Removes excluded text from a Node.
7+
*
8+
* @param {Node} target Node to filter.
9+
* @param {string} exclude CSS selector of nodes to exclude.
10+
* @returns {DOMString} Text from `target` with text removed.
11+
*/
12+
export function filterText(target, exclude) {
13+
const clone = target.cloneNode(true); // clone as to not modify the live DOM
14+
if (exclude) {
15+
// remove excluded nodes
16+
clone.querySelectorAll(exclude).forEach(node => node.remove());
17+
}
18+
return clone.innerText;
19+
}
20+
521
// Callback when a copy button is clicked. Will be passed the node that was clicked
622
// should then grab the text and replace pieces of text that shouldn't be used in output
723
export function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {
8-
924
var regexp;
1025
var match;
1126

docs/_build/html/_static/css/badge_only.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)