From 564eba9e75f1399e5027b02e0f57ff181e82f743 Mon Sep 17 00:00:00 2001 From: JoFrhwld Date: Tue, 10 Feb 2026 15:02:33 -0500 Subject: [PATCH] update formant dataframe --- src/fasttrackpy/tracks.py | 4 ++-- tests/test_outputs.py | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/fasttrackpy/tracks.py b/src/fasttrackpy/tracks.py index 80d1458..8bb2571 100644 --- a/src/fasttrackpy/tracks.py +++ b/src/fasttrackpy/tracks.py @@ -586,7 +586,7 @@ def __get_pitch(self) -> npt.NDArray: ) pitch_array = np.array([ pitch_obj.get_value_at_time(t) - for t in self.candidates[0].time_domain + for t in self.winner.time_domain ]) return pitch_array @@ -594,7 +594,7 @@ def __get_intensty(self) -> npt.NDArray: intensity_obj = self.sound.to_intensity(time_step = self.time_step) intensity = np.array([ intensity_obj.get_value(time = t) - for t in self.candidates[0].time_domain + for t in self.winner.time_domain ]) return intensity diff --git a/tests/test_outputs.py b/tests/test_outputs.py index 575a8f9..0fd7606 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -25,16 +25,19 @@ def dest(tmp_path_factory): dest = tmp_path_factory.mktemp("dest") return dest -@TEST_DATA + class TestDataFrames: - def test_formant_df(self, candidates): - - formant_df = candidates.to_df(output="formants") - big_formant_df = candidates.to_df(which='all', output="formants") + @CORPUS + def test_formant_df(self, candidates2): + for cand in candidates2: + + formant_df = cand.to_df(output="formants") + big_formant_df = cand.to_df(which='all', output="formants") - assert isinstance(formant_df, pl.DataFrame) - assert isinstance(big_formant_df, pl.DataFrame) + assert isinstance(formant_df, pl.DataFrame) + assert isinstance(big_formant_df, pl.DataFrame) + @TEST_DATA def test_param_df(self, candidates): param_df = candidates.to_df(output="param") big_param_df = candidates.to_df(which='all', output="formants") @@ -42,6 +45,7 @@ def test_param_df(self, candidates): assert isinstance(param_df, pl.DataFrame) assert isinstance(big_param_df, pl.DataFrame) + @TEST_DATA def test_log_param_df(self, candidates): log_param_df = candidates.to_df(output="log_param") big_log_param_df = candidates.to_df(which='all', output='log_param')