Repository navigation
Conversation
…by_measure One case per assertion of the app's tests that call get_time_by_measure on a timeline with two beats or more, with the times the tests expect. Dev's get_time_by_measure, run on each case loaded as TiLiA loads a file, gives the same times. The meter cases are unchanged. Part of TimeLineAnnotator/project-management#218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TimeMap.find gives the measures a bar names, by number, label, pass and now movement: find_rows takes a movement, and without one every movement matches. TimeMap.times_of ports BeatTimeline.get_time_by_measure, with one time for each measure the bar names rather than one lookup among every pass's beats at once: - the fraction counts the measure's own beats, interpolated between two beats; a fraction that is a beat's at 3 decimals is that beat; - the fraction 1 is the next downbeat when the next bar is numbered one more, and as a segment's end the measure's end; - past the last beat, the last measure lasts as long as the one before it in the timeline, as TiLiA projects it; - as a segment's end, the fraction 0 also gives where each time through the bar numbered just below ends, but for an end that leads into a bar the query doesn't name; - a bar no measure names gives no time, and a fraction outside 0 to 1 gives none, with a warning. The shared examples gain the cases for these rules: an end on a downbeat, the last bar, passes with different numbers of beats, a bar that doesn't exist, the fraction 1, and the last time through a bar. Part of TimeLineAnnotator/project-management#218 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Claude
Finds bars by number, label, pass and movement, and gives the times of a bar and a fraction of it: a port of
BeatTimeline.get_time_by_measurefor imports by measure, with one time per pass (TimeLineAnnotator/project-management#315 (one time per pass)).What changed
table.py:find_rowstakesmovement. Without one, every movement matches; with one, only that movement's rows.TimeMap.find(number=None, *, label=None, pass_=None, movement=None):find_rowsover the time map's rows.TimeMap.times_of(number=None, fraction=0.0, *, label=None, pass_=None, movement=None, segment_end=False), in the newlookup.py.get_time_by_measurelooks among every pass's beats at once.times_ofgives one time for each measure thatfindnames:is_segment_enddoes. An end that leads into a bar N the query doesn't name is left out. This is TimeLineAnnotator/project-management#321 (segment ends with a pass, label or movement)'s answer, option B. Without a pass, a label or a movement, it changes nothing.shared_examples.json: 31times_ofcases. The meter cases are unchanged.get_time_by_measureon two beats or more: one case per assertion, with the test's times.get_time_by_measureper pass) fixes it.test_timemap_lookup.py: runs the shared cases and checks their layout, and tests labels, passes, movements, cadenzas and the rules above.Two of the app's tests have no case.
test_get_times_by_measure_smaller_than_min_measure_numberuses a timeline with one beat, and the core has no time map for fewer than two beats. Intest_get_times_by_measure_no_beats, TiLiA raises and the core has no time map, so neither gives a time.How the expected times were checked
Each case's times come from the app's test, or from #315 for its five cases.
check_times_of.pyloads each case into dev'sBeatTimelineas TiLiA loads a file:create_timelinewith the beats as components, andbeats_in_measureandmeasure_numbersfrom the marks, sodeserialize_componentsruns. It then runsget_time_by_measure. On dev ata53083ba, 26 cases give the same times, and #315's five give exactly the times #315 lists for dev (for example, the last bar at 0.5 gives[6.25, 7.25, 8.33], not[7.0]). The script ran in a detached worktree of dev, with this branch's environment, and left it unchanged:check_times_of.pyadd_times_of_cases.py, which wrote the cases into the file in its layoutTests
uv sync --all-packages, thenuv run --package tilia-core pytest packages/tilia-core -q: 889 passed, 21 skipped, 8 xfailed, on Python 3.11.uv run --isolated --python 3.10 ...): 892 passed, 18 skipped, 8 xfailed. The three tests that 3.11 skips need Unicode 13.0, which is Python 3.10's.python scripts/check_packages.pyon Python 3.14.6: all package checks passed.Guarantees, and what removing their code did
Each guarantee was neutralised alone, the package's tests were run, and the code was restored. All 889 passed again afterwards.
segment_endignored at 1find_rows: a movement narrows the rows to itNot claimed or tested: a cadenza at a segment's end on a downbeat. The bar below is chosen among measures that aren't cadenzas, and no test checks what that gives.
With the other open PRs
#733 (choosing the time map) and #747 (quarter stamps and distances) also change
timemap.pyandtable.py. Here,timemap.pygainsfindandtimes_ofand importslookupandfind_rows, and intable.pyonlyfind_rowschanges. Whichever merges later rebases.__init__.pyis unchanged. Once the others have landed, nothing new needs exporting:findandtimes_ofare methods ofTimeMap, which is exported already.Part of TimeLineAnnotator/project-management#218
🤖 Generated with Claude Code