Script workflow for coherence/diversity extraction, pairing, and iterative re-composition
This guide documents the sequence used to:
This guide gives a concise orientation to the pipeline sequence and the role of each stage, while the full stage-level workflow documentation is available in:
../INTENDING_TOPOLOGY_WORKFLOW/3x4_COHERENCE_STRATIFIED_WORKFLOW.md../INTENDING_TOPOLOGY_WORKFLOW/3x4_COHERENCE_STRATIFIED_WORKFLOW.htmlRun:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/01_1_COMBINATORICS.jsxWhat it does:
Grid layer in the active Illustrator documentGenerated Vectors layerVector_<n>(i,j,...) in ~/Desktop/Generated_Combinations/mapping.csv and vectors_coordinates.csv in ~/Desktop/Generated_Combinations/Reliability note (June 2026): the Stage 1 pass includes startup cleanup and save-retry handling so complete pair extraction matches combinatoric expectation for valid closed-path sources.
How it works:
Collects all pathItems from the Grid layer and sorts them by centroid position (top-to-bottom, left-to-right), renaming each path Grid_N. Generates all pairwise combinations (configurable for larger groupings, optionally filtered by adjacency). For each combination, combineItems() duplicates and groups the paths into a cascade layout on the Generated Vectors layer. Each group is saved as an individual .ai file via saveVectorAsDocument(), and centroid coordinates for all saved vectors are exported via exportCoordinatesCSV().
Important outputs:
~/Desktop/Generated_Combinations/*.ai~/Desktop/Generated_Combinations/mapping.csv~/Desktop/Generated_Combinations/vectors_coordinates.csvRun:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/02_2_BATCH_PROCESS_METRICS.jsxWhat it does in active generated-vector mode:
Generated Vectors layer from the active documentKept_VectorsRemoved_VectorsHow it works:
Reads each group from the Generated Vectors layer and duplicates it into a temporary working group in a new document. Runs two metric calculations: computeGroupMetrics() computes pairwise distances, centroid standard deviation, convex hull area, and triangle area; computeAndAttachAsymmetryMetrics() computes distance, angle, length, and area asymmetry normalised to 0–1. Each group is evaluated against configurable thresholds using the configured metricMode (options: per_metric, combined, max_pairwise). Items passing thresholds are placed in Kept_Vectors; others go to Removed_Vectors. All metric values per group are written to the log CSV.
Important outputs:
~/Desktop/Generated_Combinations/generated_layer_subtractive_log.csv.ai document (commonly referred to as generated_layer_subtractive_result.ai)Note:
kept/removed split is an older process component, but retained and still usable.Run pair-analysis scripts:
03b_1_ANALYZE_PAIR_COHERENCE.jsx — ../INTENDING_TOPOLOGY_WORKFLOW/scripts/
Reads all items from the Complete layer, extracts pair keys from vector names matching the pattern (i,j), and groups instances by pair key. For each group, it builds a context signature per instance (rounded position and size), then calculates consistency as the proportion of instances sharing the most common signature. Final coherence score = consistency × 0.7 + frequency × 0.3.
03b_2_COUNT_VECTOR_FREQUENCIES.jsx — ../INTENDING_TOPOLOGY_WORKFLOW/scripts/
Reads all items from the Complete layer, matches names against the pattern Vector_N(i,j), and tallies source participation by the grid indices inside (i,j). Frequency output is therefore keyed by source grid index (for example 0..8 in a 9-source cell), not by Vector_N sequence ID.
Generated data:
~/Desktop/pair_coherence_analysis.json~/Desktop/vector_frequencies.json~/Desktop/vector_frequency_analysis.txtPractical staging note: these files are written to Desktop by the analysis scripts, then commonly moved or copied into a per-cell coherence frequency/ folder for local reproducible runs.
Optional visualisation scripts (not required to continue the core pipeline):
03b_3_CREATE_FREQUENCY_LAYERS_3D.jsx — ../INTENDING_TOPOLOGY_WORKFLOW/scripts/
Reads vector_frequencies.json, resolves data from config.dataFolderPath first (if set), then active-document local folders, then Desktop fallback. For each source grid index, creates N copies across N layers (where N = frequency). Applies a configured visual strategy per layer (opacity fade, colour gradient, or spatial offset). Creates a new Frequency_Landscape_3D document.
03b_4_CREATE_COHERENCE_LAYERS.jsx — ../INTENDING_TOPOLOGY_WORKFLOW/scripts/
Reads pair_coherence_analysis.json (same resolver order: explicit folder override, local folders, Desktop fallback) and the Complete layer, groups vectors by grid coordinate pair key, sorts by coherence score descending, and creates one layer per pair in a new Coherence_Landscape document. Layer opacity = coherenceScore × 80 + frequency × 5, so higher-coherence pairs appear more opaque.
03b_5_CREATE_COHERENCE_STRENGTH_LAYERS.jsx — ../INTENDING_TOPOLOGY_WORKFLOW/scripts/
Reads pair_coherence_analysis.json (same resolver order: explicit folder override, local folders, Desktop fallback), sorts pairs by coherence score, and creates one layer per pair in a new Coherence_Strength_Landscape document with all vector instances for that pair. Layer opacity = 50 + coherenceValue × 80 — highest coherence most opaque, lowest most transparent.
These optional outputs provide opacity/layer-based views of frequency and coherence patterns using the same vector shapes generated in Steps 1-2.
Reader-scope note: Stage 3c is included here as a dependency checkpoint, not as the canonical operations runbook. For full ingest commands, label-map handling, run-folder numbering, and migration guardrails, use the Stage 3c section in ../INTENDING_TOPOLOGY_WORKFLOW/3x4_COHERENCE_STRATIFIED_WORKFLOW.md.
Stage per-cell coordinate CSVs:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/03c_consolidate_cell_csvs.pyCopies per-cell vectors_coordinates.csv files into the workflow's config/csv_exports/ folder with the standardised cell_<cell_id>_full_vectors_coordinates.csv naming that Step 4 reads. Two modes:
--source <path> --cell rXcY to import a single cell--ingest <source_dir> to bulk-import discovered cell folders in one pass (supports canonical rXcY, transposed cYrX, and optional --label-map <json_path> for custom labels)Configure:
../INTENDING_TOPOLOGY_WORKFLOW/config/cells_to_analyze.jsonRun:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/04_analyze_polygon_region_coherence.pyWhat it does:
cells_to_analyze.jsonanalysis_config.csv_directoryanalysis_config.selected_cellscell_<cell_id>_full_vectors_coordinates.csvx1, y1, x2, y2../INTENDING_TOPOLOGY_WORKFLOW/config/<run_number>/pair_coherence_composition.jsonHow it works:
For each selected cell, loads its coordinate CSV and calls calculate_coherence_from_coords(), which computes: spread_ratio = max_distance / min_distance from centroid, dispersion = std_dev / mean_distance, and coherence = spread_ratio / (1 + dispersion). Pairwise scores are generated via score_pair_compatibility(), with normalized diversity computed as |coh1 − coh2| / max(coh1, coh2) and compatibility as 1 − |coh1 − coh2| / max. Results are categorised into high_coherence_compatible, moderate_mixed, and low_coherence_complementary pairs and written to pair_coherence_composition.json.
cells_to_analyze.json finds the correct dataIt does not auto-discover globally. It points directly to data through csv_directory and strict filename matching.
Data resolution logic in 04_analyze_polygon_region_coherence.py:
CONFIG_FILE = INTENDING_TOPOLOGY_WORKFLOW/config/cells_to_analyze.jsonCSV_DIR = Path(config['analysis_config']['csv_directory']) — resolved relative to the config file if not absolute (default: config/csv_exports/)SELECTED_CELLS = config['analysis_config']['selected_cells']r1c1), it checks:CSV_DIR / "cell_r1c1_full_vectors_coordinates.csv"It explicitly works from coordinate CSV data created earlier in the process, provided those files exist in the configured directory with the expected naming scheme.
Run:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/05_extract_coherence_pairs.jsxInput requirement:
pair_coherence_composition.json from workflow config run folders:../INTENDING_TOPOLOGY_WORKFLOW/config/<run_number>/pair_coherence_composition.jsonPractical step:
How it works:
Reads pair_coherence_composition.json from the selected workflow run folder and separates entries into high-coherence, moderate, and low-coherence categories. In the active Illustrator document, creates the category layer groups (HIGH_COHERENCE_PAIRS, MODERATE_PAIRS, LOW_COHERENCE_PAIRS) and writes a human-readable polygon_pair_extraction.txt listing pair assignments and values. Region placement/population into those layers remains a manual curation step.
What it produces:
HIGH_COHERENCE_PAIRS, MODERATE_PAIRS, and LOW_COHERENCE_PAIRS layers in the active document../INTENDING_TOPOLOGY_WORKFLOW/config/<run_number>/polygon_pair_extraction.txtBridge extracted pair categories into graph morphology before final spatial sectioning.
Core scripts:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_import_high_pair_combinatorics.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/05_5_rank_pair_compositions.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_import_stage55_compositions.pyEnvironment:
Inputs:
polygon_pair_extraction.txt)gephi_nodes.csv, gephi_edges.csv)Outputs:
../INTENDING_TOPOLOGY_WORKFLOW/config/<run_number>/pair_composition_ranked.json../INTENDING_TOPOLOGY_WORKFLOW/config/<run_number>/pair_composition_ranked.csvScope note:
Translate Stage 5.5 graph morphology into section-based spatial comparisons.
Core sequence:
Primary scripts:
../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_generate_outer_edge_outlines.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_generate_propagated_volume_sections.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_render_propagated_sections_turntable.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/blender_generate_propagated_volume_sections_directional.pyRecent analysis utilities (terminal-side, optional but recommended):
../INTENDING_TOPOLOGY_WORKFLOW/scripts/compare_propagated_volume_runs.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/render_propagated_volume_overlay_svg.py../INTENDING_TOPOLOGY_WORKFLOW/scripts/summarize_propagated_surface_area.pySpec and canonical media reference:
../INTENDING_TOPOLOGY_READER/09_LAYER_6_SPATIAL_EXPLORATION_SPEC.md../INTENDING_TOPOLOGY_WORKFLOW/3x4_COHERENCE_STRATIFIED_WORKFLOW.md (Stage 6 sections)In the current canonical flow, refinement is branch-driven rather than a generic rerun loop:
HIGH_COHERENCE_PAIRS, MODERATE_PAIRS, LOW_COHERENCE_PAIRS)This keeps iteration aligned with the current 3x4 coherence-stratified branch logic, where refinement is selection-led before regeneration.
configuration space and measurement space are practical labels for the generated vector layout field and its coherence-based reading.05_LAYER_3_SYNTHESIS_COHERENCE_MEASUREMENT.html) to avoid duplication across guides.Last updated: 19 October 2026