Skip to content
Snippets Groups Projects
Commit 272c17ed authored by Felix's avatar Felix
Browse files

fix bugs and rebuild wheel

parent d1e95fb9
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
# @Email: kramer@mpi-cbg.de
# @Project: go-with-the-flow
# @Last modified by: Felix Kramer
# @Last modified time: 2021-05-23T23:17:43+02:00
# @Last modified time: 2021-05-23T23:55:51+02:00
# @License: MIT
import networkx as nx
......@@ -11,11 +11,10 @@ import numpy as np
import scipy.linalg as lina
import sys
from kirchhoff.kirchhoff_init import *
from kirchhoff.kirchhoff_flow import *
from kirchhoff.kirchhoff_flux import *
import kirchhoff.init_dual
from kirchhoff.circuit_init import *
from kirchhoff.circuit_flow import *
from kirchhoff.circuit_flux import *
import kirchhoff.init_dual as init_dual
def initialize_dual_circuit_from_networkx(input_graph1,input_graph2,e_adj):
......
......@@ -3,7 +3,7 @@
# @Email: kramer@mpi-cbg.de
# @Project: go-with-the-flow
# @Last modified by: Felix Kramer
# @Last modified time: 2021-05-23T23:17:20+02:00
# @Last modified time: 2021-05-23T23:56:10+02:00
# @License: MIT
import random as rd
......@@ -11,12 +11,12 @@ import networkx as nx
import numpy as np
import sys
import pandas as pd
# import kirchhoff_init
from kirchhoff.kirchhoff_init import *
from kirchhoff.circuit_init import *
# custom embeddings/architectures
import init_crystal
import init_random
import kirchhoff.init_crystal as init_crystal
import kirchhoff.init_random as init_random
def initialize_flow_circuit_from_networkx(input_graph):
......
......@@ -3,7 +3,7 @@
# @Email: kramer@mpi-cbg.de
# @Project: go-with-the-flow
# @Last modified by: Felix Kramer
# @Last modified time: 2021-05-23T23:17:02+02:00
# @Last modified time: 2021-05-23T23:55:42+02:00
# @License: MIT
import random as rd
......@@ -11,10 +11,10 @@ import networkx as nx
import numpy as np
import sys
import pandas as pd
# import kirchhoff_flow
from kirchhoff.kirchhoff_flow import *
import init_crystal
import init_random
from kirchhoff.circuit_flow import *
import kirchhoff.init_crystal as init_crystal
import kirchhoff.init_random as init_random
def initialize_flux_circuit_from_networkx(input_graph):
......
File moved
......@@ -3,13 +3,14 @@
# @Email: kramer@mpi-cbg.de
# @Project: go-with-the-flow
# @Last modified by: Felix Kramer
# @Last modified time: 2021-05-23T23:17:55+02:00
# @Last modified time: 2021-05-24T00:03:20+02:00
# @License: MIT
import networkx as nx
import numpy as np
import kirchhoff.init_crystal
from scipy.spatial import Voronoi
import kirchhoff.init_crystal as init_crystal
def init_dual_minsurf_graphs(dual_type,num_periods):
......
%% Cell type:code id: tags:
``` python
import networkx as nx
import sys
import numpy as np
sys.path.insert(0,'../goflow')
import kirchhoff_init as ki
import pandas as pd
```
%% Cell type:code id: tags:
``` python
n=3
G=nx.grid_graph(( n,n,1))
K = ki.initialize_circuit_from_networkx(G)
```
%% Output
circuit(): initialized and ready for (some) action :)
%% Cell type:code id: tags:
``` python
import kirchhoff_flow as kf
n=3
G=nx.grid_graph(( n,n,1))
K= kf.initialize_flow_circuit_from_networkx(G)
```
%% Output
circuit(): initialized and ready for (some) action :)
%% Cell type:code id: tags:
``` python
K.graph['num_sources']=4
K.set_source_landscape('root_multi',num_sources=2)
```
%% Output
set_source_landscape(): root_multi is set and consistent :)
%% Cell type:code id: tags:
``` python
print(K.nodes['source'])
K.nodes.plot('source','source',kind='scatter')
```
%% Output
0 -1.0
1 -1.0
2 3.5
3 -1.0
4 -1.0
5 3.5
6 -1.0
7 -1.0
8 -1.0
Name: source, dtype: float64
<AxesSubplot:xlabel='source', ylabel='source'>
%% Cell type:code id: tags:
``` python
custom={}
for i,n in enumerate(K.G.nodes()):
if i==0:
custom.update({n:len(K.G.nodes())-1})
else:
custom.update({n:-1})
print(custom)
K.set_source_landscape('root_geometric')
```
%% Output
{0: 8, 1: -1, 2: -1, 3: -1, 4: -1, 5: -1, 6: -1, 7: -1, 8: -1}
set networkx.spring_layout()
set_source_landscape(): root_geometric is set and consistent :)
%% Cell type:code id: tags:
``` python
K.set_plexus_landscape()
```
%% Output
set_plexus_landscape(): root_geometric is set and consistent :)
%% Cell type:code id: tags:
``` python
K.set_source_landscape()
```
%% Output
set_source_landscape(): default is set and consistent :)
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
import networkx as nx
import numpy as np
import sys
sys.path.insert(0,'../kirchhoff')
import kirchhoff_init as ki
import kirchhoff_flow as kiw
import kirchhoff_flux as kix
import kirchhoff_dual as kid
import kirchhoff
```
%% Cell type:code id: tags:
``` python
import kirchhoff.circuit_init as ki
n=3
G=nx.grid_graph(( n,n,1))
K = ki.initialize_circuit_from_networkx(G)
```
%% Output
circuit(): initialized and ready for (some) action :)
%% Cell type:code id: tags:
``` python
kiw.initialize_circuit_from_networkx(G)
import kirchhoff.circuit_flow as kfc
kfc.initialize_circuit_from_networkx(G)
kfc.initialize_flow_circuit_from_crystal('simple',3)
kfc.initialize_flow_circuit_from_random(random_type='voronoi_volume')
```
%% Output
circuit(): initialized and ready for (some) action :)
<kirchhoff_init.circuit at 0x16367462c48>
%% Cell type:code id: tags:
``` python
kix.initialize_circuit_from_networkx(G)
```
%% Output
circuit(): initialized and ready for (some) action :)
<kirchhoff_init.circuit at 0x1636747bd48>
%% Cell type:code id: tags:
``` python
kiw.initialize_flow_circuit_from_crystal('chain',3)
```
%% Output
circuit(): initialized and ready for (some) action :)
<kirchhoff_flow.flow_circuit at 0x1636748c088>
<kirchhoff.circuit_flow.flow_circuit at 0x1480007a0c8>
%% Cell type:code id: tags:
``` python
kiw.initialize_flow_circuit_from_random(random_type='voronoi_volume')
import kirchhoff.circuit_flux as kfc
kfc.initialize_circuit_from_networkx(G)
kfc.initialize_flow_circuit_from_crystal('simple',3)
kfc.initialize_flow_circuit_from_random(random_type='voronoi_volume')
```
%% Output
circuit(): initialized and ready for (some) action :)
circuit(): initialized and ready for (some) action :)
circuit(): initialized and ready for (some) action :)
<kirchhoff_flow.flow_circuit at 0x16367467288>
<kirchhoff.circuit_flow.flow_circuit at 0x14803149788>
%% Cell type:code id: tags:
``` python
kid.initialize_dual_flux_circuit_from_minsurf('laves',3)
import kirchhoff.circuit_dual as kid
kid.initialize_dual_flux_circuit_from_minsurf('simple',3)
```
%% Output
circuit(): initialized and ready for (some) action :)
circuit(): initialized and ready for (some) action :)
<kirchhoff_dual.dual_circuit at 0x163674ffd48>
<kirchhoff.circuit_dual.dual_circuit at 0x148031ead08>
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:code id: tags:
``` python
import test as cat
import networkx as nx
import matplotlib.pyplot as plt
import cycle_analysis.cycle_tools_coalescence as ctc
import cycle_analysis.test as cat
# generate a dummy graph for testing
# put an edge weight distribution on the system, available are random/gradient/bigradient/nested_square
n=7
G=nx.grid_graph(( n,n,1))
G=cat.generate_pattern(G,'random')
weights=[G.edges[e]['weight'] for e in G.edges()]
pos=nx.get_node_attributes(G,'pos')
# merge all shortest cycles and create merging tree, then calc asymmetry of the tree's branches
T=ctc.coalescence()
minimum_basis=T.construct_networkx_basis(G)
cycle_tree=T.calc_cycle_coalescence(G,minimum_basis)
dict_asymmetry=T.calc_tree_asymmetry()
# plot branching asymmetry in dependence of branching level
x,y=[],[]
for n in dict_asymmetry:
x.append((cycle_tree.nodes[n]['pos'][1]-6)/2.)
y.append(dict_asymmetry[n])
plt.scatter(x,y)
plt.ylabel('asymmetry')
plt.xlabel('branching level')
plt.grid(True)
plt.show()
```
%% Output
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
import networkx as nx
import numpy as np
import scipy.linalg as snl
```
%% Cell type:code id: tags:
``` python
n=2
G=nx.grid_graph(dim=(n,n,1))
print(nx.info(G))
p=4
adj=nx.adjacency_matrix(G).todense()
adj_p=np.linalg.matrix_power(adj,p)
evs=snl.eigvalsh(adj_p)
print(np.sum(evs))
```
%% Output
Name:
Type: Graph
Number of nodes: 4
Number of edges: 4
Average degree: 2.0000
32.0
%% Cell type:code id: tags:
``` python
```
......@@ -3,7 +3,7 @@
# @Email: kramer@mpi-cbg.de
# @Project: go-with-the-flow
# @Last modified by: Felix Kramer
# @Last modified time: 2021-05-23T23:29:24+02:00
# @Last modified time: 2021-05-24T00:03:32+02:00
# @License: MIT
......@@ -15,7 +15,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="kirchhoff", # Replace with your own username
version="0.0.1",
version="0.0.6",
author="felixk1990",
author_email="felixuwekramer@protonmail.com",
description="Collecton of routines for creation and manipulation of Kirchhoff circuits based on resistor-only networks, together with 2D/3D spatial embeddings. ",
......
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