bluepyemodel.access_point.local¶
LocalAccessPoint class.
Classes
|
Access point to access configuration files and e-models when stored locally. |
- class LocalAccessPoint(emodel, emodel_dir=None, etype=None, ttype=None, mtype=None, species=None, brain_region=None, iteration_tag=None, synapse_class=None, final_path=None, recipes_path=None, legacy_dir_structure=False, with_seeds=False)¶
Bases:
DataAccessPointAccess point to access configuration files and e-models when stored locally.
Init
- Parameters:
emodel (str) – name of the emodel.
emodel_dir (str) – path to the working directory. Default to current working directory. If iteration_tag is not None, it will be ./run/iteration_tag
ttype (str) – name of the t-type
iteration_tag (str) – iteration tag
final_path (str) – path to final.json which will contain the optimised models.
recipes_path (str) –
path to the json file which should contain the path to the configuration files used for each etype. The content of this file should follow the format:
{ "emodelname": { "morph_path": "./morphologies/", "morphology": [[morphologyname", "morphfile.asc"]], "params": "config/params/pyr.json", "protocol": "config/protocols/emodelname.json", "features": "config/features/emodelname.json" } }
legacy_dir_structure (bool) – if true, the path coming from the recipes will be replaced by “self.emodel_dir / emodel / json_path_from_recipes”. To be deprecated.
with_seed (bool) – allows for emodel_seed type of emodel names in final.json
- classmethod add_entry_recipes(recipes_path, emodel, morph_path, morphology, parameters_path, protocols_path, features_path, pipeline_settings=None)¶
Append an entry to the recipes, create the file if it does not exist
- Parameters:
recipes_path (str) – path to the json containig the recipes.
emodel (str) – name of the emodel.
morph_path (str) – path the directory containing the morphologies.
morphology (list of str) – name of the morphology and name of the file.
parameters_path (str) – path to the json that contains the parameters.
protocols_path (str) – path to the json that contains the protocols.
features_path (str) – path to the json that contains the features.
pipeline_settings (dict) – pipeline settings.
- check_emodel_workflow_configurations(emodel_workflow)¶
Emodel workflow is not used in local, so always return True to let the workflow run
- create_emodel_workflow(state='not launched')¶
Create an empty EModelWorkflow instance. EModel workflow should not be used in local
- format_emodel_data(model_data)¶
Format emodel data.
- get_all_recipes()¶
Load the recipes from a json file.
See docstring of __init__ for the format of the file of recipes.
- get_available_mechanisms()¶
Get the list of names of the available mechanisms
- get_available_morphologies()¶
Get the list of names of available morphologies
- get_emodel(lock_file=True)¶
Get dict with parameter of single emodel (including seed if any)
- get_emodel_names()¶
Get the list of all the names of emodels
- Returns:
keys are emodel names with seed, values are names without seed.
- Return type:
- get_emodel_workflow()¶
Emodel workflow is not used in local, so return None here
- get_emodels(emodels=None)¶
Get a list of emodels
- Parameters:
emodels (list) – list of names of the emodels.
- get_final(lock_file=True)¶
Get emodel dictionary from final.json.
- get_final_content(lock_file=True)¶
Return the final content from recipes if available, or fallback to final.json
- get_fitness_calculator_configuration(record_ions_and_currents=False)¶
Get the configuration of the fitness calculator (efeatures and protocols)
- get_json(recipe_entry)¶
Helper function to load a json using path in recipe.
- get_json_path(recipe_entry)¶
Helper function to get a json path in recipe.
- get_mechanisms_directory()¶
Return the path to the directory containing the mechanisms for the current emodel
- get_model_configuration(skip_get_available_morph=False)¶
Get the configuration of the model, including parameters, mechanisms and distributions
- Parameters:
skip_get_available_morph (bool) – only used in nexus access point.
- get_model_name_for_final(seed)¶
Return model name used as key in final.json.
- get_morphologies()¶
Get the name and path to the morphologies from the recipes.
- Returns:
[{‘name’: morph_name, ‘path’: ‘morph_path’}]. Might contain the additional entries “seclist_names” and “secarray_names” if they are present in the recipes.
- Return type:
morphology_definition (list)
- get_recipes()¶
Load the recipes from a json file for an emodel.
See docstring of __init__ for the format of the file of recipes.
- get_targets_configuration()¶
Get the configuration of the targets (targets and ephys files used)
- has_best_model(seed)¶
Check if the best model has been stored.
- has_fitness_calculator_configuration()¶
Check if the fitness calculator configuration exists
- has_model_configuration()¶
Check if the model configuration exists
- has_pipeline_settings()¶
Returns True if pipeline settings are present in the recipes
- has_targets_configuration()¶
Check if the target configuration exists
- is_checked_by_validation(seed)¶
Check if the emodel with a given seed has been checked by Validation task.
- is_validated()¶
Check if enough models have been validated.
- property morph_dir¶
Return the morphology directory as read from the recipes, or fallback to ‘morphology’.
- property morph_path¶
Return the path to the morphology file as read from the recipes.
- save_final(final, final_path, lock_file=True)¶
Save final emodels in json
- set_emodel(emodel)¶
Setter for the name of the emodel, check it exists (with or without seed) in recipe.
- set_unfrozen_params(params)¶
Freeze parameters for partial optimisation.
- sonata_exists(seed)¶
Returns True if the sonata hoc file has been exported
- store_emodel(emodel)¶
Store an emodel obtained from BluePyOpt in the final.json. Note that if a model in the final.json has the same key (emodel__iteration_tag__seed), it will be overwritten.
- store_emodels_hoc(only_validated=False, only_best=True, seeds=None, map_function=<class 'map'>, new_emodel_name=None, description=None)¶
Not Implemented
- store_emodels_sonata(only_validated=False, only_best=True, seeds=None, map_function=<class 'map'>, new_emodel_name=None, description=None)¶
Not Implemented
- store_fitness_calculator_configuration(configuration)¶
Store a fitness calculator configuration
- store_hocs(only_validated=False, only_best=True, seeds=None, map_function=<class 'map'>, new_emodel_name=None, description=None, output_base_dir='export_emodels_hoc')¶
Not Implemented
- store_model_configuration(configuration, path=None)¶
Store a model configuration as a json
- store_or_update_emodel(emodel)¶
Calls store_emodel.
- store_or_update_emodel_workflow(emodel_workflow)¶
Emodel workflow is not used in local, so pass
- store_targets_configuration(configuration)¶
Store the configuration of the targets (targets and ephys files used)