das.make_dataset

das.make_dataset.blur_events(event_trace: numpy.ndarray, event_std_seconds: float, samplerate: float) numpy.ndarray[source]

Blur event trace with a gaussian.

Parameters
  • event_trace (np.ndarray) – shape (N,)

  • event_std_seconds (float) – With of the Gaussian in seconds

  • samplerate (float) – sample rate of event_trace

Returns

blurred event trace

Return type

np.ndarray

das.make_dataset.events_to_probabilities(eventsamples, desired_len=None, extent=61)[source]

Converts list of events to one-hot-encoded probability vectors.

Parameters
  • eventsamples (List[int]) – List of event “times” in samples.

  • desired_len (float, optional) – Length of the probability vector. Events exceeding desired_len will be ignored. Defaults to max(eventsamples) + extent.

  • extent (int, optional) – Temporal extent of an event in the probability vector. Each event will be represented as a box with a duration exent samples centered on the event. Defaults to 61 samples (+/-30 samples).

Returns

np.array with shape [desired_len, 2]

where probabilities[:, 0] corresponds to the probability of no event and probabilities[:, 0] corresponds to the probability of an event.

Return type

probabilities

das.make_dataset.generate_data_splits(arrays: Mapping, splits: List[float], split_names: List[str], shuffle: bool = True, seed: Optional[float] = None)[source]

[summary]

Parameters
  • arrays (Mapping) – [description]

  • splits ([type]) – [description]

  • split_names ([type]) – [description]

  • shuffle (bool, optional) – [description]. Defaults to True.

  • seed (float, optional) – Defaults to None (do not seed random number generator)

Returns

[description]

Return type

[type]

das.make_dataset.generate_file_splits(file_list: List, splits: List[float], split_names: List[str], shuffle: bool = True, seed: Optional[float] = None) List[source]

[summary]

Parameters
  • file_list (List) – [description]

  • splits (List[float]) – [description]

  • split_names (List[str]) – [description]

  • shuffle (bool, optional) – [description]. Defaults to True.

  • seed (float, optional) – Defaults to None (do not seed random number generator)

Raises
  • ValueError – [description]

  • ValueError – [description]

Returns

[description]

Return type

List

das.make_dataset.infer_class_info(df: pandas.core.frame.DataFrame)[source]

[summary]

Parameters

df ([type]) – [description]

Returns

[description]

Return type

[type]

das.make_dataset.init_store(nb_channels, nb_classes, samplerate=None, make_single_class_datasets=False, class_names=None, class_types=None, store_type=<class 'zarr.storage.TempStore'>, store_name='store.zarr', chunk_len=1000000)[source]

[summary]

Parameters
  • nb_channels (int) – [description]

  • nb_classes (int) – [description] <- should infer from class_names!

  • samplerate (float, optional) – [description]. Defaults to None.

  • make_single_class_datasets (bool, optional) – make y_suffix and attrs[‘class_names/types_suffix’]. Defaults to None.

  • class_names (List[str], optional) – [description]. Defaults to None.

  • class_types (List[str], optional) – ‘event’ or ‘segment’. Defaults to None.

  • store_type ([type], optional) – [description]. Defaults to zarr.TemporaryStore.

  • store_name (str, optional) – [description]. Defaults to ‘store.zarr’.

  • chunk_len (int, optional) – [description]. Defaults to 1_000_000.

Raises
  • ValueError – [description]

  • ValueError – [description]

Returns

[description]

Return type

[type]

das.make_dataset.make_annotation_matrix(df: pandas.core.frame.DataFrame, nb_samples: int, samplerate: float, class_names: Optional[List[str]] = None) numpy.ndarray[source]

[summary]

Parameters
  • df ([type]) – [description]

  • nb_samples ([type]) – [description]

  • samplerate

  • class_names (List[str]) – will take only events in class_names, order in class_names determines order in class_matrix if not provided, will take the names in df

Returns

[description]

Return type

[type]

das.make_dataset.make_gaps(y: numpy.ndarray, gap_seconds: float, samplerate: float, start_seconds: Optional[List[float]] = None, stop_seconds: Optional[List[float]] = None) numpy.ndarray[source]

[summary]

0011112222000111100 -> 0011100222000111100 (gap_fullwidth=2)

Parameters
  • y (np.ndarray) – One-hot encoded labels [T, nb_labels]

  • gap_seconds (float) – [description]

  • samplerate (float) – [description]

  • start_seconds

  • stop_seconds

Returns

[description]

Return type

np.ndarray

das.make_dataset.normalize_probabilities(p: numpy.ndarray) numpy.ndarray[source]

[summary]

Parameters

p (np.ndarray) – [description]

Returns

[description]

Return type

np.ndarray