emodel_generalisation.utils¶
Other util functions.
Functions
|
Return sorted labels to cluster a matrix with linkage. |
|
Convert combo values to hash for saving traces. |
|
Get feature df from complete df. |
|
Get score df from complete df. |
|
compute the median and max scores from computations on filtered features. |
|
Isolate a generic function for independent NEURON instances. |
|
Load from JSON file. |
|
Plot traces from df, with highlights on rows with trace_highlight = True. |
|
Write json file. |
- emodel_generalisation.utils.cluster_matrix(df, distance=False)¶
Return sorted labels to cluster a matrix with linkage.
If distance matrix already set distance=True.
- emodel_generalisation.utils.get_combo_hash(combo)¶
Convert combo values to hash for saving traces.
- emodel_generalisation.utils.get_feature_df(df, filters=None)¶
Get feature df from complete df.
- emodel_generalisation.utils.get_score_df(df, filters=None)¶
Get score df from complete df.
- emodel_generalisation.utils.get_scores(morphs_combos_df, features_to_ignore=None, features_to_keep=None, clip=250)¶
compute the median and max scores from computations on filtered features.
- emodel_generalisation.utils.isolate(func, timeout=None)¶
Isolate a generic function for independent NEURON instances.
It must be used in conjunction with NestedPool.
Example:
def _to_be_isolated(morphology_path, point): cell = nrnhines.get_NRN_cell(morphology_path) return nrnhines.point_to_section_end(cell.icell.all, point) def _isolated(morph_data): return nrnhines.isolate(_to_be_isolated)(*morph_data) with nrnhines.NestedPool(processes=n_workers) as pool: result = pool.imap_unordered(_isolated, data)
- Parameters:
func (function) – function to isolate
- Returns:
the isolated function
Note: it does not work as decorator.
- emodel_generalisation.utils.load_json(filepath, **kwargs)¶
Load from JSON file.
- emodel_generalisation.utils.plot_traces(trace_df, trace_path='traces', pdf_filename='traces.pdf')¶
Plot traces from df, with highlights on rows with trace_highlight = True.
- emodel_generalisation.utils.write_json(filepath, data, **kwargs)¶
Write json file.