The Virtual Brain Project

Table Of Contents

Previous topic

service Package

Next topic

simulator Package

This Page

utils Package

command_line_utils

tvb.contrib.scripts.utils.command_line_utils.execute_command(command, cwd='/var/jenkins_home/workspace/TVB - Step1@2/tvb_build', shell=True, fatal_error=False)[source]

computations_utils

Some math tools

tvb.contrib.scripts.utils.computations_utils.compute_gain_matrix(locations1, locations2, normalize=100.0, ceil=False)[source]
tvb.contrib.scripts.utils.computations_utils.compute_in_degree(weights)[source]
tvb.contrib.scripts.utils.computations_utils.compute_spikes_counts(spikes_times, time)[source]
tvb.contrib.scripts.utils.computations_utils.curve_elbow_point(vals, interactive)[source]
tvb.contrib.scripts.utils.computations_utils.get_greater_values_array_inds(values, n_vals=1)[source]
tvb.contrib.scripts.utils.computations_utils.normalize_weights(weights, percentile, remove_diagonal=True, ceil=1.0)[source]
tvb.contrib.scripts.utils.computations_utils.select_by_hierarchical_group_metric_clustering(distance, disconnectivity=array([], dtype=float64), metric=None, n_groups=10, members_per_group=1)[source]
tvb.contrib.scripts.utils.computations_utils.select_greater_values_2Darray_inds(values, threshold=None, percentile=None, nvals=None, verbose=False)[source]
tvb.contrib.scripts.utils.computations_utils.select_greater_values_array_inds(values, threshold=None, percentile=None, nvals=None, verbose=False)[source]
tvb.contrib.scripts.utils.computations_utils.spikes_events_to_time_index(spike_time, time)[source]
tvb.contrib.scripts.utils.computations_utils.spikes_rate_convolution(spike, spikes_kernel)[source]
tvb.contrib.scripts.utils.computations_utils.weighted_vector_sum(weights, vectors, normalize=True)[source]

data_structures_utils

class tvb.contrib.scripts.utils.data_structures_utils.CalculusConfig[source]

Bases: builtins.object

