Skip to content

Commit

Permalink
📶 nix-coverage integration properly working
Browse files Browse the repository at this point in the history
  • Loading branch information
daquintero committed Nov 12, 2024
1 parent bde8a72 commit f62cf28
Show file tree
Hide file tree
Showing 32 changed files with 947 additions and 563 deletions.
9 changes: 0 additions & 9 deletions .coveragerc

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ jobs:
- name: Run Coverage Tests
run: |
nix develop . --command bash -c "
coverage run -m pytest -rA tests/ &&
coverage report -m &&
source scripts/test_coverage.sh &&
total=\$(coverage report | tail -n1 | awk '{print \$NF}' | tr -d '%') &&
echo \"total=\${total}\" >> \$GITHUB_ENV &&
echo \"### Total coverage: \${total}%\"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
tag_name: v${{ env.VERSION }} # Use the incremented version as the tag name
release_name: ${{ env.VERSION }} # Customize the release name
body: |
:tada: :tada: Piel Release Version: ${{ env.VERSION }}. Now stable and all CI env coverage tested. Let us know any feedback!
:tada: :tada: Piel Release Version: ${{ env.VERSION }}.
draft: false
release: true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 9 additions & 6 deletions docs/examples/03a_sax_cocotb_cosimulation.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# # Digital & Photonic Cosimulation with `sax` and `cocotb`

# <div style="padding: 10px; border-radius: 5px;">
# <strong>⚠️ Warning:</strong> This example requires uses packages which are locally available when cloning and installing the `stable` verision of the github source code. See example setup as follows:
# <strong>⚠️ Warning:</strong> This example requires the <code>piel-nix</code> tools environment.
# <a href="https://piel.readthedocs.io/en/latest/sections/environment/index.html" target="_blank">See environment configuration documentation</a>.
# </div>

# + active=""
# !git clone https://github.com/daquintero/piel.git
# !cd piel/
# !pip install -e .[tools]
# !pip install -r requirements_notebooks.txt
# !source scripts/install_piel_nix.sh
# !nix develop .
# -

# We begin by importing a parametric circuit from `gdsfactory`:
Expand Down Expand Up @@ -404,10 +405,12 @@
# ### Model Composition

# +
mixed_switch_lattice_circuit_netlist = (
mixed_switch_lattice_circuit.get_netlist_recursive(allow_multiple=True)
mixed_switch_lattice_circuit_netlist = piel.tools.gdsfactory.get_netlist_recursive(
mixed_switch_lattice_circuit, allow_multiple=True
)
top_level_name = (mixed_switch_lattice_circuit.get_netlist())["name"]
top_level_name = (piel.tools.gdsfactory.get_netlist(mixed_switch_lattice_circuit))[
"name"
]

mixed_switch_lattice_circuit_netlist.keys()
# -
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/03b_optical_function_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@
)

