dirconn.write_simulation_bids#

dirconn.write_simulation_bids(sim: SimulatedData, root: str | os.PathLike[str], *, subject: str, task: str, session: str | None = None, run: int | str | None = None, overwrite: bool = False) → dict[str, Path]#

Write a simulation as a raw BIDS dataset plus a derivatives dataset.

The sensor channels go to a standard raw EEG dataset in root (BrainVision files, written by mne-bids; the simulated unit is written as one microvolt). Epoched simulations are stored as concatenated trials with an events.tsv file and a Dirconn sidecar entry that lets read_bids() split them again. Everything else goes to root/derivatives/dirconn-simulation in the dirconn convention: the noise-free node activity (desc-sources), the direct channels as recorded (desc-direct), the broadband truth, the leadfield and a record holding the provenance.

Nothing is written when a target already exists and overwrite is false.

Parameters:
  • sim (SimulatedData) – The simulation to store.

  • root (path-like) – Root of the raw BIDS dataset.

  • subject (str) – BIDS entities.

  • task (str) – BIDS entities.

  • session (optional) – BIDS entities.

  • run (optional) – BIDS entities.

  • overwrite (bool) – Replace existing files.

Returns:

The files written: raw (the BrainVision header), sources, direct (only with direct nodes), truth, leadfield and simulation.

Return type:

dict of str to Path