Skip to content

Commit

Permalink
removed GriddedResidualConnector from crossvalidation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
iancze committed Feb 19, 2023
1 parent 354bf4c commit 61661c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -12,11 +12,11 @@ repos:
- id: detect-private-key
- id: name-tests-test
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.8.0
rev: 5.12.0
hooks:
- id: isort
args: []
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Changelog

## v0.1.4

- Removed the `GriddedResidualConnector` class and the `src/connectors.py` module. Moved `index_vis` to `datasets.py`.

## v0.1.3

- Added the {func}`mpol.fourier.make_fake_data` routine and the [Mock Data tutorial](ci-tutorials/fakedata.md).
Expand Down
29 changes: 8 additions & 21 deletions docs/ci-tutorials/crossvalidation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ from astropy.utils.data import download_file
from torch.utils.tensorboard import SummaryWriter
from mpol import (
connectors,
coordinates,
crossval,
datasets,
Expand Down Expand Up @@ -184,43 +183,31 @@ flayer.forward(torch.zeros(dset.nchan, coords.npix, coords.npix))
The following plots visualize how we've split up the data. For each $K$-fold, we have the "training" visibilities, the dirty image corresponding to those training visibilities, and the "test" visibilities which will be used to evaluate the predictive ability of the model.

```{code-cell}
fig, ax = plt.subplots(nrows=k, ncols=3, figsize=(6, 10))
fig, ax = plt.subplots(nrows=k, ncols=2, figsize=(4, 10))
for i, (train_subset, test_subset) in enumerate(k_fold_datasets):
rtrain = connectors.GriddedResidualConnector(flayer, train_subset)
rtrain.forward()
rtest = connectors.GriddedResidualConnector(flayer, test_subset)
rtest.forward()
# train_subset and test_subset are `GriddedDataset`s
vis_ext = rtrain.coords.vis_ext
img_ext = rtrain.coords.img_ext
train_mask = rtrain.ground_mask[0]
train_chan = rtrain.sky_cube[0]
test_mask = rtest.ground_mask[0]
test_chan = rtest.sky_cube[0]
train_mask = train_subset.ground_mask[0]
test_mask = test_subset.ground_mask[0]
ax[i, 0].imshow(
train_mask.detach().numpy(),
interpolation="none",
origin="lower",
extent=vis_ext,
extent=coords.vis_ext,
cmap="GnBu",
)
ax[i, 1].imshow(train_chan.detach().numpy(), origin="lower", extent=img_ext)
ax[i, 2].imshow(
test_mask.detach().numpy(), origin="lower", extent=vis_ext, cmap="GnBu"
ax[i, 1].imshow(
test_mask.detach().numpy(), origin="lower", extent=coords.vis_ext, cmap="GnBu"
)
ax[i, 0].set_ylabel("k-fold {:}".format(i))
ax[0, 0].set_title("train mask")
ax[0, 1].set_title("train dirty img.")
ax[0, 2].set_title("test mask")
ax[0, 1].set_title("test mask")
for a in ax.flatten():
a.xaxis.set_ticklabels([])
Expand Down

0 comments on commit 61661c5

Please sign in to comment.