-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
237 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
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
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
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 @@ | ||
from .rotate_image import * # noqa |
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,9 @@ | ||
from jdaviz.core.registries import tray_registry | ||
from jdaviz.core.template_mixin import TemplateMixin | ||
|
||
__all__ = ['RotateImageSimple'] | ||
|
||
|
||
@tray_registry('imviz-rotate-image', label="Simple Image Rotation") | ||
class RotateImageSimple(TemplateMixin): | ||
template_file = __file__, "rotate_image.vue" |
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,9 @@ | ||
<template> | ||
<j-tray-plugin> | ||
<v-row> | ||
<j-docs-link :link="'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#simple-image-rotation'">Rotate image N-up/E-left.</j-docs-link> | ||
</v-row> | ||
|
||
|
||
</j-tray-plugin> | ||
</template> |
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,203 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "206e73ce", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"from astropy.io import fits\n", | ||
"from astropy.nddata import NDData\n", | ||
"from astropy.wcs import WCS\n", | ||
"\n", | ||
"from jdaviz import Imviz" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6e816343", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Image of interest (HST/ACS FLT)\n", | ||
"a = np.random.random((2048, 4096))\n", | ||
"w = WCS({'WCSAXES': 2,\n", | ||
" 'CRPIX1': 2100.0,\n", | ||
" 'CRPIX2': 1024.0,\n", | ||
" 'PC1_1': -1.14852e-05,\n", | ||
" 'PC1_2': 7.01477e-06,\n", | ||
" 'PC2_1': 7.75765e-06,\n", | ||
" 'PC2_2': 1.20927e-05,\n", | ||
" 'CDELT1': 1.0,\n", | ||
" 'CDELT2': 1.0,\n", | ||
" 'CUNIT1': 'deg',\n", | ||
" 'CUNIT2': 'deg',\n", | ||
" 'CTYPE1': 'RA---TAN',\n", | ||
" 'CTYPE2': 'DEC--TAN',\n", | ||
" 'CRVAL1': 3.581704851882,\n", | ||
" 'CRVAL2': -30.39197867265,\n", | ||
" 'LONPOLE': 180.0,\n", | ||
" 'LATPOLE': -30.39197867265,\n", | ||
" 'MJDREF': 0.0,\n", | ||
" 'RADESYS': 'ICRS'})\n", | ||
"hdu = fits.ImageHDU(a, name='SCI')\n", | ||
"hdu.header.update(w.to_header())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9a69e6b9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(w)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3069a91e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# What about JWST GWCS?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b72a0049", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Just a dummy array to hold the WCS.\n", | ||
"a_dummy = fits.ImageHDU(np.ones((3, 3), dtype=np.int16))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a526d9a9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# WCS with N-up/E-left\n", | ||
"w_ref = WCS({'CTYPE1': 'RA---TAN',\n", | ||
" 'CUNIT1': 'deg',\n", | ||
" 'CDELT1': -0.0002777777778,\n", | ||
" 'CRPIX1': 1,\n", | ||
" 'NAXIS1': 3,\n", | ||
" 'CTYPE2': 'DEC--TAN',\n", | ||
" 'CUNIT2': 'deg',\n", | ||
" 'CDELT2': 0.0002777777778,\n", | ||
" 'CRPIX2': 1,\n", | ||
" 'NAXIS2': 3}) \n", | ||
"w_ref.wcs.crval = w.wcs.crval" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "55b2cc04", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"w_ref" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "84d06406", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ndd = NDData(a_dummy.data, wcs=w_ref)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "93fcdb1b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"imviz = Imviz(verbosity='warning')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e3585cda", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"imviz.load_data(ndd, data_label='wcs_ref')\n", | ||
"imviz.load_data(hdu, data_label='jb5g05ubq_flt')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "bc2cf21c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"imviz.link_data(link_type='wcs')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "022cc29f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"imviz.app" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "31fefe0a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"imviz.default_viewer.zoom_level = 2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c86aed70", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"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.9.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |