> For the complete documentation index, see [llms.txt](https://skaha-labs.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skaha-labs.gitbook.io/documentation/online-processing/gain-calibration.md).

# Gain Calibration

A gain calibration, as described [here](/documentation/technical-description/internal-calibration.md), is performed. First, the internal calibration load is applied, with t\_kelvin being the physical temperature of the calibration load:

```python
data_hh = t_kelvin * statistics.median(np.array(data[2][ind]) / np.array(data[0][ind]))
data_vv = t_kelvin * statistics.median(np.array(data[3][ind]) / np.array(data[1][ind]))
data_u = t_kelvin * statistics.median(np.array(data[4][ind]) / (np.sqrt(np.array(data[0][ind])) * np.sqrt(np.array(data[1][ind]))))
data_v = t_kelvin * statistics.median(np.array(data[5][ind]) / (np.sqrt(np.array(data[0][ind])) * np.sqrt(np.array(data[1][ind]))))
```

And then gain drifts due to variations in the receiver temperature are removed, with t being the physical temperature of the PCB (we use the physical temperature of the calibration load as it is measured on the PCB) in degrees Celsius:

```python
LNA_fact_hh = -0.0004132 * data_hh + 0.4057
LNA_fact_vv = -0.0004132 * data_vv + 0.4057
offset_hh = LNA_fact_hh * t
offset_vv = LNA_fact_vv * t
data_hh -= offset_hh
data_vv -= offset_vv

data_hh2 = 1.778 * data_hh - 175.9
data_vv2 = 1.778 * data_vv - 175.9
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://skaha-labs.gitbook.io/documentation/online-processing/gain-calibration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
