Repository navigation
Grow library families with some preset values changed (--family-settings), release 3.9.0 - #381
Merged
Merged
Conversation
…inst the released modules tests/test_pinned_release_3_8.py runs the 3.8.0 modules, copied unchanged into tests/fixtures/reference_code_3_8 (main's import closure, bed included, with library, describe, join and frames), beside the current ones over one driver: member_argv for every family under each library option, the manifest's growth settings, grow_member for every family 3.8 offers at small R (argv, kwargs, nodes, program, index row), a plan of every family, and the default library beside one of foam, capillary_bed and aligned_bed, each grown and then resumed with its index removed (every archive's arrays and metadata, the index rows and the manifest content). Every record is restricted to the keys 3.8 wrote; a run's seconds and peak memory and the manifest's library_version and code_sha256 are left out. The global generators start from a fixed state and are compared after each case. The hashes recorded on this machine are checked as the 3.6 pin checks its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…--family-settings vsystem-library --family-settings FAMILY JSON (repeatable, once per family) overrides a family's preset values from library.FAMILY_SETTING_KEYS: a bed object merged over the preset's bed and normalised by bed.parse_settings, and every other value replacing the preset's. normalise_family_settings checks and normalises them, refusing the library's own settings, what makes a family what it is, a bed for a family without one, a null bed, a changed bed kind or layout, mistyped values and a negative number argparse would read as an option; the command line also refuses a family not listed, one given twice and malformed, non-object or empty JSON, naming the family. The settings reach each member as flags appended to its command line in key order, so the recorded argv stays a runnable vsystem command line that grows the same network. Before anything is grown each family's command line is parsed and checked by main.validate_shaping at both ends of the ratio range, and for a bed family the planned candidate edges at R_HI, the largest R the cap admits and the smallest R feeder_stop admits are printed. The manifest records the settings under growth.family_settings and each archive under family_settings, only when given; resuming with different settings is refused and validate_existing compares the argv with them. A library without the option is 3.8's, and settings for one family leave the plan and the other families' members unchanged. Version 3.9.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s 3.8 wrote Anastomosis bridge records, in grow_network's return and in archive metadata, are restricted to their ten 3.8 fields as rung records already were, and index.csv's events cell is kept to the 3.8 counters, so that a field or counter a later version appends never enters the comparison. Every 3.8 key is kept, so the recorded hashes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d bed object with ValueError The feeder_stop line printed the bound to six significant digits, which could round below the member check's strict bound; it now prints %g only where that is the same number, else the repr. A bed object with a key that is not a string reached dict(**value) and raised TypeError; the bed is now merged with dict.update, so bed.parse_settings refuses it with ValueError. Numpy arrays and scalars inside an array setting given through the Python API are taken as the JSON values they stand for. The tests add refusals at one end of the ratio range only (root offsets outside the cube at R_LO, too many feeder sheets at R_HI) and compare a member's command line without settings with 3.8's written out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's library section gains --family-settings in the option table and a section on family settings: the keys and how each is merged or replaced, the classes of refused options and why each is refused, the flags on a member's command line, the checks and lines before growth, the records in the manifest and the archives, resuming, and how a consumer tells a variant library from a default one, with the benchmark's measurements of foam over bed spacing and density and capillary_bed over its generations, and the largest R the default cap admits at each foam setting. The tests section names the 3.8 pin and the settings tests, and the option table lists fibre among the families and box constants. CHANGELOG 3.9.0 with Library, Measurement and Compatibility sections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lision avoidance The library-owned class of refused options now reads "fixed for every member from the plan, the library's options and its box layout", which holds for growth in the volume and for collision avoidance, set by the library for trees and by every other preset itself; clip_axes, which the library neither sets nor records, joins the numerical and output settings. The README and CHANGELOG state that the up-front check and the printed lines cover the families given settings, that check_family_settings returns the lines vsystem-library prints, and round capillary_bed's length change at R 8 to 20 %. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
vsystem-librarygains one opt-in, repeatable option,--family-settings FAMILY JSON, which grows a family with some of its preset values changed, for example a foam bed at a smaller spacing or a capillary fill of more generations:The settings reach each member as flags on its recorded command line, which stays a runnable
vsystemcommand line growing the same network, and are recorded in the manifest and the archives, so the library stays reproducible and resumable. A library without the option is 3.8's.Behaviour
Keys:
library.FAMILY_SETTING_KEYS(append-only):persistence,anastomosis_fraction,anastomosis_radius,anastomosis_min_separation,aneurysm_prob,stenosis_prob,root_offsets,guidance,capillary_generations,capillary_runs,cross_connect,rung_below,rung_spacing,rung_radius,rung_lateral_deg,rung_axis,rung_min_separation,bed.Bed: merged over the preset's bed and normalised by
bed.parse_settings, so every key ofbed.KIND_KEYS[kind]is recorded (13 for foam, 21 for fibre). Refused for a family whose preset has no bed, asnull, and with akindorlayoutother than the preset's. The preset's ownkindorlayoutmay be repeated, as a normalised bed does.Other values replace the preset's: arrays whole (
nullrefused), numbers as floats, whole numbers for the integer settings,cross_connectas a bool. A bool is refused where a number is expected.library.normalise_family_settings(family, spec)checks and normalises one family's settings: keys inFAMILY_SETTING_KEYSorder, idempotent. It raisesValueError, which the command line turns into an exit naming the family. The command line also refuses a family not listed, a family given twice, and JSON that is malformed, not an object or empty.Refused options, with the reason in the message:
d0,d_min,iterations, the box,collision_margin,avoid_collisions,grow_in_volume, …);tortuosity,anastomose,anastomose_mode, a bed'skindorlayout, turning a bed on or off);A negative number in exponent notation (such as
-1e-05, reachable only for the two probabilities) is also refused, because argparse would read it as an option and the member's command line would not run. The README gives the reason for each class.Command line:
member_argv(..., settings=...)appends one flag per key after the 3.8 flags, in key order. Option strings come frommain.build_parser(family)'s actions; values are written as compact sorted JSON,reprfor floats and digits for ints, with--cross-connect/--no-cross-connectfor the bool.grow_member(..., settings=...)passes the settings through the same path. Withsettings=Noneboth return what 3.8 returned.Checked before growth: each family with settings has its command line at R_LO and R_HI parsed by
main.build_parser(family)and checked bymain.validate_shaping. A refusal at either end refuses the library and names the family.Printed before growth, for a family with settings and a bed:
--bed-max-candidatesand the largest R the cap admits (largest_admitted_ratio, bisection on the countgrow_member's unchanged cap reads, rounded down);feeder_stopexceeds R_LO, with the smallest R it admits.Members beyond either bound are recorded as failures, as before.
Records:
growth.family_settingsholds the settings, and only when some family has settings, so a rerun with different settings, or none, is refused by the existing comparison.family_settings, andvalidate_existingcompares the command line with them.growth.family_settingsand the archive'sfamily_settingsare where a consumer tells a variant library from a default one.Compatibility
tests/test_pinned_release_3_8.pyruns the 3.8.0 modules, copied unchanged intotests/fixtures/reference_code_3_8(main's import closure including bed, with library, describe, join and frames), beside the current ones in the same environment. It compares:member_argvfor every family under each library option;grow_memberfor every family 3.8 offers at small R (argv, kwargs, nodes, program, index row);Every record is restricted to the keys 3.8 wrote, listed literally, with
seconds,peak_rss_mb,library_versionandcode_sha256left out. The global generators start from a fixed state and are compared after each case. The hashes are recorded intests/fixtures/reference_hashes_3_8.json, and the pin was committed passing beforelibrary.pychanged.Settings for one family leave the plan, the seeds, the ratios and the other families' members bitwise equal to a library without them.
main.py,bed.py, main's import closure,main.FAMILIES,main.RNG_STREAMSandlibrary.RNG_STREAMSare unchanged. Version 3.9.0 inpyproject.tomlandlibrary.LIBRARY_VERSION. Python 3.9 syntax, numpy and tifffile only.Measurement
tests/test_library_settings.SettingsBenchmark(slow-gated) grows each member throughgrow_memberwith settings, in a fresh process, seed 1. All 28 members finished, none over 15 minutes.Density 0.6 adds 14–23 % of length at any spacing. At R 8, capillary_bed with 4 generations took 882 s to grow, the slowest member measured. The largest R the default cap (2 × 10⁶ candidate edges) admits, rounded down:
The full table (points, planned candidates, peak RSS, tissue p90 and max, capillary length share) is in the README.
Tests
tests/test_library_settings.pycovers:main.mainon their recorded command line for foam ({"bed": {"spacing": 5}}), capillary_bed ({"capillary_generations": 4}) and a mesh member carrying every non-bed key;grow_member's own refusal;🤖 Generated with Claude Code