# +
chain_3_mode_lattice_circuit_netlist = (
chain_3_mode_lattice_circuit.get_netlist_recursive(allow_multiple=True)
chain_3_mode_lattice_circuit_netlist = piel.tools.gdsfactory.get_netlist_recursive(
chain_3_mode_lattice_circuit, allow_multiple=True
)
top_level_name = (chain_3_mode_lattice_circuit.get_netlist())["name"]
top_level_name = piel.tools.gdsfactory.get_netlist(chain_3_mode_lattice_circuit)["name"]


recursive_composed_required_models = sax.get_required_circuit_models(
Expand Down
Binary file modified docs/examples/04_spice_cosimulation/netlist.raw
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# # `piel` Electronic-Photonic Co-Design - Full Flow Demo

# <div style="padding: 10px; border-radius: 5px;">
# <strong>⚠️ Warning:</strong> This example requires using the piel nix environment which are locally available when cloning and installing the `stable` verision of the github source code. See example setup as follows
# <strong>⚠️ Warning:</strong> This example requires the <code>piel-nix</code> tools environment.
# <a href="https://piel.readthedocs.io/en/latest/sections/environment/index.html" target="_blank">See environment configuration documentation</a>.
# </div>
#
# Note that this is only CI tested in an ubuntu environment:
# ```
# git clone https://github.com/daquintero/piel.git
# source scripts/install_piel_nix.sh
# ```
#
# You can verify you have the tools required by running the following magic cells:

# + active=""
# !git clone https://github.com/daquintero/piel.git
# !cd piel/
# !source scripts/install_piel_nix.sh
# !nix develop .
# -

# ! which openlane

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@
(* generator = "Amaranth" *)
module top(bit_phase_0, bit_phase_1, input_fock_state_str);
reg \$auto$verilog_backend.cc:2334:dump_module$1 = 0;
(* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:86" *)
(* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:86" *)
output [4:0] bit_phase_0;
reg [4:0] bit_phase_0;
(* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:86" *)
(* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:86" *)
output [4:0] bit_phase_1;
reg [4:0] bit_phase_1;
(* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:82" *)
(* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:82" *)
input [2:0] input_fock_state_str;
wire [2:0] input_fock_state_str;
always @* begin
if (\$auto$verilog_backend.cc:2334:dump_module$1 ) begin end
(* full_case = 32'd1 *)
(* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:112" *)
(* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:112" *)
casez (input_fock_state_str)
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h4:
bit_phase_0 = 5'h00;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h1:
bit_phase_0 = 5'h00;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h2:
bit_phase_0 = 5'h1f;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:124" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:124" */
default:
bit_phase_0 = 5'h00;
endcase
end
always @* begin
if (\$auto$verilog_backend.cc:2334:dump_module$1 ) begin end
(* full_case = 32'd1 *)
(* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:112" *)
(* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:112" *)
casez (input_fock_state_str)
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h4:
bit_phase_1 = 5'h00;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h1:
bit_phase_1 = 5'h1f;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:115" */
3'h2:
bit_phase_1 = 5'h00;
/* src = "/nix/store/spmis1i5ppqaji3xk4ypfbknqzs93pls-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:124" */
/* src = "/nix/store/gi3w8lbvfd4x4gf9m2shpybb58mdkzrr-python3.11-piel-0.1.0/lib/python3.11/site-packages/piel/tools/amaranth/construct.py:124" */
default:
bit_phase_1 = 5'h00;
endcase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

temperature_range_limits_K = tuple([70, 273])

help(calculate_coaxial_cable_heat_transfer)
# help(calculate_coaxial_cable_heat_transfer)

basic_coaxial_cable_heat_transfer = calculate_coaxial_cable_heat_transfer(
temperature_range_K=temperature_range_limits_K,
Expand Down
196 changes: 196 additions & 0 deletions docs/examples/component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/examples/false_transition.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions piel/analysis/signals/dc/transfer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import metrics
from . import power
7 changes: 7 additions & 0 deletions piel/connectivity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .core import (
create_all_connections,
create_component_connections,
create_sequential_component_path,
create_connection_list_from_ports_lists,
get_port_index_from_name,
)
File renamed without changes.
7 changes: 4 additions & 3 deletions piel/flows/electro_optic.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from ..tools.qutip import fock_states_only_individual_modes
from ..models.frequency.defaults import get_default_models
from ..integration.thewalrus_qutip import fock_transition_probability_amplitude
from piel.tools.gdsfactory import get_netlist_recursive, get_netlist

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -288,7 +289,7 @@ def compose_network_matrix_from_models(

if netlist_function is None:
# Generate the netlist recursively
netlist = circuit_component.get_netlist_recursive(allow_multiple=True)
netlist = get_netlist_recursive(circuit_component, allow_multiple=True)

switch_instance_list_i = get_matched_model_recursive_netlist_instances(
recursive_netlist=netlist,
Expand Down Expand Up @@ -465,7 +466,7 @@ def generate_s_parameter_circuit_from_photonic_circuit(

if netlist_function is None:
# Step 2: Generate the netlist recursively
netlist = circuit.get_netlist_recursive(allow_multiple=True)
netlist = get_netlist_recursive(circuit, allow_multiple=True)
else:
netlist = netlist_function(circuit)

Expand All @@ -481,7 +482,7 @@ def generate_s_parameter_circuit_from_photonic_circuit(
Custom exception mapping.
"""
# Step 3: Identify the top-level circuit name
top_level_name = circuit.get_netlist()["name"]
top_level_name = get_netlist(circuit)["name"]

# Step 4: Get required measurement for the top-level circuit
required_models = sax.get_required_circuit_models(
Expand Down
7 changes: 6 additions & 1 deletion piel/tools/gdsfactory/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .netlist import get_input_ports_index, get_matched_ports_tuple_index
from .netlist import (
get_input_ports_index,
get_matched_ports_tuple_index,
get_netlist,
get_netlist_recursive,
)
15 changes: 15 additions & 0 deletions piel/tools/gdsfactory/netlist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Literal, Optional
from functools import partial


def get_matched_ports_tuple_index(
Expand Down Expand Up @@ -120,3 +121,17 @@ def get_input_ports_index(
raise ValueError(f"Sorting algorithm '{sorting_algorithm}' is not supported.")

return ports_index_order


def get_netlist(*args, **kwargs):
from gdsfactory.get_netlist import get_netlist as get_netlist_raw

return get_netlist_raw(*args, **kwargs, extend_recursive_port_names=True)


def get_netlist_recursive(*args, **kwargs):
from gdsfactory.get_netlist import (
get_netlist_recursive as get_netlist_recursive_raw,
)

return get_netlist_recursive_raw(*args, **kwargs, get_netlist_func=get_netlist)
1 change: 0 additions & 1 deletion piel/tools/gplugins/__init__.py

This file was deleted.

Loading

0 comments on commit f62cf28

Please sign in to comment.