INTERACTIVE_ELBOW_POINT = False
MAX_INT_VALUE = 9223372036854775807
MAX_SINGLE_VALUE = 3.4028235e+38
MIN_INT_VALUE = 9223372036854775807
MIN_SINGLE_VALUE = -3.4028235e+38
WEIGHTS_NORM_PERCENT = 99
tvb.contrib.scripts.utils.data_structures_utils.arrays_of_dicts_to_dicts_of_ndarrays(arr)[source]
tvb.contrib.scripts.utils.data_structures_utils.assert_arrays(params, shape=None, transpose=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.assert_equal_objects(obj1, obj2, attributes_dict=None, logger=None)[source]
tvb.contrib.scripts.utils.data_structures_utils.concatenate_heterogeneous_DataArrays(data, dim_name, data_name='', fill_value=nan, dims=None)[source]
tvb.contrib.scripts.utils.data_structures_utils.construct_import_path(path, package=None)[source]
tvb.contrib.scripts.utils.data_structures_utils.copy_object_attributes(obj1, obj2, attr1, attr2=None, deep_copy=False, check_none=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.data_xarray_from_continuous_events(events, times, senders, variables=[], filter_senders=None, exclude_senders=[], name=None, dims_names=['Variable', 'Neuron', 'Time'])[source]
tvb.contrib.scripts.utils.data_structures_utils.delete_list_items_by_indices(lin, inds, start_ind=0)[source]
tvb.contrib.scripts.utils.data_structures_utils.delete_list_items_by_values(lin, values)[source]
tvb.contrib.scripts.utils.data_structures_utils.dict_str(d)[source]
tvb.contrib.scripts.utils.data_structures_utils.dict_to_list_or_tuple(dictionary, output_obj='list')[source]
tvb.contrib.scripts.utils.data_structures_utils.dicts_of_lists(dictionary, n=1)[source]
tvb.contrib.scripts.utils.data_structures_utils.dicts_of_lists_to_lists_of_dicts(dictionary)[source]
tvb.contrib.scripts.utils.data_structures_utils.ensure_list(arg)[source]
tvb.contrib.scripts.utils.data_structures_utils.ensure_string(arg)[source]
tvb.contrib.scripts.utils.data_structures_utils.extract_dict_stringkeys(d, keys, modefun='find', two_way_search=False, break_after=9223372036854775807, remove=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.extract_integer_intervals(iterable, print=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.find_labels_inds(labels, keys, modefun='find', two_way_search=False, break_after=9223372036854775807)[source]
tvb.contrib.scripts.utils.data_structures_utils.flatten_list(lin, sort=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.flatten_tuple(t, sort=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.formal_repr(instance, attr_dict, sort_dict_flag=False)[source]

A formal string representation for an object. :param attr_dict: dictionary attribute_name: attribute_value :param instance: Instance to read class name from it

tvb.contrib.scripts.utils.data_structures_utils.format_all_numbers_in_strings(input_strings, num_integers=7, num_decimals=6)[source]
tvb.contrib.scripts.utils.data_structures_utils.generate_region_labels(n_regions, labels=[], str='. ', numbering=True, numbers=[])[source]
tvb.contrib.scripts.utils.data_structures_utils.get_list_or_tuple_item_safely(obj, key)[source]
tvb.contrib.scripts.utils.data_structures_utils.get_val_key_for_first_keymatch_in_dict(name, pkeys, **kwargs)[source]
tvb.contrib.scripts.utils.data_structures_utils.is_float(value)[source]
tvb.contrib.scripts.utils.data_structures_utils.is_integer(value)[source]
tvb.contrib.scripts.utils.data_structures_utils.is_numeric(value)[source]
tvb.contrib.scripts.utils.data_structures_utils.isequal_string(a, b, case_sensitive=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.iterable_to_dict(obj)[source]
tvb.contrib.scripts.utils.data_structures_utils.join_labels_indices_dict(d)[source]
tvb.contrib.scripts.utils.data_structures_utils.labels_to_inds(labels, target_labels)[source]
tvb.contrib.scripts.utils.data_structures_utils.linear_index_to_coordinate_tuples(linear_index, shape)[source]
tvb.contrib.scripts.utils.data_structures_utils.linspace_broadcast(start, stop, num_steps, maxdims=3)[source]
tvb.contrib.scripts.utils.data_structures_utils.list_of_dicts_to_dict_of_lists(lst)[source]
tvb.contrib.scripts.utils.data_structures_utils.list_of_dicts_to_dict_of_tuples(lst)[source]
tvb.contrib.scripts.utils.data_structures_utils.list_of_dicts_to_dicts_of_ndarrays(lst, shape=None)[source]
tvb.contrib.scripts.utils.data_structures_utils.list_of_strings_to_string(lstr, sep=', ')[source]
tvb.contrib.scripts.utils.data_structures_utils.make_float(x, precision='64')[source]
tvb.contrib.scripts.utils.data_structures_utils.make_int(x, precision='64')[source]
tvb.contrib.scripts.utils.data_structures_utils.monopolar_to_bipolar(labels, indices=None, data=None)[source]
tvb.contrib.scripts.utils.data_structures_utils.obj_to_dict(obj)[source]
Parameters:obj – Python object to introspect
Returns:dictionary after recursively taking obj fields and their values
tvb.contrib.scripts.utils.data_structures_utils.property_to_fun(property)[source]
tvb.contrib.scripts.utils.data_structures_utils.reg_dict(x, lbl=None, sort=None)[source]
X:a list or np vector
Lbl:a list or np vector of labels
Returns:dictionary
tvb.contrib.scripts.utils.data_structures_utils.rotate_n_list_elements(lst, n)[source]
tvb.contrib.scripts.utils.data_structures_utils.set_list_item_by_reference_safely(ind, item, lst)[source]
tvb.contrib.scripts.utils.data_structures_utils.shape_to_ndim(shape, squeeze=False)[source]
tvb.contrib.scripts.utils.data_structures_utils.shape_to_size(shape)[source]
tvb.contrib.scripts.utils.data_structures_utils.sort_dict(d)[source]
tvb.contrib.scripts.utils.data_structures_utils.sort_events_by_x_and_y(events, x='senders', y='times', filter_x=None, filter_y=None, exclude_x=[], exclude_y=[])[source]
tvb.contrib.scripts.utils.data_structures_utils.split_string_text_numbers(ls)[source]
tvb.contrib.scripts.utils.data_structures_utils.squeeze_array_to_scalar(arr)[source]
tvb.contrib.scripts.utils.data_structures_utils.switch_levels_of_dicts_of_dicts(d)[source]
tvb.contrib.scripts.utils.data_structures_utils.vector2scalar(x)[source]
tvb.contrib.scripts.utils.data_structures_utils.where(condition, one, two)[source]

file_utils

File writing/reading and manipulations

tvb.contrib.scripts.utils.file_utils.change_filename_or_overwrite(path, overwrite=True)[source]
tvb.contrib.scripts.utils.file_utils.change_filename_or_overwrite_with_wildcard(path, overwrite=True)[source]
tvb.contrib.scripts.utils.file_utils.delete_all_files_in_folder(folderpath)[source]
tvb.contrib.scripts.utils.file_utils.delete_folder_safely(folderpath)[source]
tvb.contrib.scripts.utils.file_utils.ensure_unique_file(parent_folder, filename)[source]
tvb.contrib.scripts.utils.file_utils.insensitive_glob(pattern)[source]
tvb.contrib.scripts.utils.file_utils.move_overwrite_files_to_folder_with_wildcard(folder, path_wildcard)[source]
tvb.contrib.scripts.utils.file_utils.safe_makedirs(folder)[source]
tvb.contrib.scripts.utils.file_utils.wildcardit(name, front=True, back=True)[source]
tvb.contrib.scripts.utils.file_utils.write_metadata(meta_dict, h5_file, key_date, key_version, path='/')[source]

log_error_utils

Logs and errors

tvb.contrib.scripts.utils.log_error_utils.print_toc_message(tic)[source]
tvb.contrib.scripts.utils.log_error_utils.raise_error(msg, logger=None)[source]
tvb.contrib.scripts.utils.log_error_utils.raise_import_error(msg, logger=None)[source]
tvb.contrib.scripts.utils.log_error_utils.raise_not_implemented_error(msg, logger=None)[source]
tvb.contrib.scripts.utils.log_error_utils.raise_value_error(msg, logger=None)[source]
tvb.contrib.scripts.utils.log_error_utils.warning(msg, logger=None)[source]

parcellation_utils

tvb.contrib.scripts.utils.parcellation_utils.parcellation_correspondence(inds_from, labels_from, labels_to)[source]

time_series_utils