bluepymm package

Subpackages

Submodules

bluepymm.main module

Main

bluepymm.main.get_parser()[source]

Return the argument parser

bluepymm.main.main()[source]

Main

bluepymm.main.run(arg_list)[source]

Run BluePyMM

bluepymm.tools module

BluePyMM tools

class bluepymm.tools.NestedPool(processes=None, initializer=None, initargs=(), maxtasksperchild=None, context=None)[source]

Bases: Pool

Class that represents a MultiProcessing nested pool

Process(*args, **kwds)[source]
bluepymm.tools.cd(dir_name)[source]

Change directory

bluepymm.tools.check_all_combos_have_run(database, description)[source]

Verify that all entries of a given database have run.

Parameters:
  • database – a pandas.DataFrame with a column ‘to_run’

  • description – string that contains description of database

Returns:

True if the value of ‘to_run’ is False for all rows.

Raises:
  • Exception, if the database contains at least one entry where the value

  • of 'to_run' is True.

bluepymm.tools.check_compliance_with_neuron(template_name)[source]

Verify that a given name is compliant with the rules for a NEURON template name: a name should be a non-empty alphanumeric string, and start with a letter. Underscores are allowed. The length should not exceed 50 characters.

Returns:

True if compliant, false otherwise.

bluepymm.tools.check_no_null_nan_values(data, description)[source]

Check whether a pandas.DataFrame contains neither None nor NaN values.

Returns:

True if successful.

Return type:

bool

Raises:

Exception – if data contains at least one None or NaN value.

bluepymm.tools.decode_bstring(bstr_obj)[source]

Decodes and returns the str object from bytes.

Parameters:

bstr_obj – the bytes string object

Returns:

string object if conversion is successful, input object otherwise.

bluepymm.tools.get_neuron_compliant_template_name(name)[source]

Get template name that is compliant with NEURON based on given name.

Parameters:

name – string

Returns:

If name is NEURON-compliant, the same string is return. Otherwise, hyphens are replaced by underscores and if appropriate, the string is shortened. Leading numbers are removed.

bluepymm.tools.load_json(path)[source]

Load json file

bluepymm.tools.load_module(name, path)[source]

Try and load module name but only in path

from https://docs.python.org/2/library/imp.html#examples

bluepymm.tools.makedirs(path)[source]

mkdir but don’t fail when dir exists

bluepymm.tools.shorten_and_hash_string(label, keep_length=40, hash_length=9)[source]

Convert string to a shorter string if required.

Parameters:
  • label – a string to be converted

  • keep_length – length of the original string to keep. Default is 40 characters.

  • hash_length – length of the hash to generate, should not be more then 20. Default is 9 characters.

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.

Raises:

ValueError, if 'hash_length' exceeds 20.

bluepymm.tools.write_json(output_dir, output_name, config)[source]

Write json file

Module contents

Init