Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strauss hack jt #17

Open
wants to merge 48 commits into
base: strauss-hack
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f4fd992
fix: make standalone work with matplotlib >= 3.9.0
maartenbreddels Jul 9, 2024
6e2826f
Merge pull request #2944 from maartenbreddels/fix_matplotlib_standalo…
pllim Jul 9, 2024
e65237f
Fix standalone build events for PR (#2946)
pllim Jul 9, 2024
2201752
sync notebook github links in HTML docs to the git commit used to bui…
bmorris3 Jul 10, 2024
18bb83e
support exporting a plot from an unopened/inactive plugin (#2934)
kecnry Jul 11, 2024
3e7aade
Merge pull request #3080 from bmorris3/link-nbs-to-stable
bmorris3 Jul 11, 2024
8e2249b
BUG: Specviz to respect local_path when provided (#3081)
pllim Jul 11, 2024
73e54d0
delay callback when calling previous zoom (#2949)
kecnry Jul 11, 2024
59b179e
Fix for issue #3086
bmorris3 Jul 15, 2024
39ac1c4
Update jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_ex…
bmorris3 Jul 16, 2024
23b3edd
Catalogs plugin results table (#2915)
kcarver1 Jul 16, 2024
5bea741
fix for Imviz parser romandeps test since default update in #2767
bmorris3 Jul 17, 2024
b13c3bc
exclude subsets from WCS-only layer filter
bmorris3 Jul 17, 2024
6b7f233
fixes for linkcheck test
bmorris3 Jul 17, 2024
4fe79a9
Merge pull request #3097 from bmorris3/exclude-subsets-orientation-dr…
bmorris3 Jul 17, 2024
f35af23
docs link cleanup (#3095)
kecnry Jul 18, 2024
df59fd7
Improve overwrite warning behavior in export (#3094)
rosteen Jul 18, 2024
dfb4bfa
Markers: Save to CSV (#3089)
pllim Jul 18, 2024
5c92eae
Create private method for importing spectral region objects (#2941)
javerbukh Jul 19, 2024
3279bcf
export plugin: hide all serverside-saving sections on MAST (#3096)
kecnry Jul 22, 2024
3d54bd7
Update docs/sample_notebooks.rst
bmorris3 Jul 22, 2024
eaa720e
Merge pull request #3098 from bmorris3/fix-roman-parser-test
bmorris3 Jul 22, 2024
e34fcf9
changelog update for release of v3.10.3
bmorris3 Jul 22, 2024
da26504
Merge pull request #3109 from bmorris3/back-to-dev-v3.10.4
bmorris3 Jul 23, 2024
c1ae0f2
fix spectral extr. normalization, test against flux cal obs
bmorris3 Jul 22, 2024
22ed4cf
Merge pull request #3088 from bmorris3/cubeviz-default-extract
bmorris3 Jul 23, 2024
143cd8d
expanded support of SB/Flux translations (#2940)
gibsongreen Jul 23, 2024
6fb47ab
TST: Also run slow test in non-dev env, fix Catalog Search bug (#3101)
pllim Jul 24, 2024
3de1b08
MNT: Remove unused astropy version check, update doctest (#3114)
pllim Jul 24, 2024
dc2186e
Update model fit result units after toggling flux/surface brightness …
rosteen Jul 29, 2024
682e302
Generalize cube extract (#2939)
kecnry Jul 30, 2024
e26b9ef
TST: Fix tests downloading data into source dir.
pllim Jul 30, 2024
1a210d1
"Imviz Line Profiles (XY)" renamed to "Image Profiles (XY)" (#3121)
kecnry Jul 30, 2024
a126296
Update the mouse over units by listening to the unit-conversion plugi…
haticekaratay Jul 30, 2024
ec0720b
Merge pull request #3122 from pllim/moar-code-cleanup
pllim Jul 30, 2024
9d46233
Cubeviz to use wcs1d-fits from specutils
pllim Mar 17, 2023
5a020cc
Merge pull request #2094 from pllim/cubeviz-use-wcs1d-fits
pllim Jul 30, 2024
5a74cd6
BUG: Fix MaNGA cube loading (#3119)
pllim Jul 31, 2024
09c3cc6
Fix cube fit toggle with spectral subset selected (#3123)
rosteen Jul 31, 2024
6049d9a
Create audified cube and use with spectrum at spaxel tool
javerbukh Jul 9, 2024
627a34f
Add Sonify Data plugin and connect to spectrum per spaxel tool
javerbukh Jul 10, 2024
9e98b32
Fix errors
javerbukh Jul 10, 2024
e6d52b4
Try moving code to mixin
javerbukh Jul 10, 2024
0080b2f
Move code to viewers.py
javerbukh Jul 10, 2024
4b01304
Remove print statements
javerbukh Jul 10, 2024
505f73f
Patches:
Jul 11, 2024
89d6fff
fix np import
Jul 31, 2024
5c67736
add audio frequency range choice and equal loudness normalisation opt…
Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-alldeps-cov
toxposargs: --remote-data
toxposargs: --remote-data --run-slow
allow_failure: false

- name: OS X - Python 3.12
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'v*'
workflow_dispatch:
pull_request:
types: [opened, synchronize, labeled, unlabeled]

defaults:
run:
Expand Down
59 changes: 57 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ New Features
------------

- Added flux/surface brightness translation and surface brightness
unit conversion in Cubeviz and Specviz. [#2781]
unit conversion in Cubeviz and Specviz. [#2781, #2940, #3088, #3113]

- Plugin tray is now open by default. [#2892]

Expand All @@ -30,6 +30,10 @@ Cubeviz
Imviz
^^^^^

- Added a table with catalog search results. [#2915, #3101]

- "Imviz Line Profiles (XY)" plugin is renamed to "Image Profiles (XY)". [#3121]

Mosviz
^^^^^^

Expand Down Expand Up @@ -67,6 +71,12 @@ Cubeviz

- Spectral Extraction: renamed ``collapse_to_spectrum(...)`` to ``extract(...)``. [#2859]

- Generic FITS parsing now goes through ``specutils`` loaders first, if possible.
If a ``specutils`` loader is used, uncertainty is converted to standard deviation type. [#3119]

- Custom Spectrum1D writer format ``jdaviz-cube`` is removed. Use ``wcs1d-fits`` from
``specutils`` instead. [#2094]

Imviz
^^^^^

Expand All @@ -86,6 +96,10 @@ Specviz2d
Bug Fixes
---------

- Markers table can now export to CSV but its columns had to be changed to accomodate this fix:
world and pixel (previously containing SkyCoord and pixel location tuples, respectively) are now
each two separate columns for world_ra/world_dec and pixel_x/pixel_y, respectively. [#3089]

Cubeviz
^^^^^^^

Expand All @@ -99,6 +113,13 @@ Cubeviz
- Flux units are now correct for collapsed spectra when using the sum function
when units are in per steradian. [#2873]

- Mouse over coordinates now responds to the selected surface brightness unit. [#2931]

- Fixed MaNGA cube loading. Uncertainty type is also handled properly now. [#3119]

- Fixed spectral axis value display in Markers plugin. Previously, it failed to display
very small values, resulting in zeroes. [#3119]

Imviz
^^^^^

Expand Down Expand Up @@ -181,7 +202,31 @@ Other Changes and Additions

- Max pinned matplotlib to <3.9 due to standalone build problems. [#2917]

3.10.3 (unreleased)
3.10.4 (unreleased)
===================

Bug Fixes
---------

- Fixed the data menu in Model Fitting not being populated if Cube Fit was toggled
while a spectral subset was selected. [#3123]

Cubeviz
^^^^^^^

Imviz
^^^^^

Mosviz
^^^^^^

Specviz
^^^^^^^

Specviz2d
^^^^^^^^^

3.10.3 (2024-07-22)
===================

Bug Fixes
Expand All @@ -190,6 +235,14 @@ Bug Fixes
- Display default filepath in Export plugin, re-enable API exporting, enable relative and absolute
path exports from the UI. [#2896]

- Fixes exporting the stretch histogram from Plot Options before the Plot Options plugin is ever opened. [#2934]

- Previous zoom tool is optimized to only issue one zoom update to the viewer. [#2949]

- Fixes overwrite behavior for plugin plots, and properly closes overwrite warning overlay after confirmation. [#3094]

- Disable all non-image exporting when the server is not running locally, to avoid confusion with the file being saved on the server. [#3096]

Cubeviz
^^^^^^^

Expand All @@ -201,6 +254,8 @@ Imviz
- Fix multiple footprints bug that prevented footprint updates on changes to the
viewer orientation. [#2918]

- Exclude subset layers from the orientation options in the Orientation plugin. [#3097]

Mosviz
^^^^^^

Expand Down
21 changes: 18 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# Thus, any C-extensions that are needed to build the documentation will *not*
# be accessible, and the documentation will not build correctly.

import subprocess
import sys
import datetime

Expand Down Expand Up @@ -145,9 +146,23 @@
version = '.'.join(release.split('.')[:2])

extensions += ['sphinx.ext.extlinks', 'sphinx_design'] # noqa: F405
gh_tag = f'v{release}' if '.dev' not in release else 'main'
extlinks = {'gh-tree': (f'https://github.com/spacetelescope/jdaviz/tree/{gh_tag}/%s', '%s'),
'gh-notebook': (f'https://github.com/spacetelescope/jdaviz/blob/{gh_tag}/notebooks/%s.ipynb', '%s notebook')} # noqa: E501

# get the most recent git commit hash at build time:
commit_hash = subprocess.run(
# git call for the latest commit hash:
'git rev-parse HEAD'.split(),
capture_output=True
).stdout.decode().strip()

# inject the most recent commit hash into the github links used in `sample_notebooks.rst`:
extlinks = {
'gh-tree': (
f'https://github.com/spacetelescope/jdaviz/tree/{commit_hash}/%s', '%s'
),
'gh-notebook': (
f'https://github.com/spacetelescope/jdaviz/blob/{commit_hash}/notebooks/%s.ipynb', '%s notebook'
)
}

# -- Options for HTML output --------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/cubeviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where the mask (if available) is as defined in

.. code-block:: python

mydata.write("mydata.fits", format="jdaviz-cube")
mydata.write("mydata.fits", format="wcs1d-fits", hdu=1)


.. _cubeviz-export-model:
Expand Down
9 changes: 8 additions & 1 deletion docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,12 @@ catalog dropdown menu.
and works best when you only have a single image loaded in a viewer.

To load a catalog from a supported `JWST ECSV catalog file <https://jwst-pipeline.readthedocs.io/en/latest/jwst/source_catalog/main.html#output-products>`_, choose "From File...".
The file must be able to be parsed by `astropy.table.Table.read` and contain a column labeled 'sky_centroid'.
The file must be able to be parsed by `astropy.table.Table.read` and contains the following columns:

* ``'sky_centroid'``: Column with `~astropy.coordinates.SkyCoord` sky coordinates of the sources.
* ``'label'``: Column with string identifiers of the sources. If you have numerical identifiers,
they will be recast as string.

Clicking :guilabel:`SEARCH` will show markers for any entry within the filtered zoom window.

If you have multiple viewers open, you will see another dropdown menu to select the active
Expand All @@ -397,6 +402,8 @@ are not stored. To save the current result before submitting a new query, you ca
The table returned from the API above may cover more sources than shown in the currently zoomed-in
portion of the image. Additional steps will be needed to filter out these points, if necessary.

Performing a search populates a table that contains the
right ascension, declination, and the object ID of the found sources.

.. _imviz-footprints:

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ You also need the up-to-date tags for proper software versioning:
git rebase upstream/main

For the rest of contributing workflow, it is very similar to
`how to make a code contribution to astropy <https://docs.astropy.org/en/latest/development/workflow/development_workflow.html>`_,
`how to make a code contribution to astropy <https://docs.astropy.org/en/latest/development/quickstart.html>`_,
including setting up virtual environments, git basics, and more.

An exception is the change log; if your patch requires a change log, see ``CHANGES.rst`` for examples.
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/api_nuts_bolts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Utilities API
:no-inheritance-diagram:
:no-inherited-members:

.. automodapi:: jdaviz.configs.cubeviz.plugins.mixins
:no-inheritance-diagram:
:no-inherited-members:

.. automodapi:: jdaviz.configs.imviz.wcs_utils
:no-inheritance-diagram:
:no-inherited-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/sample_notebooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ These tools include three types of example Jupyter notebooks.

1. :gh-tree:`Sample Jdaviz Notebooks <notebooks>` that illustrate how to use Jdaviz and various API calls. These notebooks are located in the ``notebooks`` sub-directory of the git repository.

2. `Sample JDAT notebooks <https://jwst-docs.stsci.edu/jwst-post-pipeline-data-analysis/data-analysis-example-jupyter-notebooks>`_ that illustrate likely science workflows with data obtained from the various JWST instruments. These notebook incorporate ``astropy`` and Jdaviz when possible.
2. `Sample JDAT notebooks <https://jwst-docs.stsci.edu/jwst-post-pipeline-data-analysis#JWSTPostPipelineDataAnalysis-JWSTdataanalysis(JDAT)notebooks>`_ that illustrate likely science workflows with data obtained from the various JWST instruments. These notebooks incorporate ``astropy`` and Jdaviz when possible.

3. `Sample JWST pipeline notebooks <https://jwst-docs.stsci.edu/jwst-science-calibration-pipeline-overview/example-jupyter-notebooks-running-the-pipeline>`_ that illustrate how to run the JWST science calibration pipeline.
13 changes: 5 additions & 8 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,17 @@ def equivalent_units(self, data, cid, units):
'Jy', 'mJy', 'uJy', 'MJy',
'W / (m2 Hz)', 'W / (Hz m2)', # Order is different in astropy v5.3
'eV / (s m2 Hz)', 'eV / (Hz s m2)',
'erg / (s cm2)',
'erg / (s cm2 Angstrom)', 'erg / (s cm2 Angstrom)',
'erg / (s cm2 Hz)', 'erg / (Hz s cm2)',
'ph / (s cm2 Angstrom)', 'ph / (s cm2 Angstrom)',
'ph / (Angstrom s cm2)',
'ph / (Hz s cm2)', 'ph / (Hz s cm2)', 'bol', 'AB', 'ST'
]
+ [
'Jy / sr', 'mJy / sr', 'uJy / sr', 'MJy / sr',
'W / (Hz sr m2)',
'eV / (s m2 Hz sr)',
'erg / (s cm2 sr)',
'erg / (s cm2 Angstrom sr)', 'erg / (s cm2 Hz sr)',
'ph / (s cm2 Angstrom sr)', 'ph / (s cm2 Hz sr)',
'bol / sr', 'AB / sr', 'ST / sr'
'eV / (Hz s sr m2)',
'erg / (s sr cm2)',
'AB / sr'
])
else: # spectral axis
# prefer Hz over Bq and um over micron
Expand Down Expand Up @@ -2601,7 +2598,7 @@ def load_configuration(self, path=None, config=None):
if self.config in ALL_JDAVIZ_CONFIGS:
self.docs_link = f'https://jdaviz.readthedocs.io/en/{self.vdocs}/{self.config}/index.html' # noqa
else:
self.docs_link = 'https://jdaviz.readthedocs.io'
self.docs_link = f'https://jdaviz.readthedocs.io/en/{self.vdocs}'

self.state.settings.update(config.get('settings'))

Expand Down
1 change: 1 addition & 0 deletions jdaviz/configs/cubeviz/cubeviz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tray:
- specviz-line-analysis
- cubeviz-moment-maps
- imviz-aper-phot-simple
- cubeviz-sonify-data
- export
- about
viewer_area:
Expand Down
66 changes: 0 additions & 66 deletions jdaviz/configs/cubeviz/helper.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import numpy as np
from astropy.io import fits
from astropy.io import registry as io_registry
from specutils import Spectrum1D
from specutils.io.registers import _astropy_has_priorities

from jdaviz.core.events import SnackbarMessage
from jdaviz.core.helpers import ImageConfigHelper
from jdaviz.configs.default.plugins.line_lists.line_list_mixin import LineListMixin
Expand Down Expand Up @@ -166,63 +160,3 @@ def get_aperture_photometry_results(self):

"""
return self.plugins['Aperture Photometry']._obj.export_table()


# TODO: We can remove this when specutils supports it, i.e.,
# https://github.com/astropy/specutils/issues/592 and
# https://github.com/astropy/specutils/pull/1009
# NOTE: Cannot use custom_write decorator from specutils because
# that involves asking user to manually put something in
# their ~/.specutils directory.

def jdaviz_cube_fitswriter(spectrum, file_name, **kwargs):
"""This is a custom writer for Spectrum1D data cube.
This writer is specifically targetting data cube
generated from Cubeviz plugins (e.g., cube fitting)
with FITS WCS. It writes out data in the following format
(with MASK only exist when applicable)::

No. Name Ver Type
0 PRIMARY 1 PrimaryHDU
1 SCI 1 ImageHDU (float32)
2 MASK 1 ImageHDU (uint16)

The FITS file generated by this writer does not need a
custom reader to be read back into Spectrum1D.

Examples
--------
To write out a Spectrum1D cube using this writer:

>>> spec.write("my_output.fits", format="jdaviz-cube", overwrite=True) # doctest: +SKIP

"""
pri_hdu = fits.PrimaryHDU()

flux = spectrum.flux
sci_hdu = fits.ImageHDU(flux.value.astype(np.float32))
sci_hdu.name = "SCI"
sci_hdu.header.update(spectrum.meta)
sci_hdu.header.update(spectrum.wcs.to_header())
sci_hdu.header['BUNIT'] = flux.unit.to_string(format='fits')

hlist = [pri_hdu, sci_hdu]

# https://specutils.readthedocs.io/en/latest/spectrum1d.html#including-masks
# Good: False or 0
# Bad: True or non-zero
if spectrum.mask is not None:
mask_hdu = fits.ImageHDU(spectrum.mask.astype(np.uint16))
mask_hdu.name = "MASK"
hlist.append(mask_hdu)

hdulist = fits.HDUList(hlist)
hdulist.writeto(file_name, **kwargs)


if _astropy_has_priorities():
kwargs = {"priority": 0}
else: # pragma: no cover
kwargs = {}
io_registry.register_writer(
"jdaviz-cube", Spectrum1D, jdaviz_cube_fitswriter, force=False, **kwargs)
2 changes: 2 additions & 0 deletions jdaviz/configs/cubeviz/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from .tools import * # noqa
from .mixins import * # noqa
from .viewers import * # noqa
from .parsers import * # noqa
from .moment_maps.moment_maps import * # noqa
from .slice.slice import * # noqa
from .spectral_extraction.spectral_extraction import * # noqa
from .sonify_data.sonify_data import * # noqa
Loading