Python API¶
The Python API is the boundary the GUI and CLI drive. This reference is generated from the docstrings.
Experiment and recording¶
detail.api.experiment.Experiment
¶
Source code in detail/api/experiment.py
1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 | |
name
property
¶
Experiment display name (from config.yaml; decoupled from the folder).
description
property
¶
Experiment description (empty string if unset).
modified_at
property
¶
Unix mtime of the most recent experiment-level change.
The max mtime across config.yaml, recordings/ and runs/ — a cheap
proxy for "last activity" without walking the whole tree.
recording_ids
property
¶
The recording ids in id order — the listing, without the records.
:attr:recordings builds a :class:Recording per id, and each one reads its
recording.yaml to learn its name. A caller that only needs how many there
are, or which ids exist, pays a file read per recording for a number it could
have had from the directory listing.
recording_metadata
property
¶
The cohort metadata table: {recording_id: {column: value}} (§11).
metadata_columns
property
¶
User-defined grouping-variable columns (excluding recording_id).
import_runs
property
¶
Every recording that was imported, shaped like a run record (§3).
An import is the one long operation this app runs that is not a run: it writes no run
record, and its state lives on the recording as import_status. This is the adapter
that lets it be listed, counted and cancelled beside the families that do — the shape
api.active.RUN_KINDS reads, carrying the recording id a surface needs to open it and
the name a surface should show instead of that id (§11).
created_at is the recording's own, which is the right answer rather than a
convenient one: create_shell mints the recording synchronously when the import is
submitted, so it is the moment the import was asked for.
Read under a pin because every :class:Recording property is its own recording.yaml
read and this wants three of them per recording — and the quit guard asks this question
on the UI thread, where the difference is one round trip per recording instead of
three (storage/read_cache.py).
distill_runs
property
¶
All distill-run records (§12), reconciled to their real on-disk status.
processing_runs
property
¶
Experiment-level processing-run records — the runs index (§15).
datasets
property
¶
Training datasets in the experiment (scans datasets/).
models
property
¶
Trained models in the experiment (scans models/).
analysis_runs
property
¶
Analysis runs in the experiment (scans analysis/).
export_runs
property
¶
Every export run in the experiment (scans exports/).
comparisons
property
¶
All saved comparisons in this experiment.
imported_models
property
¶
The machine-global imported models (shared across all experiments).
create(name, parent_dir=None)
classmethod
¶
Create the experiment directory structure and config.yaml.
parent_dir defaults to the managed workspace root (the default
storage location, §2) — the GUI never picks a folder.
Source code in detail/api/experiment.py
1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 | |
open(experiment_dir)
classmethod
¶
Open an existing experiment (validates config.yaml).
Source code in detail/api/experiment.py
1594 1595 1596 1597 1598 | |
list_all()
classmethod
¶
All experiments in the managed workspace (storage default root, §2).
Source code in detail/api/experiment.py
1600 1601 1602 1603 | |
import_archive(archive, *, replace=False, name=None, progress=None)
classmethod
¶
Import an exported experiment bundle into the managed workspace (§15).
Creates it, or replaces a same-id experiment when replace is True; name
overrides the target id (import as a separate copy).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
Callable[[str, float, str], None] | None
|
|
None
|
A recording whose video is referenced in place is looked for where the exporting machine
had it, and its video root registered here when a video there matches (#916);
referenced_video_missing lists what was not found.
Raises:
| Type | Description |
|---|---|
ValueError
|
Malformed/corrupt archive or unsupported schema_version. |
FileExistsError
|
Target id exists and |
Source code in detail/api/experiment.py
1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | |
replace_losses(archive, *, name=None)
staticmethod
¶
What importing archive with replace=True would delete and not bring back, or
None when there is no experiment to replace.
The same answer an import without replace carries on its refusal
(export_store.ExperimentExistsError.losses); replace_warning words it. Walks the
existing experiment, so a surface calls it off the UI thread.
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Source code in detail/api/experiment.py
1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | |
export(dest=None, *, include_video=False, include_datasets=False, gzip=False, progress=None)
¶
Pack this experiment into a single portable archive (§15). Slim by default
(outputs + metadata + models; no source video / datasets) — pass
include_video / include_datasets for a full transfer. Returns the
archive path (default <workspace>/<id>.segproj.tar).
progress is a (stage, fraction, detail) callback — scanning →
checking → hashing → packing. The GUI does not call this directly: its
Export runs the catalogue's bundle target as an export run (run_export), so the
export is listed under Active processes and survives the window closing.
Source code in detail/api/experiment.py
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 | |
preview_image(width=PREVIEW_WIDTH)
¶
A cached still identifying this experiment, or None if one can't be made.
The frame comes from the middle of the first recording whose video is on this
machine: the opening frames are often a blank lead-in and the last ones an empty
arena, so a midpoint is the one place likely to show the animal. It is written once
to <experiment>/preview.jpg and regenerated only when older than
modified_at, so listing a workspace costs a file read rather than a decode per
experiment.
Never raises. None means there is nothing to show — no recordings, no video, a
referenced video that isn't on this machine (§5 reference-in-place), or a cache that
couldn't be written (read-only media) — and the caller renders a placeholder.
Source code in detail/api/experiment.py
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | |
set_metadata(name=None, description=None)
¶
Edit experiment identity (name / description) in config.yaml.
Only the given fields change; the experiment directory is not renamed.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in detail/api/experiment.py
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 | |
notes(kind, entry_id='')
¶
The user's notes on one entry, or "" when it has none.
kind is one of storage.notes.KINDS (experiment, recording, run,
analysis_run, dataset, model, distill, export_run,
comparison); experiment takes no entry_id.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
FileNotFoundError
|
If there is no such entry. |
Source code in detail/api/experiment.py
1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | |
set_notes(kind, entry_id, text)
¶
Replace the user's notes on one entry; empty text clears them.
Safe while the entry's run is still going: the notes are a file of their own
(notes.md), never a field in a record a worker is rewriting.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
FileNotFoundError
|
If there is no such entry. |
Source code in detail/api/experiment.py
1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 | |
create_recording(recording_id, metadata=None)
¶
Create a recording at a chosen id (identity only — video/streams are
optional, added later) and seed its metadata.csv row (§11).
The id is the caller's, which is what a script or a test wants. An application
adding a recording a user is naming should call :meth:add_recording instead —
it mints the id and leaves the name to the user.
Source code in detail/api/experiment.py
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | |
add_recording(name, metadata=None)
¶
Add a recording the user has named: the tool mints the id, the name is theirs.
name is normally the video's filename — a good starting label and a terrible
identity, since the file gets moved, renamed, or joined by a second part. The id
is opaque and permanent (recording_000); the name is editable and unique, and
is what every surface displays.
A name already taken is suffixed (m27_day3 → m27_day3_2) rather than
refused: the caller here is the tool, importing a folder where two files can
legitimately share a name, and failing the import over a label would be absurd.
A name a user types goes through :meth:Recording.set_name, which refuses.
Source code in detail/api/experiment.py
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 | |
missing_previews(recording_ids=None)
¶
Preview builds missing on this machine across recording_ids (default: every
recording), proxies before masks within each recording (§3 Video preview cache).
One stat per part once this machine's cache knows the file.
Source code in detail/api/experiment.py
1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 | |
build_previews(recording_ids=None, progress=None)
¶
Build every missing preview for recording_ids (default: all) under one bar;
returns a previews.PreviewBuildReport (built count, and each failure with why).
The bar is weighed by video length across the whole batch, and its phase line names
the recording, part and build in hand.
Source code in detail/api/experiment.py
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | |
recording_names()
¶
{recording_id: name} for every recording — the display map.
The name is the handle on every surface, so this is read per page build. It rides
the mtime-cached recording_store.read_recording, the same read the recordings
table already makes several of per row (no new I/O class — the UI-thread rule).
Source code in detail/api/experiment.py
1887 1888 1889 1890 1891 1892 1893 1894 | |
unique_name(name, *, exclude=None)
¶
name, or the first free name_2 / name_3 … variant.
exclude skips one recording's own name, so renaming a recording to what it is
already called is not a collision with itself.
Source code in detail/api/experiment.py
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | |
video_not_packed()
¶
Why a bundle with include_video would pack no video, or None when it would
pack some (no_video_packed_reasons). Walks the experiment the way the export does, so
a surface calls it off the UI thread.
Source code in detail/api/experiment.py
1913 1914 1915 1916 1917 1918 1919 | |
referenced_video_missing()
¶
Ids of recordings whose video is referenced in place and is not on this machine.
What is left after an import has looked where the exporting machine kept the video:
locating one file of such a recording (Recording.relink_video_part) registers its
folder, and every recording whose video is in that folder finds it too. A stat per part,
so a surface calls this off the UI thread.
Source code in detail/api/experiment.py
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 | |
resolve_recording(ref)
¶
A recording by id or name — what a user types is the name (§11).
An exact id wins, so a recording perversely named another's id can still be reached by its own id. Then a unique name. Anything else raises rather than guessing.
Raises:
| Type | Description |
|---|---|
KeyError
|
no recording matches, or the name is ambiguous (only possible in an experiment whose names predate the uniqueness rule). |
Source code in detail/api/experiment.py
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 | |
propagate_spatial(category_key, source, *, targets=None, names=None, progress=None)
¶
Copy category_key from source onto targets (default: every other
recording), never replacing what a target already has.
A target that already holds this category is skipped and reported, not
overwritten — the operation has no undo and spans many recordings, so a
correction is a deliberate delete on the recording that needs it. So is a target
the category does not fit — a calibration onto a video of another shape, which is
another rig. A target that refuses for any other reason is skipped too rather than
aborting the batch, the same contract as apply_stream_preset.
Returns:
| Type | Description |
|---|---|
PropagationResult
|
A |
PropagationResult
|
and why, and what the trip changed about the definitions themselves. |
Raises:
| Type | Description |
|---|---|
KeyError
|
|
ValueError
|
unknown |
Source code in detail/api/experiment.py
1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 | |
propagate_field_of_view(source, **kwargs)
¶
Copy source's field of view onto recordings that have none (Section 10).
See propagate_spatial.
Source code in detail/api/experiment.py
2051 2052 2053 2054 2055 2056 | |
propagate_calibration(source, **kwargs)
¶
Copy source's distance calibration onto recordings that have none
(Section 10). See propagate_spatial.
Source code in detail/api/experiment.py
2058 2059 2060 2061 2062 2063 | |
propagate_rois(source, **kwargs)
¶
Copy source's regions of interest onto recordings that have none
(Section 10). See propagate_spatial.
Source code in detail/api/experiment.py
2065 2066 2067 2068 2069 2070 | |
propagate_points(source, **kwargs)
¶
Copy source's points of interest onto recordings that have none
(Section 10). See propagate_spatial.
Source code in detail/api/experiment.py
2072 2073 2074 2075 2076 2077 | |
import_behavior_labels(manifest_path, *, name='behavior', importer='behavior_csv', progress=None)
¶
Batch-import behavior ground-truth labels onto existing recordings (Section 3).
Loads + validates the labels manifest (all problems reported upfront,
Tenet 10), then adds each recording's file as a behavior-role stream named
name (default "behavior"), each resolved against its own timestamp
map. Every file in one batch uses the same importer (behavior_csv or
boris). progress(index, total, recording_id, fraction, status) reports
per recording. Returns the skipped recordings as [(recording_id, error), ...].
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the manifest file is absent. |
ValueError
|
If the manifest is malformed or references an unknown recording or missing file (nothing is imported). |
Source code in detail/api/experiment.py
2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 | |
heading_definitions()
¶
Saved heading definitions, oldest first: {name, front, back} ([] if none).
Source code in detail/api/experiment.py
2113 2114 2115 | |
get_heading_definition(name)
¶
Raises: ValueError if no definition named name exists.
Source code in detail/api/experiment.py
2117 2118 2119 | |
save_heading_definition(name, front, back, *, overwrite=False)
¶
Save a heading definition: the points whose mean is the front and the points whose mean is the back. Checked against a skeleton when a run uses it, not here.
Raises:
| Type | Description |
|---|---|
ValueError
|
An invalid name or definition, or the name exists and |
Source code in detail/api/experiment.py
2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
delete_heading_definition(name)
¶
Raises: ValueError if no definition named name exists.
Source code in detail/api/experiment.py
2135 2136 2137 | |
export_heading_definition(name, out_path)
¶
Write a saved definition to a standalone, shareable YAML file.
Raises:
| Type | Description |
|---|---|
ValueError
|
No definition named |
Source code in detail/api/experiment.py
2139 2140 2141 2142 2143 2144 2145 | |
import_heading_definition(in_path, *, name=None, overwrite=False)
¶
Import a definition from a standalone file; returns the name it was saved under.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
|
ValueError
|
A malformed file, the wrong schema version, or (without
|
Source code in detail/api/experiment.py
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 | |
list_stream_presets()
¶
Saved importer setups for this experiment, oldest first ([] if none).
Source code in detail/api/experiment.py
2162 2163 2164 | |
get_stream_preset(name)
¶
Raises: ValueError if no preset named name exists.
Source code in detail/api/experiment.py
2166 2167 2168 | |
save_stream_preset(name, importer, config, *, offset_ns=None, overwrite=False)
¶
Save an importer + its config for reuse on this experiment's other recordings.
Raises:
| Type | Description |
|---|---|
ValueError
|
An invalid name, or the name exists and |
Source code in detail/api/experiment.py
2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 | |
check_new_stream_preset_name(name)
¶
Refuse a name :meth:save_stream_preset would refuse without overwrite, so a
caller that saves after other work can refuse before doing it.
Raises:
| Type | Description |
|---|---|
ValueError
|
An invalid name, or a preset by that name exists. |
Source code in detail/api/experiment.py
2188 2189 2190 2191 2192 2193 2194 2195 | |
delete_stream_preset(name)
¶
Raises: ValueError if no preset named name exists.
Source code in detail/api/experiment.py
2197 2198 2199 | |
export_stream_preset(name, out_path)
¶
Write a saved preset to a standalone, shareable YAML file.
Raises:
| Type | Description |
|---|---|
ValueError
|
No preset named |
Source code in detail/api/experiment.py
2201 2202 2203 2204 2205 2206 2207 | |
import_stream_preset(in_path, *, name=None, overwrite=False)
¶
Import a preset from a standalone file; returns the name it was saved under.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
|
ValueError
|
A malformed file, the wrong schema version, or (without
|
Source code in detail/api/experiment.py
2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 | |
apply_stream_preset(preset, sources, *, name, by_video=False, progress=None)
¶
Import one stream per recording from a saved preset (Section 3).
The batch shape for a mapping worked out once. sources is
[(recording_ref, file, offset_ns | None), ...] — one row per recording, with
its own file and its own offset, because those are exactly what a preset cannot
carry: each video and logger pair has its own skew, so one number applied to sixty
recordings is one recording's answer given to all of them.
A recording that fails is recorded and skipped, so one unreadable file never sinks
the batch — the same contract as import_behavior_labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The stream name to give each import (the same on every recording). |
required |
by_video
|
bool
|
Each |
False
|
progress
|
Callable[[int, int, str, float, str], None] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
list[tuple[str, str]]
|
The skipped recordings as |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in detail/api/experiment.py
2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 | |
set_recording_metadata(recording_id, values)
¶
Set/merge a recording's grouping variables; new columns are added (§11).
Source code in detail/api/experiment.py
2304 2305 2306 | |
add_metadata_column(name)
¶
Add an empty grouping-variable column to the cohort table (§11).
Source code in detail/api/experiment.py
2308 2309 2310 | |
delete_metadata_column(name)
¶
Remove a grouping-variable column and its values from every recording (§11).
Idempotent; recording_id cannot be deleted.
Source code in detail/api/experiment.py
2312 2313 2314 2315 | |
set_metadata_table(columns, rows)
¶
Replace the whole cohort table (§11): columns in order, rows keyed by
recording id. Commits a fully edited table — added/deleted columns and cell edits
together — in one write; the bulk counterpart to :meth:set_recording_metadata.
Source code in detail/api/experiment.py
2317 2318 2319 2320 2321 2322 2323 2324 | |
metadata_csv_key(path)
¶
(key_column, header) for a metadata CSV: the column an import would key on
by default — None when none is recognised — and every column it has, so a
surface can ask which one holds the video file name (#330).
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file is absent. |
ValueError
|
An empty file, or an empty or duplicate column header. |
Source code in detail/api/experiment.py
2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 | |
import_metadata_csv(path, *, dry_run=False, key_column=None)
¶
Bulk-apply recording grouping variables from a CSV (§11): merge-only, blank cells skipped, a row matching no recording rejected. Validates the whole file first — on any error nothing is applied (Tenet 10).
Each row is matched to a recording by its key column: recording_id, the
recording's name, or its video file name — the key a sheet prepared before
import actually carries, since the id is minted at import and the name is right
only once every recording has been renamed (#330). A video file name is the base
name, any case, extension optional, and matches any of the recording's video parts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_column
|
str | None
|
The column to key on. |
None
|
A name or file key is resolved to its id here and never sets anything: renaming
is Recording.set_name, which enforces uniqueness.
Returns (errors, warnings, recordings_updated).
Source code in detail/api/experiment.py
2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 | |
export_metadata_csv(path)
¶
Write the current grouping variables to path as a fill-in CSV template
(§11) — recording_id, name, file, then every column, one row per
recording.
name and file (the first video part's file name, as the table shows it)
ride along so the sheet is legible — an id alone tells a person filling it in
nothing — and so the filled sheet can be keyed back on any of the three. Neither
is a stored value: editing one here renames nothing.
Source code in detail/api/experiment.py
2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 | |
cancel_import(recording_id)
¶
Mark a recording's unfinished import cancelled. A no-op once it is terminal.
This records a decision; it does not reach into a worker. An import runs on a thread
owned by whichever app has this experiment open (gui/import_queue.py), so there is no
cross-process handle to pull — and on the path that matters, quitting, the worker dies
with the process regardless. What the caller gets is the difference between a record
that says cancelled and one left at queued for the next open to call failed:
the same outcome, one of them blaming the user for it.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the recording doesn't exist. |
Source code in detail/api/experiment.py
2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 | |
reconcile_imports()
¶
Flip orphaned import statuses (queued / importing left by a
crash or close, with no active queue) to failed so they're visible +
deletable, not stuck. Called on experiment open before the import queue starts
(the in-memory queue can't resume — §3).
Source code in detail/api/experiment.py
2546 2547 2548 2549 2550 2551 2552 2553 | |
reconcile_runs()
¶
Fold each still-active processing run's real on-disk status back into its
record on experiment open (§15). A run's coordinator + workers are detached and
may outlive the app, but a crashed/SIGKILLed run can read running forever.
Evidence-based (see :meth:_reconcile_run). Mirrors :meth:reconcile_imports.
Source code in detail/api/experiment.py
2555 2556 2557 2558 2559 2560 2561 2562 2563 | |
reconcile_recording_runs()
¶
Adopt each per-recording run's real status into its recording.yaml (§15).
_RecordedRun.wait() is what copies a job's terminal status into the recording, and
a one-recording run has no coordinator to call it: a Ctrl-C, a closed terminal, or a
script that never waits left the entry pending forever, the recording refused a
second run, and tracking refused it as "not complete" (issue #28, finding 5). This is
the backstop, run wherever an experiment is opened — the GUI and every CLI command.
Driven from PROCESSING_MODULES (every per-recording module's runs_key), so a
new module is covered the day it registers. Cost: one recording.yaml read per
recording, and one job.json read only per entry still marked active — never per
run. An entry whose job is still active is left alone while its worker lives; one with
no run dir yet is a launch in progress and is left alone too. Returns how many entries
changed.
Source code in detail/api/experiment.py
2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 | |
delete_recording(recording_id)
¶
Delete a recording and everything it owns — its imported video, runs (detection / tracking / embedding / downsampling), arenas, and masks.
A processing run merely indexes per-recording runs (its outputs live in
the recordings, Tenet 5), so the recording is pruned from every processing
run's per_recording map and an emptied run record is removed — not
blocked. Nothing outside a recording is computed from a whole recording
today; a future cross-recording analysis would register as a dependent.
Refused while a run is using the recording (issue #28, finding 6): a processing run that lists it, a run of its own still going, or an analysis, distill, dataset or export run reading it. Deleting under a live worker orphaned it — the worker re-created the folder within seconds — and wiped the run record the coordinator was still writing, so the other recordings never ran. Every family is reconciled first, so a run that is only recorded as running (its process long gone) does not block the delete.
The recording leaves both of a run record's fields, per_recording and
recording_ids (finding 10): a deleted id left in the plan made process retry
fail reading its recording.yaml and process list count it.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such recording exists. |
ValueError
|
If a run is still using the recording — it names each one. |
Source code in detail/api/experiment.py
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 | |
delete()
¶
Delete the whole experiment directory — every recording, run, model, and
dataset it owns. Nothing outside an experiment depends on it, so this is
never blocked (the cohesive delete strategy, gui_design §1.1). The
Experiment instance is dead afterwards.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the experiment directory no longer exists. |
Source code in detail/api/experiment.py
2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 | |
run_processing(module_id, recording_ids, config, progress=None)
¶
Run a processing module over a selection of recordings.
Validates every selected recording up front (Tenet 10), reserves the run
record, then spawns a detached coordinator (executor/coordinator.py)
that sequences the per-recording Recording.run calls and publishes aggregate
progress. Returns an :class:AttachedRun polling that progress — so the run
survives the app closing and any process can reattach (§15). Per-recording
outputs land in each recording (Tenet 5).
progress takes the standard (stage, fraction, detail) callback and names
each recording as the up-front checks reach it: over a large selection they read
every recording's outputs, which is minutes, not a moment.
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown |
Source code in detail/api/experiment.py
2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 | |
retry_run(run_id, progress=None)
¶
Re-run a terminal processing run's incomplete recordings, into the same record.
Gap-fills rather than minting a new run: each recording already owns its own stage
run id in per_recording, so the record is a map with holes in it. The re-spawned
coordinator seeds those results and drives only what isn't complete, and the
run rolls up to complete once every recording is (§15). Retried recordings get a
fresh stage run id from Recording.run, so nothing appends into a half-written
zarr — a recording is re-run whole, not resumed mid-way (§7 resume is not built).
Covers failed and cancelled runs alike: the set is every recording that
isn't complete, including ones the coordinator never launched.
progress takes the (stage, fraction, detail) callback and names each
recording as it is re-validated, as :meth:run_processing does.
Returns:
| Name | Type | Description |
|---|---|---|
An |
AttachedRun
|
class: |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run record does not exist. |
ValueError
|
If the run is still running, its module is unknown, every recording is already complete, or any incomplete recording no longer validates. |
Source code in detail/api/experiment.py
2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 | |
attach_run(run_id)
¶
Reattach to a processing run by id — a live one streams its coordinator's progress, a terminal one returns at once. Works after an app restart because the coordinator + workers are detached and progress is on disk (§15).
Source code in detail/api/experiment.py
3079 3080 3081 3082 3083 | |
attach_active_run(run_id)
¶
An :class:AttachedRun when the run is still active (for a live reattach
after reopen), else None — so the GUI shows a progress bar for a run that
is still going and a static record for a finished one.
Source code in detail/api/experiment.py
3085 3086 3087 3088 3089 3090 3091 3092 | |
distill(name, classes, n_frames, *, source_recording_ids=None, sampling='stratified', logit_threshold=0.5, min_contour_area=100, val_split=0.15, background_share=LabelingConfig.model_fields['background_share'].default, negative_prompt=None, label_model_id='sam3', label_model_variant=None, label_compute=None, base_model='yolo11s-seg.pt', trainer_id='ultralytics_yolo', hyperparams=None, train_compute=None)
¶
Distill a fast detector in one durable run (§12): label a frame sample with a
prompt-capable model, then train a closed-set YOLO on those labels.
negative_prompt names something in the video that is not the subject (a tether's
cable): it is labelled as a class of its own so the student learns it apart, and the
trained model never reports it (§12 Negative prompt).
Validates the union of the labeling and training pre-flight up front (Tenet 10),
reserves the run record, then spawns a detached distill coordinator that
sequences the two stages and publishes folded progress. Returns an
:class:AttachedDistillRun — the run survives the app closing and any process can
reattach. The trained model lands in models/<id>/ (usable in this experiment at
once); promote it with :meth:promote_model for cross-experiment reuse.
Raises:
| Type | Description |
|---|---|
ValueError
|
no/duplicate classes, a non-prompt-capable label model, a recording
without video, |
Source code in detail/api/experiment.py
3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | |
resume_distill(run_id)
¶
Resume a terminal (failed / cancelled) distill run into the same record: reuse a complete labeled dataset, resume a partial model, and re-spawn the coordinator.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run record does not exist. |
ValueError
|
If the run is still running or already complete. |
Source code in detail/api/experiment.py
3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 | |
cancel_distill(run_id)
¶
Stop an active distill run: kill the coordinator, cancel the live stage worker,
and record the run's real status (complete if training actually finished,
else cancelled). No-op once terminal. Raises FileNotFoundError if absent.
Source code in detail/api/experiment.py
3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 | |
delete_distill(run_id)
¶
Delete a distill run's index record only (distill/<id>/). The produced
dataset, trained model, and any promoted global model are independent artifacts
with their own lifecycles and are left intact — delete them explicitly.
Refused while the run is active (reconciled first, so a dead coordinator does not block): deleting the record under a live coordinator is the processing-run case of issue #28, finding 6 — the coordinator re-writes a record nothing lists any more.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run record does not exist. |
ValueError
|
If the run is still active. |
Source code in detail/api/experiment.py
3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 | |
attach_distill_run(run_id)
¶
Reattach to a distill run by id — a live one streams its coordinator's progress, a terminal one returns at once (§12).
Source code in detail/api/experiment.py
3382 3383 3384 3385 | |
attach_active_distill_run(run_id)
¶
An :class:AttachedDistillRun when the run is still active, else None — so
the GUI shows a live bar for a running distill and a static record for a done one.
Source code in detail/api/experiment.py
3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 | |
distill_run_record(run_id)
¶
The full distill.yaml for one run, reconciled (Tenet 2).
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run record does not exist. |
Source code in detail/api/experiment.py
3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 | |
reconcile_distill_runs()
¶
Fold each still-active distill run's real on-disk status back into its record on
experiment open (§12) — the SIGKILL backstop, mirroring :meth:reconcile_runs.
Source code in detail/api/experiment.py
3416 3417 3418 3419 3420 3421 3422 | |
promote_model(model_id, name=None)
¶
Promote a completed trained model into the machine-global catalog so it can be selected in any experiment (§12) — the on-demand step after a distill. The global model records its provenance (this experiment + the source dataset + base model + metrics), and its weights are copied so it stays self-contained. Returns the assigned global model id.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the model (or its weights file) does not exist. |
ValueError
|
If the model is not complete or the derived global id collides. |
Source code in detail/api/experiment.py
3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 | |
dataset_record(dataset_id)
¶
The full dataset.yaml for one dataset (for detail views — Tenet 2).
Source code in detail/api/experiment.py
3553 3554 3555 3556 3557 | |
generate_dataset(name, source_run_id, frame_selection=None, val_split=0.15, min_contour_area=100)
¶
Export a YOLO training dataset from a completed detection/tracking run (§12). No new inference — reuses the run's masks. Returns a run handle.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the source run record is absent. |
ValueError
|
If the source run is not a complete detection/tracking run. |
Source code in detail/api/experiment.py
3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 | |
label_dataset(name, classes, n_frames, source_recording_ids=None, logit_threshold=0.5, min_contour_area=100, val_split=0.15, compute=None, sampling='stratified', model_id='sam3', model_variant=None, background_share=LabelingConfig.model_fields['background_share'].default, negative_prompt=None)
¶
Build a YOLO dataset by running a prompt-capable model on a sample of frames (§12) —
the distill-into-YOLO source, no existing detection run needed. model_id picks which
prompt-capable model labels (sam3 by default), model_variant its size
(None = the model's default). n_frames is sampled proportionally to recording
length; sampling picks how frames are drawn within each video ("stratified" spreads
them evenly across time, "uniform" is fully random). source_recording_ids=None uses
every recording. Frames where the model found none of the classes are kept with an
empty label, up to background_share of the dataset. negative_prompt adds a class
for something that is not the subject (a tether's cable), labelled so a detector trained
on the dataset learns it apart and never reports it (§12 Negative prompt). Returns a
run handle.
The flat scalar parameters (model_id, model_variant, n_frames, sampling,
logit_threshold, min_contour_area, val_split, background_share,
negative_prompt) are
validated by
:class:LabelingConfig; the checks below need recording data and stay here.
Raises:
| Type | Description |
|---|---|
ValueError
|
no classes, duplicate class prompts, a scalar out of its model bounds
(bad |
Source code in detail/api/experiment.py
3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 | |
keypoint_dataset(name, detect_runs=None, n_frames=None, **options)
¶
Build a YOLO-pose dataset (§12 Distill keypoints, the label stage on its own).
The teacher is detect_runs (finished keypoint detect runs: recording names or ids,
each with a run id or None for the only one; tracking= may name the tracking
run each recording's poses are assigned to, else the one on the detect run's
detection run) or the patch method (example_set=, tracking=, model_id=,
label_compute=); the other options are KeypointDatasetConfig's. Returns a
DatasetRun.
Source code in detail/api/experiment.py
3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 | |
test_keypoints(detect_runs=None, **options)
¶
Test a keypoint teacher on about a dozen frames drawn the way a distill would, with
the held-out check against the example clicks; writes nothing (§12, Test
cut-off…). Takes distill_keypoints's teacher keywords plus n_frames and
seed. Returns a TeacherTest.
Source code in detail/api/experiment.py
3769 3770 3771 3772 3773 3774 3775 3776 | |
distill_keypoints(name, detect_runs=None, n_frames=None, **options)
¶
Distill a teacher into a fast YOLO-pose student in one durable run (label →
train → register). The teacher is detect_runs or the patch method
(example_set= + tracking=), as :meth:keypoint_dataset takes it. Options:
KeypointDatasetConfig's fields plus base_model (a -pose checkpoint),
trainer_id, hyperparams, train_compute and label_compute. Returns an
:class:AttachedDistillRun.
Source code in detail/api/experiment.py
3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 | |
example_sets(purpose='example')
¶
This experiment's example sets of one purpose (None for all), id order.
Source code in detail/api/experiment.py
3792 3793 3794 3795 3796 | |
example_set(set_id)
¶
One example set; FileNotFoundError names the sets that exist.
Source code in detail/api/experiment.py
3798 3799 3800 3801 3802 | |
create_example_set(name, skeleton, *, purpose='example')
¶
A new, empty example set holding a copy of skeleton.
Source code in detail/api/experiment.py
3804 3805 3806 3807 3808 | |
sample_example_frames(set_id, sources, n_frames=5, **options)
¶
Copy tracked frames into an example set (varied or spread); see
api.keypoints.sample_example_frames for the options.
Source code in detail/api/experiment.py
3810 3811 3812 3813 3814 3815 3816 3817 | |
add_example_frame(set_id, recording, tracking_run_id, part_id, frame_idx, track_id)
¶
Copy one navigated-to frame into an example set.
Source code in detail/api/experiment.py
3819 3820 3821 3822 3823 3824 3825 3826 3827 | |
set_example_marks(set_id, frame_index, marks)
¶
Replace one frame's marks and write the set atomically.
Source code in detail/api/experiment.py
3829 3830 3831 3832 3833 | |
remove_example_frame(set_id, frame_index)
¶
Drop one frame from an example set (its PNG stays).
Source code in detail/api/experiment.py
3835 3836 3837 3838 3839 | |
example_frame_image(set_id, frame_index)
¶
One example frame's picture as RGB uint8.
Source code in detail/api/experiment.py
3841 3842 3843 3844 3845 | |
update_example_set(set_id, *, name=None, skeleton=None)
¶
Rename an example set, and/or change its skeleton until its first mark.
Source code in detail/api/experiment.py
3847 3848 3849 3850 3851 | |
duplicate_example_set(set_id, *, name=None)
¶
A new, empty set holding a copy of this set's skeleton.
Source code in detail/api/experiment.py
3853 3854 3855 3856 3857 | |
export_example_set(set_id, out_dir)
¶
Write a set (examples.yaml + its frame images) to a folder.
Source code in detail/api/experiment.py
3859 3860 3861 3862 3863 | |
example_set_runs(set_id)
¶
(recording_id, run_id) of the keypoint detect runs that list a set.
Source code in detail/api/experiment.py
3865 3866 3867 3868 3869 | |
import_example_set(yaml_path)
¶
Read a prepared example set (YAML + images beside it) in under a fresh id.
Source code in detail/api/experiment.py
3871 3872 3873 3874 3875 | |
delete_example_set(set_id)
¶
Delete an example set no keypoint run lists.
Source code in detail/api/experiment.py
3877 3878 3879 3880 3881 | |
model_names()
¶
{model_id: name} for every model this experiment can name — its own trained
models plus the machine-global imported ones (§5/§12). The model twin of
:meth:recording_names.
Records key on the model id, which is permanent; the name is what people read (§11). A label built from this falls back to the id for anything absent — a built-in model, whose id is its name, or a model deleted since the run. Cost is O(models), not O(recordings), so it is cheap enough to build per page render.
Source code in detail/api/experiment.py
3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 | |
model_record(model_id)
¶
The full model.yaml for one trained model (for detail views — Tenet 2).
Source code in detail/api/experiment.py
3921 3922 3923 | |
model_metric_history(model_id)
¶
Per-epoch metrics for a trained model, oldest first; [] if it has none yet.
The series behind model_record's summary. final_metrics answers how good is this
model; someone deciding whether to stop training early is asking the other question —
is it still getting better — and one number cannot tell a run that has been improving
for an hour from one that plateaued forty epochs ago.
Readable while the run is live, because it comes off the trainer's own on-disk record rather than progress events — so it is whole on a page opened after the run began, and a model that trained overnight has its curve in the morning.
Returns [] rather than raising when the trainer is not installed on this machine:
reading a finished run's record must not require the backend that produced it (a model
trained elsewhere and imported has no Ultralytics here), and a missing curve is the
honest rendering of a history we cannot read.
Source code in detail/api/experiment.py
3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 | |
train_model(name, dataset_id, trainer_id, base_model, hyperparams=None, compute=None)
¶
Train a custom detection model from a dataset (§12). Returns a handle.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the dataset does not exist. |
ValueError
|
If the dataset is not complete, the trainer is unknown or not ready, the backend is unsupported, or hyperparams are invalid. |
Source code in detail/api/experiment.py
3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 | |
resume_training(model_id)
¶
Resume a training that was killed or crashed mid-run (cancelled / failed) from
its last checkpoint instead of restarting from epoch 0 (§12). Re-submits the original
job; the runner picks up run/weights/last.pt. Returns a handle.
A partial model is refused: it stopped cleanly, so its checkpoint was finalized
and holds nothing to resume (:data:RESUMABLE_TRAINING_STATUSES).
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the model does not exist. |
ValueError
|
If the model finished (complete / partial) or is running, its recorded training job is missing/unreadable, its trainer is unknown, or it has no checkpoint to resume from. |
Source code in detail/api/experiment.py
4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 | |
delete_dataset(dataset_id)
¶
Delete a training dataset (images + labels + dataset.yaml).
Blocked only while active work would lose its inputs (gui_design §1.1): the dataset's own export, or a model still training from it. A completed model is self-contained (it copied its weights), so its lineage reference is left to dangle — it does not block.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such dataset exists. |
ValueError
|
If the dataset's export or a model training from it is active. |
Source code in detail/api/experiment.py
4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 | |
delete_model(model_id)
¶
Delete a trained model (model.yaml + trainer run + weights).
Blocked only while active work would lose its inputs (gui_design §1.1): the model's own training, or a detection run still using it. A completed detection run keeps its own masks, so its lineage reference is left to dangle — it does not block.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such model exists. |
ValueError
|
If the model's training or a detection run using it is active. |
Source code in detail/api/experiment.py
4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 | |
delete_run(run_id)
¶
Delete a processing run: its per-recording outputs (zarr stores + recording.yaml entries) and the experiment-level run record.
Refuses if any per-recording output is still depended on by a downstream run (e.g. tracking built on this detection) — delete those first. Nothing is removed until the whole run is clear to delete (Tenet 10).
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such run record exists. |
ValueError
|
If the run is still active, or a downstream run depends on it. |
Source code in detail/api/experiment.py
4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 | |
cancel_run(run_id)
¶
Stop an active processing run: signal a live orchestrator (the on-disk
cancel sentinel — works even after the app restarted), cancel each in-flight
per-recording worker, and record each recording's real on-disk status. A recording
the coordinator never launched is listed as cancelled (not run), so process
retry picks it up. The run record becomes cancelled unless every planned
recording actually completed (then complete — e.g. a worker that finished after
the GUI was closed, so its results aren't hidden); see :func:roll_up_run_status.
No-op once terminal.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such run record exists. |
Source code in detail/api/experiment.py
4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 | |
cancel_model(model_id)
¶
Stop an active model-training run (kill its worker), then record its real
on-disk status — cancelled if killed, but complete if the worker
actually finished (so a done run isn't mislabeled). No-op once terminal.
Raises FileNotFoundError if the model doesn't exist.
Source code in detail/api/experiment.py
4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 | |
stop_model(model_id)
¶
Ask a training run to stop at its next epoch and keep what it has.
The counterpart to :meth:cancel_model, and the reason the two exist separately: cancel
force-kills after three seconds, which on a run whose epochs take minutes means the
worker dies mid-epoch and never writes weights.best or metrics into the record.
The checkpoint file is on disk and nothing references it.
This only asks. The run stops at its next epoch boundary, runs its own completion path,
and records the best weights it reached — which is what "the metrics look good, stop
here" has to mean to be worth offering. The record's status stays as the worker leaves
it (complete), because the run did finish, early.
No-op once terminal. Raises FileNotFoundError if the model does not exist.
Source code in detail/api/experiment.py
4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 | |
cancel_dataset(dataset_id)
¶
Stop an active dataset-export run (kill its worker), then record its real
on-disk status (cancelled if killed, complete if it finished). No-op
once terminal. Raises FileNotFoundError if the dataset doesn't exist.
Source code in detail/api/experiment.py
4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 | |
attach_job_run(kind, run_id)
¶
Reattach to a single-job run — a live one streams its worker's progress, a terminal one returns at once. Works from any process, after an app restart included: the worker is detached and its progress is on disk.
kind is a key of _JOB_RUN_KINDS. The typed wrappers below are what callers
use; this is the shared body.
The runner modules are imported first, and that is not optional. A progress event is
rebuilt from job.json by tag, and every tag outside core/dataclasses.py — every
analysis module's, and the export's — is registered as a side effect of importing the
module that defines it. Reattaching without that raises unknown progress event type
the moment the first event is read. No test saw it because conftest's autouse
_isolate_registries imports every runner into every test, so the registry is full in
the suite and empty in a bare detail analysis attach.
Source code in detail/api/experiment.py
4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 | |
attach_active_job_run(kind, run_id)
¶
An :class:AttachedJobRun when that run is still active, else None — so the
GUI shows a live bar for a running one and a static record for a finished one. The
single-job twin of :meth:attach_active_run.
Source code in detail/api/experiment.py
4390 4391 4392 4393 4394 4395 4396 | |
job_run_active(kind, run_id)
¶
Whether that run's job is still working, whatever its record already claims.
The record is usually enough. An authored run (§21) is the exception: its runner
writes open before the work that ends the job, so for that stretch the record says
"ready to interpret" while the job is still writing what interpreting reads. Believed,
the run page built the workspace mid-fit and its tabs read an artifact that did not
exist yet ("no behavior_output.yaml"). So an authored status is checked against the job
envelope, which is the one place that knows the job has not finished.
Source code in detail/api/experiment.py
4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 | |
analysis_job_active(run_id)
¶
:meth:job_run_active for an analysis run.
Source code in detail/api/experiment.py
4423 4424 4425 | |
attach_analysis_run(run_id)
¶
Reattach to an analysis run by id (§16).
Source code in detail/api/experiment.py
4427 4428 4429 | |
attach_active_analysis_run(run_id)
¶
A handle for a still-active analysis run, else None (§16).
Source code in detail/api/experiment.py
4431 4432 4433 | |
attach_dataset_run(dataset_id)
¶
Reattach to a dataset-export run by id (§12).
Source code in detail/api/experiment.py
4435 4436 4437 | |
attach_active_dataset_run(dataset_id)
¶
A handle for a still-active dataset export, else None (§12).
Source code in detail/api/experiment.py
4439 4440 4441 | |
attach_model_run(model_id)
¶
Reattach to a training run by id (§12).
Source code in detail/api/experiment.py
4443 4444 4445 | |
attach_active_model_run(model_id)
¶
A handle for a still-active training run, else None (§12).
Source code in detail/api/experiment.py
4447 4448 4449 | |
attach_export_run(run_id)
¶
Reattach to an export run by id (#354).
Source code in detail/api/experiment.py
4451 4452 4453 | |
attach_active_export_run(run_id)
¶
A handle for a still-active export, else None (#354).
Source code in detail/api/experiment.py
4455 4456 4457 | |
reconcile_job_runs()
¶
Fold every still-active single-job run's real on-disk status back into its record
on experiment open — the SIGKILL backstop for analysis, dataset, model and export
runs alike (§12/§16), beside :meth:reconcile_runs for processing runs.
Driven by _JOB_RUN_KINDS, so a fifth kind inherits the backstop by adding a
table entry. Without it a killed worker leaves a record reading running forever,
which also cannot be deleted — every delete method refuses an active record.
Source code in detail/api/experiment.py
4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 | |
reconcile_analysis_runs()
¶
The analysis slice of :meth:reconcile_job_runs — kept because callers name it,
and because a caller that only touched analysis should not sweep every kind.
Source code in detail/api/experiment.py
4527 4528 4529 4530 4531 4532 | |
reconcile_analysis_run(run_id)
¶
Reconcile one analysis run against its job envelope; True if the record moved.
One job.json read, so a surface can afford it on the way into a run's page rather
than trusting a record last reconciled when the experiment was opened. That gap is
real: a run that fails during a session keeps its optimistic record until something
sweeps, and the surface that shows it is exactly the one about to offer its results.
Source code in detail/api/experiment.py
4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 | |
export_record(run_id)
¶
The full record for one export run (for detail views).
Source code in detail/api/experiment.py
4592 4593 4594 4595 4596 | |
run_export(subject_kind, subject_id, target_ids, parent, *, scope=None, **options)
¶
Export target_ids from a subject into a new folder under parent, as a run.
One request is one run, however many targets it covers: they share a destination folder and a manifest because that is what was asked for once. The targets become the run's units.
parent is resolved to a machine-local alias (storage/roots.py) before it reaches
the job: everything in a job lands in the run record via runners.job_params, a record
is .yaml, and an absolute path in one would make experiment.export refuse this
experiment permanently (Tenet 6).
The folder name is minted here rather than in the worker so a surface can say where the files are going before the run starts.
Raises:
| Type | Description |
|---|---|
ExportError
|
if a target is unknown, cannot run for this subject, or the request is
one |
ValueError
|
if |
Source code in detail/api/experiment.py
4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 | |
estimate_export(subject_kind, subject_id, target_ids, parent=None, *, scope=None, **options)
¶
How big an export would be and how long it would take, without writing it.
The same arguments as :meth:run_export, and the answer is what the Export dialog and
detail export run show before they start: an :class:exporters.ExportEstimate, one
entry per target plus the free space on parent's drive. A video target times a few
dozen frames on this machine to answer (about a second); everything else reads sizes and
row counts from disk.
Raises:
| Type | Description |
|---|---|
ExportError
|
if a target is unknown, |
Source code in detail/api/experiment.py
4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 | |
cancel_export(run_id)
¶
Stop an active export run. No-op once terminal.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run doesn't exist. |
Source code in detail/api/experiment.py
4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 | |
delete_export(run_id)
¶
Delete an export run's record. Blocked while it is still active.
Deletes the record, never the exported files: those are in the user's own folder, outside the experiment, and forgetting a run is not a request to delete its output.
Source code in detail/api/experiment.py
4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 | |
analysis_record(run_id)
¶
The full analysis.yaml for one analysis run (for detail views).
Source code in detail/api/experiment.py
4780 4781 4782 4783 4784 | |
analysis_run_dir(run_id)
¶
The on-disk output directory for an analysis run (analysis/<run_id>/)
— for opening it in a file manager.
Source code in detail/api/experiment.py
4786 4787 4788 4789 | |
location_plots(run_id)
¶
Plots of a completed location-export run (DESIGN_PLAN §16 "Location plots"): its animals' paths, occupancy, speed and body, drawn from the run's own CSVs.
Returns:
| Type | Description |
|---|---|
LocationPlots
|
A |
LocationPlots
|
for files. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The run is not a location export, or has no completed recording. |
Source code in detail/api/experiment.py
4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 | |
run_analysis(module_id, config)
¶
Launch an experiment-scoped analysis run (§16): one module over a selection
of recordings, producing artifacts in analysis/<run_id>/. A single
executor job (not a per-recording fan-out). Returns a run handle.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the module is unknown or config validation fails. |
Source code in detail/api/experiment.py
4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 | |
run_comparison(config, *, progress=None, stop_check=None)
¶
Run a §24 comparison — group statistics across recording metadata — and save it.
Source code in detail/api/experiment.py
4840 4841 4842 4843 4844 | |
get_comparison(comparison_id)
¶
Handle for an existing comparison in this experiment.
Source code in detail/api/experiment.py
4846 4847 4848 4849 4850 | |
measures(run_id)
¶
The §23 measures of one analysis run's behavior artifact (§19).
Source code in detail/api/experiment.py
4852 4853 4854 4855 4856 | |
authored_run(run_id)
¶
The §21 handle for an authored run, or None if this run is not one.
A computed run (a location export, an eval) has no authored state and pins nothing, so it has no handle of this kind — the caller shows no snapshot surface rather than an empty one.
Source code in detail/api/experiment.py
4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 | |
comparisons_using(run_id)
¶
{snapshot_id: [comparison_id, ...]} for one analysis run's pinned artifacts.
Derived, never stored. A snapshot records why it was taken but not what consumed it: an export has no stable identifier to keep (its path lies outside the experiment, and an absolute path in an experiment file is a hard rule), and a comparison id does not exist until after the pin. So the link is read back off the consumers, which is also the §21 rule that a fact checkable from the store gets no second writer.
One pass over comparisons/, which holds tens of records in a real experiment rather
than thousands. Records written before source_snapshot existed carry none and are
skipped rather than guessed at.
Source code in detail/api/experiment.py
4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 | |
delete_comparison(comparison_id)
¶
Delete a comparison and everything it wrote, exports included.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
no comparison with that id. |
Source code in detail/api/experiment.py
4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 | |
query_run(run_id)
¶
Reopen an existing §20 Query run as a QueryRun handle (no active search job) —
for calibrating a cutoff, naming a behavior, or exporting the artifact.
The way a searched run is reached to be calibrated: the search leaves the run open
rather than complete, and the whole of calibration happens through this handle.
Source code in detail/api/experiment.py
4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 | |
temporal_clustering_run(run_id)
¶
Reopen an existing §22 temporal-clustering run as a TemporalClusteringRun handle
(no active fit job) — for choosing a granularity, naming clusters, or exporting.
The way a fitted run is reached to be interpreted: the fit leaves the run open rather
than complete, and the whole of interpretation happens through this handle.
Source code in detail/api/experiment.py
4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 | |
cancel_analysis(run_id)
¶
Stop an active analysis run (kill its worker), then record its real
on-disk status (cancelled if killed, complete if it finished). No-op
once terminal. Raises FileNotFoundError if the run doesn't exist.
Source code in detail/api/experiment.py
4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 | |
delete_analysis(run_id)
¶
Delete an analysis run (its analysis/<run_id>/ directory).
A completed analysis run is self-contained (it copied the derived values into its own CSVs), so it never blocks deleting its source runs — the analogue of the dataset/model lineage-dangle. Blocked only while the run is still active.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no such analysis run exists. |
ValueError
|
If the run is still active. |
Source code in detail/api/experiment.py
4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 | |
set_hf_token(token)
¶
Validate and store the Hugging Face token; return the account name.
Writes the machine-global ~/.config/detail/credentials.yaml (not
experiment state), exposed here as the single API boundary (Tenet 2).
Source code in detail/api/experiment.py
5010 5011 5012 5013 5014 5015 5016 | |
check_model_access(model_id, variant=None)
¶
Proactive readiness for a model — drives 'set up access' UI states.
Source code in detail/api/experiment.py
5020 5021 5022 5023 5024 | |
install_model(model_id, progress_cb=None, *, variant=None)
¶
Ensure a model's weights are present; raises ModelNotReadyError if blocked.
variant picks the size — each is a separate download (§5).
Source code in detail/api/experiment.py
5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 | |
import_model(weights_path, *, family=None, skeleton=None, name=None, made_by=None, description=None, notes=None, preview=None)
¶
Import an external checkpoint into the machine-global catalog — usable in any
experiment. A pose checkpoint lands as a keypoint model and needs skeleton (a
preset, library id or skeleton YAML) that fits it; see
:func:detail.api.models.import_model. Optional made_by / description /
notes / preview are stored as catalog metadata (§12). Returns the assigned
id.
Source code in detail/api/experiment.py
5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 | |
remove_imported_model(model_id)
¶
Delete a machine-global imported model (raises if absent).
Source code in detail/api/experiment.py
5072 5073 5074 | |
detail.api.recording.Recording
¶
Source code in detail/api/recording.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 | |
import_status
property
¶
ready | queued | importing | failed | cancelled —
defaults to ready for recordings created before the field existed (and
for ones with no deferred import work).
video_available
property
¶
True iff the recording has video parts and all their files are present
on disk. False for a video-excluded export (entries + timestamps kept, the
.mp4 blobs absent) — preview surfaces check this to degrade gracefully
instead of failing to decode.
distance_calibration
property
¶
The recording's distance-calibration block (Section 10), or None if not set.
Fields: pixels_per_mm, ref_resolution [W, H], and (for a two-point pick)
the normalized points and distance_mm.
pixels_per_mm
property
¶
pixels_per_mm at the recording's current video resolution (rescaled from the
calibration's own resolution), or None if uncalibrated. With no video yet, the
calibration's own value at its ref_resolution (:meth:calibration_reference).
Raises:
| Type | Description |
|---|---|
ValueError
|
the calibration cannot describe this video — see
:meth: |
streams
property
¶
Stream manifest entries from recording.yaml (empty list if none).
is_annotated
property
¶
Whether the recording carries behavior ground-truth labels (Section 3).
Presence of any ground-truth behavior-role stream means the recording
is annotated; per-behavior eligibility uses is_annotated_for (an ethogram
scores only some behaviors). It is what an evaluation against ground truth gates a
recording on.
A stream carrying a method's own re-ingested output (origin: predicted)
does not annotate anything — counting it here would let a run be gated in on
the very predictions it is about to be scored against (§19).
video_sources
property
¶
Where each video part's footage came from — one entry per part, "" when
unknown (a part imported before origins were recorded; honest, not a guess).
One accessor because the user's question is the same ("which file is this?"). Both
kinds store {root, rel} and are composed into an absolute path here, at display
time — what they mean differs: a referenced part's source is the video's
live location (relinking rewrites it, so this follows the file), while a copied
part's origin is where it came from (the tool holds the footage; the original
may since have moved, and nothing breaks if it has).
video_parts
property
¶
Video part entries from recording.yaml — [{index, file, timestamps}, ...].
Read accessor so callers never read recording.yaml directly (Tenet 2).
video_fps
property
¶
The recording's frame rate, or None if no video has been imported.
The container's advertised rate, read from recording.yaml — cheap enough for a
form to consult per keystroke. It is a display number: the frame-exact reference
is the PTS timestamp map, and a stride is an exact integer either way (§4, Tenet 8).
video_resolution
property
¶
The recording's source video resolution (width, height), or None if
no video has been imported.
part_frame_counts
property
¶
Frame count of each video part, from its active timestamp map.
Lets a caller map a recording-global frame index to (part_index,
local_idx) — e.g. the arena-draw canvas's single continuous frame
slider (§10).
arenas
property
¶
Arena entries from recording.yaml — [{id, name, n_vertices}, ...].
rois
property
¶
ROI entries — [{id, name, n_vertices, active}, ...] (active is
{start, end} or None = whole video).
points
property
¶
POI entries — [{id, name, n_vertices, active}, ...] (n_vertices
is 1; active is {start, end} or None = whole video).
keypoint_detect_runs
property
¶
The keypoint detect run records (§26), as detection_runs is. run_spec reads a
module's runs off the live Recording by runs_key, so without this every picker of
a keypoint run listed nothing in the app while the dict-driven tests passed.
keypoint_track_runs
property
¶
The keypoint track run records (§26); see keypoint_detect_runs.
add_video_part(path, storage='default', video_root=None, progress=None, should_stop=None)
¶
Import a video file as the next part: register it with the recording,
generate its timestamp map, and append it to recording.yaml (Section 3).
The source is copied in verbatim, so the recording holds the footage at its
original rate and resolution — a stage that wants fewer frames sets a
every_n_frames on the run (§4), which needs no second copy. With
storage="reference" the part is referenced in place: the video is not
copied; the recording stores its location (a {root, rel} reference — the seam a
remote backend plugs into) plus a content fingerprint, so a moved or changed file can
be detected (Section 2). video_root is optional — when omitted, the video's own
folder is remembered automatically (the caller references a path, never picks a
location). The external source is only read, never modified. t_ns is each frame's
time, global across parts (offset by the cumulative duration before it, Tenet 8).
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
ValueError
|
If a reference import is missing/mismatched against its video root. |
UserInputError
|
If the video's resolution or frame rate is not the recording's. Every part of a recording shares both (§3): boxes, masks and calibrations are in its pixels, and a detection run decodes every part's masks at one size. |
Source code in detail/api/recording.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
verify_videos()
¶
Check every video part is present and (for referenced parts) unchanged (Section 2).
Returns the list of integrity issues (empty means all good) — the same check the run pre-flight gate enforces, exposed so a user can check without launching a run.
Source code in detail/api/recording.py
492 493 494 495 496 497 498 499 | |
relink_video_part(part_index, new_path, progress=None)
¶
Point a part at its video file again: Locate video, and recording relink.
A referenced part is pointed at a moved or renamed file, verified by fingerprint: the new file's content fingerprint must match what was recorded. A mismatch means the content changed, not just moved, and is refused (remove and re-add the recording instead). The new path need not be under a registered video root: one is registered for it, the way an import does. When the part's own root is not registered on this machine (an experiment made elsewhere) and the file sits where that root would put it, the root itself is registered, so every other recording referencing it resolves too.
A copied part whose file is missing (an experiment imported from a bundle without
its video, or replaced by one) has the file copied back in to its
video/part_NNN.mp4; the part stays a copied part. The file is accepted only if
its frame times match the part's recorded timestamp map exactly (count and every
t_ns, both re-based to start at 0) and its resolution matches the recording's,
and, for a part that recorded a fingerprint, only if that matches too. The copy goes
to a sibling temporary file moved into place when complete, so a cancel (progress
raising) leaves no half file. A copied part whose file is present is refused: there
is nothing to put back.
progress(stage, fraction, detail) reports a put-back's two long steps,
:data:STAGE_TIMESTAMPS then :data:STAGE_COPYING. A referenced relink reads two
MiB and reports nothing.
Returns:
| Type | Description |
|---|---|
str | None
|
The video-root alias this call registered on this machine, or |
str | None
|
used one that was already registered (always |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
|
IndexError
|
|
ValueError
|
the content differs from a referenced part's. |
UserInputError
|
a copied part's video is already here, or the file is not that part's video (it names what differs). |
Source code in detail/api/recording.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | |
parts_to_locate()
¶
The parts Locate video can act on: every referenced part, and each copied part whose file is not here, with the file it was copied from when that is on this machine.
Reads the recording's parts, a stat per copied part, and resolves each missing
copied part's origin, which can be a network share: call it off the UI thread.
Source code in detail/api/recording.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | |
define_arena(name, keyframes)
¶
Define a named arena polygon (Section 10).
Each keyframe is (frame_idx, [(x, y), ...]) with recording-global
frame_idx (0 = first frame of part_001) and normalized vertices in
[0, 1]. All keyframes must have the same vertex count.
Returns:
| Type | Description |
|---|---|
str
|
The auto-assigned stable arena id (e.g. |
str
|
what |
Raises:
| Type | Description |
|---|---|
ValueError
|
If keyframes are invalid (see
|
Source code in detail/api/recording.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | |
arena_dependents(arena_id)
¶
Tracking run ids that used arena_id — editing or removing the arena
would make their recorded region inconsistent, so it is blocked while any
exist (delete those runs first).
Source code in detail/api/recording.py
691 692 693 694 695 696 697 698 699 700 | |
arena_keyframes(arena_id)
¶
The arena's polygon keyframes as [(frame_idx, [(x, y), ...]), ...]
(normalized vertices), e.g. to reload it into the editor.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no arena with this id exists in the recording. |
Source code in detail/api/recording.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | |
clear_arenas()
¶
Remove all arenas (keyframes + recording.yaml entries) so the recording's single arena can be redrawn. Already-computed runs are unaffected.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a tracking run used one of the arenas (see
|
Source code in detail/api/recording.py
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
delete_arena(arena_id)
¶
Remove a single arena (keyframes + recording.yaml entry). Already-computed runs are unaffected — the polygon was applied at run time.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a tracking run used this arena (see |
Source code in detail/api/recording.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | |
define_roi(name, keyframes, active=None)
¶
Define a named region-of-interest polygon (Section 10).
ROIs are analysis-time only — they do not affect detection or
tracking. Keyframes match define_arena (recording-global frame_idx,
normalized [0, 1] vertices, >= 3 per keyframe). active is an
optional inclusive (start, end) recording-global frame interval the ROI
is present for; None = whole video.
Returns:
| Type | Description |
|---|---|
str
|
The auto-assigned stable id (e.g. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If keyframes/active are invalid, or the name is empty or already used within this recording. |
Source code in detail/api/recording.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | |
roi_keyframes(roi_id)
¶
The ROI's polygon keyframes (to reload it into the editor).
Raises:
| Type | Description |
|---|---|
ValueError
|
If no ROI with this id exists in the recording. |
Source code in detail/api/recording.py
828 829 830 831 832 833 834 | |
roi_at_frame(roi_id, frame_idx)
¶
The ROI polygon at frame_idx as an (n_vertices, 2) array, or
None if the ROI is not active at that frame (Section 10).
Source code in detail/api/recording.py
836 837 838 839 | |
delete_roi(roi_id)
¶
Remove an ROI (keyframes + recording.yaml entry). Unconditional: a finished location run keeps its own rows, and the id is never given to another ROI.
Source code in detail/api/recording.py
841 842 843 844 | |
define_point(name, keyframes, active=None)
¶
Define a named point of interest (Section 10) — a landmark point (lever, port, hopper).
Each keyframe carries exactly one normalized vertex; a single keyframe
is a static point, more keyframes move it (e.g. a panning camera).
Analysis-time only (does not affect detection/tracking). active as in
define_roi. Distinct from pose keypoints (user-placed, not model-derived).
Returns:
| Type | Description |
|---|---|
str
|
The auto-assigned stable id (e.g. |
Source code in detail/api/recording.py
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
point_keyframes(point_id)
¶
The POI's keyframes (one vertex each).
Raises:
| Type | Description |
|---|---|
ValueError
|
If no POI with this id exists in the recording. |
Source code in detail/api/recording.py
868 869 870 871 872 873 874 875 876 | |
point_at_frame(point_id, frame_idx)
¶
The point as a (1, 2) array at frame_idx, or None if the POI
is not active at that frame (Section 10).
Source code in detail/api/recording.py
878 879 880 881 | |
delete_point(point_id)
¶
Remove a POI (keyframes + recording.yaml entry). Unconditional.
Source code in detail/api/recording.py
883 884 885 | |
set_rois(defs)
¶
Replace all ROIs in one transaction — the multi-region manager's "Save all"
(Section 10). Each entry is {"name", "keyframes", "active", "id"} (active
and id optional). An entry carrying the id of an ROI that exists keeps it; any
other gets an id never used in this recording before. Returns the ids, in order.
Raises:
| Type | Description |
|---|---|
ValueError
|
If any def is invalid (empty/duplicate name or id, bad keyframes/active). |
Source code in detail/api/recording.py
887 888 889 890 891 892 893 894 895 896 897 | |
set_points(defs)
¶
Replace all POIs in one transaction — the manager's "Save all" (Section 10).
Each entry is {"name", "keyframes", "active", "id"}; each keyframe carries one
vertex. Ids are kept and minted as in :meth:set_rois. Returns the ids, in order.
Source code in detail/api/recording.py
899 900 901 902 903 904 | |
check_spatial_defs(kind, defs)
¶
Refuse a whole set of kind ("arena", "roi" or "point") definitions
the way :meth:set_rois / :meth:set_points / :meth:define_arena would, writing
nothing — for a caller that commits several kinds at once and must not have written
one before another is refused (the scene editor's Save).
Raises:
| Type | Description |
|---|---|
ValueError
|
An empty or duplicated name or id, or invalid keyframes / active. |
Source code in detail/api/recording.py
906 907 908 909 910 911 912 913 914 915 | |
check_distance_calibration(points, distance_mm)
¶
Refuse what :meth:set_distance_calibration would refuse, writing nothing.
Raises:
| Type | Description |
|---|---|
ValueError
|
if there is no video, the points coincide, or |
Source code in detail/api/recording.py
917 918 919 920 921 922 923 924 925 926 927 | |
export_spatial_csv(path)
¶
Write this recording's whole spatial setup to a round-trippable CSV (Section 10) — the field of view, the distance calibration, and the ROIs + POIs — for sharing or importing onto another recording.
One file per recording rather than one per kind; the import side is per kind, so a single export can feed any of them.
Source code in detail/api/recording.py
929 930 931 932 933 934 935 936 937 | |
import_spatial_csv(path, kinds=('roi', 'point'))
¶
Take the kinds rows of an exported spatial CSV onto this recording (§10).
Goes through :meth:receive_spatial, so a setup pulled from a file obeys the
same rules as one pushed from a recording: nothing is replaced, a name already
here is refused rather than suffixed (2), keyframe motion is flattened, and an
active window does not travel.
All or nothing across kinds: every definition is checked before the first is
written, so a bad point does not leave the regions above it behind (a retry then
refused them as "already exists").
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Source code in detail/api/recording.py
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | |
import_scene_csv(path)
¶
Take everything an exported spatial CSV carries onto this recording (§10): its
field of view, distance calibration, regions and points, each by its own rules
(:meth:import_field_of_view_csv, :meth:import_calibration_csv,
:meth:import_spatial_csv). Nothing is replaced.
Only the kinds the file holds are tried. A kind it does not carry is not a refusal: trying all four turned a one-region file into one "Added" line and three "Not added" ones, which reads as a partial failure (#35 finding 14). A kind refused whole (this recording already has a field of view or a calibration) is one refusal, named by what it is.
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
the file is absent. |
ValueError
|
the file is malformed, or carries no scene geometry at all. |
Source code in detail/api/recording.py
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | |
import_spatial_from(source, kinds=('roi', 'point'))
¶
Take another recording's ROIs/POIs onto this one (§10) — the pull twin of
Experiment.propagate_rois / propagate_points, and the same rules.
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Source code in detail/api/recording.py
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | |
field_of_view_refusal()
¶
Why this recording cannot receive a field of view, or None.
One sentence for both directions. It lived only on the push side, so pulling a field of view onto a locked recording said "already has one" and stopped, while pushing the identical setup named the tracking runs you would have to delete first — same situation, two qualities of advice.
It carries no "here" or "there": the pull direction reads it about the recording you are on and the push direction reads it about a row in a list of sixty others, so either word is wrong half the time.
Source code in detail/api/recording.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | |
receive_spatial(defs, kind)
¶
Take defs (already parsed, from a recording or a CSV) onto this recording.
The one door for a setup arriving from elsewhere, whichever direction it was
started from and whichever source it came from. Applies
storage.spatial.prepare_for_arrival's timeline policy, then refuses by name for
the set-shaped kinds — nothing is ever replaced.
Returns:
| Type | Description |
|---|---|
list[str]
|
|
list[str]
|
was dropped, and |
Raises:
| Type | Description |
|---|---|
ValueError
|
A definition that is not valid (nothing is written). |
Source code in detail/api/recording.py
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | |
propagate_spatial_from(source, kind, names=None)
¶
Take a copy of source's kind definitions (Section 10).
A thin read in front of :meth:receive_spatial, which owns the policy.
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Source code in detail/api/recording.py
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | |
import_field_of_view_from(source)
¶
Take source's field of view onto this recording (§10).
Never replaces. A recording that already has one keeps it; delete it here first
(and the tracking runs holding it, which arena_dependents names). This used to
clear_arenas() and copy over the top after a Yes/No — the same operation the
push direction refuses outright, which is how one setup arriving from elsewhere
came to have two contradictory rules depending on which way you started it.
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Source code in detail/api/recording.py
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | |
import_field_of_view_csv(path)
¶
Take the field of view out of an exported spatial CSV (§10). Never replaces —
see :meth:import_field_of_view_from.
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str], list[tuple[str, str]]]
|
|
Source code in detail/api/recording.py
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | |
import_calibration_from(source)
¶
Take source's distance calibration onto this recording (§10).
Never replaces: there is one pixel scale, so a recording that already has one keeps it. Nothing to flatten for the timeline — a calibration is two points, a distance and the resolution it was measured at, with no frame index anywhere. Refused onto a video of a different shape, where no one pixel scale is right.
Raises:
| Type | Description |
|---|---|
ValueError
|
the source has none, this recording already has one, or its video's aspect ratio differs from the one the calibration was measured on. |
Source code in detail/api/recording.py
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | |
import_calibration_csv(path)
¶
Take the distance calibration out of an exported spatial CSV (§10). Never
replaces — see :meth:import_calibration_from.
Raises:
| Type | Description |
|---|---|
FileNotFoundError | ValueError
|
a missing/malformed CSV, one carrying no calibration, a recording that already has one, or one whose video is a different shape from the one the calibration was measured on. |
Source code in detail/api/recording.py
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | |
calibration_reference()
¶
How to read :attr:pixels_per_mm: "" when it is at this recording's video, or
" at WxH (no video yet)" when the recording has no video and the number is the
calibration's own, at the resolution it was measured on.
Source code in detail/api/recording.py
1284 1285 1286 1287 1288 1289 1290 1291 1292 | |
calibration_refusal()
¶
Why this recording's distance calibration gives no scale for its video, or
None (also when it has no calibration or no video).
Reachable although every carry-over refuses it: the video can be replaced after the calibration was set, and a calibration copied before the refusal existed is still on disk.
Source code in detail/api/recording.py
1294 1295 1296 1297 1298 1299 1300 1301 1302 | |
calibration_refusal_for(calibration)
¶
Why calibration gives no scale for this recording's video, or None
(also when either is missing). The question a copy asks of a target before it is
offered: a calibration belongs to a rig, and a video of another shape is another
rig.
Source code in detail/api/recording.py
1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
set_distance_calibration(points, distance_mm)
¶
Calibrate from two normalized points a known real distance (mm) apart — the GUI two-point pick (Section 10). Uses the current video resolution as the reference.
Raises:
| Type | Description |
|---|---|
ValueError
|
if there is no video, the points coincide, or |
Source code in detail/api/recording.py
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | |
set_pixels_per_mm(pixels_per_mm)
¶
Calibrate directly from a pixels_per_mm scalar (the CLI/scripted path, no
two-point pick), measured at the current video resolution (Section 10).
Raises:
| Type | Description |
|---|---|
ValueError
|
if there is no video or |
Source code in detail/api/recording.py
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | |
clear_distance_calibration()
¶
Remove the distance calibration (idempotent).
Source code in detail/api/recording.py
1338 1339 1340 | |
location_tables(tracking_run_id, *, keypoint_run_id=None, progress=None, **options)
¶
Per-frame, per-track spatial features for a completed tracking run — bbox/centroids/areas, the body's centre, area, length and width, and position relative to this recording's ROIs/POIs.
Returns an analysis.locations.LocationTables (compute only, no write) —
the reuse hook for a preview or a future analysis module. Read-only; the
compute is pure (no executor, no run record).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracking_run_id
|
str
|
A complete tracking run of this recording. |
required |
keypoint_run_id
|
str | None
|
A complete keypoint track run whose poses went to that tracking
run, read into a fourth table ( |
None
|
progress
|
Callable[[str, float, str], None] | None
|
|
None
|
**options
|
float | bool | None
|
The measurement options of |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the tracking run is missing or not complete, an option is not one this export has, or one is outside its bounds; or the keypoint track run is not complete or assigned its poses to another tracking run. |
Source code in detail/api/recording.py
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | |
export_locations(tracking_run_id, out_dir, *, keypoint_run_id=None, progress=None, **options)
¶
Compute + write the three location CSVs (tracks / roi_relations /
point_relations, and keypoints with a keypoint_run_id) + a
locations.yaml manifest into a new folder under out_dir; returns that folder. Tables keyed by t_ns (joins with streams).
progress and options are :meth:location_tables's; progress also hears
the write.
The names are fixed, so each export gets its own folder: writing them straight into
out_dir replaced one recording's files with the next one's (#29).
Source code in detail/api/recording.py
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | |
backfill_kinematics(embed_run_id, *, progress=None, overwrite=False)
¶
Write the §14 kinematics/ sibling for an embedding run that has none.
A run made before kinematics existed has no per-frame geometry, so nothing downstream can say where a behavior happened. This regenerates it from the detection zarr — the masks and boxes are still there — without a GPU, a model, or a video decode. Returns the number of parts written.
progress takes the standard (stage, fraction, detail) callback; on a long
recording this is minutes, and a silent long op is indistinguishable from a hang.
Already-written parts are skipped unless overwrite, so an interrupted run resumes.
Source code in detail/api/recording.py
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | |
missing_previews(tracking_run_ids=None)
¶
The preview builds this recording is missing on this machine (§3 Video preview cache) — each part's proxy, and each complete tracking run's masks. One stat per part once the cache knows the file; empty when everything is built.
Source code in detail/api/recording.py
1494 1495 1496 1497 1498 1499 1500 1501 1502 | |
build_preview(progress=None, *, tracking_run_ids=None, masks=True)
¶
Build this recording's display-only previews on this machine; returns a
previews.PreviewBuildReport (built, and failed — each failed build with
why; one failure does not stop the rest).
Each part's proxy (480x270 at most, 15 fps) and, with masks, each complete
tracking run's masks at proxy size (tracking_run_ids limits which). They live in
the machine-local preview cache, never in the experiment, and no pipeline stage reads
them (§3). Minutes per hour of video, so progress takes the standard
(stage, fraction, detail) callback; a callback that raises stops the build and the
part in hand is discarded.
Source code in detail/api/recording.py
1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | |
kinematics_missing_parts(embed_run_id)
¶
Embedding parts of this run with no kinematics sibling — empty when it is complete.
Source code in detail/api/recording.py
1531 1532 1533 1534 1535 | |
kinematics(embed_run_id, track_id=0)
¶
Where the subject was on each embedded frame (§14), or None if never captured.
{frame_idx, t_ns, cx_norm, cy_norm, mask_area_norm, bbox_norm}, all normalized to the
frame so two recordings of different resolutions are comparable. The same rows, in the
same order, as the embedding run's own — without reading the embedding column beside it.
None for a run made before this was captured; :meth:backfill_kinematics fills it in.
Source code in detail/api/recording.py
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 | |
add_stream(name, raw_path, importer, aux_paths=None, covered_behaviors=None, origin=None, config=None, offset_ns=0)
¶
Import a time-series stream and record it in recording.yaml (Section 3).
Runs the named StreamImporter over raw_path (plus any
aux_paths it declares) to produce canonical rows in stream-local time,
copies the source files verbatim into streams/<name>/raw/, writes the
canonical CSV, and appends the manifest. The folder is built aside and moved into
place only once every check has passed, so a refused import leaves nothing behind.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique, path-safe stream name (also the directory name). |
required |
raw_path
|
Path | str
|
The primary data file to import. |
required |
importer
|
str
|
A registered importer id (e.g. |
required |
aux_paths
|
dict[str, Path | str] | None
|
Extra files keyed by the importer's |
None
|
covered_behaviors
|
list[str] | None
|
For a |
None
|
origin
|
str | None
|
For a |
None
|
config
|
dict | None
|
The importer's own parameters, matching its |
None
|
offset_ns
|
int
|
The stream's alignment offset, set at import instead of as a
separate edit afterwards — |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Unknown importer, invalid/duplicate name, a missing
required aux input, a |
FileNotFoundError
|
If |
Source code in detail/api/recording.py
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 | |
list_stream_presets()
¶
The experiment's saved importer setups (Section 3).
On Recording as well as Experiment because a preset is used from a
recording — the surface that imports a stream should not have to reach past itself
to find out what setups exist.
Source code in detail/api/recording.py
1801 1802 1803 1804 1805 1806 1807 1808 | |
get_stream_preset(name)
¶
Raises: ValueError if no preset named name exists.
Source code in detail/api/recording.py
1810 1811 1812 | |
save_stream_preset(name, importer, config, *, offset_ns=None, overwrite=False)
¶
Save an importer + config on the experiment, for its other recordings.
Raises:
| Type | Description |
|---|---|
ValueError
|
An invalid name, or the name exists and |
Source code in detail/api/recording.py
1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | |
add_stream_from_preset(name, raw_path, preset, *, offset_ns=None, aux_paths=None, origin=None)
¶
Import a stream using a saved preset's importer + config (Section 3).
The preset supplies the importer and its config; everything that belongs to
this recording — the file, the stream name, the alignment offset — stays an
argument, because those are what differ between recordings even when the mapping
does not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset_ns
|
int | None
|
This recording's alignment offset. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Unknown preset, or any |
FileNotFoundError
|
If |
Source code in detail/api/recording.py
1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | |
streams_by_role(role)
¶
Stream manifest entries with the given role (Section 3).
The discovery surface a role-consuming module reads through — e.g. an
evaluation against ground truth finds recordings carrying a behavior-role stream.
Source code in detail/api/recording.py
1914 1915 1916 1917 1918 1919 1920 | |
covered_behaviors(name=None)
¶
Behaviors the annotation scored (Section 3) — the eligibility vocabulary.
Reads the manifest's covered_behaviors (importers declare it, so a
scored-but-never-occurred behavior still counts); falls back to the distinct
labels present for a legacy stream that predates the field. name selects
a stream; default is the first behavior stream. Empty if none.
Source code in detail/api/recording.py
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 | |
behavior_types(name=None)
¶
Per-behavior point/state type (Section 3).
Reads the manifest's behavior_types (importers derive it — BORIS from its
type column, the CSV from interval durations); falls back to inferring from
the stream's own durations for a legacy stream. name selects a stream;
default is the first behavior stream. Empty if none.
Source code in detail/api/recording.py
1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 | |
is_annotated_for(behavior, name=None)
¶
Whether the recording's annotation scored behavior (Section 3).
True iff behavior is in the stream's covered vocabulary — so a query
"miss" of it counts as a real false negative, not an unscored behavior.
A predicted stream never makes a recording eligible, whether it was named
or resolved (§19): a method scored against its own output measures nothing,
and the failure is silent because the numbers come out looking excellent.
Returns False rather than raising — this is an eligibility question, and
"not annotated for this" is the honest answer to it.
Source code in detail/api/recording.py
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 | |
stream_events(name)
¶
The stream's canonical rows, typed per its manifest dtypes (Section 3).
For a MED-PC events stream each row is (t_ns, code, label); for a
behavior interval stream (t_ns, end_t_ns, label, subject, start_frame,
end_frame); for a continuous stream (t_ns, *channels).
t_ns is stream-local: the manifest's alignment.offset_ns is not applied
here. For a video-anchored stream (video_frames / video_seconds, e.g.
behavior labels) that is already video time, because the offset of such a stream is
definitionally 0. For an external-clock stream it is the device's own time, and
stream_preview(name).events(aligned=True) is the accessor that maps it to video
time. The distinction matters to anything computing an offset — the sync-to-video
helper derives frame_t_ns - anchor_t_ns from these rows, and pre-aligned rows
would count the offset twice.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the stream's canonical file is absent. |
Source code in detail/api/recording.py
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 | |
stream_row_counts()
¶
{stream name: data rows} for every stream, None where its file is missing.
For a table that shows a count per stream: it reads each canonical file to the end
(a long sensor trace is seconds), so a GUI calls it off the UI thread. A stream whose
file is gone is None rather than raising, so one missing file costs its own row and
not the others' counts.
Source code in detail/api/recording.py
2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | |
stream_preview(name)
¶
A read-only accessor for previewing a stream (Section 3): its events in stream-local and video-aligned time, grouped for a timeline raster.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no stream with this name exists in the recording. |
Source code in detail/api/recording.py
2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 | |
set_stream_offset(name, offset_ns)
¶
Set the stream's constant alignment offset (signed ns; Section 3).
video_t_ns = stream_t_ns + offset_ns — positive if the stream began
after the video, negative if before. Applied at read time; the canonical
data is never rewritten.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no stream with this name exists, or it is on the video's own
clock ( |
Source code in detail/api/recording.py
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 | |
stream_dependents(name)
¶
Runs that build on this stream and would be orphaned by deleting it.
Aggregates every consumer registered for the stream's role in
STREAM_CONSUMERS. Empty today — no stage consumes streams yet — but a
future consumer registers there without editing this method, keeping the
deletion strategy (gui_design §1.1) uniform.
Source code in detail/api/recording.py
2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 | |
delete_stream(name)
¶
Remove a stream's directory + its recording.yaml entry (idempotent).
Source code in detail/api/recording.py
2099 2100 2101 | |
set_name(name)
¶
Rename the recording (id/dir unchanged) — the label every surface displays.
A name a user typed that is already taken is refused, not silently suffixed:
the tool quietly renaming what someone deliberately typed is the worse failure.
(The import path, where the tool proposes filenames and collisions are routine,
suffixes instead — Experiment.add_recording.)
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in detail/api/recording.py
2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 | |
reorder_video_parts(new_order)
¶
Reorder the video parts and re-offset global timestamps (Tenet 8).
Part order is the recording's time reference, so this applies only before
any processing run exists. new_order is the current part indices in
the desired sequence.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a processing run already exists (it was computed
against the current order), or |
Source code in detail/api/recording.py
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 | |
frame_t_ns(global_frame_idx)
¶
Video t_ns of a recording-global frame index (Section 3, Tenet 8).
Maps the continuous frame index (0 = first frame of part_001) to its
(part, local) position via the per-part active timestamp maps and
returns that frame's global t_ns. Powers stream→video alignment
(the "sync to video frame" offset = frame_t_ns(frame) - anchor_t_ns).
Raises:
| Type | Description |
|---|---|
IndexError
|
If |
Source code in detail/api/recording.py
2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | |
frame_timestamps()
¶
Concatenated global video t_ns per recording-global frame index.
One int64 value per frame across all parts (Tenet 8) — the timeline axis
for previews, and the inverse of frame_t_ns for a whole recording
without re-reading the maps per lookup. Empty when no video is imported.
Source code in detail/api/recording.py
2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 | |
get_frame(part_index, frame_idx)
¶
Decode a single RGB frame from a video part — inspection helper.
Intended for preview / inspection (e.g. arena drawing backdrop, GUI
thumbnails). Frame seeking is permitted here under Tenet 11's preview
exemption. Seeks through the part's timestamp map, so the frame returned
is the frame_idx-th in presentation order.
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Raises:
| Type | Description |
|---|---|
IndexError
|
If |
Source code in detail/api/recording.py
2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 | |
detection_preview(run_id)
¶
A read-only per-frame overlay accessor for a completed detection run (decode + boxes), for in-GUI preview without writing an annotated video.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no detection run with this id exists in the recording. |
Source code in detail/api/recording.py
2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 | |
tracking_preview(run_id)
¶
A read-only per-frame overlay accessor for a completed tracking run (decode + boxes colored by track id), for in-GUI preview.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no tracking run with this id exists in the recording. |
Source code in detail/api/recording.py
2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | |
run_dependents(module_id, run_id)
¶
Runs in this recording that build on run_id and would be orphaned by
deleting it — as (module_id, downstream_run_id) pairs.
Source code in detail/api/recording.py
2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 | |
delete_run(module_id, run_id)
¶
Remove a per-recording run's output directory + its recording.yaml entry.
The caller must ensure nothing depends on it (see run_dependents).
Idempotent: a missing directory or entry is skipped.
Source code in detail/api/recording.py
2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 | |
cancel_run(module_id, run_id)
¶
Stop a per-recording run: kill its worker (graceful-then-force, via the
run dir — works even after the GUI restarted) and record its real on-disk
status in recording.yaml. Returns that status — usually cancelled, but a
graceful stop keeps partial and a worker that already finished keeps
complete (so a done run isn't relabeled). Idempotent.
Source code in detail/api/recording.py
2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 | |
run(module_id, config)
¶
Run a processing module (§6.5): validate, submit, record, return a handle.
The single backbone behind every run_* stage method. The module
(detection / tracking / embedding, or a future stage)
owns validation, job construction, and the recording.yaml record shape.
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown |
ModelNotReadyError
|
If a model-backed stage's weights/credentials are not in place. |
Source code in detail/api/recording.py
2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | |
run_render_preview(tracking_run_id, track_ids, renderer_spec, n_sample_frames, save_as=None, seed=None)
¶
Sample N detections from the requested tracks and render each (Section 14).
Synchronous: blocks while N samples are decoded + rendered. Not an
executor job — no zarr, no recovery, no recording.yaml entry. save_as
writes source + rendered JPGs and preview.json to
embeddings/render_previews/<save_as>/ for inspection in any image
viewer.
Raises:
| Type | Description |
|---|---|
ValueError
|
For any failed pre-run validation. |
Source code in detail/api/recording.py
2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 | |
run_embedding(tracking_run_id, track_ids, model_id=None, renderer_spec=None, batch_size=32, compute=None, model_variant=None, constructor=None, readout=None, input_size=None, every_n_frames=None, *, align='none', keypoint_run_id=None, heading=None, max_gap_s=0.5, mirror_hold_s=1.0, facing_camera_ratio=0.5)
¶
Embed the selected tracks through the renderer + model (Section 14).
constructor is the name the renderer_spec was resolved from; passing it records the
constructor on the run so a constructor-axis comparison can read it (the spec alone does not
name it). renderer_spec None resolves the constructor per recording in validate,
which is the route an aligned run takes (the aligned canvas is sized from the turned
masks and the alignment step is inserted there). readout selects the feature read-out
and input_size the model input resolution (both recorded for the model / resolution
comparison axes). every_n_frames omitted inherits the tracking run's cadence.
§14 Egocentric alignment: align rotate / mirror turns each subject image so
the animal faces right, reading the heading from keypoint_run_id (a keypoint track run on
the same tracking run) through the saved heading definition heading; max_gap_s,
mirror_hold_s and facing_camera_ratio are its settings and part of the run's
identity. model_id omitted runs the configured default (EmbeddingConfig), and
renderer_spec and constructor both omitted render the default constructor.
Thin wrapper over run.
Source code in detail/api/recording.py
2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 | |
track_ids(tracking_run_id)
¶
Sorted track ids a completed tracking run produced (from its
tracks.zarr). [] when the run has no tracks summary yet.
A completed run's tracks.zarr is immutable, so the read is cached against
its mtime — the GUI reads this once per selected recording on every selection
change, and over many recordings the repeated zarr opens are the select-all lag.
Source code in detail/api/recording.py
2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 | |
embedding_preview(run_id)
¶
A read-only accessor for a completed embedding run (Section 14): run metadata, per-track coverage, a 2-D PCA of the embeddings, and the frame + model input behind any point.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no embedding run with this id exists in the recording. |
Source code in detail/api/recording.py
2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 | |
input_image_preview(tracking_run_id, renderer_spec, *, alignment=None)
¶
A read-only scrubber accessor: per source frame, the original frame and the model-input image a constructor produces for a track (Section 14).
alignment (§14) is the resolved alignment a run would record — align,
keypoint_run_id, heading_definition, heading_cutoff, max_gap_s,
mirror_hold_s, facing_camera_ratio — so the preview turns each input the way
the run will, and shows no input where the run would embed no row.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no tracking run with this id exists in the recording. |
Source code in detail/api/recording.py
2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 | |
resolve_constructor(constructor, tracking_run_id, track_ids, model_id=None, resize=None, input_size=None, canvas_px=None)
¶
Resolve a named input-image constructor to a concrete renderer_spec for
this recording (Section 14), computing the shared canvas from this recording's
masks when the constructor needs it — or taking canvas_px as given, which is
how an aligned preview passes the canvas sized from the turned masks (§14). The same resolution an embedding run
applies — use it to preview a constructor's inputs before launching.
model_id supplies the default resize target (the model's input size) so a
preview shows exactly the image the run will embed; input_size (the model
resolution knob) overrides that default, and resize overrides both.
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown constructor, or tracks with no detections. |
Source code in detail/api/recording.py
2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 | |
run_prompt_test(model_id, prompts, n_sample_frames, compute, save_as=None, seed=None, model_variant=None, display_classes=None, min_conf=0.0, on_result=None)
¶
Preview a detection model on M sampled frames and return per-frame results (Section 8).
Open-vocab models (SAM3) compare the N candidate prompts, one
result column each. A trained/imported closed-set model takes no prompt —
it previews its own classes; display_classes picks which (default: all),
one result column per class.
The model runs wide open, so every returned detection is a proposal with its own
confidence — filter the results at whatever threshold you want to look at.
min_conf applies only to the JPGs save_as writes, which can't be
re-thresholded once they exist.
Synchronous: blocks until the predictions complete. Not an executor job — no
zarr, no recovery, no recording.yaml entry. save_as writes overlay JPGs and
test.json to detections/prompt_tests/<save_as>/ for inspection.
Raises:
| Type | Description |
|---|---|
ValueError
|
For any failed pre-run validation. |
ModelNotReadyError
|
If the model's weights / credentials are not in place. |
Source code in detail/api/recording.py
2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 | |
run_detection(model_id, prompt, compute, conf_threshold=0.5, confirm_fn=None, model_variant=None, batch_size=None, every_n_frames=1)
¶
Detect on each video part with the given model + prompt (Section 7).
Thin wrapper over run.
Source code in detail/api/recording.py
2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 | |
run_tracking(detection_run_id, tracker_id=None, hyperparams=None, arena_ids=None, arena_name=None, every_n_frames=None)
¶
Link detections into tracks, optionally arena-filtered (Section 13).
Thin wrapper over run. every_n_frames omitted inherits the detection run's.
tracker_id omitted takes configs.tracking.DEFAULT_TRACKER, and hyperparams
omitted takes the chosen tracker's own defaults. Both are left out of the config
rather than passed as None: run does no None-stripping, and a None is
rejected by the model before validate can resolve it.
arena_name is the field of view by name, which is the same field of view on
every recording; arena_ids names this recording's own arena directly. Prefer the
name for anything that runs over more than one recording — an id is minted per
recording, so the same one is a different polygon on the recording next to it.
Source code in detail/api/recording.py
2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | |
run_keypoint_detect(detection, model_id, *, example_set_id=None, min_pose_confidence=None, model_variant=None, decode=None, side_rule=None, crop_px=None, every_n_frames=None, batch_size=None, compute=None)
¶
Place a skeleton's points on the animals of a detection run (§26
keypoint_detect): one row per pose instance, no subject — keypoint_track
gives each to a tracked subject.
detection is the detection run id. model_id names the method
(dinov3_match, which learns from example_set_id's marked frames, or a
distilled student, which keeps every pose at or above min_pose_confidence).
decode / side_rule / crop_px left unset are resolved against the
skeleton and written back to the run record; every_n_frames omitted inherits the
detection run's cadence. Thin wrapper over run.
Source code in detail/api/recording.py
2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 | |
keypoint_detect_run(run_id)
¶
A detect run's reader (§26): its record, skeleton, parts, instances, coverage.
Source code in detail/api/recording.py
2857 2858 2859 2860 2861 | |
keypoint_instances(run_id, part_id)
¶
Every pose instance a detect run placed in one video part, unassigned (§26
Analysis and export): {column: array} with frame_idx, t_ns, bbox,
confidence, detection_row, points, point_scores, candidates /
candidate_scores when kept and extras/<name>. Zero rows for a part where
nothing was placed.
Raises:
| Type | Description |
|---|---|
KeyError
|
|
Source code in detail/api/recording.py
2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 | |
run_keypoint_track(detect, method=None, config=None, *, tracking=None, match_min_inside=None, match_mask_grow=None)
¶
Give a detect run's instances to a tracking run's subjects and settle them over
time (§26 keypoint_track).
detect is the keypoint detect run id; tracking the tracking run whose
subjects the instances are assigned to — omitted, the one complete tracking run on
the detect run's detection run (several are refused, named). match_min_inside /
match_mask_grow left unset take the assignment's defaults. method omitted
takes the detect run's method's own default (dinov3_match: temporal_decode);
config holds the method's settings, every field of which is resolved and
recorded. CPU only, seconds per recording. Thin wrapper over run.
Source code in detail/api/recording.py
2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 | |
keypoint_track_run(run_id)
¶
A track run's reader (§26): record, skeleton, parts, rows, coverage.
Source code in detail/api/recording.py
2928 2929 2930 2931 2932 | |
keypoints(run_id, track_id)
¶
The final points of one track, every part — {part_id: {frame_idx, t_ns, points,
point_scores, changed}} (§26 Surfaces).
Source code in detail/api/recording.py
2934 2935 2936 2937 2938 2939 2940 | |
Analysis runs¶
An analysis run is experiment-level, over a selection of recordings. AnalysisRun is the base
every module's run handle shares; AuthoredRun adds the editable state that a run you keep
working on needs.
detail.api.experiment.AnalysisRun
¶
Bases: RunHandle
Run handle for an analysis run (§16); reconciles analysis.yaml's status
to the executor's terminal status on wait (the runner writes the full
record on success; a failure leaves the initial running record to fix up).
Source code in detail/api/experiment.py
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | |
detail.api.authored_run.AuthoredRun
¶
Bases: AnalysisRun
An analysis run whose result is authored in place after its compute finishes (§21).
inner (the executor handle) is present while the compute is in flight and None for a
run reached later to work on; every authored operation works either way.
Source code in detail/api/authored_run.py
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 | |
status
property
¶
The run's own status — open while it is being worked on, complete once
finished.
Read from the record rather than the executor handle, which only ever describes the
compute job: a run whose compute finished perfectly is open, because nobody has
said they are done with it.
artifact_stale
property
¶
Whether this run's §19 artifact is known not to match its authored state.
Set while a reprojection is in flight and cleared when it lands, so a reprojection that
dies — a transient share write, a kill — leaves the disagreement recorded instead of
silent. :meth:reproject is the way back.
data_sources()
¶
{recording_ids, embed_run_ids, embed_run_id, track_id, method} — the same keys
for every kind of authored run.
embed_run_ids is each recording's own embedding run, which is what a reader must
use; embed_run_id is set only when every recording's agrees.
Here, once, rather than per kind: a clustering run names its recordings
source_recording_ids and a query search_recording_ids, and a surface shared by
both (BROWSE) that asked the state by one of those names loaded nothing for the other.
A kind answers only which recordings it read (:meth:_recording_ids);
core.run_selection reads either shape of the embedding map.
Source code in detail/api/authored_run.py
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | |
finish_blocker()
¶
Why this run cannot be finished yet, naming the fix, or None when it can.
Finishing says the authoring is done, so a run whose result still lacks the decision it is made of — a behavior scan's cutoff, a clustering run's first label — refuses. Finished anyway, its AUDIT told the user to make that decision and to reopen the run, at once.
The one wording of each kind's rule: :meth:finalize raises it, the CLI prints it, and
a surface greys its Finish with it in words before it is pressed. A kind overrides
this; tests/api/test_run_lifecycle_parity.py holds every kind to having decided.
Cheap — one read of the run's state — because a surface asks it on the UI thread.
Source code in detail/api/authored_run.py
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | |
finalize(*, progress=None)
¶
Mark the run finished — the user's statement that they are done, and pin the artifact.
The artifact is unchanged: it already says what the state says. What finalize adds is a
snapshot of it (§21), because "I am done" is the moment a result is most likely to be
cited, and reopen() is one call away — a statement that can move out from under a
number somebody has already read is not a statement.
Long when edits have deferred frame views (see :meth:pin), so it reports through
progress(stage, fraction, detail).
Raises:
| Type | Description |
|---|---|
ReadOnlyRunError
|
on a snapshot view, before anything else is asked. |
ValueError
|
if the compute did not finish ( |
UserInputError
|
:meth: |
Source code in detail/api/authored_run.py
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | |
reopen()
¶
Move a finalized run back to open so it can be worked on again.
The counterpart to finalize being a statement rather than a lock (§21) — without it
the soft lock would be a hard one.
Source code in detail/api/authored_run.py
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | |
pin(*, reason, progress=None)
¶
Freeze the working artifact and return the snapshot id.
Returns the existing snapshot when the artifact has not changed since the last pin, so
exporting the same run twice yields one snapshot rather than two, and None when the
run has no artifact to pin (a fit whose granularity is unset — §21).
Brings the frame views current first: a snapshot copies them and is never rewritten, so
this is the last moment they can be. That rebuild is the long part, and the only one that
reports through progress.
Source code in detail/api/authored_run.py
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | |
snapshots()
¶
Every pinned copy of this run's artifact, oldest first.
Source code in detail/api/authored_run.py
1383 1384 1385 1386 1387 1388 1389 | |
snapshot(snapshot_id)
¶
One snapshot's record — what it was taken for, and the state behind it.
Source code in detail/api/authored_run.py
1391 1392 1393 | |
view(snapshot_id)
¶
This run as it was when snapshot_id was pinned — read-only (§21).
Everything that reads the run reads the frozen state and the frozen artifact instead; every
write refuses. Returns None when the module declares no view class.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run has no such snapshot. |
ValueError
|
If the snapshot recorded no state. Snapshots pinned before a comparison
pinned through the run handle carry |
Source code in detail/api/authored_run.py
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | |
snapshot_interpretation(record)
¶
Summarize one snapshot record in this module's own terms.
The default says nothing rather than guessing: a module that has not declared how it interprets a snapshot shows the columns every snapshot has (when, why, how many instances, what used it) and no invented ones. Overriding is how a module earns its own.
Source code in detail/api/authored_run.py
1426 1427 1428 1429 1430 1431 1432 1433 | |
instance_placements()
¶
{cluster_id: {recording_id: [placement, ...]}} — where each instance was, and
which instance it was, or None when this run has no positions at all.
A placement is a dict with instance_id, cx, cy, subject, t_ns and
end_t_ns — enough for a surface to turn a clicked dot back into the thing it stands
for. :meth:instance_positions is the coordinates-only view of this, derived rather
than read a second time.
Identity is carried rather than recomputed on purpose. instance_id is a hash of
(recording_id, subject, source_label, t_ns, end_t_ns), and for a pose run the
artifact's end_t_ns is the end of the row run while member_clips reports the
one row, end_t_ns == t_ns. (It used to extend the row by its sampling period, as a
preview "with duration" — which a player reading both ends inclusive turned into the
row plus the next frame, and a thumbnail at the span's middle into the next frame
alone.) Rebuilding the hash from a clip would therefore miss for pose and match for
temporal, silently and only on one module.
Source code in detail/api/authored_run.py
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | |
instance_positions()
¶
{cluster_id: {recording_id: [(cx_norm, cy_norm), ...]}} — where each instance was,
or None when this run has no positions to report at all.
On the base rather than on one run class, because every §19 producer writes the same
artifact and the surfaces that read it are shared. It lived on TemporalClusteringRun
alone, and ClusterWorkspace — which pose and behavior clustering both use — reached
for it with getattr(run, "instance_positions", None). A run type that never
implemented it was then indistinguishable from a run that had no positions, and both
silently hid the map: pose clustering shipped without the spatial map the other
clustering pages had, and nothing anywhere said so.
None is the actionable state — the run predates §14's kinematics/ and
recording backfill-kinematics fills it in. {} means there were positions but
none landed in a cluster, which needs no action and no sentence.
Grouped here rather than in the widget because it is a fact about this run's artifact, not about how a panel is laid out (§22: the method answers, the surface renders).
Source code in detail/api/authored_run.py
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | |
snapshot_artifact(snapshot_id)
¶
The frozen §19 artifact a snapshot holds.
Read from the snapshot rather than re-derived from its recorded state: re-deriving under later code is exactly what makes an old result unreproducible (§21).
Source code in detail/api/authored_run.py
1511 1512 1513 1514 1515 1516 1517 1518 1519 | |
coverage_summary()
¶
Per recording: how much of the video was analysed, and how much of that is labelled.
{recording_id, video_ns, analysed_ns, in_instance_ns} — two ratios a user reads
together, because one number cannot say which step lost a frame: analysed / video
is tracking and embedding, in_instance / analysed is this run. Read from
:meth:artifact, so a snapshot view reports its frozen numbers.
video_ns is None when the recording has no timestamp map. Instance time uses
:func:behavior_output.instance_ns, the rule the cluster table and measures use, so the
three agree.
Source code in detail/api/authored_run.py
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | |
reproject(*, progress=None)
¶
Rebuild the §19 artifact from the stored compute output and the current state.
Every edit already does this; it is public for the case where the artifact and the state
disagree — a crash between the two writes — since §19's rule for a materialized view is
to regenerate rather than to reconcile. Long (a shard read and a frame-view zarr per
analyzed unit), so it reports through progress(stage, fraction, detail).
Source code in detail/api/authored_run.py
1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 | |
bring_frame_views_current(*, progress=None)
¶
Rebuild the frame views the last edits deferred; return how many were rebuilt.
An edit writes the intervals and leaves the per-frame views, which are most of a
reprojection's cost and read by none of the surfaces an edit refreshes (#325). Anything
that reads them — measures, a pin, an export — calls this first, and a reader that did not
gets FrameViewsPendingError rather than a stale view. Free when nothing is pending;
otherwise one zarr per recording the edits actually moved, reported through
progress(stage, fraction, detail).
Under the edit lock, so it cannot interleave with an edit that is moving the intervals under it.
Raises:
| Type | Description |
|---|---|
ResultsOutOfDateError
|
the last edit was saved but its reprojection did not land
(:attr: |
Source code in detail/api/authored_run.py
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | |
audit_labels()
¶
Every label path the audit can address — each label present, and each above it.
A parent appears even when no instance reports it directly (every member sits under a sub-label), because its precision is still a question: it is scored over everything under it. Ordered so a parent precedes its sub-labels, which is how a surface nests them.
Source code in detail/api/authored_run.py
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | |
audit_precision(*, label=None, path=None, cutoff=None, own_only=False)
¶
The precision the audit supports, with its interval, its n and its coverage.
The reader of the earlier one-by-one audit (audit.csv), which nothing writes any
more: the review of every clip replaced it (review_precision). Kept so a run audited
before keeps the figure that audit bought.
None when nothing has been audited — the caller says "no reliability estimate" and
never substitutes one. A returned precision of None with a reason is the
other refusal: the audit no longer covers enough of this run to speak for it
(:func:~detail.storage.behavior_audit.decision_coverage).
path asks about one label of a nested vocabulary, over every instance under it. Where
the run's clusters are known (a clustering run with a node cache) the estimate is
stratified by cluster — each cluster's precision weighted by its share of the label —
because the draw gives undecided clusters more than their share. A label whose clusters
changed after it was audited counts only judgments made since (membership_changed_at);
the result says so in since.
Read from _audit_dir(), so a snapshot reports its own frozen audit rather than the
live run's — the mix that seam exists to prevent.
Source code in detail/api/authored_run.py
1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 | |
audit_by_cluster(*, path=None, own_only=False)
¶
Each labelled cluster's precision with its 95% confidence interval (§19, clusters).
[{node, label, path, size, share, estimate, answers}] — the question a user asked by
picking the cluster: is it as pure as they thought? The audit reports the interval; the
answer is the reader's. path is the label path the cluster carries; size its
instances; share its part of its label's instances; answers counts what its judged
clips were
answered as, in the words of the buttons (answer_text), which is what says what an
impure cluster is instead. The path argument limits it to clusters under one label;
None gives every labelled cluster, which INTERPRET draws on its tree.
Every judgment a cluster has counts here, before or after a label edit: the figure is about the cluster, and the cluster did not change. Empty where clusters are not known.
Source code in detail/api/authored_run.py
1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | |
audit_precision_by_recording(*, label=None, path=None, cutoff=None, own_only=False)
¶
The same estimate split per recording — where one cutoff behaves differently in different animals, which an overall figure hides completely (§20).
Source code in detail/api/authored_run.py
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | |
audit_decisions()
¶
Every standing decision — one row per instance, the most recent judgment about it.
AuditRow.decided separates "judged unclear" from "never looked at"; both carry
human_label of None.
Source code in detail/api/authored_run.py
2027 2028 2029 2030 2031 2032 2033 2034 2035 | |
detail.api.query.QueryRun
¶
Bases: QueryReviewOperations, AuthoredRun
Handle for a Query run. inner (the executor handle) is present while the search is
in flight and None for a run reached later to calibrate; every calibration operation
works either way.
Source code in detail/api/query.py
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
snapshot_interpretation(record)
¶
A snapshot of this run is its behaviors and the cutoff each was calibrated to (§20).
A cutoff is what a Query run authors, the way a granularity is what a clustering run
authors — "which cutoff did I ship?" is the question a pinned result has to answer. A
behavior with cutoff: None has been searched and not calibrated, which is why the count
of calibrated ones is its own column rather than folded into the total.
Source code in detail/api/query.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
finish_blocker()
¶
Why this run cannot be finished yet, naming each behavior with no cutoff, or None.
AuthoredRun.finish_blocker for a behavior scan. Finishing says the calibration is
done, and a behavior with no cutoff has none: it is absent from the artifact and its
review has no clips to cover. A run finished that way showed an Audit telling the user
to set a cutoff on Calibrate and to reopen the run, at once. AuthoredRun.finalize
raises it after the read-only and incomplete-search refusals. One read of query.yaml.
Source code in detail/api/query.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
state()
¶
The whole authored state — behaviors, method, searched recordings.
Through _read_state rather than reading the file, because that is the seam a snapshot
view replaces (§21). Reading the run directory here bypassed it, so a pinned calibration
rendered the live cutoffs and names under a banner saying "Read-only" — the frozen
instance list beside them making it look internally consistent.
Source code in detail/api/query.py
203 204 205 206 207 208 209 210 211 | |
behaviors()
¶
The run's behaviors, each with its id, name, example clips and cutoff.
Source code in detail/api/query.py
213 214 215 | |
load_results(behavior_id, progress=None)
¶
Load this behavior's search results and extract their candidates, once.
Returns {(recording_id, subject): SearchResult} for the units whose search
completed; a unit whose shard is absent (its search failed or was interrupted) is
simply not in the map, which is what lets the rest still be calibrated.
The extraction is forced here, not left to the first reader. A method caches its
candidate list on the result object, so whoever touches it first pays for the whole
thing — and that is the one genuinely sized step in calibration. Doing it behind a
named call with a progress callback is what lets a surface show a bar instead of
freezing on whichever read happened to come first.
progress(stage, fraction, detail) matches the synchronous long-op shape the CLI's
_StageProgress and the GUI's run_progress both drive.
Source code in detail/api/query.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
candidates_at(behavior_id, cutoff)
¶
{(recording_id, subject): [QueryCandidate]} at cutoff — without
committing it.
What a calibration surface shows while the user is still deciding: the matches a setting would yield, read off the warmed results rather than by reprojecting. Keeping this on the handle is what stops a view from having to know where a shard lives or how a method is resolved.
Source code in detail/api/query.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
score_distribution(behavior_id, *, bins=20)
¶
{recording_id: (counts, edges)} over every candidate's confidence.
§20 requires the per-recording distributions to be always visible, because a single cutoff that keeps most of one animal's behavior and little of another's biases the result along the very axis being compared — and a pooled curve cannot show it. Histograms of the candidates, not of the instances at some cutoff: the point is to see where each recording's mass sits before choosing one.
Every searched recording gets an entry, including one whose search returned nothing — an absent row would read as "not searched", which is the distinction coverage exists to preserve.
Source code in detail/api/query.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
recording_duration_ns(recording_id)
¶
Full video duration of a searched recording, in nanoseconds.
The x-axis extent a timeline is drawn against, so a mark's position reflects where in the whole recording it falls rather than where it falls among the matches.
Source code in detail/api/query.py
309 310 311 312 313 314 315 316 317 318 319 320 321 | |
frequency_curve(behavior_id, *, steps=41, progress=None)
¶
How many instances each cutoff returns — the calibration view's whole basis.
Without ground truth there is no score to optimize, so choosing a cutoff means looking
at what each setting returns. This is that, as data: [{cutoff, n_instances, capped},
...] over steps evenly spaced cutoffs in [0, 1].
Instance count is not guaranteed monotonic in the cutoff (§20): a method that re-forms extents can split one instance into two as the cutoff tightens. So this reports what it measures and no caller may assume a shape.
capped says the method's own candidate limit bound that point. §20 requires it:
"a curve that flattens because storage ran out looks exactly like a curve that
flattens because the animal stopped."
Cheap because instances_at is a slice of one cached extraction rather than a fresh
search — before that it was quadratic per point and a slider drag cost minutes.
Reads the results load_results warmed, so building the curve a second time (a
second behavior, a redraw, a reopened view) costs no disk and no extraction.
Source code in detail/api/query.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
artifact()
¶
The §19 behavior artifact this run currently states.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the search never completed, so there is nothing to state. |
Source code in detail/api/query.py
367 368 369 370 371 372 373 | |
set_cutoff(behavior_id, cutoff, *, progress=None)
¶
Set (or clear, with None) one behavior's confidence cutoff, and reproject.
A cutoff of None is not zero. An uncalibrated behavior is absent from the
artifact rather than present with no rows, because §19 reads a vocabulary entry with
no rows inside coverage as a real zero — "we looked and it never happened" — which is
a different claim from "nobody has chosen a threshold yet".
Reprojects, which reads a shard and rewrites a frame-view zarr per searched unit —
real work on a cohort, so progress(stage, fraction, detail) is driven throughout
and every caller is expected to render it.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the run is finalized, or the cutoff is outside |
KeyError
|
If no behavior carries that id. |
Source code in detail/api/query.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
name_behavior(behavior_id, name, *, progress=None)
¶
Rename one behavior, and reproject.
The id never moves (§19 hashes it into every instance_id, which audit decisions
are keyed by), so a rename re-points the label and leaves every recorded judgment
attached to what it was made about.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the run is finalized, the name is blank, or another behavior in this run already carries it. |
KeyError
|
If no behavior carries that id. |
Source code in detail/api/query.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
export(out_dir, *, progress=None)
¶
Write one per-recording behavior-stream CSV into a new folder under out_dir;
return that folder. Each export gets its own, so a second one never replaces the first.
§19's deliberate, user-initiated re-ingest: the artifact is never auto-written into a
recording's streams/, because keeping the prediction/ground-truth boundary
structural is what makes the leakage rule enforceable rather than remembered. Each row
carries origin: predicted, so re-importing one can never read back as ground truth.
One CSV per searched recording, including recordings with no instances — an empty file is the honest statement for a recording that was searched and matched nothing.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the run carries no artifact yet. |
ValueError
|
If the search did not reach every unit (cancelled, or a behavior's search failed on one) — the message names them; re-run the search. |
UserInputError
|
If no behavior has a cutoff yet (nothing is calibrated). |
The artifact is pinned first and the CSVs are written from the pinned copy (§21), so
an exported file always corresponds to a snapshot still on disk: reopening the run and
re-cutting it afterwards cannot leave the export describing something unfindable. Pinning
brings deferred frame views current, the one long step, reported through progress.
Source code in detail/api/query.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
detail.api.temporal_clustering.TemporalClusteringRun
¶
Bases: ClipReviewOperations, ClipEditOperations, LabelOperations, NodeCacheMixin, AuthoredRun
Handle for a temporal-clustering run.
inner (the executor handle) is present while the fit is in flight and None for a run
reached later to interpret; every interpretation operation works either way.
Source code in detail/api/temporal_clustering.py
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
snapshot_interpretation(record)
¶
A snapshot of this run is the labels it carried (§22).
Source code in detail/api/temporal_clustering.py
74 75 76 | |
state()
¶
The whole authored state: labels, the cache floor, and the fit's resolved inputs.
Source code in detail/api/temporal_clustering.py
103 104 105 106 | |
finish_blocker()
¶
Why this run cannot be finished yet — no behavior carries a label — or None.
AuthoredRun.finish_blocker for a clustering run. A fit is a tree nobody has read
until a node is labelled: no instance in the output carries a label, so AUDIT has
nothing to review and BROWSE nothing to show. A run finished that way showed an AUDIT
saying "label a node on INTERPRET" over an INTERPRET saying "this run is finished,
reopen it".
Counted from the stored resolution (named_count), which a run written before labels
lived on nodes reports too, so a legacy run with names is not refused. One read of the
state file, no fit.
Worded in the screen's noun: INTERPRET calls a node of this tree a behavior
(TEMPORAL_TERMS), and tests/gui/test_temporal_workspace.py holds every word it
shows to that, this sentence included.
Source code in detail/api/temporal_clustering.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
subsample_note()
¶
What the fit left out, in a sentence, or None if it compared every bout.
§22 requires the interpretation surface to state a subsample. A fit capped by
max_segments looks exactly like a full one — same clusters, same table, same
confident-looking scatter — so this is the only thing standing between a user and a
vocabulary quietly built on a fraction of their data.
Source code in detail/api/temporal_clustering.py
137 138 139 140 141 142 143 144 145 | |
instances()
¶
Every instance the current interpretation yields.
Reads the projected artifact rather than recomputing: the artifact is what every other reader sees, so a browse list built from a second computation could disagree with it.
Source code in detail/api/temporal_clustering.py
147 148 149 150 151 152 153 | |
artifact()
¶
The §19 behavior output this run currently projects.
Source code in detail/api/temporal_clustering.py
155 156 157 | |
hierarchy()
¶
This fit's merge tree — the :class:ClusterTree a surface draws (§22).
Asked of the handle rather than reached for past it, which is the layering §22 states
("the module never looks inside a fit"). node_view is what a surface reads a node
through; this is the bare tree it indexes.
Source code in detail/api/temporal_clustering.py
171 172 173 174 175 176 177 178 | |
export(out_dir, *, progress=None)
¶
Write one per-recording behavior-stream CSV into a new folder under out_dir;
return that folder. Each export gets its own, so a second one never replaces the first.
§19's deliberate, user-initiated re-ingest: the artifact is never auto-written into a
recording's streams/. Each row carries origin: predicted, so re-importing one can
never read back as ground truth.
The artifact is pinned first and the CSVs are written from the pinned copy (§21), so
an exported file always corresponds to a snapshot still on disk: reopening the run and
re-cutting it afterwards cannot leave the export describing something unfindable. Pinning
brings deferred frame views current, the one long step, reported through progress.
Source code in detail/api/temporal_clustering.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
Results¶
detail.api.measures.Measures
¶
The measures of one analysis run's behavior artifact.
Source code in detail/api/measures.py
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
table(*, windows=None, measures=None, progress=None)
¶
The tidy table: one row per (recording, subject, label, window, measure).
windows defaults to the whole coverage span. A sub-window needs the producer's frame
view -- coverage.csv says how much time was observed and not where -- and
measure_run refuses rather than dividing by the recording's total.
progress(stage, fraction, detail) reports the one long step: rebuilding frame views
that edits since the last read deferred.
Source code in detail/api/measures.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
export(out_dir, *, windows=None, measures=None, progress=None)
¶
Write measures.csv, frames.csv and measures.yaml into a new folder under
out_dir; return that folder. Each export gets its own, so a second one — another
window rule, another run — never replaces the first (#29).
The frame table is the reason this is an export rather than a single file: the frame view is zarr, so a per-frame classification is not otherwise readable outside this tool. The instance table is deliberately not copied -- the artifact already writes one beside the run, and a second copy is two files that can disagree.
Source code in detail/api/measures.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
detail.api.comparison.Comparison
¶
Handle for a saved comparison: read its record, check drift, export tables and figures.
Source code in detail/api/comparison.py
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 | |
record()
¶
The saved record.
Raises:
| Type | Description |
|---|---|
UserInputError
|
no comparison with this id (a mistyped |
Source code in detail/api/comparison.py
910 911 912 913 914 915 916 917 918 919 920 921 | |
ranking()
¶
This comparison's ranking with its floor, re-ranked from its stored observations
through comparison_report.rank_record — the one record → ranking mapping (§22) — or
None where there is nothing to rank. Seconds over a large family: call it off the
UI thread.
Source code in detail/api/comparison.py
923 924 925 926 927 928 929 930 931 932 933 | |
kept_nodes(alpha=None)
¶
The node ids a node screen kept, in rank order — what the filter dock turns into
leaves — at the strictness alpha, or its own floor. Empty for a labels comparison,
or a screen that kept nothing. Ranks; a caller already holding :meth:ranking passes
it to :func:kept_nodes_of instead.
Source code in detail/api/comparison.py
935 936 937 938 939 940 | |
drift()
¶
What changed since this was run — edited labels, a swapped video, moved code, or the source analysis being re-interpreted.
A stale comparison is indistinguishable from a current one by looking at it, which is why every surface that renders these numbers checks (§18.5). None of it means the stored numbers are wrong: they were measured from a pinned snapshot and stay exactly reproducible (§21). What drift says is that a re-run would not match them.
Source code in detail/api/comparison.py
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 | |
export(out_dir=None, *, formats=DEFAULT_FORMATS, style=None, theme=None, progress=None)
¶
Write the publication tree (tables + figures + summary + manifest); return the manifest.
Defaults into the comparison's own directory, because §24 makes a comparison a saved object holding its outputs rather than a record pointing at a separate export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_dir
|
Path | str | None
|
where to write; the comparison's own folder when omitted. |
None
|
formats
|
tuple[str, ...]
|
the figure formats to write. |
DEFAULT_FORMATS
|
style
|
FigureStyle | None
|
the figure style (default :data: |
None
|
theme
|
str | None
|
|
None
|
progress
|
Callable[[str, float, str], None] | None
|
|
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in detail/api/comparison.py
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 | |
Machine-global catalogs¶
These take no experiment: the model catalog is per machine, and a tool run is saved outside any experiment.
detail.api.models
¶
Experiment-independent machine-global model catalog (Section 5).
Built-in models (the MODELS / EMBEDDING_MODELS registries) and
machine-global imported weights are not experiment state — readiness, install, and
the imported catalog are all shared across experiments. This is the experiment-free
surface the GUI's top-level Models tab uses; Experiment's model methods
delegate here. Backend imports stay lazy (Tenet 13): importing this module pulls
in no torch / ultralytics / sam3.
list_models()
¶
All machine-global models — built-in (every role in MODEL_REGISTRIES) + imported.
Source code in detail/api/models.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
model_readiness(model_id, variant=None)
¶
Proactive readiness for a model — drives the 'check access' UI. Imported models are on disk by definition (no repo/token), so they are always ready; only built-ins consult their cache/credentials.
variant selects the size to answer for (the model's default when omitted).
Source code in detail/api/models.py
325 326 327 328 329 330 331 332 333 334 335 336 | |
is_installed(model_id, variant=None)
¶
Whether a model's weights are on this machine — a cheap, no-network check,
and the authoritative one: a run's pre-flight gates on it, because load() will
not download. Imported models are on disk by definition; every built-in answers
for itself via DetectionModel/EmbeddingModel.is_installed (§5).
Answers for variant (the model's default when omitted) — the run gates on the
variant it was configured with, so a variant-blind answer here is a false green.
Source code in detail/api/models.py
353 354 355 356 357 358 359 360 361 362 363 364 | |
install_model(model_id, progress_cb=None, *, variant=None)
¶
Ensure a built-in model's weights are present; raises ModelNotReadyError if blocked.
variant picks the size to download. Each variant is a separate download, so
installing one leaves the others absent — installing the default does not make a
run configured for another size runnable.
Source code in detail/api/models.py
339 340 341 342 343 344 345 346 347 348 349 350 | |
import_model(weights_path, *, family=None, skeleton=None, name=None, made_by=None, description=None, notes=None, preview=None)
¶
Import an external Ultralytics checkpoint into the machine-global catalog (usable in
any experiment). Class names and the task are read from the checkpoint; the task decides
whether it lands as a detection or a keypoint model (§12 Keypoint models in the
catalog). family is optional and, when given, is checked against the task.
A pose checkpoint needs skeleton — a preset id, a library id, a skeleton YAML, a
Skeleton or its dict — with the checkpoint's number of points and left/right pairs
matching its flip_idx; it is added to the skeleton library unless one with its digest
is there. made_by / description / notes / preview are captured so the
model isn't 'lost in a folder' (§12). Returns the assigned id.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
|
UserInputError
|
|
ValueError
|
Unknown family or one that disagrees with the task, an unknown skeleton, a pose checkpoint without a fitting skeleton, a skeleton for a detection checkpoint, a class-less checkpoint, or an id collision. |
Source code in detail/api/models.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
remove_imported_model(model_id)
¶
Delete a machine-global imported model (raises if absent).
Also deletes a catalog folder an import cut short left behind (no model.yaml,
:func:imported.unfinished): it is no model, but it blocks its name, and nothing else
could delete it. Only a name in either listing is deleted, so an id is never a path.
Source code in detail/api/models.py
738 739 740 741 742 743 744 745 746 747 748 749 750 | |
detail.api.tools
¶
Machine-global Tools API (§27) — the experiment-free entry point for one-off runs.
A tool runs synchronously and saves a managed run under the machine-global tools
workspace (storage/tool_runs.py). This module is the surface the CLI and GUI both
drive: it resolves the tool, allocates a run directory, runs it (recording
running → complete/failed on the manifest), and lists / reads / deletes past runs.
Experiment-free, so it is a module of functions (like api/models.py), not a class.
list_tools()
¶
Every registered tool, ordered by id.
Source code in detail/api/tools.py
32 33 34 35 36 37 38 | |
run_tool(tool_id, config, *, progress=None, stop_check=None)
¶
Run a tool and record its managed run; return the final manifest.
The manifest is written running before the work starts (so a crash leaves a
visible record), then complete with the result — stopped when the user ended
it early (the partial output is still there and still openable), or failed with
the error, re-raised for the caller to surface.
Raises:
| Type | Description |
|---|---|
ValueError
|
Unknown |
Source code in detail/api/tools.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
list_tool_runs(tool_id=None)
¶
All tool-run manifests (one tool or every tool), ordered by run id.
Source code in detail/api/tools.py
128 129 130 | |
read_tool_run(run_id)
¶
One tool-run manifest by id (raises FileNotFoundError if absent).
Source code in detail/api/tools.py
133 134 135 | |
delete_tool_run(run_id)
¶
Delete a tool run by id (idempotent).
Source code in detail/api/tools.py
138 139 140 | |