[ PROMPT_NODE_26904 ]
Neuropixels Analysis API 参考
[ SKILL_DOCUMENTATION ]
# API 参考
按模块组织的 neuropixels_analysis 函数快速参考。
## 核心模块 (Core Module)
### load_recording
python
npa.load_recording(
path: str,
format: str = 'auto', # 'spikeglx', 'openephys', 'nwb'
stream_id: str = None, # e.g., 'imec0.ap'
) -> Recording
从各种格式加载 Neuropixels 记录。
### run_pipeline
python
npa.run_pipeline(
recording: Recording,
output_dir: str,
sorter: str = 'kilosort4',
preprocess: bool = True,
correct_motion: bool = True,
postprocess: bool = True,
curate: bool = True,
curation_method: str = 'allen',
) -> dict
运行完整的分析工作流。返回包含所有结果的字典。
## 预处理模块 (Preprocessing Module)
### preprocess
python
npa.preprocess(
recording: Recording,
freq_min: float = 300,
freq_max: float = 6000,
phase_shift: bool = True,
common_ref: bool = True,
bad_channel_detection: bool = True,
) -> Recording
应用标准预处理链。
### detect_bad_channels
python
npa.detect_bad_channels(
recording: Recording,
method: str = 'coherence+psd',
**kwargs,
) -> list
检测并返回坏通道 ID 列表。
### apply_filters
python
npa.apply_filters(
recording: Recording,
freq_min: float = 300,
freq_max: float = 6000,
filter_type: str = 'bandpass',
) -> Recording
应用频率滤波器。
### common_reference
python
npa.common_reference(
recording: Recording,
operator: str = 'median',
reference: str = 'global',
) -> Recording
应用公共参考 (CMR/CAR)。
## 运动模块 (Motion Module)
### check_drift
python
npa.check_drift(
recording: Recording,
plot: bool = True,
output: str = None,
) -> dict
检查记录是否存在漂移。返回漂移统计信息。
### estimate_motion
python
npa.estimate_motion(
recording: Recording,
preset: str = 'kilosort_like',
**kwargs,
) -> dict
估算运动而不应用校正。
### correct_motion
python
npa.correct_motion(
recording: Recording,
preset: str = 'nonrigid_accurate',
folder: str = None,
**kwargs,
) -> Recording
应用运动校正。
**预设 (Presets):**
- `'kilosort_like'`: 快速、刚性校正
- `'nonrigid_accurate'`: 较慢,适用于严重漂移
- `'nonrigid_fast_and_accurate'`: 平衡选项
## 排序模块 (Sorting Module)
### run_sorting
python
npa.run_sorting(
recording: Recording,
sorter: str = 'kilosort4',
output