SpeakerCollection

SpeakerCollection(self, track_list=[])

A class to represent the vowel system of all speakers in a TextGrid.

Intended usage

It is a subclass of defaultdict, and can be keyed by the (file_name, group_name) tuple.

vowel_measurements = [VowelMeasurement(t) for t in fasttrack_tracks]
speakers = SpeakerCollection(vowel_measurements)

Parameters

Name Type Description Default
track_list list[VowelMeasurement] A list of VowelMeasurements. []

Classes

Name Description
containing_class A class for an entire vowel system.

containing_class

SpeakerCollection.containing_class(self, track_list=EMPTY_LIST)

A class for an entire vowel system.

Intended Usage

It is a subclass of defaultdict, so it can be keyed by vowel class label.

vowel_measurements = [VowelMeasurement(t) for t in fasttrack_tracks]
vowel_system = VowelClassCollection(vowel_measurements)

Parameters

Name Type Description Default
track_list list[VowelMeasurement] A list of VowelMeasurements. EMPTY_LIST

Attributes

Name Type Description
winners list[OneTrack] All winner tracks from the entire vowel system.
vowel_measurements list[VowelMeasurement] All VowelMeasurement objects within this vowel system
textgrid AlignedTextGrid The AlignedTextGrid associated with this vowel system.
winner_expanded_formants NDArray[Shape[20, FormantN], Float] A cached property that returns the expanded formants for the winners.
winner_param NDArray[Shape[Param, Formant, N], Float] An array of all parameters from all winners across the vowel system.
winner_maxformant NDArray[Shape[1, N], Float] An array of the maximum formants of all winners across the vowel system
winner_param_mean NDArray[Shape[1, FormantParam], Float] The mean of all DCT parameters across all formants for the winners in this vowel system.
winner_param_cov NDArray[Shape[FormantParam, FormantParam], Float] The covariance of all parameters across all formants for the winners in this vowel system
winner_param_icov NDArray[Shape[FormantParam, FormantParam], Float] The inverse of winner_param_cov.
winner_maxformant_mean float The mean maximum formant across all winners in this vowel system.
winner_maxformant_cov NDArray[Shape[1, 1], Float] The covariance of the maximum formant across all winners in this vowel system.
winner_maxformant_icov NDArray[Shape[1, 1], Float] The inverse of winner_maxformant_cov

Classes

Name Description
containing_class A class used to represent a vowel class.
containing_class

SpeakerCollection.containing_class.containing_class(self, label='', vowel_measurements=lambda: []())

A class used to represent a vowel class.

Intended Usage

VowelClass subclasses collections.abc.Sequence, so it is indexable. While it can be created on its own, it is best to leave this up to either VowelClassCollection or SpeakerCollection.

vowel_measurements = [VowelMeasurement(t) for t in fasttrack_tracks]
vowel_class = VowelClass("ay", vowel_measurements)
Parameters
Name Type Description Default
label str The vowel class label ''
tracks list[VowelMeasurement] A list of VowelMeasurements required
Attributes
Name Type Description
label str label of the vowel class
tracks list A list of VowelMeasurements
vowel_system VowelClassCollection The containing vowel system
winners list[OneTrack] A list of winner OneTracks from the vowel class
winner_param NDArray[Shape[Param, Formant, N], Float] An np.array of winner DCT parameters from the vowel class
winner_param_mean NDArray[Shape[ParamFormant, 1], Float] Mean of winner DCT parameters
winner_param_cov NDArray[Shape[ParamFormant, ParamFormant], Float] Covariance of winner DCT parameters
winner_param_icov NDArray[Shape[ParamFormant, ParamFormant], Float] Inverse covariance of winner DCT parameters
Classes
Name Description
containing_class A class used to represent a vowel measurement.

containing_class

SpeakerCollection.containing_class.containing_class.containing_class(self, track, heuristic=Heuristic())

A class used to represent a vowel measurement.

Intended Usage

Certain properties of a VowelMeasurement instance are set by its membership within a VowelClass and that VowelClass’s membership in a VowelClassCollection. These memberships are best managed by passing a list of VowelMeasurements to SpeakerCollection.

vowel_measurements = [VowelMeasurement(t) for t in fasttrack_tracks]
speakers = SpeakerCollection(vowel_measurements)

Parameters

Name Type Description Default
track fasttrackpy.CandidateTracks A fasttrackpy.CandidateTrracks object required
heuristic Heuristic A point measurement Heuristic to use. Defaults to Heuristic(). Heuristic()

Attributes

