bluecellulab.cell.template¶
Module for handling NEURON hoc templates.
Functions
|
Verify that a given name is compliant with the rules for a NEURON. |
Get template name that is compliant with NEURON based on given name. |
|
|
Retrieve the hoc cell to access public hoc functions/attributes. |
|
Converts a string to a shorter string if required. |
Classes
|
Loads and manages a NEURON HOC cell template together with its morphology. |
|
- class bluecellulab.cell.template.NeuronTemplate(template_filepath, morph_filepath, template_format, emodel_properties)[source]¶
Loads and manages a NEURON HOC cell template together with its morphology.
Supports four morphology path formats:
.asc/.swc: individual morphology files..h5single file: an individual HDF5 morphology file..h5container: a path of the formcontainer.h5/cell_namewherecontainer.h5is an HDF5 morphologies container andcell_nameis the key of the morphology inside it (with or without a trailing.h5suffix).v5-style directory: a directory path passed directly to legacy HOC templates that locate the morphology file internally.
- Parameters:
template_filepath (
str|Path)morph_filepath (
str|Path)template_format (
str)emodel_properties (
Optional[EmodelProperties])
- class bluecellulab.cell.template.TemplateParams(template_filepath, morph_filepath, template_format, emodel_properties)[source]¶
-
emodel_properties:
Optional[EmodelProperties]¶ Alias for field number 3
-
morph_filepath:
str|Path¶ Alias for field number 1
-
template_filepath:
str|Path¶ Alias for field number 0
-
template_format:
str¶ Alias for field number 2
-
emodel_properties:
- bluecellulab.cell.template.check_compliance_with_neuron(template_name)[source]¶
Verify that a given name is compliant with the rules for a NEURON.
A name should be a non-empty alphanumeric string, and start with a letter. Underscores are allowed. The length should not exceed 50 characters.
- Parameters:
template_name (
str)- Return type:
bool
- bluecellulab.cell.template.get_neuron_compliant_template_name(name)[source]¶
Get template name that is compliant with NEURON based on given name.
- Parameters:
name (
str)- Return type:
str
- bluecellulab.cell.template.public_hoc_cell(cell)[source]¶
Retrieve the hoc cell to access public hoc functions/attributes.
- Parameters:
cell (
HocObject)- Return type:
HocObject
- bluecellulab.cell.template.shorten_and_hash_string(label, keep_length=40, hash_length=9)[source]¶
Converts a string to a shorter string if required.
- Parameters:
label (
str) – A string to be converted.keep_length – Length of the original string to keep.
hash_length – Length of the hash to generate, should not be more than 20.
- Return type:
str- Returns:
If the length of the original label is shorter than the sum of ‘keep_length’ and ‘hash_length’ plus one, the original string is returned. Otherwise, a string with structure <partial>_<hash> is returned, where <partial> is the first part of the original string with length equal to <keep_length> and the last part is a hash of ‘hash_length’ characters, based on the original string.