File size: 2,319 Bytes
8c5a642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Constants and shared defaults for A1 SI baseline bootstrap."""

from __future__ import annotations

from dataclasses import dataclass

DEFAULT_ALLOWED_RUNS: tuple[int, ...] = (1, 2, 3, 4)
DEFAULT_TIME_SCALE_SECONDS: float = 0.01
DEFAULT_HRF_LAG_SECONDS: float = 5.0

# Locked baseline models from project scope.
DEFAULT_MODEL_IDS: tuple[str, ...] = (
    "Qwen/Qwen3-0.6B",
    "meta-llama/Llama-3.2-1B",
    "GSAI-ML/LLaDA-8B-Instruct",
)

# Run-level word timing tables available in ds005345 annotations.
DEFAULT_RUN_WORD_TABLE_MAP: dict[int, str | None] = {
    1: "single_female_word_information.csv",
    2: "single_male_word_information.csv",
    3: None,
    4: None,
}

# Fallback sources for mixed-condition runs when dedicated mixed word timings are absent.
DEFAULT_MIXED_RUN_WORD_TABLE_FALLBACK_MAP: dict[int, str] = {
    3: "single_female_word_information.csv",
    4: "single_male_word_information.csv",
}


@dataclass(frozen=True)
class RunCondition:
    """Condition labels attached to each run in the baseline mapping."""

    condition_fixed: str
    speaker_stream: str
    condition_fallback: str | None = None


DEFAULT_RUN_CONDITION_MAP: dict[int, RunCondition] = {
    1: RunCondition(condition_fixed="single_female", speaker_stream="female"),
    2: RunCondition(condition_fixed="single_male", speaker_stream="male"),
    3: RunCondition(
        condition_fixed="mixed_female",
        speaker_stream="mixed_female",
        condition_fallback="mixed",
    ),
    4: RunCondition(
        condition_fixed="mixed_male",
        speaker_stream="mixed_male",
        condition_fallback="mixed",
    ),
}


def resolve_run_condition(run: int, enable_mixed_fallback: bool) -> tuple[str, str, str, bool]:
    """Resolve fixed/effective condition labels for one run.

    Returns:
        (condition_fixed, condition_effective, speaker_stream, used_mixed_fallback)
    """
    if run not in DEFAULT_RUN_CONDITION_MAP:
        raise KeyError(f"Run {run} is not present in condition map")

    info = DEFAULT_RUN_CONDITION_MAP[run]
    use_fallback = bool(enable_mixed_fallback and info.condition_fallback is not None)
    condition_effective = info.condition_fallback if use_fallback else info.condition_fixed

    return info.condition_fixed, condition_effective, info.speaker_stream, use_fallback