-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sounds like inminent upgrade is required
- Loading branch information
1 parent
9f26098
commit 69e81db
Showing
5 changed files
with
101 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
:py:mod:`piel.visual.style` | ||
=========================== | ||
|
||
.. py:module:: piel.visual.style | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
piel.visual.style.activate_piel_styles | ||
|
||
|
||
|
||
.. py:function:: activate_piel_styles() | ||
Activates the piel fast rc params. | ||
|
||
:returns: None | ||
|
||
|
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
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 @@ | ||
from .switch_lattice import compose_switch_position_list |
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,42 @@ | ||
import functools | ||
from itertools import product | ||
import numpy as np | ||
import pathlib | ||
from typing import Optional, Callable | ||
|
||
|
||
def compose_switch_position_list( | ||
network: np.array, | ||
gap_elements: list = None, | ||
cross_elements: list = None, | ||
*args, | ||
**kwargs | ||
): | ||
""" | ||
This function returns a list of the switch positions in the network, the corresponding instance, and the 2D position in the network. | ||
Args: | ||
network (np.array): The network array. | ||
gap_elements (list, optional): The gap elements in the network. Defaults to None. | ||
cross_elements (list, optional): The cross elements in the network. Defaults to None. | ||
Returns: | ||
switch_position_list (list): A list of tuples of the form (switch_instance, (row, col)). | ||
""" | ||
if cross_elements is None: | ||
cross_elements = ["-"] | ||
if gap_elements is None: | ||
gap_elements = ["0"] | ||
|
||
# Temporary fix for the case where the gap_elements and cross_elements are lists | ||
cross_elements = cross_elements[0] | ||
gap_elements = gap_elements[0] | ||
|
||
switch_position_list = [ | ||
(value, (row, col)) | ||
for row, row_values in enumerate(network) | ||
for col, value in enumerate(row_values) | ||
if (value != gap_elements) | ||
if (value != cross_elements) | ||
] | ||
return switch_position_list |