Skip to content

Commit

Permalink
Merge pull request #2225 from meeseeksmachine/auto-backport-of-pr-222…
Browse files Browse the repository at this point in the history
…3-on-v3.5.x

Backport PR #2223 on branch v3.5.x (Replace subset_to_apply in docs where possible)
  • Loading branch information
kecnry authored May 30, 2023
2 parents 29184ba + a1f3e3e commit 7c6e054
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/cubeviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ An example without accessing Specviz:
.. code-block:: python
subset1_spec1d = cubeviz.get_data(data_label=flux_data_label,
subset_to_apply="Subset 1",
spatial_subset="Subset 1",
function="mean")
Note that in the above example, the ``function`` keyword is used to tell Cubeviz
Expand Down
4 changes: 2 additions & 2 deletions docs/specviz/export_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To extract a spectrum with a spectral subset applied:

.. code-block:: python
specviz.get_data(subset_to_apply='Subset 1')
specviz.get_data(spectral_subset='Subset 1')
In this case, the returned `specutils.Spectrum1D` object will have a ``mask``
attribute, where ``True`` corresponds to the region outside the selected subset
Expand All @@ -42,7 +42,7 @@ spectrum containing only your subset by running:

.. code-block:: python
spec = specviz.get_data(subset_to_apply='Subset 1')
spec = specviz.get_data(spectral_subset='Subset 1')
subset_spec = Spectrum1D(flux=spec.flux[~spec.mask],
spectral_axis=spec.spectral_axis[~spec.mask])
specviz.load_spectrum(subset_spec)
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/cubeviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def specviz(self):
def get_data(self, data_label=None, spatial_subset=None, spectral_subset=None, function=None,
cls=None):
"""
Returns data with name equal to data_label of type cls with subsets applied from
subset_to_apply.
Returns data with name equal to ``data_label`` of type ``cls`` with subsets applied from
``spatial_subset`` and/or ``spectral_subset`` using ``function`` if applicable.
Parameters
----------
Expand Down
30 changes: 21 additions & 9 deletions notebooks/SpecvizExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import warnings\n",
Expand All @@ -37,7 +39,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from jdaviz import Specviz\n",
Expand All @@ -63,7 +67,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"specviz.show()"
Expand Down Expand Up @@ -91,7 +97,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"data_dir = tempfile.gettempdir()\n",
Expand All @@ -116,11 +124,13 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"# Returns a version of the whole spectra, with a mask applied\n",
"specviz.get_spectra(data_label='myfile', subset_to_apply='Subset 1')"
"specviz.get_data(data_label='myfile', spectral_subset='Subset 1')"
]
},
{
Expand All @@ -133,10 +143,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"specviz.app.get_subsets_from_viewer('spectrum-viewer')"
"specviz.get_spectra()"
]
},
{
Expand Down Expand Up @@ -281,7 +293,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.9.16"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 7c6e054

Please sign in to comment.