# Precise reference :id=top

------

> _Doc Ver:_ 1.2  
_App Ver:_ 2.6.6.53  
_Date:_ 09/14/2026

------

## Special note (two features — do not open the wrong page) :id=not

**Precise reference** and **precise wavelength calibration** are two unrelated SA1 functions. Both names contain “precise”, the menus sit next to each other, and Ask often retrieves the wrong page.

| | **Precise reference** (this page) | **Precise wavelength calibration** (other page) |
|---|----------------------|----------------------------|
| Menu | Setting → **Precise refer** | Setting → **Precise wavelength** |
| URL | `addon.php?dir=precise_refer` | `addon.php?dir=precise_wl` |
| Config | `/var/sa/conf/precise_refer_main.json` + `precise_refer_conf_1/2/3.json` | `/var/sa/conf/precise_wl.json` |
| Target | **One already-matched sensor** | **Every demodulated wavelength in the frame** |
| Input | That sensor’s wavelength or computed PV | Etalon comb + wavemeter CSV |
| Output | Looked-up **true physical value** | Corrected **absolute wavelength (pm)** |
| Algorithm | Piecewise linear between neighbouring table points | Least squares over all matched table lines |
| Hardware | No etalon | Needs a temperature-insensitive etalon |
| Ask with | “precise refer”, “lookup table”, “WL→PV” | “precise wavelength”, “etalon”, “PVJ” |

- Questions about **precise refer / how to enable it / lookup / formula skipped**: this page only. Do not open Precise wavelength, do not type an etalon channel, do not import a wavemeter CSV, do not use `:DATA:PVJ?` as the check.
- Questions about **etalon / comb / wavemeter / absolute wavelength / +22 pm**: [Precise wavelength calibration](precise_wl.md), not this page.
- Either can stay off. Factory default is off for both. Enabling one does not enable the other.

------

## 1. What it does :id=what

Use precise reference when:

- Sensor calibration data is hard to fit to coefficients that meet the R² requirement;
- You need high-precision physical values from a calibration table.

Give each sensor (by **ID or SN**) a **measured value → true PV** table. At run time the current measurement is piecewise-linear interpolated and **written as the physical value**. While enabled, precise reference **runs before every formula**; the formula interpreter is used only when there is no matching region (and extend is off) or the setting is invalid.

The measured value may be:

- `0`: **wavelength** (same offset as the list: wavelength − 1 500 000)
- `1`: **already computed physical value**, then mapped to the true value

This has nothing to do with the etalon, the spectrum comb, `WLCAL_*`, or `:DATA:PVJ?`.

------

## 2. Get the calibration table :id=parameter

By hand or with the built-in sensor-calibration program, obtain wavelength (or computed PV) versus true physical value.

Example, serial `6900001`, ID `2`:

```
Wavelength, Temperature (Celsius)
1530000,11
1530100,19
1530200,31
1530300,39
1530400,52
```

“Wavelength” here is the list **−1 500 000 offset** (1530000 means 1 530 000 pm absolute). Do not paste the **nm CSV** from precise wavelength calibration into this box.

------

## 3. Setting format :id=convert

```
ID or SN:par1,pv1,par2,pv2;
```

Chain several sensors with `;`. **Every entry must end with `;`.**

```
6900001:1530000,11,1530100,19,1530200,31,1530300,39,1530400,52;
```

or by ID:

```
2:1530000,11,1530100,19,1530200,31,1530300,39,1530400,52;
```

Descending order is allowed if it stays monotonic.

?> Parameters must be ascending or descending, never shuffled. At least two pairs.

If the same sensor appears in more than one box, **the last setting wins**.

------

## 4. Enable on the web :id=setting

1. Log in as **admin**.
2. **Setting** → **Precise refer** (`addon.php?dir=precise_refer`). Do not click Precise wavelength next to it.
3. Tab **Precise refer**:
   - Check **Enable** (`PREFER_ENABLE`)
   - **Reference parameter**: `0` wavelength (−1 500 000) or `1` physical value
   - **Extend**: outside the table, use the nearest point (accuracy suffers)
   - **Configure ID**: 1 / 2 / 3
4. Open **Configure 1/2/3** and paste the string from §3.
5. **Save**. AfterCfg sends `:SYS:RELOAD` (returns `0`). Do not `killall -9`.

Help on that page opens this document (`help/#/{lang}precise_refer`).

------

## 5. Compute priority :id=prio

Regardless of the formula-interpreter setting, **after precise reference is enabled it runs before every formula**.

If [precise wavelength calibration](precise_wl.md) is also on: wavelength is corrected first, then match, then precise reference / formula. Precise reference then sees the calibrated `w`. They are still two features: one rewrites wavelength, the other looks up physical value.

------

## 6. JSON :id=json

| File | Role |
|------|------|
| `/var/sa/conf/precise_refer_main.json` | Enable, WL vs PV, extend, which config file |
| `/var/sa/conf/precise_refer_conf_1.json` (and `_2`, `_3`) | Per-sensor lookup strings |

After editing files, `:SYS:RELOAD` (`sa-cli reload --yes`). Do not `killall -9`.

------

## 7. Ask (this page, not precise wavelength) :id=ask

Chat: http://112.74.47.129:9999 (say **SA1 2.x** and “precise refer, not precise wavelength”). On-device: [ask.md](ask.md). Portal FAQ: 精确参考 / lookup / PREFER.

| Q | Short answer |
|----|------|
| Is precise refer the same as precise wavelength? | **No.** This page looks up PV per sensor. Wavelength cal uses an etalon. |
| How do I enable precise refer? | Setting → **Precise refer** → enable → paste ID/SN table → Save → `:SYS:RELOAD`. |
| Do I plug an etalon / type channel 1? | **No.** Those steps belong to precise wavelength. |
| Why did the formula stop? | A successful lookup skips the formula. That is intended. |
| Verify with `:DATA:PVJ?`? | That check is for wavelength cal. Here watch the sensor’s **physical value**. |

------

## 8. Help :id=help

| Entry | Where |
|------|------|
| Device Help menu | Precise refer / 精确参考 |
| Addon Help | This page |
| Handbook | SAH2026091403 Precise refer |
| Portal FAQ / hub | “精确参考” / lookup — not “精确波长校准” |
| Online | `http://192.168.3.9/sa1/help/#/precise_refer` |

| Rev | Date | Note |
|-----|------|------|
|1.2|09/14/2026|Special note: split from precise wavelength; FAQ / Ask / menu no longer share keywords. Save → `:SYS:RELOAD`.|
|1.0|09/13/2026|First version.|
