Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kirchhoff-circuits
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kramer
kirchhoff-circuits
Commits
d131e0d0
Commit
d131e0d0
authored
3 years ago
by
felix
Browse files
Options
Downloads
Patches
Plain Diff
update draw funcs
parent
4dfc9f14
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kirchhoff/circuit_flow.py
+3
-3
3 additions, 3 deletions
kirchhoff/circuit_flow.py
kirchhoff/draw_networkx.py
+17
-24
17 additions, 24 deletions
kirchhoff/draw_networkx.py
kirchhoff/init_dual.py
+57
-1
57 additions, 1 deletion
kirchhoff/init_dual.py
with
77 additions
and
28 deletions
kirchhoff/circuit_flow.py
+
3
−
3
View file @
d131e0d0
...
...
@@ -95,7 +95,7 @@ def setup_default_flow_circuit(skeleton=None):
return
kirchhoff_graph
def
setup_flow_circuit
(
skeleton
=
None
,
source
=
None
,
plexus
=
None
):
def
setup_flow_circuit
(
skeleton
=
None
,
source
Mode
=
None
,
plexus
Mode
=
None
,
**
kwargs
):
"""
Initialize a flow circuit from a given networkx graph and dictioinary of boundary conditions.
...
...
@@ -111,8 +111,8 @@ def setup_flow_circuit(skeleton=None, source=None, plexus=None):
"""
kirchhoff_graph
=
initialize_flow_circuit_from_networkx
(
skeleton
)
kirchhoff_graph
.
set_source_landscape
(
source
)
kirchhoff_graph
.
set_plexus_landscape
(
plexus
)
kirchhoff_graph
.
set_source_landscape
(
source
Mode
,
**
kwargs
)
kirchhoff_graph
.
set_plexus_landscape
(
plexus
Mode
,
**
kwargs
)
return
kirchhoff_graph
# class flow_circuit(kirchhoff_init.circuit, object):
...
...
This diff is collapsed.
Click to expand it.
kirchhoff/draw_networkx.py
+
17
−
24
View file @
d131e0d0
...
...
@@ -65,25 +65,17 @@ def plot_networkx(input_graph, **kwargs):
}
if
not
options
[
'
axis
'
]:
new_layout
.
update
(
{
'
scene
'
:
dict
(
xaxis_title
=
''
,
yaxis_title
=
''
,
zaxis_title
=
''
,
xaxis
=
dict
(
showbackground
=
False
,
showticklabels
=
False
),
yaxis
=
dict
(
showbackground
=
False
,
showticklabels
=
False
),
zaxis
=
dict
(
showbackground
=
False
,
showticklabels
=
False
),
aspectmode
=
"
data
"
,
)
}
dict
(
plot_bgcolor
=
"
#FFF
"
,
# Sets background color to white
xaxis
=
dict
(
linecolor
=
"
#BCCCDC
"
,
# Sets color of X-axis line
showgrid
=
False
# Removes X-axis grid lines
),
yaxis
=
dict
(
linecolor
=
"
#BCCCDC
"
,
# Sets color of Y-axis line
showgrid
=
False
,
# Removes Y-axis grid lines
),
)
)
fig
.
update_layout
(
**
new_layout
)
...
...
@@ -112,7 +104,7 @@ def plot_networkx_dual(dual_circuit, *args, **kwargs):
'
colormap
'
:[
'
plasma
'
,
'
plasma
'
],
'
markersize
'
:
[
2
,
2
],
'
linewidth
'
:
[
10
,
10
],
'
axis
'
:
True
'
axis
'
:
True
,
}
for
k
,
v
in
kwargs
.
items
():
...
...
@@ -134,7 +126,8 @@ def plot_networkx_dual(dual_circuit, *args, **kwargs):
'
showlegend
'
:
False
,
'
autosize
'
:
True
,
'
margin
'
:
{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
0
,
'
b
'
:
0
},
'
scene_camera
'
:
dict
(
eye
=
dict
(
x
=
2
,
y
=
2
,
z
=
0.9
))
'
scene_camera
'
:
dict
(
eye
=
dict
(
x
=
2
,
y
=
2
,
z
=
0.9
)),
'
scene
'
:
dict
(
aspectmode
=
"
data
"
),
}
if
not
options
[
'
axis
'
]:
new_layout
.
update
(
...
...
@@ -143,17 +136,17 @@ def plot_networkx_dual(dual_circuit, *args, **kwargs):
yaxis_title
=
''
,
zaxis_title
=
''
,
xaxis
=
dict
(
showbackground
=
Fals
e
,
showbackground
=
Tru
e
,
showticklabels
=
False
,
autorange
=
True
,
),
yaxis
=
dict
(
showbackground
=
Fals
e
,
showbackground
=
Tru
e
,
showticklabels
=
False
,
autorange
=
True
,
),
zaxis
=
dict
(
showbackground
=
Fals
e
,
showbackground
=
Tru
e
,
showticklabels
=
False
,
autorange
=
True
,
),
...
...
This diff is collapsed.
Click to expand it.
kirchhoff/init_dual.py
+
57
−
1
View file @
d131e0d0
...
...
@@ -47,7 +47,7 @@ def init_dual_catenation(dual_type, num_periods):
"""
Initialize a dual spatially embedded multilayer graph, with internal graphs based on
simple catenatednetwork skeletons.
simple catenated
network skeletons.
Args:
dual_type (string): The type of dual skeleton (simple, diamond, laves, catenation).
...
...
@@ -59,6 +59,7 @@ def init_dual_catenation(dual_type, num_periods):
"""
plexus_mode
=
{
'
catenation
'
:
networkx_dual_catenation
,
'
crossMesh
'
:
networkx_dual_crossMesh
,
}
if
dual_type
in
plexus_mode
:
...
...
@@ -713,3 +714,58 @@ class networkx_dual_catenation(networkx_dual, object):
self
.
layer
=
[
G1
,
G2
]
class
networkx_dual_crossMesh
(
networkx_dual
,
object
):
"""
A class for spatial, dual Laves circuits.
Attributes
----------
layer (list): List of the mutlilayered circuits.
lattice_constant (float): Scale for the spacing between the networks.
"""
def
__init__
(
self
,
num_periods
):
"""
A constructor for multilayer circuit catenation objects, setting default values
for the interal graph objects and geometry
"""
super
(
networkx_dual_crossMesh
,
self
).
__init__
()
self
.
lattice_constant
=
1
self
.
translation_length
=
1
self
.
dual_crossMesh
(
num_periods
)
def
dual_crossMesh
(
self
,
num_periods
):
"""
Set internal networkx structure, dual crossed_mesh.
Args:
num_periods (int): Repetition number of the unit tile.
"""
num_periods1X
,
num_periods1Y
,
num_periods2X
,
num_periods2Y
=
num_periods
np1
=
[
num_periods1X
,
num_periods1Y
]
np2
=
[
num_periods2X
,
num_periods2Y
]
N
=
[
np1
,
np2
]
ic
=
init_crystal
.
networkx_square
G1
,
G2
=
[
nx
.
Graph
(
ic
(
i
).
G
)
for
i
in
N
]
theta
=
np
.
pi
/
2.
rot_mat
=
np
.
array
(((
1
,
0
,
0
),
(
0
,
np
.
cos
(
theta
),
-
np
.
sin
(
theta
)),
(
0
,
np
.
sin
(
theta
),
np
.
cos
(
theta
))
))
for
n
in
G1
.
nodes
():
p
=
np
.
array
(
G1
.
nodes
[
n
][
'
pos
'
])
p1
=
np
.
dot
(
rot_mat
,
p
)
p2
=
np
.
add
([
0.5
,
0.5
,
-
0.5
],
p1
)
G1
.
nodes
[
n
][
'
pos
'
]
=
self
.
lattice_constant
*
p2
self
.
layer
=
[
G1
,
G2
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment