# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
