Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-and-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ $default-branch, "main", "dev", "workflows" ]
pull_request:
branches: [ $default-branch, "main", "dev", "feature/**" ]
branches: [ $default-branch, "main", "dev", "feature/**", "release/**" ]

jobs:
lint-and-test:
Expand Down Expand Up @@ -44,4 +44,4 @@ jobs:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fasttrackpy"
version = "0.5.2"
version = "0.5.3"
description = "A python implementation of FastTrack"
authors = [
"JoFrhwld <JoFrhwld@gmail.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/fasttrackpy/patterns/audio_textgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_target_intervals(
interval
for tier in target_tiers
for interval in tier
if re.match(target_labels, interval.label) and
if re.search(target_labels, interval.label) and
(interval.end - interval.start) > min_duration
]

Expand Down
12 changes: 10 additions & 2 deletions src/fasttrackpy/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(
)
self.maximum_formant = maximum_formant

self.formants, self.bandwidths, self.time_domain = self._track_formants()
self.formants, self.bandwidths, self._time_domain = self._track_formants()
self.smoothed_list = self._smooth_formants()
self.smoothed_b_list = self._smooth_bandwidths()
self.smoothed_b_log_list = self._smooth_log_bandwidths()
Expand All @@ -178,7 +178,7 @@ def __init__(
def __repr__(self):
return f"A formant track object. {self.formants.shape}"

def _track_formants(self):
def _track_formants(self)->tuple[np.array, np.array, np.array]:
formant_obj = self.sound.to_formant_burg(
time_step = self.time_step,
max_number_of_formants = 5.5,
Expand Down Expand Up @@ -239,6 +239,14 @@ def _smooth_log_bandwidths(self):
]
return smoothed_b_list

@property
def time_domain(self):
half = self._time_domain.min()/2
if self.interval:
return self._time_domain + self.interval.start - half
return self._time_domain-half


@property
def smoothed_formants(self):
return np.array(
Expand Down
13 changes: 13 additions & 0 deletions tests/test_patterns/test_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,24 @@ def test_get_target_intervals(self):
for tiers in all_tiers
]

stressed_intervals = [
get_target_intervals(tiers, target_labels="1")
for tiers in all_tiers
]

stressed_labels = [
"1" in interval.label
for group in stressed_intervals
for interval in group
]

assert [isinstance(interval, SequenceInterval)
for group in all_intervals
for interval in group
]

assert all(stressed_labels)

assert [hasattr(interval, "wav")
for group in all_intervals
for interval in group
Expand Down