Skip to content
Snippets Groups Projects
Commit d131e0d0 authored by felix's avatar felix
Browse files

update draw funcs

parent 4dfc9f14
No related branches found
No related tags found
No related merge requests found
......@@ -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, sourceMode=None, plexusMode=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(sourceMode, **kwargs)
kirchhoff_graph.set_plexus_landscape(plexusMode, **kwargs)
return kirchhoff_graph
# class flow_circuit(kirchhoff_init.circuit, object):
......
......@@ -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=False,
showbackground=True,
showticklabels=False,
autorange=True,
),
yaxis = dict(
showbackground=False,
showbackground=True,
showticklabels=False,
autorange=True,
),
zaxis = dict(
showbackground=False,
showbackground=True,
showticklabels=False,
autorange=True,
),
......
......@@ -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]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment