From 595b06b33fc7f97c012ef384db2c7c69f38b8869 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Tue, 18 Jun 2024 14:52:41 -0700 Subject: [PATCH] bump python version (#257) * bump python version * fix with releases * changelog * Fixes for devdeps * revert doctests due to ndcube release * docs --- .github/workflows/ci.yml | 28 ++++-- .github/workflows/draft-pdf.yml | 23 ----- .pre-commit-config.yaml | 4 +- .readthedocs.yml | 2 +- changelog/257.breaking.rst | 1 + joss_paper/paper.bib | 92 ------------------- joss_paper/paper.md | 134 ---------------------------- setup.cfg | 8 +- sunraster/instr/spice.py | 4 +- sunraster/instr/tests/test_spice.py | 24 +++-- sunraster/spectrogram.py | 2 +- sunraster/spectrogram_sequence.py | 5 +- tox.ini | 7 +- 13 files changed, 60 insertions(+), 274 deletions(-) delete mode 100644 .github/workflows/draft-pdf.yml create mode 100644 changelog/257.breaking.rst delete mode 100644 joss_paper/paper.bib delete mode 100644 joss_paper/paper.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42ced10c..d5fc893d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: toxdeps: tox-pypi-filter posargs: -n auto envs: | - - linux: py311 + - linux: py312 test: needs: [core] @@ -38,8 +38,8 @@ jobs: toxdeps: tox-pypi-filter posargs: -n auto envs: | - - windows: py39 - - macos: py310 + - windows: py310 + - macos: py311 docs: needs: [core] @@ -55,6 +55,24 @@ jobs: envs: | - linux: build_docs + cron: + if: | + github.event_name == 'workflow_dispatch' || ( + github.event_name == 'pull_request' && + contains(github.event.pull_request.labels.*.name, 'Run cron CI') + ) + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main + with: + default_python: '3.12' + submodules: false + coverage: codecov + toxdeps: tox-pypi-filter + posargs: -n auto --color=yes + envs: | + - linux: py312-devdeps + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + online: if: "!startsWith(github.event.ref, 'refs/tags/v')" needs: [docs] @@ -65,7 +83,7 @@ jobs: toxdeps: tox-pypi-filter posargs: -n 1 --dist loadgroup envs: | - - linux: py311-online + - linux: py312-online publish: if: | @@ -81,7 +99,7 @@ jobs: needs: [test] uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main with: - python-version: "3.9" + python-version: "3.12" test_extras: 'dev' test_command: 'pytest -p no:warnings --doctest-rst -m "not mpl_image_compare" --pyargs sunraster' submodules: false diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml deleted file mode 100644 index 2e97e3a2..00000000 --- a/.github/workflows/draft-pdf.yml +++ /dev/null @@ -1,23 +0,0 @@ -on: [push] - -jobs: - paper: - runs-on: ubuntu-latest - name: Paper Draft - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build draft PDF - uses: openjournals/openjournals-draft-action@master - with: - journal: joss - # This should be the path to the paper within your repo. - paper-path: joss_paper/paper.md - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: paper - # This is the output path where Pandoc will write the compiled - # PDF. Note, this should be the same directory as the input - # paper.md - path: joss_paper/paper.pdf diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a48f3ae..7c56f19c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|__init__.py|docs/conf.py)$" - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.2 hooks: - id: black exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" @@ -16,7 +16,7 @@ repos: - id: isort exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-ast - id: check-case-conflict diff --git a/.readthedocs.yml b/.readthedocs.yml index dc5115f1..4f38fb27 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -2,7 +2,7 @@ version: 2 build: os: ubuntu-20.04 tools: - python: "3.9" + python: "3.12" apt_packages: - graphviz diff --git a/changelog/257.breaking.rst b/changelog/257.breaking.rst new file mode 100644 index 00000000..a7922835 --- /dev/null +++ b/changelog/257.breaking.rst @@ -0,0 +1 @@ +Increased the minimum version of Python to 3.10.0 diff --git a/joss_paper/paper.bib b/joss_paper/paper.bib deleted file mode 100644 index b8a776c3..00000000 --- a/joss_paper/paper.bib +++ /dev/null @@ -1,92 +0,0 @@ -@ARTICLE{eis, - author = {{Culhane}, J.~L. and {Harra}, L.~K. and {James}, A.~M. and {Al-Janabi}, K. and {Bradley}, L.~J. and {Chaudry}, R.~A. and {Rees}, K. and {Tandy}, J.~A. and {Thomas}, P. and {Whillock}, M.~C.~R. and {Winter}, B. and {Doschek}, G.~A. and {Korendyke}, C.~M. and {Brown}, C.~M. and {Myers}, S. and {Mariska}, J. and {Seely}, J. and {Lang}, J. and {Kent}, B.~J. and {Shaughnessy}, B.~M. and {Young}, P.~R. and {Simnett}, G.~M. and {Castelli}, C.~M. and {Mahmoud}, S. and {Mapson-Menard}, H. and {Probyn}, B.~J. and {Thomas}, R.~J. and {Davila}, J. and {Dere}, K. and {Windt}, D. and {Shea}, J. and {Hagood}, R. and {Moye}, R. and {Hara}, H. and {Watanabe}, T. and {Matsuzaki}, K. and {Kosugi}, T. and {Hansteen}, V. and {Wikstol}, {\O}.}, - title = "{The EUV Imaging Spectrometer for Hinode}", - journal = {\solphys}, - keywords = {Face Sheet, Carbon Fiber Reinforce Plastic, Optical Bench, Solar Optical Telescope, Instrument Control Unit}, - year = 2007, - month = jun, - volume = {243}, - number = {1}, - pages = {19-61}, - doi = {10.1007/s01007-007-0293-1}, - adsurl = {https://ui.adsabs.harvard.edu/abs/2007SoPh..243...19C}, - adsnote = {Provided by the SAO/NASA Astrophysics Data System} -} - -@ARTICLE{iris, - author = {{De Pontieu}, B. and {Title}, A.~M. and {Lemen}, J.~R. and {Kushner}, G.~D. and {Akin}, D.~J. and {Allard}, B. and {Berger}, T. and {Boerner}, P. and {Cheung}, M. and {Chou}, C. and {Drake}, J.~F. and {Duncan}, D.~W. and {Freeland}, S. and {Heyman}, G.~F. and {Hoffman}, C. and {Hurlburt}, N.~E. and {Lindgren}, R.~W. and {Mathur}, D. and {Rehse}, R. and {Sabolish}, D. and {Seguin}, R. and {Schrijver}, C.~J. and {Tarbell}, T.~D. and {W{\"u}lser}, J. -P. and {Wolfson}, C.~J. and {Yanari}, C. and {Mudge}, J. and {Nguyen-Phuc}, N. and {Timmons}, R. and {van Bezooijen}, R. and {Weingrod}, I. and {Brookner}, R. and {Butcher}, G. and {Dougherty}, B. and {Eder}, J. and {Knagenhjelm}, V. and {Larsen}, S. and {Mansir}, D. and {Phan}, L. and {Boyle}, P. and {Cheimets}, P.~N. and {DeLuca}, E.~E. and {Golub}, L. and {Gates}, R. and {Hertz}, E. and {McKillop}, S. and {Park}, S. and {Perry}, T. and {Podgorski}, W.~A. and {Reeves}, K. and {Saar}, S. and {Testa}, P. and {Tian}, H. and {Weber}, M. and {Dunn}, C. and {Eccles}, S. and {Jaeggli}, S.~A. and {Kankelborg}, C.~C. and {Mashburn}, K. and {Pust}, N. and {Springer}, L. and {Carvalho}, R. and {Kleint}, L. and {Marmie}, J. and {Mazmanian}, E. and {Pereira}, T.~M.~D. and {Sawyer}, S. and {Strong}, J. and {Worden}, S.~P. and {Carlsson}, M. and {Hansteen}, V.~H. and {Leenaarts}, J. and {Wiesmann}, M. and {Aloise}, J. and {Chu}, K. -C. and {Bush}, R.~I. and {Scherrer}, P.~H. and {Brekke}, P. and {Martinez-Sykora}, J. and {Lites}, B.~W. and {McIntosh}, S.~W. and {Uitenbroek}, H. and {Okamoto}, T.~J. and {Gummin}, M.~A. and {Auker}, G. and {Jerram}, P. and {Pool}, P. and {Waltham}, N.}, - title = "{The Interface Region Imaging Spectrograph (IRIS)}", - journal = {\solphys}, - keywords = {Heating, chromospheric, coronal, Chromosphere, models, active, Corona, Magnetic fields, chromosphere, Instrumentation and data management, Spectrum, ultraviolet, Astrophysics - Solar and Stellar Astrophysics}, - year = 2014, - month = jul, - volume = {289}, - number = {7}, - pages = {2733-2779}, - doi = {10.1007/s11207-014-0485-y}, -archivePrefix = {arXiv}, - eprint = {1401.2491}, - primaryClass = {astro-ph.SR}, - adsurl = {https://ui.adsabs.harvard.edu/abs/2014SoPh..289.2733D}, - adsnote = {Provided by the SAO/NASA Astrophysics Data System} -} - -@misc{irispy-docs, - author = {{irispy-lmsal Developers}}, - title = {irispy-lmsal Documentation}, - year = {2023}, - publisher = {ReadTheDocs}, - journal = {ReadTheDocs}, - url = {https://irispy-lmsal.readthedocs.io/en/stable/} -} - -@misc{irispy-code, - author = {{irispy-lmsal Developers}}, - title = {irispy-lmsal code-base}, - year = {2023}, - publisher = {GitHub}, - journal = {GitHub Repository}, - url = {https://github.com/LM-SAL/irispy-lmsal} -} - -@article{ndcube-apj, - author = {{Ryan}, Daniel and {Mumford}, Stuart and {Barnes}, Will T. and {Kumar Baruah}, Ankit and {Bhope}, Adwait and {Buchlin}, Eric and {Freij}, Nabil and {Ginsburg}, Adam and {Hayes}, Laura A. and {Homeier}, Derek and {Hughes}, J. Marcus and {Lowder}, Chris and {O'Steen}, Richard and {Pellorce}, Baptiste and {Robitaille}, Thomas and {Sharma}, Yash and {Shih}, Albert Y. and {Tollerud}, Erik and {West}, Matthew J.}, - title = "{A Unified Framework for Manipulating N-dimensional Astronomical Data and Coordinate -Transformations in Python: The NDCube 2 & Astropy APE-14 WCS APIs}", - year = {2023, submitted}, - journal = {The Astrophysical Journal}, -} - -@article{ndcube-joss, - author = {{Ryan}, Daniel and {et al}}, - title = "{ndcube: Manipulating N-dimensional Astronomical Data in Python}", - year = {2023, submitted}, - journal = {Journal of Open Source Software}, -} - -@misc{sep12, - author = {{Mumford}, Stuart and {Ryan}, Daniel F.}, - title = {SEP-0012: NDCube 2 API}, - year = {2020}, - publisher = {GitHub}, - journal = {GitHub repository}, - url = {https://github.com/sunpy/sunpy-SEP/blob/master/SEP-0012.md} -} - -@ARTICLE{spice, - author = {{SPICE Consortium} and {Anderson}, M. and {Appourchaux}, T. and {Auch{\`e}re}, F. and {Aznar Cuadrado}, R. and {Barbay}, J. and {Baudin}, F. and {Beardsley}, S. and {Bocchialini}, K. and {Borgo}, B. and {Bruzzi}, D. and {Buchlin}, E. and {Burton}, G. and {B{\"u}chel}, V. and {Caldwell}, M. and {Caminade}, S. and {Carlsson}, M. and {Curdt}, W. and {Davenne}, J. and {Davila}, J. and {Deforest}, C.~E. and {Del Zanna}, G. and {Drummond}, D. and {Dubau}, J. and {Dumesnil}, C. and {Dunn}, G. and {Eccleston}, P. and {Fludra}, A. and {Fredvik}, T. and {Gabriel}, A. and {Giunta}, A. and {Gottwald}, A. and {Griffin}, D. and {Grundy}, T. and {Guest}, S. and {Gyo}, M. and {Haberreiter}, M. and {Hansteen}, V. and {Harrison}, R. and {Hassler}, D.~M. and {Haugan}, S.~V.~H. and {Howe}, C. and {Janvier}, M. and {Klein}, R. and {Koller}, S. and {Kucera}, T.~A. and {Kouliche}, D. and {Marsch}, E. and {Marshall}, A. and {Marshall}, G. and {Matthews}, S.~A. and {McQuirk}, C. and {Meining}, S. and {Mercier}, C. and {Morris}, N. and {Morse}, T. and {Munro}, G. and {Parenti}, S. and {Pastor-Santos}, C. and {Peter}, H. and {Pfiffner}, D. and {Phelan}, P. and {Philippon}, A. and {Richards}, A. and {Rogers}, K. and {Sawyer}, C. and {Schlatter}, P. and {Schmutz}, W. and {Sch{\"u}hle}, U. and {Shaughnessy}, B. and {Sidher}, S. and {Solanki}, S.~K. and {Speight}, R. and {Spescha}, M. and {Szwec}, N. and {Tamiatto}, C. and {Teriaca}, L. and {Thompson}, W. and {Tosh}, I. and {Tustain}, S. and {Vial}, J. -C. and {Walls}, B. and {Waltham}, N. and {Wimmer-Schweingruber}, R. and {Woodward}, S. and {Young}, P. and {de Groof}, A. and {Pacros}, A. and {Williams}, D. and {M{\"u}ller}, D.}, - title = "{The Solar Orbiter SPICE instrument. An extreme UV imaging spectrometer}", - journal = {\aap}, - keywords = {Sun: UV radiation, Sun: transition region, Sun: corona, instrumentation: spectrographs, methods: observational, techniques: imaging spectroscopy, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics}, - year = 2020, - month = oct, - volume = {642}, - eid = {A14}, - pages = {A14}, - doi = {10.1051/0004-6361/201935574}, -archivePrefix = {arXiv}, - eprint = {1909.01183}, - primaryClass = {astro-ph.IM}, - adsurl = {https://ui.adsabs.harvard.edu/abs/2020A&A...642A..14S}, - adsnote = {Provided by the SAO/NASA Astrophysics Data System} -} diff --git a/joss_paper/paper.md b/joss_paper/paper.md deleted file mode 100644 index 90829179..00000000 --- a/joss_paper/paper.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: 'sunraster: Manipulating and Visualizing Solar Slit-spectrograph Observations in Python' -tags: - - Python - - astronomy - - solar physics - - spectroscopy -authors: - - name: Daniel F. Ryan - orcid: 0000-0001-8661-3825 - affiliation: "1, 2" # (Multiple affiliations must be quoted) - corresponding: true - - name: Nabil Freij - orcid: 0000-0002-6253-082X - affiliation: "3, 4" - - name: Stuart Mumford - orcid: 0000-0003-4217-4642 - affiliation: 5 - - name: Baptiste Pellorce - affiliation: "6, 7" - - name: Steven D. Christe - orcid: 0000-0001-6127-795X - affiliation: 8 - - name: Ankit Kumar Baruah - affiliation: 9 - - name: Tiago Pereira - orcid: 0000-0003-4747-4329 - affiliation: "7, 10" - - name: Eric Buchlin - orcid: 0000-0003-4290-1897 - affiliation: 11 - - name: Theresa A. Kucera - orcid: 0000-0001-9632-447X - affiliation: 8 -affiliations: - - name: University of Applied Sciences Northwest Switzerland, Switzerland - index: 1 - - name: American University, USA - index: 2 - - name: Lockheed Martin Solar and Astrophysics Laboratory, USA - index: 3 - - name: Bay Area Environmental Research Institute, USA - index: 4 - - name: Aperio Software Ltd, UK - index: 5 - - name: Claude Bernard Lyon 1 University, France - index: 6 - - name: Institute of Theoretical Astrophysics, Norway - index: 7 - - name: NASA Goddard Space Flight Center, USA - index: 8 - - name: Workato Gmbh, Germany - index: 9 - - name: Rosseland Centre for Solar Physics, University of Oslo, Norway - index: 10 - - name: Université Paris-Saclay, CNRS, Institut d'Astrophysique Spatiale, France - index: 11 -date: 24 February 2023 -bibliography: paper.bib - ---- - -# Summary - -sunraster is a free, open-source, community-developed Python package for inspecting, -manipulating, and visualizing solar rastering slit-spectrograph observations. -The sunraster data classes link observations with various forms of supporting data -including: measurement uncertainties; units; a data mask to mark pixels with unreliable -or un-physical data values; WCS (World Coordinate System) transformations that describe -the position, wavelengths and times represented by the pixels; and general metadata. -These classes provide support for analysis tasks, such as extracting regions of -interest and applying/removing exposure time corrections, as well as a quick-look -visualization suite. -sunraster depends heavily on the ndcube package [@ndcube-apj; @ndcube-joss] and its -SpectrogramCube class complies with the NDCube 2 API [sep12; @sep12]. - -# Statement of Need - -Observing the location, morphology, dynamics and energetics of physical phenomena -is often key to understanding the underlying physics that drives them. -However, making simultaneous spatial, temporal and spectral measurements with a single -instrument is often challenging. -One option is to disperse the incoming light through a narrow slit onto a pixelated -detector creating a spectrogram, i.e. an image with a spectral dimension and a spatial -dimension corresponding to the long axis of the slit. -The second spatial dimension is reconstructed by scanning the slit across a region of -interest and taking sequential exposures. -A complete scan, known as a raster, creates a space-space-spectral data cube, and a time -dimension can be generated by repeating raster scans over the same region of interest. -Rastering or Scanning slit-spectrographs, as such instruments are known, have been -successfully employed for solar UV/EUV observations, e.g. the EUV Imaging -Spectrograph onboard Hinode [EIS; @eis], the Interface Region Imaging Spectrograph -[IRIS; @iris], and the SPectral Imaging for the Coronal Environment onboard Solar -Orbiter [SPICE; @spice]. - -However the rastering slit-spectrograph design leads to a fundamental complication, -namely that one of the spatial dimensions is coupled with time. -This can create ambiguity if the dynamic timescales of the observed phenomenon is -less than or comparable to the rastering cadence. -This requires scientists to think of their data as both 3-D (time/space-spectral-space) -and 4-D (time-spectral-space-space/time) alternately, and sometimes simultaneously, -depending on their science goals. - -By building on features inherited from the ndcube package, sunraster provides an API -for seamlessly switching between the 3-D and 4-D paradigms without changing or -hard-copying the underlying data. -This saves users carrying around multiple copies of the same data which might become -inconsistent during a data analysis workflow. -A powerful slicing API enables users to extract regions of interest with single commands -that not only alter the data array, but also the associated uncertainties, data mask -and the coordinate transformations. -This saves users from performing multiple tedious and error-prone tasks on the various -components of their dataset individually. -It also makes the development of analysis workflows quicker, more reliable, and easier -to understand, thus boosting users' productivity. - -# Community Applications - -Most of sunraster's tools are instrument-agnostic. -However it does provide specific tools for reading Solar Orbiter/SPICE FITS files -and hence helping SPICE users leverage the wider scientific Python ecosystem -for their analysis. -In addition, the data and metadata classes in the IRIS mission's Python user -tools package [irispy-lmsal; @irispy-docs; @irispy-code] inherit from and build -upon those provided by sunraster. - -# Acknowledgements - -We acknowledge financial support for sunraster from Solar Orbiter/SPICE -(grant 80NSSC19K1000) as well as NASA's SDO/AIA and IRIS missions -(grant NNG04EA00C and NNG09FA40C). -We also acknowledge the SunPy and Python in Heliophysics communities for their support. - -# References diff --git a/setup.cfg b/setup.cfg index e5242a0b..f59bac7f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,14 +21,14 @@ classifiers = Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Scientific/Engineering :: Physics [options] zip_safe = False -python_requires = >=3.9 +python_requires = >=3.10 packages = find: include_package_data = True setup_requires = @@ -40,7 +40,7 @@ install_requires = [options.extras_require] instr = - sunpy>=5.0.0rc1 + sunpy>=5.0.0 tests = pytest-astropy docs = @@ -88,6 +88,8 @@ filterwarnings = ignore: invalid value encountered in true_divide # https://github.com/pytest-dev/pytest-cov/issues/557 ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning +doctest_subpackage_requires = + docs/* = ndcube<2.3.0 [pycodestyle] max_line_length = 120 diff --git a/sunraster/instr/spice.py b/sunraster/instr/spice.py index 6e033157..48108ea2 100644 --- a/sunraster/instr/spice.py +++ b/sunraster/instr/spice.py @@ -105,7 +105,9 @@ def read_spice_l2_fits(filenames, windows=None, memmap=True, read_dumbbells=Fals first_sequence = window_sequences[0][1] first_spectral_window = first_sequence[0].meta.spectral_window if all(window[1][0].meta.spectral_window == first_spectral_window for window in window_sequences): - aligned_axes = tuple(range(len(first_sequence.dimensions))) + aligned_axes = tuple( + range(len(first_sequence.shape if hasattr(first_sequence, "shape") else first_sequence.dimensions)) + ) else: aligned_axes = tuple( i for i, phys_type in enumerate(first_sequence.array_axis_physical_types) if "em.wl" not in phys_type diff --git a/sunraster/instr/tests/test_spice.py b/sunraster/instr/tests/test_spice.py index 67ad5ab7..e03ec13d 100644 --- a/sunraster/instr/tests/test_spice.py +++ b/sunraster/instr/tests/test_spice.py @@ -300,8 +300,10 @@ def test_read_spice_l2_fits_multiple_rasters_multiple_windows(spice_rasdb_filena assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE) assert set(result.aligned_axes.values()) == {(0, 2, 3)} assert len(result) == 2 - assert all(window.dimensions[0].value == len(filenames) for window in result.values()) - assert all(isinstance(window, RasterSequence) for window in result.values()) + for window in result.values(): + assert isinstance(window, RasterSequence) + data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value + assert data_length == len(filenames) def test_read_spice_l2_fits_multiple_rasters_single_window(spice_rasdb_filename): @@ -310,8 +312,10 @@ def test_read_spice_l2_fits_multiple_rasters_single_window(spice_rasdb_filename) assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE) assert result.aligned_axes is None assert len(result) == 1 - assert all(window.dimensions[0].value == len(filenames) for window in result.values()) - assert all(isinstance(window, RasterSequence) for window in result.values()) + for window in result.values(): + assert isinstance(window, RasterSequence) + data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value + assert data_length == len(filenames) def test_read_spice_l2_fits_multiple_sns_multiple_windows(spice_sns_filename): @@ -320,8 +324,10 @@ def test_read_spice_l2_fits_multiple_sns_multiple_windows(spice_sns_filename): assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE) assert set(result.aligned_axes.values()) == {(0, 2, 3)} assert len(result) == 2 - assert all(window.dimensions[0].value == len(filenames) for window in result.values()) - assert all(isinstance(window, SpectrogramSequence) for window in result.values()) + for window in result.values(): + assert isinstance(window, SpectrogramSequence) + data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value + assert data_length == len(filenames) def test_read_spice_l2_fits_multiple_files_dumbbells(spice_rasdb_filename): @@ -330,8 +336,10 @@ def test_read_spice_l2_fits_multiple_files_dumbbells(spice_rasdb_filename): assert isinstance(result, READ_SPICE_L2_FITS_RETURN_TYPE) assert all(window[0].meta.contains_dumbbell for window in result.values()) assert set(result.aligned_axes.values()) == {tuple(range(4))} - assert all(window.dimensions[0].value == len(filenames) for window in result.values()) - assert all(isinstance(window, SpectrogramSequence) for window in result.values()) + for window in result.values(): + assert isinstance(window, SpectrogramSequence) + data_length = window.shape[0] if hasattr(window, "shape") else window.dimensions[0].value + assert data_length == len(filenames) def test_read_spice_l2_fits_incompatible_files(spice_rasdb_filename, spice_sns_filename): diff --git a/sunraster/spectrogram.py b/sunraster/spectrogram.py index 18a654e2..8900afc7 100644 --- a/sunraster/spectrogram.py +++ b/sunraster/spectrogram.py @@ -299,7 +299,7 @@ def __str__(self): {"".join(["-"] * len(self.__class__.__name__))} Time Period: {time_period} Instrument axes: {self.instrument_axes} - Pixel dimensions: {self.dimensions.astype(int)} + Pixel dimensions: {self.shape if hasattr(self, "shape") else self.dimensions.astype(int)} Longitude range: {lon_range} Latitude range: {lat_range} Spectral range: {spectral_range} diff --git a/sunraster/spectrogram_sequence.py b/sunraster/spectrogram_sequence.py index 0514a5c6..d6931b87 100644 --- a/sunraster/spectrogram_sequence.py +++ b/sunraster/spectrogram_sequence.py @@ -228,7 +228,10 @@ def __init__(self, data_list, common_axis, meta=None): self._spectral_axis_name = SPECTRAL_AXIS_NAME self._set_single_scan_instrument_axes_types() - raster_dimensions = SpectrogramSequence.dimensions + # TODO: Compatibility with upcoming ndcube 2.3 + raster_dimensions = ( + SpectrogramSequence.shape if hasattr(SpectrogramSequence, "shape") else SpectrogramSequence.dimensions + ) sns_dimensions = SpectrogramSequence.cube_like_dimensions raster_array_axis_physical_types = SpectrogramSequence.array_axis_physical_types sns_array_axis_physical_types = SpectrogramSequence.cube_like_array_axis_physical_types diff --git a/tox.ini b/tox.ini index 3e7ae280..d37f3557 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] min_version = 4.0 envlist = - py{39,310,311}{,-oldestdeps,-devdeps,-online} + py{310,311,312}{,-oldestdeps,-devdeps,-online} build_docs codestyle @@ -17,11 +17,12 @@ setenv = COLUMNS = 180 PYTEST_COMMAND = pytest -vvv --pyargs sunraster --cov=sunraster --cov-report=xml --cov-config={toxinidir}/setup.cfg {toxinidir}/docs build_docs,online: HOME = {envtmpdir} + devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple deps = - devdeps: cython - devdeps: git+https://github.com/astropy/astropy + devdeps: astropy>=0.0.dev0 devdeps: git+https://github.com/sunpy/ndcube devdeps: git+https://github.com/sunpy/sunpy + devdeps: numpy>=0.0.dev0 oldestdeps: ndcube<2.2 online: pytest-rerunfailures online: pytest-timeout