From 00a1943d7faf9ee02c33669359ff087ddf7a3216 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Fri, 6 Oct 2023 11:51:24 +0100 Subject: [PATCH 1/2] pin down gwcs until ASDF files are updated (#301) * pin down gwcs until ASDF files are updated * Add changelog * Fix a nested Dask array bug * Skip some cells to see if the build passes * Fix doctest * this is silly --- changelog/301.breaking.rst | 4 ++++ changelog/301.bugfix.rst | 2 ++ dkist/io/loaders.py | 5 +---- docs/tutorial/6_visualization.md | 10 ++++++++-- docs/whatsnew/1.0.rst | 10 +++++----- setup.cfg | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 changelog/301.breaking.rst create mode 100644 changelog/301.bugfix.rst diff --git a/changelog/301.breaking.rst b/changelog/301.breaking.rst new file mode 100644 index 000000000..7f89bc2d2 --- /dev/null +++ b/changelog/301.breaking.rst @@ -0,0 +1,4 @@ +The ASDF files currently being served by the data center are incompatible with +gwcs 0.19+. This is due to a change in how Stokes coordinates are represented. +In this release we have pinned the gwcs version to <0.19. A future release will +require 0.19+ when the ASDF files have been updated. diff --git a/changelog/301.bugfix.rst b/changelog/301.bugfix.rst new file mode 100644 index 000000000..34a8ef339 --- /dev/null +++ b/changelog/301.bugfix.rst @@ -0,0 +1,2 @@ +Ensure that we don't nest Dask arrays when no FITS files can be read. +This might result in more memory being used when computing an array with missing files. diff --git a/dkist/io/loaders.py b/dkist/io/loaders.py index 27312ac55..da7376e43 100644 --- a/dkist/io/loaders.py +++ b/dkist/io/loaders.py @@ -7,9 +7,7 @@ import logging from pathlib import Path -import dask.array as da import numpy as np -from dask import delayed from astropy.io import fits from sunpy.util.decorators import add_common_docstring @@ -96,8 +94,7 @@ def __getitem__(self, slc): _LOGGER.debug("File %s does not exist.", self.absolute_uri) # Use np.broadcast_to to generate an array of the correct size, but # which only uses memory for one value. - return da.from_delayed(delayed(np.broadcast_to)(np.nan, self.shape) * np.nan, - self.shape, self.dtype) + return np.broadcast_to(np.nan, self.shape) * np.nan with fits.open(self.absolute_uri, memmap=False, # memmap is redundant with dask and delayed loading diff --git a/docs/tutorial/6_visualization.md b/docs/tutorial/6_visualization.md index 891e43268..6e8240c07 100644 --- a/docs/tutorial/6_visualization.md +++ b/docs/tutorial/6_visualization.md @@ -67,8 +67,11 @@ So the list needed to specify the default ordering would be `[None, None, 'y', ' If instead we want to plot the image formed by the raster scan at a particular wavelength and Stokes value, we would do this: ```{code-cell} ipython -#ds.plot(plot_axes=[None, 'y', None, 'x']) -#plt.show() +--- +tags: [skip-execution] +--- +ds.plot(plot_axes=[None, 'y', None, 'x']) +plt.show() ``` You may have noticed this plot took somewhat longer to draw than the previous one. @@ -80,6 +83,9 @@ You can also use `plot_axes` to create a line plot, by specifying only one axis So to plot a spectrum at a fixed Stokes, time and raster location we can tell plot to use the dispersion axis as the x axis. ```{code-cell} ipython +--- +tags: [skip-execution] +--- ds.plot(plot_axes=[None, None, 'x', None]) plt.show() ``` diff --git a/docs/whatsnew/1.0.rst b/docs/whatsnew/1.0.rst index 032cdb40a..0999b3969 100644 --- a/docs/whatsnew/1.0.rst +++ b/docs/whatsnew/1.0.rst @@ -30,16 +30,16 @@ Here is a really quick demo of searching for all unembargoed VISP data and downl >>> import dkist.net >>> res = Fido.search(a.Instrument.visp, a.dkist.Embargoed.false) # doctest: +REMOTE_DATA - >>> res # doctest: +REMOTE_DATA + >>> res # doctest: +SKIP Results from 1 Provider: 84 Results from the DKISTClient: - Start Time End Time ... - ... - ----------------------- ----------------------- ... - ... ... ... + Start Time End Time ... Average Temporal Sampling + ... s + ----------------------- ----------------------- ... ------------------------- + ... ... ... ... Length = 84 rows diff --git a/setup.cfg b/setup.cfg index 2dc4b4cf4..a8a1b57cb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ install_requires = astropy>=5 dask[array]>=2021.8.0 globus-sdk>=3.0 - gwcs>=0.18.0 + gwcs>=0.18.0,<0.19 matplotlib>=3.5 ndcube[plotting,reproject]>=2.0 numpy>=1.22 From 9696c7c26aa2b47a7398a1f7c883cc122ab3bfa4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:39:44 +0100 Subject: [PATCH 2/2] [pre-commit.ci] pre-commit autoupdate (#303) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f6fe79c30..a83a32458 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-yaml - id: check-ast