+++
title = "Convert axes"
weight = 10
+++

### Convert axes of Datafield

To convert a scattering simulation result from the usual representation
as function of $\varphi_\text{f},\alpha_\text{f}$ to
coordinates $q_y,q_z$, do
```python
trafo = ba.FrameTrafo.ScatteringToQ(wavelength)
datafield_out = trafo.transformedDatafield(datafield_in)
```

The transform only modifies the axes, not the intensity data.
Regardless of the axes,
simulated intensities are per pixel of a flat, rectangular detector in real space.
The equidistant axes in $\varphi_\text{f},\alpha_\text{f}$ or $q_y,q_z$
are only first-order approximations.
Their errors vanish in the small-angle limits.

{{< galleryscg >}}
{{< figscg src="/img/auto/scatter2d/VsQ.png" width="670px" caption="Scattering intensity">}}
{{< /galleryscg >}}

{{< show-ex file="scatter2d/VsQ.py" >}}

### History

This functionality was provided in completely different ways in BornAgain <=21.
The present solution has been introduced in BornAgain 24.
