NeuroAnalyzer Preferences

Preferences control how NeuroAnalyzer behaves: which messages are shown, whether progress bars are displayed and whether channels marked as bad are used in analyses. They are stored with Preferences.jl, so they persist between Julia sessions.

Available preferences

Preference Default Function Effect
verbose true set_verbose() show NeuroAnalyzer info and warning messages
progress_bar true set_progress_bar() show progress bars in long-running functions
exclude_bad_channels false set_exclude_bad_channels() skip channels marked as bad when channels are selected
exclude_bad_segments false set_exclude_bad_segments() skip segments marked as bad (epoching, analyses of continuous signals)
colors true set_colors() print messages in color

Each function takes true or false. The new value takes effect immediately and is saved, so it is also used in the next sessions.

Viewing the current settings

info() shows the current preferences together with the NeuroAnalyzer and Julia versions, the plugins and resources paths, the number of threads and the versions of the installed packages:

info()

The preferences are also listed when NeuroAnalyzer is loaded.

Changing preferences

One at a time:

set_verbose(false)       # hide info and warning messages
set_progress_bar(false)  # hide progress bars
set_exclude_bad_channels(true)  # skip bad channels
set_exclude_bad_segments(true)  # skip bad segments
set_colors(false)        # plain (uncolored) messages

All at once (all four keyword arguments are required):

set_prefs(verbose = true,
          progress_bar = true,
          exclude_bad_channels = false,
          exclude_bad_segments = false,
          colors = true)

Notes

verbose

With verbose = false, messages printed by NeuroAnalyzer functions ([ Info: …, [ Warning: …) are hidden. Errors are always shown, and so are messages printed by Julia or by other packages.

Tip: Warnings often explain why a result may be unexpected (e.g. a filter cutoff adjusted to the Nyquist frequency); turn verbose off only for well-tested scripts.

progress_bar

Progress bars are shown by functions that process many channels, epochs or frequencies (e.g. filtering, ICA, spectrograms, ITPC, bootstrapping). Turn them off when the output is written to a log file, where each update of the bar adds a line.

exclude_bad_channels

Channels are marked as bad in obj.header.recording[:bad_channel], e.g. by channel_reject!() or manually. With exclude_bad_channels = true, these channels are left out whenever channels are selected with the ch argument (e.g. ch = "eeg"), so they do not enter analyses or plots. With exclude_bad_channels = false (default), bad channels are only marked and are used like any other channel.

The preference is the default of the exclude_bad_channels argument of the functions that select channels; the argument overrides it in a single call:

p = psd(eeg; ch = "eeg", exclude_bad_channels = true)

The preference applies to the analysis functions (including ICA and PCA, which are fitted without the bad channels and applied to the same channels); processing and editing functions (filtering, referencing, deleting or extracting channels, …) always use all selected channels, so that bad channels stay consistent with the others and can be interpolated later. A function that analyses one channel throws an error if this channel is bad and bad channels are excluded.

Plots show all selected channels and mark the bad ones (e.g. a red × in plot_locs() and plot_topo(), light gray traces in plot_erp() and plot_psd()); what a plot computes from several channels (topographic interpolation, GFP, averages and 95% CIs of butterfly plots) follows the preference.

exclude_bad_segments

Segments are marked as bad with markers of type "BAD" (e.g. in the interactive signal plot, b, or with add_marker()); a bad segment applies to all channels or to the channels listed in the marker. With exclude_bad_segments = true:

  • epoch() skips the epochs that overlap a bad segment of all channels (also a segment that begins before the epoch) and marks the epochs that overlap a bad segment of some channels as rejected (obj.epochs.reject; average_epochs() leaves these epochs out),
  • analyses of continuous signals that summarize the samples (e.g. amp(), hjorth(), entropy(), covm()) remove the samples of the bad segments (of all channels or of the analyzed channels) and join the remaining parts, as reject_by_annotation = "omit" of MNE-Python,
  • spectral analyses (psd() and the functions based on it, e.g. band_power(), psd_slope(), fooof()) compute the spectrum within each good part of the signal (between bad segments and discontinuities, markers of type "boundary") and average the spectra, so that no window crosses a bad segment (as the Welch PSD of MNE-Python and spectopo() of EEGLAB); parts shorter than the window length are not used; lag-based measures (acor(), acov(), pacor(), acw(), xcor(), xcov()) compute the lagged products only within the good parts,
  • statistics and similarity measures (rms(), rmse(), corr(), cosim(), mutual_information(), msci95(), sym_idx(), channel_stats(), epoch_stats()) remove the bad samples in the same way; measures comparing two objects (e.g. corr(obj1, obj2)) remove the samples of the bad segments of either object from both signals, so that the samples stay paired, and the differences between consecutive samples (channel_stats(), epoch_stats()) are computed within the good parts only.

Time-resolved analyses (e.g. spectrograms, envelopes), connectivity measures (e.g. coherence(), plv(); use epochs that skip the bad segments, see Bad channels and epochs) and processing functions (e.g. filtering) use the whole signal. The preference is the default of the exclude_bad_segments argument of these functions.

colors

Colored messages are easier to read in a terminal; turn colors off if the terminal or log viewer shows escape codes (e.g. [36m) instead of colors.

Where preferences are stored

Preferences are saved in the LocalPreferences.toml file next to the Project.toml of the active Julia environment, e.g. ~/.julia/environments/v1.12/LocalPreferences.toml for the default environment:

[NeuroAnalyzer]
verbose = true
progress_bar = false
exclude_bad_channels = false
exclude_bad_segments = false
colors = true

Each project environment has its own preferences, so different projects can use different settings. Deleting the [NeuroAnalyzer] section restores the defaults.