-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #728 from javerbukh/mosviz_niriss_nb
Add Mosviz NIRISS example notebook
- Loading branch information
Showing
1 changed file
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2b2fcea7", | ||
"metadata": {}, | ||
"source": [ | ||
"# MOSViz NIRISS example notebook" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b180dd8a", | ||
"metadata": {}, | ||
"source": [ | ||
"Note: We silence most warnings for now. For debugging, you can comment out the next cell and then restart the kernel to re-enable warnings." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "869727c8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import warnings\n", | ||
"warnings.simplefilter('ignore')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e3d6f12f", | ||
"metadata": {}, | ||
"source": [ | ||
"This starts MOSViz." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f2233e63", | ||
"metadata": { | ||
"scrolled": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from jdaviz.configs.mosviz.helper import MosViz\n", | ||
"\n", | ||
"mosviz = MosViz()\n", | ||
"mosviz.app" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "75d0e918", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run this cell if your desired data path is a temporary directory.\n", | ||
"\n", | ||
"import tempfile\n", | ||
"data_dir = tempfile.gettempdir()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "raw", | ||
"id": "bbf74c94", | ||
"metadata": {}, | ||
"source": [ | ||
"# *** OR ***\n", | ||
"# Enable and run this cell if you have a different data path.\n", | ||
"# Replace the value with your real path.\n", | ||
"\n", | ||
"data_dir = '/path/to/my_mosvis_data_dir' " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2ac93c58", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run this cell if you wish to download and unzip our example data.\n", | ||
"# This requires the \"zipfile\" package.\n", | ||
"\n", | ||
"from zipfile import ZipFile\n", | ||
"from astropy.utils.data import download_file\n", | ||
"import pathlib\n", | ||
"\n", | ||
"example_data = 'https://stsci.box.com/shared/static/9lkf5zha6zkf8ujnairy6krobbh038wt.zip'\n", | ||
"fn = download_file(example_data, cache=True)\n", | ||
"with ZipFile(fn, 'r') as sample_data_zip:\n", | ||
" sample_data_zip.extractall(data_dir)\n", | ||
"\n", | ||
"level3_path = (pathlib.Path(data_dir) / 'NIRISS_for_parser_p0171')\n", | ||
" \n", | ||
"data_dir = level3_path" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8bcd4639", | ||
"metadata": {}, | ||
"source": [ | ||
"Once loaded below, click on one of the rows in the table to have your data displayed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1c75b8a1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mosviz.load_niriss_data(data_dir)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |