tpattern 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tpattern-0.1.6/tpattern.egg-info → tpattern-0.1.7}/PKG-INFO +1 -1
- {tpattern-0.1.6 → tpattern-0.1.7}/pyproject.toml +1 -1
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/__init__.py +1 -1
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/advisor.py +47 -4
- {tpattern-0.1.6 → tpattern-0.1.7/tpattern.egg-info}/PKG-INFO +1 -1
- {tpattern-0.1.6 → tpattern-0.1.7}/LICENSE +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/README.md +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/setup.cfg +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_calibrated_pins.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_contrast.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_dedup.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_guided.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_null_compare.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_report_dendrogram.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_reproduction.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_support_reporting.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tests/test_synthetic.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/ci.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/contrast.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/detect.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/diagnostics.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/guided.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/io.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/methods.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/pattern.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/randomise.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/report.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/significance.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/synthetic.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern/viz.py +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern.egg-info/SOURCES.txt +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern.egg-info/dependency_links.txt +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern.egg-info/requires.txt +0 -0
- {tpattern-0.1.6 → tpattern-0.1.7}/tpattern.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tpattern"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.7"
|
|
8
8
|
description = "Open, auditable temporal & sequential pattern analysis (T-patterns) for sport and behaviour"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -6,7 +6,7 @@ behavior: T-patterns and their detection. Behavior Research Methods,
|
|
|
6
6
|
Instruments, & Computers, 32(1), 93-110.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
__version__ = "0.1.
|
|
9
|
+
__version__ = "0.1.7" # defined before submodule imports (methods.py reads it)
|
|
10
10
|
|
|
11
11
|
from .io import Observation, read_observation, read_sample, read_table
|
|
12
12
|
from .pattern import Instance, Pattern
|
|
@@ -50,12 +50,55 @@ class Recommendation:
|
|
|
50
50
|
notes: list[str] = field(default_factory=list)
|
|
51
51
|
|
|
52
52
|
def __str__(self) -> str:
|
|
53
|
-
|
|
53
|
+
"""Readable plain-text view: each setting, its recommended value, then the
|
|
54
|
+
wrapped reason. Kept ANSI/markup-free so it can be pasted verbatim."""
|
|
55
|
+
import textwrap
|
|
56
|
+
w = 76
|
|
57
|
+
|
|
58
|
+
def wrap(text, first, rest):
|
|
59
|
+
return textwrap.fill(text, width=w, initial_indent=first,
|
|
60
|
+
subsequent_indent=rest)
|
|
61
|
+
|
|
62
|
+
out = ["=" * w,
|
|
63
|
+
f"RECOMMENDED SETTINGS ({self.n_obs:,} observations, "
|
|
64
|
+
f"{self.n_events:,} events)",
|
|
65
|
+
"=" * w]
|
|
54
66
|
for c in self.choices:
|
|
55
|
-
|
|
67
|
+
out += ["", f" {c.option} -> {c.recommended}",
|
|
68
|
+
wrap(c.rationale, " ", " ")]
|
|
56
69
|
for n in self.notes:
|
|
57
|
-
|
|
58
|
-
return "\n".join(
|
|
70
|
+
out += ["", wrap(n, " * ", " ")]
|
|
71
|
+
return "\n".join(out)
|
|
72
|
+
|
|
73
|
+
def _repr_html_(self) -> str:
|
|
74
|
+
"""Rich rendering in notebooks (Colab/Jupyter): the recommended value in
|
|
75
|
+
bold, the setting name and explanation in normal weight. Shown when you
|
|
76
|
+
display the object (a bare `rec` or `display(rec)`); `print(rec)` still
|
|
77
|
+
gives the plain-text view above."""
|
|
78
|
+
import html
|
|
79
|
+
|
|
80
|
+
def esc(s):
|
|
81
|
+
return html.escape(str(s))
|
|
82
|
+
|
|
83
|
+
rows = "".join(
|
|
84
|
+
'<div style="margin:0 0 11px 0;">'
|
|
85
|
+
f'<div><span style="color:#6b7280;">{esc(c.option)}:</span> '
|
|
86
|
+
f'<strong style="color:#111;">{esc(c.recommended)}</strong></div>'
|
|
87
|
+
f'<div style="color:#4b5563;margin-top:2px;">{esc(c.rationale)}</div>'
|
|
88
|
+
'</div>'
|
|
89
|
+
for c in self.choices)
|
|
90
|
+
notes = ""
|
|
91
|
+
if self.notes:
|
|
92
|
+
lis = "".join(f'<li style="color:#4b5563;margin:2px 0;">{esc(n)}</li>'
|
|
93
|
+
for n in self.notes)
|
|
94
|
+
notes = f'<ul style="margin:6px 0 0 0;padding-left:18px;">{lis}</ul>'
|
|
95
|
+
return (
|
|
96
|
+
'<div style="font-family:system-ui,-apple-system,Segoe UI,sans-serif;'
|
|
97
|
+
'font-size:13px;line-height:1.5;max-width:780px;">'
|
|
98
|
+
'<div style="font-weight:600;font-size:14px;margin-bottom:8px;'
|
|
99
|
+
'padding-bottom:5px;border-bottom:1px solid #e5e7eb;">'
|
|
100
|
+
f'Recommended settings · {self.n_obs:,} observations, '
|
|
101
|
+
f'{self.n_events:,} events</div>{rows}{notes}</div>')
|
|
59
102
|
|
|
60
103
|
def methods_text(self) -> str:
|
|
61
104
|
"""A ready-to-adapt Methods paragraph, grounded in the measured values."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|