From 88e00e66000938df1afc07ea14c53d000ca35e3f Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Thu, 23 Jul 2026 13:33:30 +0200 Subject: [PATCH] docs: finish cluster_weights->cluster_counts terminology cleanup Follow-up to #105. Rename the leftover user-facing "weight" labels and column names to "count", and the matching test, so nothing displays the old term: - getting-started.ipynb: "Cluster weights" print label and the to_dataframe("weight") column -> "count". - multi-dim.ipynb: prose "Cluster weights" and to_dataframe("weight") column -> "count". - test_parametrized: test_cluster_occurrences_matches_weights -> ..._matches_counts. Skipped the reviewer's docstring-section suggestions (Returns on the cluster_weights/n_clusters properties; Args/Returns/Raises on _cluster_counts and _validate_no_cluster_config_weights): the codebase convention is prose one-liners for trivial properties and private helpers, with structured sections only on the public aggregate() and public methods that take real parameters. Adding them would break that local consistency. Co-Authored-By: Claude Opus 4.8 --- docs/examples/getting-started.ipynb | 4 ++-- docs/examples/multi-dim.ipynb | 4 ++-- test/test_parametrized.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/examples/getting-started.ipynb b/docs/examples/getting-started.ipynb index 549e938..e615dc8 100644 --- a/docs/examples/getting-started.ipynb +++ b/docs/examples/getting-started.ipynb @@ -107,8 +107,8 @@ "source": [ "print(f\"Clusters: {result.n_clusters}\")\n", "print(f\"Timesteps per period: {result.n_timesteps_per_period}\")\n", - "print(\"Cluster weights (days each represents):\")\n", - "result.cluster_counts.to_dataframe(\"weight\")" + "print(\"Cluster counts (days each represents):\")\n", + "result.cluster_counts.to_dataframe(\"count\")" ] }, { diff --git a/docs/examples/multi-dim.ipynb b/docs/examples/multi-dim.ipynb index 52113c3..231b6f1 100644 --- a/docs/examples/multi-dim.ipynb +++ b/docs/examples/multi-dim.ipynb @@ -87,7 +87,7 @@ "coherent multi-dimensional arrays.\n", "\n", "Here, `scenario` is auto-sliced. Each scenario gets its own clustering.\n", - "Cluster weights, accuracy metrics, and cluster representatives all have the `scenario`\n", + "Cluster counts, accuracy metrics, and cluster representatives all have the `scenario`\n", "dimension — no manual looping or concatenation needed.\n", "\n", "Without tsam_xarray, you'd have to:\n", @@ -115,7 +115,7 @@ " n_clusters=4,\n", ")\n", "print(\"Result dims:\", result_sliced.cluster_representatives.dims)\n", - "result_sliced.cluster_counts.to_dataframe(\"weight\")" + "result_sliced.cluster_counts.to_dataframe(\"count\")" ] }, { diff --git a/test/test_parametrized.py b/test/test_parametrized.py index dc0c2f9..631dbde 100644 --- a/test/test_parametrized.py +++ b/test/test_parametrized.py @@ -299,7 +299,7 @@ def test_cluster_occurrences_dims(self, agg_case: AggregateCase): da = result.clustering.cluster_occurrences assert set(da.dims) == {"cluster"} | agg_case.expected_slice_dims - def test_cluster_occurrences_matches_weights(self, agg_case: AggregateCase): + def test_cluster_occurrences_matches_counts(self, agg_case: AggregateCase): """Occurrences match AggregationResult.cluster_counts.""" result = _aggregate(agg_case) np.testing.assert_array_equal(