FISH:AI 助手阅读入口 / FISH: entry point for AI assistants

Updated: 2026-12-03 Languages: 中文 / English

1. 先确认任务与版本 / Establish the task and version

中文:先确认用户要运行教学示例,还是处理自己的完整观测。记录软件位置、Python 环境、输入目录、Tcal 温标、输出目录和已完成阶段。优先阅读当前安装版本的 README.md、pyproject.toml、src/README.md,再查看 fish --help 和 FISH 中的 help。示例脚本和真实数据位于仓库的 examples/minimal_calibration/。记录所用 Git commit,并按该版本的命令和参数执行。

English: Establish whether the user wants the teaching example or a full observation reduction. Record the software location, Python environment, inputs, Tcal reference, workspace and completed stages. Read the installed version’s README.md, pyproject.toml and src/README.md, then inspect fish --help and help inside FISH. The scripts and real data are included under examples/minimal_calibration/ in the repository. Record the Git commit and use that version’s commands and parameters.

2. 教学示例 / Teaching example

中文:示例为真实 Sun17_A_01 / M01 数据,含 32 个 SCI 积分、AA/BB、已提取 CAL、Tcal 和测得的指向及 LSRK 因子。运行到重采样光谱表;立方体网格化使用更大的扫描数据。以下命令在系统终端克隆仓库、安装并运行内置示例。

English: The real Sun17_A_01 / M01 example includes 32 SCI integrations, AA/BB, extracted CAL, Tcal, measured pointings and LSRK factors. It produces a resampled spectral table; spatial gridding uses a larger scan dataset. Clone the repository, install FISH and run its bundled example in the system terminal.

git clone https://github.com/Astronlin/NJU_FAST_ISM.git
cd NJU_FAST_ISM
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[notebook,qt]'
python examples/minimal_calibration/prepare_viewer.py \
  --output "$HOME/fish-suna01-session"
fish --viewer qt

中文:在 FISH 的 fish> 提示符下恢复会话、选取第一个光谱并预览温度参考。命令行服务器可使用 fish --viewer none。

English: At the FISH fish> prompt, restore the session, select the first spectrum and preview its temperature reference. Use fish --viewer none for a command-line server session.

restore ~/fish-suna01-session/fish_session.json
get 0
tsyscal

3. 完整观测的数据准备 / Prepare a full observation

中文:收集原始脉冲星终端 PSRFITS、窄带 SCI、匹配的馈源遥测和 Tcal FITS。org_cal 是提取步骤生成的输出。根据实际文件的扫描名、日期、馈源和时间覆盖进行匹配。

English: Gather raw pulsar-backend PSRFITS, narrow-band SCI, matching feed telemetry and Tcal FITS. The extraction step generates org_cal. Match scan names, dates, feeds and time coverage using the actual files.

