.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery_examples/regions/import_a_region.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_examples_regions_import_a_region.py: .. _example_import_region: Import Regions of Interest (RoIs) ################################# Example showing how to import RoIs from other programs with `~madcubapy.regions.import_roi`. .. GENERATED FROM PYTHON SOURCE LINES 11-37 .. image-sg:: /gallery_examples/regions/images/sphx_glr_import_a_region_001.png :alt: IRAS16293_SO2a_tm1.fits :srcset: /gallery_examples/regions/images/sphx_glr_import_a_region_001.png :class: sphx-glr-single-img .. code-block:: Python from madcubapy.io import MadcubaMap from madcubapy.regions import import_roi from madcubapy.visualization import add_wcs_axes import matplotlib.pyplot as plt # Read fits file madcuba_map = MadcubaMap.read("../data/IRAS16293_SO2a_tm1.fits") # Create empty figure fig = plt.figure(figsize=(6,6)) # Plot the map ax, img = add_wcs_axes(fig, fitsmap=madcuba_map, vmin=0, vmax=200) ax.set_xlim(200, 350) ax.set_ylim(200, 350) # Import roi carta_rotated_rectangle = import_roi(input_file="../data/ellipse.mcroi", fitsmap=madcuba_map, fc="red", ec="white", lw=3, alpha=0.3) # Add roi to plot ax.add_patch(carta_rotated_rectangle) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.095 seconds) .. _sphx_glr_download_gallery_examples_regions_import_a_region.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: import_a_region.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: import_a_region.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: import_a_region.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_