print('running craph graph') graph = IO.loadPickle(loadGraph) graphs.append(graph) # w = nx.utils.powerlaw_sequence(N, 2) # g = nx.expected_degree_graph(w) # g = sorted(nx.connected_component_subgraphs(g), key = lambda x: len(x))[-1] #for i, j in g.edges(): # g[i][j]['weight'] = np.random.rand() * 2 - 1 # graphs.append(g) # graphs[0].add_edge(0,0) # for j in np.int32(np.logspace(0, np.log10(N-1), 5)): # graphs.append(nx.barabasi_albert_graph(N, j)) dataDir = 'Graphs' # relative path careful df = IO.readCSV(f'{dataDir}/Graph_min1_1.csv', header=0, index_col=0) h = IO.readCSV(f'{dataDir}/External_min1_1.csv', header=0, index_col=0) graph = nx.from_pandas_adjacency(df) attr = {} for node, row in h.iterrows(): attr[node] = dict(H=row['externalField'], nudges=0) nx.set_node_attributes(graph, attr) graphs.append(graph) if 'fs4' in os.uname().nodename or 'node' in os.uname().nodename: now = datetime.datetime.now().isoformat() rootDirectory = f'/var/scratch/cveltere/{now}' # data storage else: rootDirectory = f'{os.getcwd()}/Data/' # # real = 1 # graphs += [nx.barabasi_albert_graph(n, i) for i in linspace(2, n - 1, 3, dtype = int)]
sr = IO.SimulationResult(**store) IO.savePickle(fn, sr, verbose=1) checkTime() # init models if __name__ == "__main__": M = settings.get('model') args = parser.parse_args() file, PID = args.file, args.id print(file, PID) # this should only be run once per call if not file: g = nx.erdos_renyi_graph(3, np.random.uniform(0, 1)) PSYCHO = True if PSYCHO: df = IO.readCSV('Graphs/Graph_min1_1.csv', header = 0,\ index_col = 0) h = IO.readCSV('Graphs/External_min1_1.csv', header = 0,\ index_col = 0) g = nx.from_pandas_adjacency(df) attr = { node: dict(H=row['externalField']) for node, row in h.iterrows() } nx.set_node_attributes(g, attr) modelSettings['magSide'] = '' settings['modelSettings'] = modelSettings m = M(graph = g, \ **settings.get('modelSettings'), \ equilibrium = equilibrium) matched = m.matched