/data/PROJECT/
  raw_psr/                         # Raw pulsar-backend PSRFITS
  org_spec/SCAN/DATE/*_N_*.fits     # SCI spectra
  feed_info/SCAN_YYYY_MM_DD_*.xlsx # Telemetry
  org_cal/SCAN/M01/*_cal.fits      # Generated CAL
  fish_runs/                      # Sessions and products

中文:若安装版本提供 fish-extract-cal,先查看帮助和提取计划,再执行批量提取。其他版本按其 README 中的提取入口处理。仓库内置示例自带已提取的 CAL。

English: When the installed version provides fish-extract-cal, inspect its help and extraction plan, then run batch extraction. For other versions, follow the extraction entry point documented in their README. The bundled example includes extracted CAL.

fish-extract-cal --help
fish-extract-cal /data/PROJECT/raw_psr --project /data/PROJECT --dry-run
fish-extract-cal /data/PROJECT/raw_psr --project /data/PROJECT

中文:在系统终端运行 fish --viewer qt。进入 FISH 后选择 SCI,并计算指向。把示例路径和文件匹配式替换成实际观测。查看生成的 config.json,设置本次观测的 tcal_path、workers 和 io_workers,再执行 go where;可从 4 个处理/I/O worker 开始,并保留内存准入。

English: Start fish --viewer qt in the system terminal. In FISH, select SCI and prepare pointings. Replace the example paths and file pattern with the actual observation. Inspect the generated config.json, set this observation’s tcal_path, workers and io_workers, then run go where. Start with four processing/I/O workers and retain memory admission.

project /data/PROJECT
file in org_spec/SCAN/DATE/*_N_*.fits --run-root /data/PROJECT/fish_runs/run01
list
{
  "tcal_path": "/opt/FISH/Tcal/observation.fits",
  "workers": 4,
  "io_workers": 4
}

中文:上面的 JSON 是要更新的字段。保存完整配置文件后,在同一 FISH 会话继续。

English: The JSON shows the fields to update. Save the complete configuration file and continue in the same FISH session.

go where /workers 4

4. 共用处理顺序 / Shared processing sequence

FISH 命令 / Command 内部阶段 / Internal stage 输出 / Output
tsyscal run reference 温度参考 / Temperature references
applycal run calibration 增益及 RFI 区间 / Gain records and RFI intervals
baseline run baseline AA/BB 基线模型 / AA/BB baseline fits
table run resample 公共 LSRK 轴光谱表 / Common-LSRK spectral table
xy_map run --validate cube 立方体与验证 / Cube and validation, for full scans

中文:先通过查看器检查各阶段,在修改参数后点击 Update preview。按顺序运行并等待每个阶段显示 Complete。

English: Inspect each stage in the viewer and click Update preview after parameter edits. Run stages in order and wait for Complete at each stage.

tsyscal run
wait
applycal run
wait
baseline run
wait
table run
wait
status

中文:完整扫描数据在光谱表完成后继续网格化和验证。

English: For full scan data, continue with gridding and validation after the spectral table is complete.

xy_map run --validate
wait
status

5. 参数和物理约定 / Parameters and scientific conventions

参数 / Parameter 教学起点 / Teaching setting 含义 / Meaning
n_t_cal 10 ON−OFF 时间平滑 / ON−OFF time smoothing
n_t_apply 10 Tpsr 时间平滑 / Tpsr time smoothing
protect_kms 250 基线拟合保护区 / Protected H I fitting interval, ±km/s
baseline_components Full-band sin/cos, then degree-1 polynomial over ±1500 km/s 按列表顺序拟合 / Fit sequentially in list order
spectral_mode, n_b rebin, 2 重采样方式和因子 / Resampling mode and factor
velocity_range_kms [-250,250] 输出 LSRK 区间 / Output LSRK interval

中文:分别拟合 AA/BB;每个基线分量在自己的速度范围内拟合和扣除。RFI 目录记录作为搜索先验,实际检出后才成为拟合排除区。H I 保护区用于选择拟合锚点,模型仍应用于线下基线。SCI 时间按头信息确认;原始 UTOBS 为积分起点时,标定、指向和 Doppler 均使用 UTOBS + EXPOSURE/2。教学数据带有对应约定和保存的坐标。完整观测的参数根据实际谱形和元数据确定。

English: Fit AA and BB independently. Each baseline component fits and subtracts within its own velocity range. RFI catalogues provide search priors; observed detections become fitting exclusions. H I protection controls fitting anchors while the model is still applied beneath the line. Check the SCI time convention in the headers; when raw UTOBS marks integration starts, calibration, pointing and Doppler use UTOBS + EXPOSURE/2. The teaching data include their timing convention and saved coordinates. Choose full-observation parameters from the observed spectra and metadata.

中文:教学示例的两个时间平滑窗口支持 1–10。通过当前版本的设置或配置文件选择 CPU/GPU;从默认 CPU 开始,GPU 选择以对应阶段的测量和数值比较为依据。

English: The teaching extract supports time-smoothing windows of 1–10. Select CPU/GPU through the installed version’s settings or configuration. Start with the default CPU backend and base GPU choices on measurements and numerical comparisons for the relevant stage.

6. 代码阅读入口 / Source map

路径相对于软件仓库根目录。Paths are relative to the package root.

路径 / Path 用途 / Purpose
README.md, pyproject.toml 安装、入口和依赖 / Installation, entry points and dependencies
src/README.md 开发者模块导览 / Developer module guide
examples/minimal_calibration/ 真实教学数据、准备脚本和 Notebook / Real example, preparation and notebook
src/fastfish/commands/shell.py FISH 命令、默认参数和校验 / Commands, defaults and validation
src/fastfish/io/ SCI/CAL 读取与提取 / SCI/CAL readers and extraction
src/fastfish/pointing/ 指向、时间和 Doppler / Pointing, timing and Doppler
src/fastfish/calibration/ 温度参考 / Temperature references
src/fastfish/processing/preview.py 交互与批处理共用计算 / Shared preview/science functions
src/fastfish/processing/stages.py 阶段依赖、指纹和批处理 / Dependencies, fingerprints and batch execution
src/fastfish/baseline/, src/fastfish/rfi/ 基线与 RFI / Baseline models and RFI detection
src/fastfish/processing/pipeline.py 网格化、组合和验证 / Gridding, combination and validation
src/fastfish/viewer/ 交互界面与预览 worker / Interactive UI and preview worker

7. 接手和交付 / Resume and report

中文:恢复已有项目时,读取 fish_session.json、config.json、status、当前任务日志及阶段摘要,按兼容性复用已完成结果。比较不同设置时使用独立输出目录并记录输入、软件版本和参数。完成后报告原始与选择的光谱数、完成阶段、输出路径、形状、验证结果,以及基线/RFI 检查。数值验证反映运算一致性;基线质量与绝对温标还需要依据观测评估。

English: To resume a project, read fish_session.json, config.json, status, the current job log and stage summaries; reuse completed products according to compatibility. Compare settings in separate workspaces and record inputs, software version and parameters. Report raw and selected spectrum counts, completed stages, product paths, dimensions, validation results and baseline/RFI checks. Numerical validation assesses arithmetic consistency; baseline quality and absolute calibration also require assessment from the observation.