Skip to content

Clarification on mne.bem Namespace Exposure #13667

Description

@scott-huberty

Is it intentional that we don't expose the bem submodule in the mne namespace? e.g here:

__all__ = [
"AcqParserFIF",
"Annotations",
"BaseEpochs",
"BiHemiLabel",
"Covariance",
"Dipole",
"DipoleFixed",
"Epochs",
"EpochsArray",
"Evoked",
"EvokedArray",
"Forward",
"Info",
"Label",
"MixedSourceEstimate",
"MixedVectorSourceEstimate",
"Projection",
"Report",
"SourceEstimate",
"SourceMorph",
"SourceSpaces",
"Transform",
"VectorSourceEstimate",
"VolSourceEstimate",
"VolVectorSourceEstimate",
"add_reference_channels",
"add_source_space_distances",
"annotations_from_events",
"apply_forward",
"apply_forward_raw",
"average_forward_solutions",
"beamformer",
"channel_indices_by_type",
"channel_type",
"channels",
"chpi",
"combine_evoked",
"commands",
"compute_covariance",
"compute_proj_epochs",
"compute_proj_evoked",
"compute_proj_raw",
"compute_rank",
"compute_raw_covariance",
"compute_source_morph",
"concatenate_epochs",
"concatenate_events",
"concatenate_raws",
"convert_forward_solution",
"coreg",
"count_annotations",
"count_events",
"create_default_subject",
"create_info",
"cuda",
"datasets",
"decimate_surface",
"decoding",
"defaults",
"dig_mri_distances",
"dipole",
"epochs",
"equalize_channels",
"event",
"events_from_annotations",
"export",
"extract_label_time_course",
"filter",
"find_events",
"find_layout",
"find_stim_steps",
"fit_dipole",
"forward",
"get_config",
"get_config_path",
"get_head_surf",
"get_meg_helmet_surf",
"get_montage_volume_labels",
"get_volume_labels_from_aseg",
"get_volume_labels_from_src",
"grade_to_tris",
"grade_to_vertices",
"grand_average",
"grow_labels",
"gui",
"head_to_mni",
"head_to_mri",
"inverse_sparse",
"io",
"label_sign_flip",
"labels_to_stc",
"make_ad_hoc_cov",
"make_bem_model",
"make_bem_solution",
"make_field_map",
"make_fixed_length_epochs",
"make_fixed_length_events",
"make_forward_dipole",
"make_forward_solution",
"make_sphere_model",
"match_channel_orders",
"merge_events",
"minimum_norm",
"morph_labels",
"morph_source_spaces",
"open_docs",
"open_report",
"parse_config",
"pick_channels",
"pick_channels_cov",
"pick_channels_forward",
"pick_channels_regexp",
"pick_events",
"pick_info",
"pick_types",
"pick_types_forward",
"preprocessing",
"random_parcellation",
"read_annotations",
"read_bem_solution",
"read_bem_surfaces",
"read_cov",
"read_dipole",
"read_epochs",
"read_epochs_eeglab",
"read_epochs_fieldtrip",
"read_epochs_kit",
"read_events",
"read_evoked_besa",
"read_evoked_fieldtrip",
"read_evokeds",
"read_evokeds_mff",
"read_forward_solution",
"read_freesurfer_lut",
"read_label",
"read_labels_from_annot",
"read_lta",
"read_morph_map",
"read_proj",
"read_reject_parameters",
"read_source_estimate",
"read_source_morph",
"read_source_spaces",
"read_surface",
"read_talxfm",
"read_trans",
"read_tri",
"read_vectorview_selection",
"rename_channels",
"report",
"scale_bem",
"scale_labels",
"scale_mri",
"scale_source_space",
"sensitivity_map",
"set_bipolar_reference",
"set_cache_dir",
"set_config",
"set_eeg_reference",
"set_log_file",
"set_log_level",
"set_memmap_min_size",
"setup_source_space",
"setup_volume_source_space",
"simulation",
"source_space",
"spatial_dist_adjacency",
"spatial_inter_hemi_adjacency",
"spatial_src_adjacency",
"spatial_tris_adjacency",
"spatio_temporal_dist_adjacency",
"spatio_temporal_src_adjacency",
"spatio_temporal_tris_adjacency",
"split_label",
"stats",
"stc_near_sensors",
"stc_to_label",
"surface",
"sys_info",
"time_frequency",
"transform_surface_to",
"use_coil_def",
"use_log_level",
"verbose",
"vertex_to_mni",
"viz",
"what",
"whiten_evoked",
"write_bem_solution",
"write_bem_surfaces",
"write_cov",
"write_events",
"write_evokeds",
"write_forward_solution",
"write_head_bem",
"write_label",
"write_labels_to_annot",
"write_proj",
"write_source_spaces",
"write_surface",
"write_trans",
]

So e.g. python -c "import mne; mne.bem.make_watershed_bem" will raise an error

but python -c "from mne.bem import make_watershed_bem" works fine.

If so, Is the latter the documented API? Our documentation explicitly cites the full namespace mne.bem.make_watershed_bem....

Activity

  1. scott-huberty commented on Feb 19, 2026

    @scott-huberty
    ContributorAuthor

    OK locally using git bisect, it looks like python -c "import mne; mne.bem" worked until the Lazy Loader PR was merged (#11838 specifically commit dea8f87 ... For reference the parent commit is ca83201).

    So seems like a regression? I can open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions