tpattern 0.1.14__tar.gz → 0.1.16__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.
Files changed (41) hide show
  1. {tpattern-0.1.14/tpattern.egg-info → tpattern-0.1.16}/PKG-INFO +12 -4
  2. {tpattern-0.1.14 → tpattern-0.1.16}/README.md +10 -1
  3. {tpattern-0.1.14 → tpattern-0.1.16}/pyproject.toml +2 -3
  4. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/__init__.py +1 -1
  5. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/significance.py +19 -0
  6. {tpattern-0.1.14 → tpattern-0.1.16/tpattern.egg-info}/PKG-INFO +12 -4
  7. {tpattern-0.1.14 → tpattern-0.1.16}/LICENSE +0 -0
  8. {tpattern-0.1.14 → tpattern-0.1.16}/setup.cfg +0 -0
  9. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_calibrated_pins.py +0 -0
  10. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_contrast.py +0 -0
  11. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_dedup.py +0 -0
  12. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_guided.py +0 -0
  13. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_null_compare.py +0 -0
  14. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_outputs.py +0 -0
  15. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_read_table_validation.py +0 -0
  16. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_reference.py +0 -0
  17. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_report_dendrogram.py +0 -0
  18. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_reproduction.py +0 -0
  19. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_sofcoder.py +0 -0
  20. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_starter.py +0 -0
  21. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_support_reporting.py +0 -0
  22. {tpattern-0.1.14 → tpattern-0.1.16}/tests/test_synthetic.py +0 -0
  23. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/advisor.py +0 -0
  24. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/ci.py +0 -0
  25. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/contrast.py +0 -0
  26. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/detect.py +0 -0
  27. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/diagnostics.py +0 -0
  28. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/guided.py +0 -0
  29. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/io.py +0 -0
  30. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/methods.py +0 -0
  31. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/pattern.py +0 -0
  32. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/randomise.py +0 -0
  33. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/reference.py +0 -0
  34. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/report.py +0 -0
  35. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/starter.py +0 -0
  36. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/synthetic.py +0 -0
  37. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern/viz.py +0 -0
  38. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern.egg-info/SOURCES.txt +0 -0
  39. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern.egg-info/dependency_links.txt +0 -0
  40. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern.egg-info/requires.txt +0 -0
  41. {tpattern-0.1.14 → tpattern-0.1.16}/tpattern.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tpattern
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: Open, auditable temporal & sequential pattern analysis (T-patterns) for sport and behaviour
5
5
  Author-email: Andrew Callaway <acallaway@bournemouth.ac.uk>
6
6
  License-Expression: MIT
@@ -11,7 +11,6 @@ Project-URL: Tagging tool (OpenTag), https://opentag.studio
11
11
  Keywords: t-pattern,THEME,temporal,sequence,sport,behaviour,notation analysis
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
@@ -19,7 +18,7 @@ Classifier: Operating System :: OS Independent
19
18
  Classifier: Intended Audience :: Science/Research
20
19
  Classifier: Topic :: Scientific/Engineering
21
20
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
- Requires-Python: >=3.9
21
+ Requires-Python: >=3.10
23
22
  Description-Content-Type: text/markdown
24
23
  License-File: LICENSE
25
24
  Requires-Dist: numpy>=1.21