Name Type Description
track fasttrackpy.CandidateTracks an object of CandidateTracks class
candidates list list of candidates for the track
heuristic Heuristic an object of Heuristic class (default is Heuristic())
vowel_class VowelClass The containing VowelClass object
formant_array FormantArray A FormantArray object
file_name str name of the file of the track
group str TierGroup of the track
id str id of the track
interval aligned_textgrid.SequenceInterval interval of the track
label str label of the track
n_formants int number of formants in the track
optimized int The number of optimization iterations the vowel measurement has been through.
winner OneTrack fasttrackpy.OneTrack The winning formant track
winner_index int The index of the winning formant track
cand_param NDArray[Shape[Param, Formant, Cand], Float] A array of the candidate DCT parameters.
cand_maxformant NDArray[Shape[1, Cand], Float] An array of the candidate maximum formants.
cand_error NDArray[Shape[Cand], Float] An array of the candidate smoothing error.
cand_error_logprob_vm NDArray[Shape[Cand], Float] Conversion of the smooth error to log probabilities. The candidate with the lowest error = log(1), and the candidate with the largest error = log(0).
cand_param_(mahal/logprob)_speaker_byvclass NDArray[Shape[Cand], Float] The mahalanobis distance (mahal) or associated log probability (logprob) for each candidate relative to the VowelClass for this speaker. These are calculated by drawing the relevant mean and covariance matrix from vm.vowel_class
cand_param_(mahal/logprob)_speaker_global NDArray[Shape[Cand], Float] The mahalanobis distance (mahal) or associated log probability (logprob) for each candidate relative to all vowel measurements for this speaker. These are calculated by drawing the relevant mean and covariance matrix from vm.vowel_class.vowel_system
cand_param_(mahal/logprob)_corpus_byvclass NDArray[Shape[Cand], Float] The mahalanobis distance (mahal) or associated log probability (logprob) for each candidate relative to this vowel class across all speakers. These are calculated by drawing the relevant mean and covariance matrix from vm.vowel_class.vowel_system.corpus
point_measure pl.DataFrame A polars dataframe of the point measurement for this vowel.
vm_context pl.DataFrame A polars dataframe of contextual information for the vowel measurement.

Methods

Name Description
to_param_df Return DataFrame of formant DCT parameters.
to_point_df Return a DataFrame of point measurements
to_tracks_df Return a DataFrame of the formant tracks

to_param_df

SpeakerCollection.containing_class.containing_class.containing_class.to_param_df(output='log_param')

Return DataFrame of formant DCT parameters.

Returns

Type Description
pl.DataFrame A DataFrame of formant DCT parameters

to_point_df

SpeakerCollection.containing_class.containing_class.containing_class.to_point_df()

Return a DataFrame of point measurements

Returns

Type Description
pl.DataFrame A DataFrame of vowel point measures.

to_tracks_df

SpeakerCollection.containing_class.containing_class.containing_class.to_tracks_df()

Return a DataFrame of the formant tracks

Returns

Type Description
pl.DataFrame A dataframe with formant track data.
Methods
Name Description
to_param_df Return DataFrame of formant DCT parameters.
to_point_df Return a DataFrame of point measurements
to_tracks_df Return DataFrame of formanttracks.

to_param_df

SpeakerCollection.containing_class.containing_class.to_param_df(output='log_param')

Return DataFrame of formant DCT parameters.

Returns

Type Description
pl.DataFrame A DataFrame of formant DCT parameters

to_point_df

SpeakerCollection.containing_class.containing_class.to_point_df()

Return a DataFrame of point measurements

Returns

Type Description
pl.DataFrame A DataFrame of vowel point measures.

to_tracks_df

SpeakerCollection.containing_class.containing_class.to_tracks_df()

Return DataFrame of formanttracks.

Returns

Type Description
pl.DataFrame A DataFrame of formant tracks

Methods

Name Description
to_param_df Return DataFrame of formant DCT parameters.
to_point_df Return a DataFrame of point measurements
to_tracks_df Return a DataFrame of the formant tracks
to_param_df

SpeakerCollection.containing_class.to_param_df(output='log_param')

Return DataFrame of formant DCT parameters.

Returns
Type Description
pl.DataFrame A DataFrame of formant DCT parameters
to_point_df

SpeakerCollection.containing_class.to_point_df()

Return a DataFrame of point measurements

Returns
Type Description
pl.DataFrame A DataFrame of vowel point measures.
to_tracks_df

SpeakerCollection.containing_class.to_tracks_df()

Return a DataFrame of the formant tracks

Returns
Type Description
pl.DataFrame A dataframe with formant track data.

Methods

Name Description
to_param_df This will return a dataframe of the DCT parameters for all speakers.
to_point_df This will return a DataFrame of point measurements
to_tracks_df This will return a data frame of formant

to_param_df

SpeakerCollection.to_param_df(output='log_param')

This will return a dataframe of the DCT parameters for all speakers. If output is passed param, it will be the DCT parameters in the original Hz. If passed log_param, it will be the DCT parameters over log(Hz).

Parameters

Name Type Description Default
output Literal[‘param’, ‘log_param’] Which set of DCT parameters to return. Defaults to “log_param”. 'log_param'

Returns

Type Description
pl.DataFrame A DataFrame of DCT parameters for all speakers.

to_point_df

SpeakerCollection.to_point_df()

This will return a DataFrame of point measurements for all speakers Returns: (pl.DataFrame): A DataFrame of vowel point measurements.

to_tracks_df

SpeakerCollection.to_tracks_df()

This will return a data frame of formant tracks for all speakers.

Returns

Type Description
pl.DataFrame A dataframe of formant tracks for all speakers.