def setUp(self): # We want to setup a volume with density variations if os.path.dirname(__file__): os.chdir(os.path.dirname(__file__)) print( f"Current directory (detect): {os.path.dirname(os.path.realpath(__file__))}" ) neuron_dir = os.path.join(os.path.dirname(__file__), "validation") self.network_path = os.path.join("networks", "network_density") self.config_file = os.path.join(self.network_path, "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=self.config_file, random_seed=1234) mesh_file = os.path.join(self.network_path, "mesh", "slice.obj") cnc.define_striatum(num_dSPN=0, num_iSPN=0, num_FS=2000, num_LTS=0, num_ChIN=0, mesh_file=mesh_file, mesh_bin_width=5e-4, neurons_dir=neuron_dir) create_slice_mesh(file_name=mesh_file, centre_point=[1e-3, 1e-3, 1e-3], x_len=2e-3, y_len=2e-3, z_len=2e-3, description="Test slice") # Linear density = x coordinate, obs we give a relative density profile # (real density is scaled based on number of neurons) density_function = "abs(x)" cnc.add_neuron_density("Striatum", "FSN", density_func=density_function) cnc.write_json(self.config_file) self.position_file = os.path.join(self.network_path, "network-neuron-positions.hdf5") npn = SnuddaPlace(config_file=self.config_file, log_file=None, verbose=True, d_view=None, h5libver="latest") npn.parse_config() npn.write_data(self.position_file)
def setup(self,simName,expType,nMSD1=120,nMSD2=120,nFS=20,nLTS=0,nChIN=0): from snudda.init.init import SnuddaInit configName= simName + "/network-config.json" cnc = SnuddaInit(struct_def={}, config_file=configName, nChannels=1) cnc.define_striatum(num_dSPN=nMSD1, num_iSPN=nMSD2, num_FS=nFS, num_LTS=nLTS, num_ChIN=nChIN, volume_type="slice", side_len=200e-6, slice_depth=150e-6) dirName = os.path.dirname(configName) if not os.path.exists(dirName): os.makedirs(dirName) cnc.write_json(configName) print("\n\npython3 snudda.py place " + str(simName)) print("python3 snudda.py detect " + str(simName)) print("python3 snudda.py prune " + str(simName)) print("python3 snudda_cut.py " + str(simName) \ + '/network-synapses.hdf5 "abs(z)<100e-6"') print("\nThe last command will pop up a figure and enter debug mode, press ctrl+D in the terminal window after inspecting the plot to continue") print("\n!!! Remember to compile the mod files: nrnivmodl data/neurons/mechanisms") print("\nTo run for example dSPN -> iSPN (and dSPN->dSPN) calibration:") print("mpiexec -n 12 -map-by socket:OVERSUBSCRIBE python3 snudda_calibrate_synapses.py run " + str(expType) + " " + str(simName) + "/network-cut-slice.hdf5 dSPN iSPN") print("\npython3 snudda_calibrate_synapses.py analyse " + str(expType) + " " + str(simName) + "/network-cut-slice.hdf5 --pre dSPN --post iSPN\npython3 snudda_calibrate_synapses.py analyse " + str(simName) + "/network-cut-slice.hdf5 --pre iSPN --post dSPN")
def setUp(self): os.chdir(os.path.dirname(__file__)) self.network_path = os.path.join("networks", "network_testing_input") self.config_file = os.path.join(self.network_path, "network-config.json") self.position_file = os.path.join(self.network_path, "network-neuron-positions.hdf5") self.save_file = os.path.join(self.network_path, "voxels", "network-putative-synapses.hdf5") # Setup network so we can test input generation from snudda.init.init import SnuddaInit cell_spec = os.path.join(os.path.dirname(__file__), "validation") cnc = SnuddaInit(struct_def={}, config_file=self.config_file, random_seed=1234) cnc.define_striatum(num_dSPN=5, num_iSPN=0, num_FS=5, num_LTS=0, num_ChIN=0, volume_type="cube", neurons_dir=cell_spec) cnc.write_json(self.config_file) # Place neurons from snudda.place.place import SnuddaPlace npn = SnuddaPlace( config_file=self.config_file, log_file=None, verbose=True, d_view= None, # TODO: If d_view is None code run sin serial, add test parallel h5libver="latest") npn.parse_config() npn.write_data(self.position_file) # Detect self.sd = SnuddaDetect(config_file=self.config_file, position_file=self.position_file, save_file=self.save_file, rc=None, hyper_voxel_size=120, verbose=True) self.sd.detect(restart_detection_flag=True) # Prune self.network_file = os.path.join(self.network_path, "network-synapses.hdf5") sp = SnuddaPrune(network_path=self.network_path, config_file=None) # Use default config file sp.prune(pre_merge_only=False)
def create_network_config(self, neurons_path, num_replicas=10, random_seed=None, neuron_types=None): self.neurons_path = neurons_path config_def = collections.OrderedDict() config_def[ "RandomSeed"], self.init_rng = SnuddaInit.setup_random_seeds( random_seed) volume_def = collections.OrderedDict() vol_name = "InputTest" volume_def[vol_name] = collections.OrderedDict() volume_def[vol_name]["type"] = "mesh" volume_def[vol_name]["dMin"] = 15e-6 volume_def[vol_name]["meshFile"] = "data/mesh/InputTestMesh.obj" volume_def[vol_name]["meshBinWidth"] = 100e-6 config_def["Volume"] = volume_def config_def["Connectivity"] = dict() # Unconnected neuron_def = self.gather_all_neurons(neuron_types=neuron_types) fake_axon_density = ["r", "1", 10e-6] for n in neuron_def.keys(): neuron_def[n]["num"] = num_replicas neuron_def[n]["volumeID"] = vol_name neuron_def[n]["rotationMode"] = "random" neuron_def[n]["hoc"] = None if not self.has_axon(neuron_def[n]["morphology"]): print( f"Morphology {neuron_def[n]['morphology']} has no axon, faking it." ) # We will have no connections in this test network, so add empty density neuron_def[n]["axonDensity"] = fake_axon_density config_def["Neurons"] = neuron_def return config_def
def init_config(self, args): # self.networkPath = args.path print("Creating config file") print(f"Network path: {self.network_path}") assert args.size is not None, "You need to specify --size when initialising config for the network" from snudda.init.init import SnuddaInit struct_def = { "Striatum": args.size, "GPe": 0, "GPi": 0, "SNr": 0, "STN": 0, "Cortex": 0, "Thalamus": 0 } # Cortex and thalamus axons disabled right now, set to 1 to include one if not args.overwrite: assert not os.path.exists(self.network_path), \ "Network path {self.network_path} already exists (aborting to prevent accidental overwriting)" self.make_dir_if_needed(self.network_path) random_seed = args.randomseed config_file = os.path.join(self.network_path, "network-config.json") SnuddaInit(struct_def=struct_def, config_file=config_file, random_seed=random_seed) if args.size > 1e5: print( f"Make sure there is enough disk space in {self.network_path}") print("Large networks take up ALOT of space")
def setUp(self): if os.path.dirname(__file__): os.chdir(os.path.dirname(__file__)) print( f"Current directory (detect): {os.path.dirname(os.path.realpath(__file__))}" ) neuron_dir = os.path.join(os.path.dirname(__file__), "validation") self.sim_name = os.path.join("networks", "network_testing_place") self.config_file = os.path.join(self.sim_name, "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=self.config_file, random_seed=1234) cnc.define_striatum(num_dSPN=10, num_iSPN=0, num_FS=10, num_LTS=0, num_ChIN=0, volume_type="cube", neurons_dir=neuron_dir) cnc.write_json(self.config_file)
def setUp(self): from snudda.place.create_cube_mesh import create_cube_mesh # Create cube meshes self.network_path = os.path.join("networks", "network_testing_project") mesh_file_a = os.path.join(self.network_path, "mesh", "volume_A.obj") mesh_file_b = os.path.join(self.network_path, "mesh", "volume_B.obj") create_cube_mesh(mesh_file_a, [5e-3, 0, 0], 300e-6, "Volume A - connect structures example") create_cube_mesh(mesh_file_b, [-5e-3, 0, 0], 300e-6, "Volume B - connect structures example") # Define network from snudda.init.init import SnuddaInit cnc = SnuddaInit(network_path=self.network_path, random_seed=123) cnc.define_structure(struct_name="VolumeA", struct_mesh=mesh_file_a, d_min=15e-6, mesh_bin_width=50e-6) cnc.define_structure(struct_name="VolumeB", struct_mesh=mesh_file_b, d_min=15e-6, mesh_bin_width=50e-6) cnc.add_neurons(name="dSPN", num_neurons=20, volume_id="VolumeA", neuron_dir=os.path.join("$DATA", "neurons", "striatum", "dspn")) cnc.add_neurons(name="iSPN", num_neurons=20, volume_id="VolumeB", neuron_dir=os.path.join("$DATA", "neurons", "striatum", "ispn")) # Add the projection we want to test dSPN->iSPN proj_file = os.path.join("data", "ExampleProjection.json") cnc.neuron_projection(neuron_name="dSPN", target_name="iSPN", projection_name="ExampleProjection", projection_file=proj_file, source_volume="VolumeA", dest_volume="VolumeB", projection_radius=100e-6, number_of_targets=[10, 5], number_of_synapses=[10, 5], dendrite_synapse_density="1", connection_type="GABA", dist_pruning=None, f1=0.9, soft_max=None, mu2=None, a3=None) # Also add dSPN-dSPN and iSPN-iSPN synapses # Note we do NOT add dSPN-iSPN again this way, as that would overwrite the above connections # (The above neuron_projection will also do normal touch detection) SPN2SPNdistDepPruning = "1-exp(-(0.4*d/60e-6)**2)" MSD1gGABA = [0.24e-9, 0.1e-9] MSD2gGABA = [0.24e-9, 0.1e-9] MSD1GABAfailRate = 0.7 # Taverna 2008, figure 2 MSD2GABAfailRate = 0.4 # Taverna 2008, 2mM pfdSPNdSPN = os.path.join("$DATA", "synapses", "striatum", "PlanertFitting-DD-tmgaba-fit.json") pfdSPNiSPN = os.path.join("$DATA", "synapses", "striatum", "PlanertFitting-DI-tmgaba-fit.json") pfiSPNdSPN = os.path.join("$DATA", "synapses", "striatum", "PlanertFitting-ID-tmgaba-fit.json") pfiSPNiSPN = os.path.join("$DATA", "synapses", "striatum", "PlanertFitting-II-tmgaba-fit.json") cnc.add_neuron_target(neuron_name="dSPN", target_name="dSPN", connection_type="GABA", dist_pruning=SPN2SPNdistDepPruning, f1=0.38, soft_max=3, mu2=2.4, a3=1.0, conductance=MSD1gGABA, parameter_file=pfdSPNdSPN, mod_file="tmGabaA", channel_param_dictionary={ "tau1": (1.3e-3, 1e3), "tau2": (12.4e-3, 1e3), "failRate": MSD1GABAfailRate }) cnc.add_neuron_target(neuron_name="iSPN", target_name="iSPN", connection_type="GABA", dist_pruning=SPN2SPNdistDepPruning, f1=0.55, soft_max=4, mu2=2.4, a3=1.0, conductance=MSD2gGABA, parameter_file=pfiSPNiSPN, mod_file="tmGabaA", channel_param_dictionary={ "tau1": (1.3e-3, 1e3), "tau2": (12.4e-3, 1e3), "failRate": MSD2GABAfailRate }) cnc.write_json() # Place neurons, then detect, project and prune from snudda.place.place import SnuddaPlace sp = SnuddaPlace(network_path=self.network_path, verbose=True) sp.parse_config() sp.write_data() from snudda.detect.detect import SnuddaDetect sd = SnuddaDetect(network_path=self.network_path, hyper_voxel_size=100, verbose=True) sd.detect() from snudda.detect.project import SnuddaProject sp = SnuddaProject(network_path=self.network_path) sp.project() sp.write() from snudda.detect.prune import SnuddaPrune sp = SnuddaPrune(network_path=self.network_path, verbose=True) sp.prune()
def test_workflow(self): #with self.subTest(stage="create"): # run_cli_command("create test-project --overwrite") if True: network_path = "test-project" if os.path.exists(network_path): import shutil shutil.rmtree(network_path) os.mkdir(network_path) os.chdir(network_path) with self.subTest(stage="setup-parallel"): os.environ["IPYTHONDIR"] = os.path.join( os.path.abspath(os.getcwd()), ".ipython") os.environ["IPYTHON_PROFILE"] = "Snudda_local" os.system( "ipcluster start -n 4 --profile=$IPYTHON_PROFILE --ip=127.0.0.1&" ) time.sleep(10) # with self.subTest(stage="init-parallel-BIG"): # run_cli_command("init tiny_parallel --size 1000000 --overwrite") # with self.subTest(stage="place-parallel-BIG"): # run_cli_command("place tiny_parallel --parallel") with self.subTest(stage="init-parallel"): run_cli_command("init tiny_parallel --size 100 --overwrite") # Lets reinit but a smaller network that contains all types of cells, to speed things up with self.subTest(stage="small-reinit-1"): config_name = os.path.join("tiny_parallel", "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=config_name, random_seed=123456) cnc.define_striatum(num_dSPN=4, num_iSPN=4, num_FS=2, num_LTS=2, num_ChIN=2, volume_type="cube") cnc.write_json(config_name) with self.subTest(stage="place-parallel"): run_cli_command("place tiny_parallel --parallel --raytraceBorders") with self.subTest(stage="detect-parallel"): run_cli_command("detect tiny_parallel --parallel") with self.subTest(stage="prune-parallel"): run_cli_command("prune tiny_parallel --parallel") from shutil import copyfile print(f"listdir: {os.listdir()}") print(f"parent listdir: {os.listdir('..')}") input_file = os.path.join(os.path.dirname(__file__), os.path.pardir, "snudda", "data", "input_config", "input-v10-scaled.json") copyfile(input_file, os.path.join("tiny_parallel", "input.json")) with self.subTest(stage="input"): run_cli_command( "input tiny_parallel --input tiny_parallel/input.json --parallel" ) # with self.subTest(stage="init-parallel-full"): # run_cli_command("init large_parallel --size 1670000 --overwrite") # with self.subTest(stage="place-parallel-full"): # run_cli_command("place large_parallel --parallel") with self.subTest(stage="parallel-stop"): os.system("ipcluster stop") # Only serial tests below this line, we stopped ipcluster. with self.subTest(stage="simulate"): print("Running nrnivmodl:") mech_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "snudda", "data", "neurons", "mechanisms") if not os.path.exists("mechanisms"): print("----> Copying mechanisms") # os.symlink(mech_dir, "mechanisms") from distutils.dir_util import copy_tree copy_tree(mech_dir, "mechanisms") else: print("-------------> !!! mechanisms already exists") eval_str = f"nrnivmodl mechanisms" # f"nrnivmodl {mech_dir} print(f"Running: {eval_str}") os.system(eval_str) # print("---> Testing to run simulate using os.system instead") # os.system("snudda simulate tiny_parallel --time 0.1 --voltOut default") # For the unittest we for some reason need to load mechansism # separately from mpi4py import MPI # This must be imported before neuron, to run parallel from neuron import h # , gui import neuron # For some reason we need to import modules manually # when running the unit test. if os.path.exists("x86_64/.libs/libnrnmech.so"): print("!!! Manually loading libraries") try: h.nrn_load_dll("x86_64/.libs/libnrnmech.so") except: import traceback tstr = traceback.format_exc() print(tstr) if False: try: from snudda.simulate.simulate import SnuddaSimulate ss = SnuddaSimulate(network_path="tiny_parallel") ss.run(100) ss.write_spikes() except: import traceback tstr = traceback.format_exc() print(tstr) import pdb pdb.set_trace() print("Time to run simulation...") run_cli_command( "simulate tiny_parallel --time 0.1 --voltOut default") os.environ["SLURM_JOBID"] = "1234" with self.subTest(stage="init-serial"): # Remove the old folder if it exists if os.path.exists("tiny_serial"): import shutil shutil.rmtree("tiny_serial") run_cli_command("init tiny_serial --size 100 --profile") with self.subTest(stage="init-overwrite-fail"): # Should not allow overwriting of existing folder if --overwrite is not specified self.assertRaises(AssertionError, run_cli_command, "init tiny_serial --size 100") # Again, let us reinit to a smaller network to speed things up with self.subTest(stage="small-reinit-2"): config_name = os.path.join("tiny_serial", "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=config_name, random_seed=1234) cnc.define_striatum(num_dSPN=3, num_iSPN=3, num_FS=2, num_LTS=2, num_ChIN=2, volume_type="cube") cnc.write_json(config_name) with self.subTest(stage="place-serial"): run_cli_command("place tiny_serial --h5legacy") with self.subTest(stage="detect-serial"): run_cli_command( "detect tiny_serial --volumeID Striatum --hvsize 120 --randomseed 123 --verbose --h5legacy" ) with self.subTest(stage="detect-serial-cont"): run_cli_command( "detect tiny_serial --volumeID Striatum --hvsize 120 --cont --h5legacy" ) with self.subTest(stage="prune-serial"): run_cli_command("prune tiny_serial --h5legacy") input_file = os.path.join(os.path.dirname(__file__), os.path.pardir, "snudda", "data", "input_config", "input-v10-scaled.json") copyfile(input_file, "tiny_serial/input.json") with self.subTest(stage="input"): run_cli_command( "input tiny_serial --time 1.0 --inputFile tiny_serial/input-spikes.hdf5" )
def test_init(self): with self.subTest(stage="init_cube"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_testing_init_cube") config_name = os.path.join(network_path, "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=config_name) cnc.define_striatum(num_dSPN=47500, num_iSPN=47500, num_FS=1300, num_LTS=0, num_ChIN=0, volume_type="cube") cnc.write_json() # TODO: This only checks that the code runs. Add check for output with self.subTest(stage="init_slice"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_testing_init_slice") config_name = os.path.join(network_path) cnc = SnuddaInit(struct_def={}, network_path=network_path) cnc.define_striatum(num_dSPN=47500, num_iSPN=47500, num_FS=1300, num_LTS=0, num_ChIN=0, volume_type="slice") cnc.write_json() with self.subTest(stage="init_full"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_testing_init_full") config_name = os.path.join(network_path, "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=config_name, random_seed=123) cnc.define_striatum(num_neurons=1670000) cnc.write_json() with self.subTest(stage="population-unit-random"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_pop_unit_random") cnc = SnuddaInit(struct_def={}, network_path=network_path) cnc.define_striatum(num_dSPN=1000, num_iSPN=1000, num_FS=20, num_LTS=0, num_ChIN=0, volume_type="slice") cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN", "iSPN"], fraction_of_neurons=0.5) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN", "iSPN"], fraction_of_neurons=0.2) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN"], fraction_of_neurons=0.3) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["iSPN"], fraction_of_neurons=0.15) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["iSPN"], fraction_of_neurons=0.15, unit_id=10) cnc.write_json() with self.subTest(stage="population-unit-sphere"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_pop_unit_sphere") cnc = SnuddaInit(struct_def={}, network_path=network_path) cnc.define_striatum(num_dSPN=10000, num_iSPN=10000, num_FS=200, num_LTS=0, num_ChIN=0, volume_type="slice") cnc.add_population_unit_density( structure_name="Striatum", neuron_types=["dSPN", "iSPN"], unit_centre=[0, 0, 0], probability_function="(d < 100e-6)*1") cnc.add_population_unit_density( structure_name="Striatum", neuron_types=["dSPN", "iSPN"], unit_centre=[300e-6, 0, 0], probability_function="exp(-d/200e-6)") cnc.add_population_unit_density( structure_name="Striatum", neuron_types=["dSPN"], unit_centre=[0, 300e-6, 0], probability_function="exp(-d/150e-6)") cnc.write_json()
def defineNetwork(self, simName, simType=None): if (simType is None): simType = self.simType configName = simName + "/network-config.json" cnc = SnuddaInit(struct_def={}, config_file=configName, nChannels=1) # In a 1x1x0.15 mm slice there are 12000 neurons normally # We want 10% of MS population only, since those are the ones being # stimulated (Chuhma et al 2011) # # 47.5% dSPN normally, now 4.75% of normal density = 570 dSPN, 570 iSPN # We assume we measure only monosynaptic connections. # # Adding 10 FSN, 10 ChIN, 10 dSPN, 10 iSPN to measure from # if (False): #Small debug version #cnc.defineStriatum(nMSD1=20,nMSD2=20,nFS=0,nLTS=0,nChIN=0, # volumeType="slice",sideLen=200e-6) #cnc.defineStriatum(nMSD1=20,nMSD2=20,nFS=10,nLTS=0,nChIN=10, # volumeType="slice",sideLen=200e-6) cnc.define_striatum(num_dSPN=153, num_iSPN=153, num_FS=10, num_LTS=0, num_ChIN=10, volume_type="slice", side_len=500e-6) if (simType == "Chuhma2011"): cnc.define_striatum( num_dSPN=1140 + self.nNrns, num_iSPN=1140 + self.nNrns, num_FS=5, num_LTS=0, num_ChIN=self.nNrns, volume_type="slice", side_len=1000e-6, slice_depth=300e-6) # 400mum, assume 100 mum dead elif (simType == "Straub2016FS"): # nFS must be correct density, but readout neurons can be any density cnc.define_striatum( num_dSPN=self.nNrns, num_iSPN=self.nNrns, num_FS=182, num_LTS=0, num_ChIN=self.nNrns, volume_type="slice", side_len=1000e-6, slice_depth=175e-6) #275e-6 m slice, assume 100e-6 dead elif (simType == "Straub2016LTS"): cnc.define_striatum(num_dSPN=self.nNrns, num_iSPN=self.nNrns, num_FS=0, num_LTS=98, num_ChIN=self.nNrns, volume_type="slice", side_len=1000e-6, slice_depth=175e-6) elif (simType == "Szydlowski2013"): cnc.define_striatum(num_dSPN=0, num_iSPN=0, num_FS=156, num_LTS=self.nNrns, num_ChIN=0, volume_type="slice", side_len=1000e-6, slice_depth=150e-6) else: print("setup : Unkown simType: " + str(simType)) exit(-1) dirName = os.path.dirname(configName) if not os.path.exists(dirName): os.makedirs(dirName) cnc.write_json(configName)
connectNeurons = False #simName = "networks/FSmorphTest2orig" #simName = "networks/FSmorphTest1b" #simName = "LTStest" #simName = "networks/twoFS" #simName = "networks/FSmorphTest4" #simName = "networks/3types-striatum" # simName = "networks/SynTest-v6" # MSMS tuning #simName = "networks/SynTest-v15" neuronsDir = "cellspecs.parkinson/" + str(args.level) + "/" configName= simName + "/network-config.json" cnc = SnuddaInit(struct_def={}, config_file=configName, nChannels=1) cnc.define_striatum(num_dSPN=1500, num_iSPN=1500, num_FS=0, num_LTS=0, num_ChIN=0, neurons_dir=neuronsDir, volume_type="cube") # cnc.defineStriatum(nMSD1=0,nMSD2=0,nFS=100,nLTS=100,nChIN=0,volumeType="slice") dirName = os.path.dirname(configName) if not os.path.exists(dirName): os.makedirs(dirName) cnc.write_json(configName)
sim_name = args.network neurons_dir = args.neurons connect_neurons = False # simName = "networks/FSmorphTest2orig" # simName = "networks/FSmorphTest1b" # simName = "LTStest" # simName = "networks/twoFS" # simName = "networks/FSmorphTest4" # simName = "networks/3types-striatum" # simName = "networks/SynTest-v6" # MSMS tuning # simName = "networks/SynTest-v15" config_name = os.path.join(sim_name, "network-config.json") cnc = SnuddaInit(struct_def={}, config_file=config_name) # cnc.defineStriatum(nMSD1=500,nMSD2=500,nFS=0,nLTS=0,nChIN=30,volumeType="cube") # cnc.defineStriatum(nMSD1=120,nMSD2=120,nFS=20,nLTS=0,nChIN=0,volumeType="slice") # cnc.defineStriatum(nMSD1=0,nMSD2=0,nFS=10000,nLTS=0,nChIN=0,volumeType="slice") # cnc.defineStriatum(nMSD1=0,nMSD2=0,nFS=10000,nLTS=0,nChIN=0,volumeType="cube") # cnc.define_striatum(num_dSPN=0, num_iSPN=0, num_FS=100, num_LTS=0, num_ChIN=0, volume_type="cube") # cnc.defineStriatum(nMSD1=10,nMSD2=10,nFS=10,nLTS=10,nChIN=10,volumeType="slice") # cnc.defineStriatum(nMSD1=500,nMSD2=500,nFS=0,nLTS=0,nChIN=500,volumeType="cube") # cnc.define_striatum(num_dSPN=1500, num_iSPN=1500, num_FS=0, num_LTS=0, num_ChIN=0, # volume_type="cube", neurons_dir=neurons_dir) # cnc.define_striatum(num_dSPN=47500, num_iSPN=47500, num_FS=1300, num_LTS=0, num_ChIN=0, # volume_type="cube", neurons_dir=neurons_dir) cnc.define_striatum(num_dSPN=25000, num_iSPN=25000, num_FS=0,
def test_population_units(self, stage="place-pop-unit-random"): network_path = os.path.join(os.path.dirname(__file__), "networks", "network_place_pop_unit_random") cnc = SnuddaInit(struct_def={}, network_path=network_path) cnc.define_striatum(num_dSPN=1000, num_iSPN=1000, num_FS=20, num_LTS=0, num_ChIN=0, volume_type="cube") cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN", "iSPN"], fraction_of_neurons=0.5) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN", "iSPN"], fraction_of_neurons=0.2) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["dSPN"], fraction_of_neurons=0.3) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["iSPN"], fraction_of_neurons=0.15) cnc.add_population_unit_random(structure_name="Striatum", neuron_types=["iSPN"], fraction_of_neurons=0.15, unit_id=10) cnc.write_json() npn = SnuddaPlace(network_path=network_path, h5libver="latest", verbose=True) npn.parse_config() npn.write_data()