hoctranslate

Utility methods for translating Python dicts into hoc template objects or global variables in NEURON accessible to hoc.

@author: - Thomas McTavish

neuronpy.util.hoctranslate.bool_to_hoc_double(hoc, key, val)[source]

Convert a python boolean into a global hoc double value. :param hoc: A hoc instance as attained by from neuron import h. :param key: Name of the variable :param val: True or False

neuronpy.util.hoctranslate.dict_to_global(hoc, the_dict, show_warning=True)[source]

Translate numbers, strings, and boolean values of a Python dictionary into global variables in NEURON. The keys of the dict become the variable names in hoc. If the hoc variables already exist, they will be overwritten. All values that are boolean, ints, or floats are translated to a double in hoc. Strings are treated as hoc strdef objects. Any other types of the dict are ignored.

Parameters:
  • hoc – A hoc instance as attained by from neuron import h.
  • the_dict – Dict to translate.
neuronpy.util.hoctranslate.list_to_hoc_vector(hoc, key, val)[source]

Convert a 1D list of ints or floats into a global hoc Vector. :param hoc: A hoc instance as attained by from neuron import h. :param key: Name of the variable :param val: 1D list of ints or floats

neuronpy.util.hoctranslate.num_to_hoc_double(hoc, key, val)[source]

Convert a python number into a global hoc double value. :param hoc: A hoc instance as attained by from neuron import h. :param key: Name of the variable :param val: Python integer or float

neuronpy.util.hoctranslate.numpy_array_to_hoc_vector(hoc, key, val)[source]

Convert a 1D numpy array into a global hoc Vector. :param hoc: A hoc instance as attained by from neuron import h. :param key: Name of the variable :param val: 1D numpy array

neuronpy.util.hoctranslate.str_to_hoc_strdef(hoc, key, val)[source]

Convert a python string into a global hoc strdef. :param hoc: A hoc instance as attained by from neuron import h. :param key: Name of the variable :param val: Python string

Previous topic

<no title>

Next topic

hocvar

This Page