big push with a lot of changes, features, and pip preparation#12
Open
oscarfasanchez wants to merge 69 commits into
Open
big push with a lot of changes, features, and pip preparation#12oscarfasanchez wants to merge 69 commits into
oscarfasanchez wants to merge 69 commits into
Conversation
…ut still not implemented the last one
…nto optional_densify_simplify
…et of variables for magic numbers
…s in engine which is a big rework to do
…nodes, but still need refinement
…xponential field not being applied
…ms in the original data
…ing and other issues
…in, to avoid fields effect, defers non embedded polygons to avoid conflicts in cleaning, changes closest point to is inside to identify which points are inside.
When two quad buffers cross, the higher-priority feature (z_order, then finer lc, wider strip, line over polygon, insertion order) now stays continuous and only the lower-priority one is trimmed -- against the winner's actual footprint plus a half-cell gap rather than both yielding to an inflated corridor. A Ball size field pins the small remaining gap fill to min(lc) of the two features, removing the cell-size jump and quality crater at clean perpendicular crossings. - engine.py: plan_line_strip/plan_polygon_band pre-pass builds untrimmed footprints; strip_plans + priority_key drive higher_priority_obstacles and one-sided trimming; clean_trimmed_pieces drops sleeve slivers; record_quad_buffer_crossings + Ball fields refine the gap. - blueprint.py: z_order flows through add_line (already added). - tests: updated the two crossing tests for one-sided trimming + new warning. All 104 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Six new tests in test_buffer.py covering the priority feature: - finer-lc tie-break makes the line win and trims the band - z_order=10 override flips the winner to the polygon - the winning strip stays transfinite through the crossing - T-junction partial crossing meshes cleanly and records a refinement disk - tangential overlap drops the resulting sliver with a warning - crossing refinement keeps near-crossing element size near lc, not background All 110 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Rewrite the header to describe one-sided priority trimming + the crossing size field instead of the old mutual-trim behavior. - Add a T-junction (tee line ending on the fault) to show partial crossings. - Add a classic straddle barrier line (no quad buffer) for treatment contrast, placed clear of all bands (domain raised to height 22). - Fix diagnostics text: the inner zone now wins its crossing and traces its outline cleanly (~0 straddling cells, was 12 under mutual trimming). Example quality vs the old mutual-trim engine: per-cell ortho mean 8.3->6.6 deg, face-level ortho mean 4.0->3.0 deg, skewness max 0.28->0.23. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A feature finer than the background now refines by default via an implicit AutoExponentialField (growth_factor=1.2), replacing the old behavior where refinement required dist_min/dist_max (a linear ThresholdField) or an explicit field. dist_min/dist_max still work for back-compat but emit a DeprecationWarning. - blueprint.py: new growth_factor parameter (>1.0) on add_polygon/add_line/ add_point, validated and flowed through the clean GeoDataFrames; dist_min/ dist_max docstrings marked deprecated. - engine.py: _auto_threshold_from_row -> _auto_field_from_row builds the AutoExponentialField default (only when no explicit field and finer than background) or the legacy ThresholdField + DeprecationWarning for dist params. - tests: rewrite the halo test to assert grading directly (the old field/no-field comparison is moot now that no-field also refines); add default-refines, deprecation-warning, growth_factor-spread, and growth_factor-validation tests. All 115 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…k outputs - Untrack src/.DS_Store and src/vorflow/vorflow.code-workspace (local files kept); fix .gitignore pattern to *.code-workspace so it actually matches - Ignore local .conda/ environment in repo root - Delete empty 0-byte modules field_engine.py and viz.py (nothing imports them) - Strip committed cell outputs from cleaning_limitations_demo.ipynb (-422 lines) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pyproject.toml: - Real authors (rhugman, Oscar Sanchez) replacing template placeholder - Add license, readme, classifiers, and project URLs - Move matplotlib from core deps to [examples] extra (the library never imports it; only examples/ and notebooks do). Also kept in dev extra. - Add ruff to dev extras (.gitignore already anticipated it) - Raise floor to requires-python >=3.10 (3.9 is EOL and was never tested in CI) etc/environment.yml: - Add scipy (imported by src but previously only present transitively) - python>3.9 -> python>=3.10, matching pyproject - Drop unused meshio Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The auto-embed counter had a never-executed 'if False' expression left over from development, immediately overwritten by the real loop below it. Note: all [DIAG] blocks were verified to already be gated behind verbosity >= 2, so no output changes here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Mark DistanceField and ConstantField docstrings as internal (ConstantField previously said 'Public/manual' despite not being exported and ignoring tags_dict; DistanceField's create() signature is incompatible with the user-facing fields= path) - Remove ThresholdField.create's constant_in parameter: declared but never read in the body, and never passed by any caller in src/tests/examples Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…one statuses README: install via extras ([examples] for matplotlib, [dev] for tooling), add projected-CRS warning for MODFLOW grids, link examples/, ROADMAP, and LICENSE. ROADMAP: mark all five gmshflow-porting milestones as implemented, with pointers to the shipped APIs and examples. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- New vorflow._log module: package logger with plain message formatting and set_verbosity(0/1/2) mapping to WARNING/INFO/DEBUG. Exported as vorflow.set_verbosity; package default is 1 (progress messages, matching the historical print output). - All 115 print() sites across blueprint/engine/fields/tessellator/utils converted: [DIAG] diagnostics -> debug, Warning:/Error: messages -> warning/error, progress messages -> info. - MeshGenerator(verbosity=...) now also drives the package logger, so verbosity=0 is genuinely silent (as its docstring always promised) while warnings and errors still show. - The boundary-curve fallback message in fields.py is now an unconditional logger.warning instead of being gated behind a plumbed-through verbosity flag. Users can silence, re-level, or redirect all vorflow output via vorflow.set_verbosity() or standard logging handlers on the 'vorflow' logger. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All nine 'except Exception: pass' blocks in the tag-tracking collectors (pre/post removeAllDuplicates and healShapes snapshots, embed candidate pool, adjacency checks) now emit logger.debug with the entity involved, so lost feature tags can be traced at verbosity=2 instead of vanishing. Also collapses the three per-dimension pre-heal snapshot branches into one. No behavior change: the same fallbacks apply, failures are just visible. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lently - check_geometry_resolution() now returns the normal stats dict (with NaN values and count=0) plus a UserWarning when no segments exist, instead of returning a bare string that crashed dict-indexing callers. - VoronoiTessellator now warns (with a hint about the likely cause) whenever it returns an empty grid: too few generator nodes, no nodes from the mesher, or no domain geometry to clip against. Return types are unchanged, so existing scripts keep working -- the failure is just no longer disguised as success. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mesh sizes (resolution, background_lc, buffer thicknesses) are in CRS units and MODFLOW needs real length units, so meshing in lat/lon degrees is almost certainly a user error. ConceptualMesh now warns (with a to_crs() hint) when the declared CRS is geographic, checked via pyproj which ships with geopandas. The default crs changes from "EPSG:4326" to None (local/unspecified coordinates): synthetic models are no longer mislabeled as WGS84 lat/lon, and their outputs carry no CRS instead of a wrong one. Scripts that pass crs= explicitly are unaffected. This also removes the spurious geopandas 'geographic CRS' warnings the old default caused throughout the test suite (67 -> 50 warnings). Adds TestCrsHandling covering the warning, the silent projected/None paths, and CRS propagation to outputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The virtual-straddle path estimated the local line direction with fixed absolute steps (0.01 forward, 0.001 endpoint threshold, in CRS units). That blended directions across corners of lines shorter than ~0.01 units and was meaningless across CRS unit scales. The logic is extracted into _unit_tangent(line, d, probe) with the probe chosen as length * 1e-4, so straddle offsets are CRS-unit independent. Degenerate (zero-length) lines now get a valid perpendicular pair instead of two coincident points. Adds TestUnitTangent regression tests covering straight lines, corner-respecting short L-shapes, unit magnitude, and the degenerate case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Makes the existing dict[int, tuple[...]] / X | None annotations safe on the full supported Python range regardless of where they appear, and converts the two remaining typing.Optional usages in utils.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…low marks - tests/conftest.py: single shared autouse ensure_gmsh_finalized fixture, replacing five identical copies. - New tests/test_fields.py (17 tests): every field class verified against the gmsh options it actually sets (Threshold Size/Dist options, MathEval expressions, AutoLinearField transition math, polygon-interior Min combination, None/invalid-parameter paths, equality grouping). - test_utils.py: check_geometry_resolution (stats + warning path), resample_geometry (spacing, holes, passthrough), summarize_quality report content via caplog. - test_voronoi_tessellator.py: export_to_shapefile round-trip via tmp_path and the no-grid no-op. - Buffer test helper now asserts nodes exist and element area matches the domain instead of only 'generate() returned truthy'. - gmsh-heavy modules marked pytest.mark.slow (registered in pyproject); '-m "not slow"' gives an 87-test fast lane (~2s). Suite: 124 -> 150 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI (.github/workflows/python-app.yml): - New lint job running 'ruff check src tests' - Test matrix now covers Python 3.10/3.11/3.12 (matching requires-python) - pytest runs with --cov=vorflow (pytest-cov comes via the [dev] extra) - Dropped the stale feat_tests branch trigger Code (40 findings -> 0): - Removed 20 unused imports and 4 unused variables - Expanded one-line 'if x: return' statements (E701) - Renamed ambiguous 'l' loop variables (E741) - Replaced '== True' comparisons: plain bool simplified; the pandas is_barrier mask now uses .fillna(False).astype(bool) which preserves the old NaN-is-False semantics explicitly - __init__.py import order exempted from E402 in pyproject (set_verbosity must run before submodule imports) Local coverage baseline: 80% total (fields 93%, blueprint 87%, engine 79%). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…aths - tessellator: the inset_mirror boundary-spacing step built a dense N x N distance matrix (quadratic memory -- ~20 GB at 50k boundary nodes). Now a scipy cKDTree query against de-duplicated coordinates returns the nearest distinct neighbor, matching the old nearest-nonzero semantics exactly. - blueprint: the two clip-to-domain loops now use shapely prepared geometry - a cheap intersects() skips fully-outside features and covers() short-circuits fully-inside ones (the common case), avoiding the full boolean intersection per feature. Identical outputs, verified by the existing inset_mirror and clipping tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The two most self-contained stages of the ~1,500-line _add_geometry -- the post-removeAllDuplicates coordinate remap and the healShapes + coordinate-based remap -- are now private methods: - _dedup_and_remap_fragment_map(out_map, object_tags, input_tag_info) - _heal_and_remap_fragment_map(...) (also owns the OCC synchronize) The trivial to_key closure is promoted to module-level _to_key so the extracted stages don't depend on _add_geometry locals. Bodies are moved verbatim; both stages mutate out_map in place exactly as before, and no variables crossed the extraction seams (verified). Behavior covered by the 35 point-tracking regression tests. First step of the planned MeshGenerator decomposition; the geometry creation loop and embedding stages remain candidates for later extraction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…the factor I assumed before and simplified the equation
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 pull request prepares the
vorflowproject for its first public release candidate (0.1.0rc1) with a focus on packaging, testing, and documentation improvements. It adds a changelog, a detailed project roadmap, and refines the README with clearer installation and usage instructions. The CI pipeline is enhanced with minimum dependency testing, linting, and coverage reporting. Additionally, a new workflow automates publishing release candidates to TestPyPI.Release preparation and documentation:
CHANGELOG.mdfollowing Keep a Changelog and Semantic Versioning, documenting all notable changes for0.1.0rc1.ROADMAP.mdand milestone documents underdocs/roadmap/, outlining ported features, decisions, and verification steps for the release. [1] [2] [3]README.mdwith clearer installation instructions (including pip and development modes), usage examples, and explanations for mesh gradation and coordinate systems. [1] [2]Continuous integration and testing enhancements:
.github/workflows/python-app.ymlto:lintjob using Ruff for code style checks.minimum-dependenciesjob to verify the package works with minimum supported versions of core dependencies. [1] [2]Packaging and distribution:
.github/workflows/testpypi.ymlto automate building and publishing release candidates (tags matchingv*rc*) to TestPyPI, including build verification, metadata checks, and a smoke test of the built wheel.MANIFEST.into exclude development artifacts and documentation from source distributions.These changes collectively ensure robust packaging, testing, and documentation for the first public release candidate of
vorflow.