ENH: New example files and some parser fixes#40
Merged
Gui-FernandesBR merged 11 commits intomasterfrom Mar 30, 2026
Merged
Conversation
Detect common non-English labels (German, French, Spanish, Italian) and provide a clear message with instructions to re-save in English, instead of the misleading 'missing simulation data' message.
get_rocket_radius() was failing with an empty sequence error for rockets that have all body tubes with radius="auto" and no nosecone, since it only looked at bodytubes and nosecones. Now also collects foreradius and aftradius from <transition> elements, which serves as fallback. Also gracefully returns 0.0 and logs a warning if no radius is found at all, instead of raising a cryptic ValueError.
search_transitions() was using ork.getRocket().getChild(0).getChildren() which only retrieves direct children of stage 0. For rockets with transitions nested inside other components, this caused an IndexError when trying to index into the smaller Java list with a BS4-based index. Added _find_transitions_recursive() to walk the full component tree. Also added name-based matching between BS4 and Java transitions to handle count mismatches, with index fallback.
bs.find_all('datapoint') was collecting datapoints from all databranch
tags in the file. .ork files with multiple simulations or recovery
events can have secondary branches with fewer columns, causing
IndexError when accessing labels by index (e.g. 'Thrust' at index 28
but branch only has 28 columns).
Now parse_ork_file() and __init_vectors() scope datapoints to the first
<databranch> only, which contains the main flight simulation data.
__get_parameter() had two issues: 1. isinstance(position, np.int64) did not match np.intp (returned by np.argwhere on some platforms) or plain Python int. 2. After NaN filtering, the array can be shorter than the original datapoints list, making the burnout_position index out of bounds. Now accepts any (int, np.integer) type and clamps the position to the valid array range with a warning log when clamping occurs.
Selected for parser path diversity: - Anonymous--Alpha: tails + rail buttons + 2 parachutes - Anonymous--Beta: 2 trapezoidal fin sets + 4 parachutes - Anonymous--Gamma: no nosecone, 4 transitions, rail buttons, 4 parachutes - Anonymous--Delta: 4 tails, 3 parachutes, multiple databranches Each directory contains rocket.ork, parameters.json, drag_curve.csv and thrust_source.csv. Identity information has been anonymized.
- conftest.py: add fixtures for the 4 new anonymous examples plus WERT and rocket_with_elliptical_fins (previously untested) - test_ork_extractor.py: parametrize over 9 examples (was 3) - Add acceptance baseline CSV files for new examples - Update NDRT baseline CSV files regenerated with fixed parser
- Uncomment pytest step in test-pytest.yaml - Add actions/setup-java@v4 (Temurin 17) before running tests, since the parser requires a JVM to load OpenRocket - Add pytest-timeout to requirements-dev.txt to prevent CI hangs
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.
This increases the library reliability