Outputs ======= ``dirconn-bids BIDS_DIR OUTPUT_DIR participant`` writes a BIDS derivatives dataset to ``OUTPUT_DIR/dirconn`` (layout version 1, :doc:`decisions/0003-derivatives-layout`) and keeps its intermediate files in the work directory (``--work-dir``, default ``OUTPUT_DIR/work``). The tree -------- .. code-block:: text OUTPUT_DIR/ dirconn/ dataset_description.json dirconn.toml configuration of the first run sub-01.html report of subject 01 logs/ CITATION.html, .md, .tex, .bib methods text of the dataset run-20261117T094834-12184/ one directory per run dirconn.log progress.jsonl crash-.txt one per failed task crash-report-.txt one per report that failed provenance.json environment-lock.txt dirconn.toml effective configuration of this run sub-01/ figures/ sub-01_desc-summary_overview.json subject-level reportlets sub-01_desc-summary_errors.json eeg/ sub-01_task-rest_run-1_desc-gc_conn.nc sub-01_task-rest_run-1_desc-gc_conn.json sub-01_task-rest_run-1_desc-gc_edges.tsv sub-01_task-rest_run-1_desc-trgc_conn.nc controls.time_reversal = true sub-01_task-rest_run-1_desc-trgc_conn.json sub-01_task-rest_run-1_desc-trgc_edges.tsv figures/ sub-01_task-rest_run-1_diagnostics.json sub-01_task-rest_run-1_desc-gc_matrix-alpha.json reportlets of the report sub-01_task-rest_run-1_desc-gc_matrix-alpha.svg (a figure, when it has one) sub-02/ ses-01/ only when the input has a session eeg/ ... work/ prepared-.npz prepared-series cache prepared-.json File names carry the entities of the input recording in the order ``sub ses task run``, then ``desc-`` (the name in ``estimation.methods``, or ``trgc`` for the time-reversal control), then the suffix. The data type directory is that of the input. Dataset files ------------- ``dataset_description.json`` and ``dirconn.toml`` are written by the first run, when they do not exist yet, and are never rewritten. The description has ``Name`` ``"dirconn derivatives"``, ``BIDSVersion`` ``"1.9.0"``, ``DatasetType`` ``"derivative"``, one ``GeneratedBy`` entry (``Name`` ``"dirconn"``, ``Version``, ``CodeURL`` and, inside the Docker image, ``Container`` with ``Type``, ``Tag`` and ``Revision``) and ``"Dirconn": {"DerivativesVersion": "1"}``, which marks the dataset as a connectivity output, so it is never taken for an input. ``dirconn.toml`` is the configuration that later runs are checked against (see :doc:`usage`); it can be passed back with ``--config``. One result ---------- Each method gives three files per recording. ``_conn.nc`` The full result, a :class:`~dirconn.Connectivity` in NetCDF4 with the axes ``source``, ``target``, ``freq`` and ``time`` and its whole provenance (method, parameters, assumption checks, data history). It is the source of truth; read it with :meth:`dirconn.Connectivity.from_netcdf`. ``values[i, j]`` is the influence of node ``i`` on node ``j``. Excluded frequencies (``estimation.exclude_freqs``) are NaN. ``_conn.json`` The sidecar, readable without dirconn: .. list-table:: :header-rows: 1 :widths: 25 75 * - Field - Meaning * - ``Measure`` - Method name recorded in the provenance. * - ``Directed`` - Whether ``values[i, j]`` and ``values[j, i]`` differ in general. * - ``Estimator`` - The ``desc`` entity. * - ``Parameters`` - The estimator's parameters, as recorded in the provenance. * - ``NodeLabels`` - Node names, in the order of both axes. * - ``NodeKinds`` - Kind of each node, in the order of ``NodeLabels``: ``cortical`` or ``direct`` for region-level inputs, ``sensor`` for sensor-level ones. * - ``Bands`` - Band name to ``[low, high]`` in Hz; empty for a method without frequency resolution. * - ``SamplingFrequency`` - Sampling rate in Hz of the prepared series the result was estimated on (after ``prepare.resample_hz``). * - ``Description`` - The orientation of the matrix, in words. * - ``Sources`` - Input files, relative to ``BIDS_DIR`` (absolute when outside it). * - ``Statistics`` - One entry per test: ``Band`` (``"broadband"`` for a method without bands), ``Test`` (``"surrogate"``, ``"analytic"`` or ``"builtin"``), ``Generator`` (``name``, the null hypothesis ``null`` and ``params``, for example the block size), ``NSurrogates``, ``Seed`` and ``ObservedHistory``, the data history of the observed value (with the block counts for block shuffling). The analytic test gives a single ``"broadband"`` entry with ``Generator`` ``{"name": "analytic"}`` and ``NSurrogates`` and ``Seed`` ``null``. The built-in test of ``pcmci`` and ``te`` gives a single ``"broadband"`` entry with ``Generator`` ``{"name": "builtin", "source": ...}``. Empty when ``statistics.test = "none"`` or when the result was not tested (``StatisticsNote``). No arrays are stored here. * - ``StatisticsNote`` - Present when a test was configured but the result was not tested, with the reason: a time-resolved result on a continuous record, where block shuffling has no time points of the result. * - ``ValueIsMagnitude`` - Present for complex-valued measures: the edge table holds magnitudes. * - ``TaskKey`` - Key of the task that wrote the result; a later run skips the task when it matches. * - ``DirconnVersion``, ``DerivativesVersion`` - Version of dirconn that wrote the file, and of the layout (``"1"``). ``_edges.tsv`` Written when ``output.long_table`` is on: one row per ordered pair of distinct nodes and band, tab-separated, with the columns =============== ============================================================================== ``source`` Node the influence comes from. ``target`` Node it goes to. ``band`` Band name; ``broadband`` for a method without frequency resolution. ``value`` The band value (magnitude for complex measures). ``p`` Raw p-value of the band's test. ``p_adj`` Corrected p-value (``statistics.correction``). ``significant`` ``True`` when ``p_adj < statistics.alpha``, else ``False``. =============== ============================================================================== The test columns are ``n/a`` without a test (``statistics.test = "none"``, and always for ``desc-trgc``). :func:`dirconn.io.derivatives.read_edges` reads the table with ``n/a`` as NaN. A time-resolved result (``adtf``, ``tpdc``, ``wdtf``) has one row per pair, band and time point, with a ``time`` column (seconds) after ``band``; its correction runs over pairs and time points together. On a continuous record with block shuffling (the default) it is not tested and its test columns are ``n/a`` (``StatisticsNote`` in the sidecar): block shuffling fits the observed value on 5 s blocks, whose time points are not those of the result. Should a test with another shape reach the writer, its columns stay ``n/a`` too; ``PValueShape`` in the sidecar's ``Statistics`` shows the shape the test had. A frequency-resolved result without bands gives a table with the header only; the NetCDF file has the values. The three files are written in the order ``_conn.nc``, ``_edges.tsv``, ``_conn.json``. The sidecar is written last and atomically: its ``TaskKey`` marks the result as complete, so a task that stopped before it is run again. The controls of a recording --------------------------- The ``controls`` task of every recording writes * ``figures/_diagnostics.json``: ``valid_fraction`` (share of valid samples after preparation), ``n_trials``, ``n_times``, ``sfreq``, ``channel_std`` (standard deviation of each channel over its valid samples, ``null`` for a channel without any), ``spectral`` (the spectral dynamic range per channel and band, ``null`` when ``controls.spectral_range_check`` is off), ``checks`` (the assumption checks drawn from it, with ``name``, ``status``, ``detail`` and ``value``) and ``task_key``; * with ``controls.time_reversal``, the ``desc-trgc`` result (time-reversed Granger causality, no tests), written after the diagnostics. The report and the methods text ------------------------------- ``sub-XX.html`` The report of subject ``XX`` (:doc:`report`), written after every participant run and by ``--reports-only``. One self-contained file; it is built from the other files of the dataset and can be deleted and rebuilt. ``_desc-_.json`` and ``.svg`` One *reportlet*, a figure or a table of the report, in the recording's ``figures`` directory (``desc`` is a method name or ``prep``, ``diag`` or ``trgc``). The subject-level reportlets (``desc-summary``: ``overview`` and ``errors``) are in ``sub-XX/figures`` with the label ``sub-XX``. The JSON has ``name``, ``section``, ``desc``, ``title``, ``caption``, ``status`` (``pass``, ``warn``, ``fail`` or ``info``), ``table`` (rows, or ``null``) and ``data``; the SVG is the figure. They are replaced whenever the report is built. ``logs/CITATION.html``, ``.md``, ``.tex``, ``.bib`` The methods paragraphs for a manuscript and their references, in four formats: what the pipeline did (the configuration, the selected model orders, the parameters dirconn filled in, the tests and controls). They cover every subject of the dataset and are replaced by every run and by ``--reports-only`` and ``--boilerplate-only``. ``crash-report-.txt``, ``crash-report-citation.txt`` The traceback of a report or of the methods text that could not be written, in the run directory (``logs/run-