Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Splitting _brain.py into multiple modules

オープン
#14,331 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
3.5k
フォーク
1.6k
平均マージ
1日 3時間
マージ済み PR(30日)
74

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mne-tools/mne-python のほかの issue

mne-tools/mne-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。