-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fe2cfe
commit 3284785
Showing
8 changed files
with
144 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 17 additions & 17 deletions
34
...full_flow_demo_electronic_photonic/full_flow_demo/full_flow_demo/src/truth_table_module.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .metrics import compose_amplifier_collection_performance_latex_table | ||
from .truth_table import compose_fock_state_truth_table_latex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from piel.conversion import convert_array_type | ||
from piel.visual.table.latex import escape_latex | ||
|
||
|
||
def compose_fock_state_truth_table_latex( | ||
df, | ||
headers: list = None, | ||
) -> str: | ||
latex_table = "\\begin{tabular}{|c|" + "c|" * (len(df.columns)) + "}\n\\hline\n" | ||
|
||
# Column headers | ||
if headers is None: | ||
headers = ["$|\\psi_{IN}\\rangle$"] + [ | ||
f"Bit Phase {i}" for i in range(len(df.columns) - 1) | ||
] | ||
|
||
latex_table += ( | ||
" & ".join([f"\\textbf{{{escape_latex(header)}}}" for header in headers]) | ||
+ " \\\\\n\\hline\n" | ||
) | ||
|
||
# Rows in Fock state notation | ||
for _, row in df.iterrows(): | ||
# Convert each bit phase to the desired LaTeX representation | ||
bit_phases = [ | ||
convert_array_type(row[f"bit_phase_{i}"], output_type="str") | ||
for i in range(len(headers) - 1) | ||
] | ||
|
||
input_fock_state = row["input_fock_state_str"] | ||
input_state = f"$|{input_fock_state}\\rangle$" | ||
|
||
# Each row formatted for LaTeX | ||
latex_row = f"{input_state} & " + " & ".join(bit_phases) + " \\\\\n\\hline\n" | ||
latex_table += latex_row | ||
|
||
# Closing LaTeX syntax | ||
latex_table += "\\end{tabular}\n" | ||
|
||
return latex_table |
Oops, something went wrong.