bbp_workflow.simulation.sim_writer¶
Simulation campaign writer.
Functions
|
Generate simulation campaign. |
|
Map |
|
Assert that circuit config path exists and return the parsed CircuitConfig. |
|
Map |
- bbp_workflow.simulation.sim_writer.generate_campaign(config, coords_filter_func, param_processors, workers, set_progress_percentage, rnd, validate_output=True)¶
Generate simulation campaign.
- Parameters:
config (xarray.DataArray) –
Simulation campaign configuration. Config must contain at least the following:
name: Full path will be:attrs.path_prefix/name.attrs.path_prefix: base location of the generated campaign.attrs.blue_config_template: path to the blue config cheetah template file.attrs.circuit_config: circuit config path. CircuitConfig file properties will be available for use in the template placeholders. For convenienceRun_Defaultsection properties will be available directly(ex.$MorphologyPath). Properties from the other sections need to be accessed by direct path(ex.$Projection_Thalamocortical_input_VPM.Path).attrs.user_target: optional path to the custom user target file. It will be copied to the generated simulation folders. Anduser_target_file_nameplaceholder will be available for use in the template. Seeuser_target_processor().attrs.rnd_seed_range: optional list of two parameters to numpy randint function to generateseedplaceholder value for simulation campaign.
coords_filter_func (str) – Full name(package.module.func) of a coords filter function. Should return True for coords values to keep. As an additional arguments will receive: idx and {coord_name}_idx. If not provided all coords will be kept.
param_processors (tuple) – Collection of parameter processing functions. Check some examples:
default_ca_treatmentandgenerate_stim_file().workers (int) – Parallelization level of campaign generation.
set_progress_percentage (Callable) – Luigi progress callback.
rnd (numpy.random.Generator) – Random number generator.
- Returns:
Copy of
configwithconfig.datapointing to the locations of the blue configs.
- bbp_workflow.simulation.sim_writer.generate_stim_file(*, path, noise_rate, **_)¶
Map
noise_rateto input spike file atpathlocation.file_name = "input.spikes" (Path(path) / file_name).write_text(f"my input spikes at {noise_rate}") return {"stim_file": file_name}
- bbp_workflow.simulation.sim_writer.parse_circuit_config(path)¶
Assert that circuit config path exists and return the parsed CircuitConfig.
- Parameters:
path (str) – Path to the circuit config file or sonata json.
- Returns:
libsonata.CircuitConfig Parsed circuit config.
- bbp_workflow.simulation.sim_writer.user_target_processor(path, user_target=None)¶
Map
user_targetfile path to file name while copying it topathlocation.This map function is always invoked when generating simulation campaigns, so you don’t have to enable it explicitly.
if user_target: user_target = Path(user_target) assert user_target.exists(), f"Not found: {user_target}" shutil.copy(user_target, path) return {"user_target_file_name": user_target.name} else: return {}