morphoclass.data.tns_dataset module

Dataset of synthetic morphologies generated by TNS.

class morphoclass.data.tns_dataset.TNSDataset(input_distributions, input_parameters, n_samples, m_types=None, layer=None, verbose=False, random_state=None, transform=None, pre_transform=None, pre_filter=None)

Bases: Generic[torch.utils.data.dataset.T_co]

Dataset of synthetic morphologies generated by TNS.

Parameters
  • input_distributions – TNS distributions passed as input_distributions to tns.NeuronGrower.

  • input_parameters – TNS parameters passed as input_parameters to tns.NeuronGrower.

  • n_samples – The number of morphologies to synthetize.

  • m_types – The m-types to generate.

  • layer – Restrict to m-types from a given layer.

  • verbose – Print additional information to stdout.

  • random_state – The random seed for reproducibility.

  • transform – The transform to pass to the Dataset superclass.

  • pre_transform – The pre-transform to pass to the Dataset superclass.

  • pre_filter – The pre-filter to pass to the Dataset superclass.

download()

Download the dataset (not used).

dump_morphologies(target_dir, ext='swc', exist_ok=False)

Write morphologies to disk.

Parameters
  • target_dir – The target directory.

  • ext – The target file name extension.

  • exist_ok – Continue even if the target directory already exists.

get(idx)

Get a data sample by index.

Parameters

idx – The index of the morphology data sample.

Returns

Return type

A neuron morphology.

len()

Get the length of the dataset.

Returns

The length of the dataset.

Return type

int

process()

Synthesize and pre-process the morphology data.

property processed_file_names

Get the preprocessed file names (not used).

Returns

Return type

An empty list.

property raw_file_names

Get the raw file names (not used).

Returns

Return type

An empty list.

synthesize_samples(m_type)

Synthesize new samples of a given m-type.

Parameters

m_type – The m-type for morphology synthesis.

Returns

The synthesized morphologies.

Return type

list

morphoclass.data.tns_dataset.generate_tns_distributions(dataset, ids=None)

Generate morphological distributions given a dataset.

Parameters
  • dataset – Model dataset from which to generate the distributions.

  • ids – Indices specifying a subset of the dataset to be used (e.g. just the training set indices). If None, then the whole dataset is used.

Returns

Return type

TNS distributions.