Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Splitting _brain.py into multiple modules

Đang mở
#14,331 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@payamsash đang làm issue này rồi.

Từ ngày 17/10/2026.

  • #14429 của @payamsash — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
tooling

Hướng nghiên cứu

The issue is about refactoring mne/viz/_brain/_brain.py into multiple modules using mixins. Start by examining the current Brain class structure and the proposed mixin categories. Look at how BaseRaw and BaseEpochs use mixins in the codebase. Determine which methods belong to each mixin and create separate files for them. Testing involves ensuring the Brain class still works after the split.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

ENH
Describe the new feature or enhancement

mne/viz/_brain/_brain.py is currently over 5k lines and all in one Brain class which makes adding new features and debugging difficult. also as mentioned by @wmvanvliet:

The _brain.py code is become too long though. We should split it up into multiple files at some point.

``

Describe your proposed implementation

I would suggest using mixing classes (as it also been used at other places like BaseRaw and BaseEpochs) sth like:

@fill_doc
class Brain(
    _SourceDataMixin,    # add_data, add_label, add_annotation, _add_volume_data, ...
    _ObjectsMixin,       # add_forward/dipole/head/skull/volume_labels/foci/sensors/text
    _ScalarDataMixin,    # update_lut, colormap range, time interpolation, _update_glyphs
    _AppearanceMixin,    # set_surf, set_cortex_colormap, silhouette
    _CameraMixin,        # show_view, _set_camera, reset_view
    _PickingMixin,       # picking, hover, glyphs, mpl traces
   ...
)

and a _helpers.py for taking the module level helpers (e.g. _safe_interp1d, _update_limits, ...).

Do you agree with this approach? @larsoner @wmvanvliet , also consider that mixins will be single use. also I would like to wait until we finally decide on the skeleton, for example I'm not sure if we need _events.py for ui_events handlers or should we put plot_time_course into picking or sth like _traces.py.

Describe possible alternatives

.

Additional context

No response

Ngôn ngữ chính
Python
Star
3.5k
Fork
1.6k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
72

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mne-tools/mne-python

Tất cả issue của mne-tools/mne-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.