def split(t, iteration, max_sims, splits):
    sim_name = "network_simulations_3D"
    it_to_split = iteration
    prefix = "_pre"
    prefix_to_split = f"{t}{prefix}_sim_iteration_{it_to_split}"
    n_splits = splits
    max_sims_to_split = max_sims

    file_tree = ft.FileTree()
    # Get path to iteration save
    it_dir_0 = file_tree.get_its_num_dir(0, it_to_split)
    only_files = [f for f in listdir(it_dir_0) if isfile(join(it_dir_0, f))]
    # Find the correct save based on `time`
    it_file = ""
    for i in only_files:
        if prefix_to_split in i:
            it_file = i
            break
    print(it_file)
    # Load iteration
    split_paths = [
        file_tree.get_splits_num_dir(0, it_to_split, j)
        for j in range(n_splits)
    ]
    """split_paths += [file_tree.get_splits_num_dir((1, it_to_split, j)
                    for j in range(64, 83))]"""
    with open(f"{it_dir_0}/{it_file}", 'rb') as file_handle:
        It = pkl.load(file_handle)
        # Split Iteration object into different files
        It.do_split(split_paths, n_splits, max_sims_to_split)
    print("It split completed successfully.")
示例#2
0
 def __init__(self,
              func_name,
              sol_range,
              num_div,
              it_step,
              nodes_scaled,
              nodes_discrete,
              cu,
              no,
              status=None,
              next_node_idx=0):
     self.func_name = func_name  # Name of the simulation
     self.sol_range = sol_range
     self.num_div = num_div
     self.it_step = it_step
     self.nodes_scaled = nodes_scaled  # nodes to to be simulated
     self.nodes_discrete = nodes_discrete  # nodes already simulated
     self.Cu = cu
     self.No = no  # Node dictionary contains nodes whose freqs have been
     # acquired
     self.file_tree = ft.FileTree()
     # Identifiers
     self.status = status  # the current date&time + one of "_pre",
     # "_inter", "_post", updated at each save after initialization
     self.file_name = f"{str(self.status)}_sim_iteration_" + str(
         self.it_step)
     self.next_node_idx = next_node_idx  # The next node to be simulated
     self.results = None
示例#3
0
    def __initControl(self):
        #窗口
        win = tk.PanedWindow(self.root,
                             opaqueresize=False,
                             bd=0,
                             sashwidth=1.5,
                             bg='black')
        win.pack(fill=tk.BOTH, expand=True)

        #左框架
        lframe = tk.Frame(win, bg="#D3D3D3")
        win.add(lframe)

        #文件列表和按钮
        self.ftree = FileTree.FileTree(lframe)
        folderbutton = tk.Button(
            lframe,
            text='open folder',
            font=("Verdana", 10),
            padx=10,
            pady=5,
            command=lambda: self.threadFunc(self.__openFolder))
        folderbutton.pack()
        self.ftree.pack(fill=tk.BOTH, expand=True)
        self.ftree.bindTree(self.__openFile)

        #右框架
        rframe = tk.Frame(win)
        win.add(rframe)

        #标签栏
        self.tab = ScrolledTab.ScrolledTab(rframe)
        self.tab.pack(fill=tk.X)
        self.tab.bindFunc(self.__newFile, self.__changeFile, self.__closeFile,
                          self.__editQuit)

        #文本框
        self.text = LabelText.LabelText(rframe)
        self.text.pack(fill=tk.BOTH, expand=True)
        self.text.bindCheck(self.__checkText)
示例#4
0

if __name__ == "__main__":
    h.nrnmpi_init()
    pc = h.ParallelContext()
    #sys.settrace(trace)
    faulthandler.enable()
    h.load_file("nrngui.hoc")
    Iteration_path = "/scratch/hartman.da/network_simulations_3D/iterations/iteration_5"
    Iteration_file = "next_step.pkl"
    with open(f"{Iteration_path}/{Iteration_file}", "rb") as f:
        Old_Iteration = pkl.load(f)

    iteration_identity = Old_Iteration.it_step
    SIM_NAME = "network_simulations_3D"
    file_tree = ft.FileTree()

    t_start = time.perf_counter()
    pc.runworker()
    results, nodes_discrete, No, Cu_br, num_div, sol_range, it_step = \
        Old_Iteration.give_shapes()
    Cu_add = Old_Iteration.give_cu_add()
    nodes_scaled = Old_Iteration.nodes_scaled
    n_nodes_new = nodes_scaled.shape[0]

    while n_nodes_new > 0:
        n_nodes_new = nodes_scaled.shape[0]
        freqs = np.zeros(n_nodes_new)

        for z, node in enumerate(nodes_scaled):
            pc.submit(network_func, [node, z])
示例#5
0
import sys
import FileTree as ft
import numpy as np
import pickle as pkl
import os
from os import listdir
from os.path import isfile, join

if __name__ == "__main__":
    it_file_time = str(sys.argv[1])
    iteration = int(sys.argv[2])
    n_splits = int(sys.argv[3])
    tree = ft.FileTree()
    it_dir = tree.get_its_num_dir(0, iteration)
    it_dir_files = [f for f in listdir(it_dir) if isfile(join(it_dir, f))]
    results_dir_list = [
        f"{tree.get_split_results_dir(0, iteration, j)}"
        for j in range(n_splits)
    ]
    size_total = 0
    ArrList = []
    it_file = None

    # Find correct iteration file
    for i in it_dir_files:
        if it_file_time in i:
            it_file = i
            break

    # Load iteration object
    if it_file is not None: