.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_shaun.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_shaun.py: ==================== Simple Shaun Example ==================== A simple example showing how to apply Shaun to correct for atmospheric seeing in a region of an SST/CRISP image. .. GENERATED FROM PYTHON SOURCE LINES 7-13 .. code-block:: default import matplotlib.pyplot as plt import numpy as np from crispy import CRISP from smug.shaun_inference import pretrained_shaun_corrector .. GENERATED FROM PYTHON SOURCE LINES 14-15 Load data, rotate it to fill the frame, and select sub-region to work on. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: default data = CRISP("crisp_l2_20140906_152724_6563_r00447_3wavelengths.fits") data.rotate_crop() crisp_sub_region = data[:, 200:500, 200:500] .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.9.13/x64/lib/python3.9/site-packages/astropy/wcs/wcs.py:725: FITSFixedWarning: 'datfix' made the change 'Set MJD-AVG to 56906.703926 from DATE-AVG'. warnings.warn( /opt/hostedtoolcache/Python/3.9.13/x64/lib/python3.9/site-packages/astropy/io/fits/card.py:264: VerifyWarning: Keyword name 'frame_dims' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. warnings.warn( /opt/hostedtoolcache/Python/3.9.13/x64/lib/python3.9/site-packages/astropy/wcs/wcs.py:725: FITSFixedWarning: 'datfix' made the change 'Set MJD-AVG to 56906.703926 from DATE-AVG'. warnings.warn( .. GENERATED FROM PYTHON SOURCE LINES 21-22 Construct Shaun model and apply to image. .. GENERATED FROM PYTHON SOURCE LINES 22-26 .. code-block:: default corrector = pretrained_shaun_corrector("Halpha") shaun_im = corrector.correct_image(crisp_sub_region.data) .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading: "https://www.astro.gla.ac.uk/users/USER-MANAGED/solar_model_weights/Shaun_Halpha_1.0.0.pth.tar" to /home/runner/.cache/torch/hub/checkpoints/Shaun_Halpha_1.0.0.pth.tar 0%| | 0.00/131M [00:00 model loaded. Segmenting image cube: 0%| | 0/3 [00:00` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_shaun.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_