nrv.backend

Description

backend: code for IO, machine and classes handling

the backend sub-package is dedicated to handling the magic behind all NRV computations. The code developed here is not meant to be used directly by the end-user, but internally to develop new functionality or maintain other sub-packages.

Classes

nrv_config(*args, **kwargs)

A unique class to handle all the configuration

NRV_Encoder(*[, skipkeys, ensure_ascii, ...])

Json encoding class, specific for NRV2 axon prevent from type error due to np.arrays solution taken as this from askpython.com

bcolors()

NRV_class()

Instanciate a basic NRV class NRV Class are empty shells, defined as abstract classes of which every class in NRV should inherite.

NRV_results([context])

Results class for NRV

sim_results([context])

NRV_simulable([t_sim, dt, record_V_mem, ...])

Generic class for all NRV simulable classes (nerve, fascicle, myelinated).

NRV_singleton

Should be used as metaclass to define singleton classes

nrv_parameters(*args, **kwargs)

A class for NRV parameters used to gather parameters

Functions

is_empty_iterable(x)

check if the object x is an empty iterable

set_idxs(_i, _n)

convert an object _i into an 1D array of index

get_query(*args, **kwgs)

Convert a list of kwargs into a str compatible with pandas.DataFrame.query

df_to(df, otype, *args, **kwgs)

convert a pandas.DataFrame to another type.

is_iterable(some_stuff)

this function chels wether or not a variable contains an iterrable

rmv_ext(fname)

return filename without extension

generate_new_fname(fname)

Prevent overwriting existing files.

create_folder(foldername[, access_rights])

create a folder with controled access rights.

check_json_fname(fname)

Add ".json" extension is missing at the end of the file name and check if it exists.

json_dump(results, filename)

save stuff as a json file

json_load(filename)

Load stuff from a json file

load_dxf_file(filename)

UNDER DEV

set_attributes(my_object, attributes_dict)

check_function_kwargs(func, kwargs)

check that the keys of a dictionnary are arguments of a function and return an updated dictionnary with only valide keys

function_to_str(func)

str_to_function(lines)

init_reporter()

set_log_level(level[, clear_log_file])

rise_error(*args[, out])

Rises and error to the log and to the prompt for the master process (process ID 0) in case of parallel computing.

rise_warning(*args[, abort])

Rises a warning to the log and to the prompt for the master process (process ID 0) in case of parallel computing.

pass_info(*args, **kwargs)

Pass an info to the log and to the prompt for the master process (process ID 0) in case of parallel computing.

pass_debug_info(*args, **kwargs)

Pass an info to the log and to the prompt for the master process (process ID 0) in case of parallel computing.

progression_popup(current, max_iter[, ...])

Displays the progression on prompt, for single process only, nothing saved to the log

prompt_debug(*args)

outputs for debug, simple redirection to icecream without the installation (see icecream help).

clear_prompt_line([n])

Clear lines of the prompt, to overwrite stuffs.

is_NRV_class(x)

Check if the object x is a NRV_class.

is_NRV_class_list(x)

check if the object x is a list containing only NRV_class.

is_NRV_class_dict(x)

check if the object x is a dictionary containing only NRV_class.

is_NRV_dict(x)

Check if the object x is a dictionary of saved NRV_class.

is_NRV_dict_list(x)

Check if the object x is a list of dictionary of saved NRV_class.

is_NRV_dict_dict(x)

Check if the object x is a dictionary containing dictionaries of saved NRV_class.

is_NRV_object_dict(x)

Check if the object x is_NRV_dict, is_NRV_dict_list or is_NRV_dict_dict.

load_any(data, **kwargs)

loads any type of NRV object from a json file or a dictionary generated with NRV_class.save

generate_results(obj, **kwargs)

generate the proper results object depending of the obj simulated

is_NRV_simulable(x)

Check if the object x is a NRV_simulable.

simulable(x)

Check if the object x is a NRV_simulable.

ncore_autoset([nmod, optim, gmsh, ...])

Automatically set the number of cores for nmod, optim and gmsh based on the number of available cores and a threshold.