Skip to content

Commit

Permalink
tests run, converted to lambda.
Browse files Browse the repository at this point in the history
  • Loading branch information
iancze committed Dec 31, 2023
1 parent 6df2d72 commit 1049f6c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 288 deletions.
10 changes: 5 additions & 5 deletions docs/tutorials/introduction_to_casatools.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ ax.set_xlabel(r"$u$ [m]")
ax.set_ylabel(r"$v$ [m]")
```

### Convert baselines to units of kilolambda
To convert the baselines to units of kilolambda, we need to know the observing frequency (or wavelength). For a spectral window with multiple channels (like this one), the baselines (if expressed in units of kilolambda) will be slightly different for each channel because the observing frequency is different for each channel. Here is one way to go about broadcasting the baselines to all channels and then converting them to units of kilolambda.
### Convert baselines to units of lambda
To convert the baselines to units of lambda, we need to know the observing frequency (or wavelength). For a spectral window with multiple channels (like this one), the baselines (if expressed in units of lambda) will be slightly different for each channel because the observing frequency is different for each channel. Here is one way to go about broadcasting the baselines to all channels and then converting them to units of lambda.

```{code-cell}
# broadcast to the same shape as the data
Expand All @@ -220,11 +220,11 @@ uu = uu / wavelengths # [lambda]
vv = vv / wavelengths # [lambda]
```

Let's plot up the baseline coverage for the first channel of the cube (index `0`).
Let's plot up the baseline coverage for the first channel of the cube (index `0`). For the plot only, we'll convert to units of k$\lambda$ to make it easier to read.

```{code-cell}
fig, ax = plt.subplots(nrows=1, figsize=(3.5, 3.5))
ax.scatter(uu[0], vv[0], s=1.5, rasterized=True, linewidths=0.0, c="k")
ax.scatter(uu[0] * 1e-3, vv[0] * 1e-3, s=1.5, rasterized=True, linewidths=0.0, c="k")
ax.set_xlabel(r"$u$ [k$\lambda$]")
ax.set_ylabel(r"$v$ [k$\lambda$]")
```
Expand Down Expand Up @@ -422,7 +422,7 @@ mask = ~flag
```

```{code-cell}
# convert uu and vv to kilolambda
# convert uu and vv to lambda
uu, vv, ww = uvw # unpack into len nvis vectors
# broadcast to the same shape as the data
# stub to broadcast uu,vv, and weights to all channels
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/rescale_AS209_weights.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,4 @@ for ID in SPECTRAL_WINDOW_ID:
print(ID, "{:.2f}".format(sigma_rescale_factors[ID]))
```

If you wanted to use these visibilities for forward modeling or [Regularized Maximum Likelihood (RML) imaging](https://mpol-dev.github.io/MPoL/), you will want to read and export the correctly flagged and rescaled visibilities and convert baselines to kilolambda.
If you wanted to use these visibilities for forward modeling or [Regularized Maximum Likelihood (RML) imaging](https://mpol-dev.github.io/MPoL/), you will want to read and export the correctly flagged and rescaled visibilities and convert baselines to lambda.
279 changes: 0 additions & 279 deletions src/visread/attic/cube.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/visread/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def convert_baselines(baselines, freq):
r"""
Convert baselines in meters to kilolambda. Assumes that baselines and freq will broadcast under division.
Convert baselines in meters to lambda. Assumes that baselines and freq will broadcast under division.
Args:
baselines (float or np.array): baselines in [m].
Expand Down
4 changes: 2 additions & 2 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ def test_convert_baselines(data_dict):
uu = data_dict["uu"]
freq = data_dict["freq"][0]

uu_lambda = process.convert_baselines(uu, freq)
process.convert_baselines(uu, freq)


def test_broadcast_and_convert(data_dict):
uu = data_dict["uu"]
vv = data_dict["vv"]
freq = data_dict["freq"]

uu_lambda, vv_lambda = process.broadcast_and_convert_baselines(uu, vv, freq)
process.broadcast_and_convert_baselines(uu, vv, freq)

0 comments on commit 1049f6c

Please sign in to comment.