@@ -49,7 +48,7 @@ auditable code — the same critical-interval method the THEME software applies
49
48
  [The method it implements](#the-method-it-implements)) — and is the analysis
50
49
  companion to the [OpenTag.Studio](https://opentag.studio) tagging tool.
51
50
 
52
- ## Two ways to use it
51
+ ## Three ways to use it
53
52
 
54
53
  ### 🚀 In your browser — Google Colab, no install, no coding
55
54
 
@@ -71,6 +70,15 @@ Three notebooks (all in [`colab/`](colab/)):
71
70
 
72
71
  `pip install tpattern` and script it — see [Getting started](#getting-started-in-a-minute), [Quickstart](#quickstart) and [`examples/`](examples/).
73
72
 
73
+ ### 📊 From R
74
+
75
+ R users (common in psychology and behavioural science) can drive the **same
76
+ engine** via [`reticulate`](https://rstudio.github.io/reticulate/) — the algorithm
77
+ stays in Python, so results match exactly. Install with
78
+ `remotes::install_github("ajcallaway/TPattern", subdir = "r")`, then run the whole
79
+ analysis in one call: `tpattern_analysis("events.csv")`. See
80
+ [Using tpattern from R](#using-tpattern-from-r).
81
+
74
82
  Bring your own data (one row per event — see [`SCHEMA.md`](SCHEMA.md)) or try the
75
83
  included [`data/`](data/) example.
76
84
 
@@ -14,7 +14,7 @@ auditable code — the same critical-interval method the THEME software applies
14
14
  [The method it implements](#the-method-it-implements)) — and is the analysis
15
15
  companion to the [OpenTag.Studio](https://opentag.studio) tagging tool.
16
16
 
17
- ## Two ways to use it
17
+ ## Three ways to use it
18
18
 
19
19
  ### 🚀 In your browser — Google Colab, no install, no coding
20
20
 
@@ -36,6 +36,15 @@ Three notebooks (all in [`colab/`](colab/)):
36
36
 
37
37
  `pip install tpattern` and script it — see [Getting started](#getting-started-in-a-minute), [Quickstart](#quickstart) and [`examples/`](examples/).
38
38
 
39
+ ### 📊 From R
40
+
41
+ R users (common in psychology and behavioural science) can drive the **same
42
+ engine** via [`reticulate`](https://rstudio.github.io/reticulate/) — the algorithm
43
+ stays in Python, so results match exactly. Install with
44
+ `remotes::install_github("ajcallaway/TPattern", subdir = "r")`, then run the whole
45
+ analysis in one call: `tpattern_analysis("events.csv")`. See
46
+ [Using tpattern from R](#using-tpattern-from-r).
47
+
39
48
  Bring your own data (one row per event — see [`SCHEMA.md`](SCHEMA.md)) or try the
40
49
  included [`data/`](data/) example.
41
50
 
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tpattern"
7
- version = "0.1.14"
7
+ version = "0.1.16"
8
8
  description = "Open, auditable temporal & sequential pattern analysis (T-patterns) for sport and behaviour"
9
9
  readme = "README.md"
10
- requires-python = ">=3.9"
10
+ requires-python = ">=3.10"
11
11
  license = "MIT"
12
12
  license-files = ["LICENSE"]
13
13
  authors = [
@@ -17,7 +17,6 @@ keywords = ["t-pattern", "THEME", "temporal", "sequence", "sport", "behaviour",
17
17
  classifiers = [
18
18
  "Development Status :: 4 - Beta",
19
19
  "Programming Language :: Python :: 3",
20
- "Programming Language :: Python :: 3.9",
21
20
  "Programming Language :: Python :: 3.10",
22
21
  "Programming Language :: Python :: 3.11",
23
22
  "Programming Language :: Python :: 3.12",
@@ -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.14" # defined before submodule imports (methods.py reads it)
9
+ __version__ = "0.1.16" # defined before submodule imports (methods.py reads it)
10
10
 
11
11
  from .io import (Observation, read_observation, read_sample, read_table,
12
12
  read_sofcoder, DataFormatError, check_reference, CHECKS)
@@ -66,6 +66,7 @@ class Calibrated:
66
66
  p_emp_strength: float = 1.0 # empirical p of the analytic strength
67
67
  fwer_keep: bool = False # Holm on p_emp
68
68
  fdr_q: float = 1.0 # Benjamini-Hochberg q on p_emp
69
+ fdr_q_by: float = 1.0 # Benjamini-Yekutieli q (dependence-robust FDR)
69
70
 
70
71
 
71
72
  @dataclass
@@ -81,6 +82,8 @@ class CalibrationResult:
81
82
  def kept(self, method: str = "fdr") -> list[Calibrated]:
82
83
  if method == "fwer":
83
84
  return [c for c in self.real if c.fwer_keep]
85
+ if method in ("fdr_by", "by"):
86
+ return [c for c in self.real if c.fdr_q_by <= self.q_target]
84
87
  return [c for c in self.real if c.fdr_q <= self.q_target]
85
88
 
86
89
 
@@ -100,6 +103,20 @@ def _benjamini_hochberg(items, get_p):
100
103
  return {id(items[i]): q[i] for i in range(m)}
101
104
 
102
105
 
106
+ def _benjamini_yekutieli(items, get_p):
107
+ """Benjamini-Yekutieli q-values: the BH q scaled by the harmonic factor
108
+ c(m) = sum_{i=1..m} 1/i, which gives false-discovery-rate control under
109
+ arbitrary dependence among the p-values (Benjamini & Yekutieli, 2001).
110
+ Surrogate p-values for patterns that share events are dependent, so this is
111
+ the dependence-robust companion to the BH q; it is more conservative."""
112
+ m = len(items)
113
+ if m == 0:
114
+ return {}
115
+ cm = sum(1.0 / i for i in range(1, m + 1))
116
+ bh = _benjamini_hochberg(items, get_p)
117
+ return {k: min(1.0, v * cm) for k, v in bh.items()}
118
+
119
+
103
120
  def _holm_keep(items, get_p, alpha):
104
121
  """Holm–Bonferroni step-down; return set of ids kept at family alpha."""
105
122
  m = len(items)
@@ -217,9 +234,11 @@ def calibrate(observations, config: Config | None = None, *,
217
234
  grp = [c for c in real if c.level == lv]
218
235
  keep = _holm_keep(grp, lambda c: c.p_emp, alpha)
219
236
  qmap = _benjamini_hochberg(grp, lambda c: c.p_emp)
237
+ bymap = _benjamini_yekutieli(grp, lambda c: c.p_emp)
220
238
  for c in grp:
221
239
  c.fwer_keep = id(c) in keep
222
240
  c.fdr_q = qmap[id(c)]
241
+ c.fdr_q_by = bymap[id(c)]
223
242
 
224
243
  return CalibrationResult(real=real, surrogate_counts=surrogate_counts,
225
244
  B=B, alpha=alpha, q_target=q_target, null=null,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tpattern
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: Open, auditable temporal & sequential pattern analysis (T-patterns) for sport and behaviour
5
5
  Author-email: Andrew Callaway <acallaway@bournemouth.ac.uk>
6
6
  License-Expression: MIT
@@ -11,7 +11,6 @@ Project-URL: Tagging tool (OpenTag), https://opentag.studio
11
11
  Keywords: t-pattern,THEME,temporal,sequence,sport,behaviour,notation analysis
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
@@ -19,7 +18,7 @@ Classifier: Operating System :: OS Independent
19
18
  Classifier: Intended Audience :: Science/Research
20
19
  Classifier: Topic :: Scientific/Engineering
21
20
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
- Requires-Python: >=3.9
21
+ Requires-Python: >=3.10
23
22
  Description-Content-Type: text/markdown
24
23
  License-File: LICENSE
25
24
  Requires-Dist: numpy>=1.21
@@ -49,7 +48,7 @@ auditable code — the same critical-interval method the THEME software applies
49
48
  [The method it implements](#the-method-it-implements)) — and is the analysis
50
49
  companion to the [OpenTag.Studio](https://opentag.studio) tagging tool.
51
50
 
52
- ## Two ways to use it
51
+ ## Three ways to use it
53
52
 
54
53
  ### 🚀 In your browser — Google Colab, no install, no coding
55
54
 
@@ -71,6 +70,15 @@ Three notebooks (all in [`colab/`](colab/)):
71
70
 
72
71
  `pip install tpattern` and script it — see [Getting started](#getting-started-in-a-minute), [Quickstart](#quickstart) and [`examples/`](examples/).
73
72
 
73
+ ### 📊 From R
74
+
75
+ R users (common in psychology and behavioural science) can drive the **same
76
+ engine** via [`reticulate`](https://rstudio.github.io/reticulate/) — the algorithm
77
+ stays in Python, so results match exactly. Install with
78
+ `remotes::install_github("ajcallaway/TPattern", subdir = "r")`, then run the whole
79
+ analysis in one call: `tpattern_analysis("events.csv")`. See
80
+ [Using tpattern from R](#using-tpattern-from-r).
81
+
74
82
  Bring your own data (one row per event — see [`SCHEMA.md`](SCHEMA.md)) or try the
75
83
  included [`data/`](data/) example.
76
84
 
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