This notebook shows and compares the distribution of chromospheric and transition region spectral line properties and inversion results below upflow regions and non-upflow regions. The Si IV, C II, and Mg II lines were observed by the IRIS spacecraft, while the Halpha line was observed by the CHASE mission. The Mg II k profiles were inverted by the IRIS2 package in SolarSoft. Link to Figure 10.

Note: The internal hyperlink only works on GitHub Pages or nbviewer. Do not click when viewing the notebook on GitHub.

In [1]:
import numpy as np
import sunpy
import sunpy.map
from sunpy.coordinates import propagate_with_solar_surface
from astropy.coordinates import SkyCoord
import astropy.units as u
import astropy.constants as const
from astropy.visualization import ImageNormalize, LogStretch, AsinhStretch
import matplotlib.pyplot as plt
from matplotlib import rc_context
from matplotlib import ticker
import cmcrameri.cm as cmcm
from fancy_colorbar import plot_colorbar, wcs_scalebar
from regions import Regions, CircleSkyRegion, CompoundSkyRegion
from scipy.stats import gaussian_kde
In [2]:
ms_style_dict = {'text.usetex': True, 'font.family': 'serif', 'axes.linewidth': 1.2,
                 'xtick.major.width': 1.2, 'xtick.major.size': 4,
                 'ytick.major.width': 1.2, 'ytick.major.size': 4,
                 'xtick.minor.width': 1.2, 'xtick.minor.size': 2,
                 'ytick.minor.width': 1.2, 'ytick.minor.size': 2,
                 'xtick.direction': 'in', 'ytick.direction': 'in',
                 'text.latex.preamble': r'\usepackage[T1]{fontenc}'
                 r'\usepackage{amsmath}' r'\usepackage{siunitx}'
                 r'\sisetup{detect-all=True}' r'\usepackage{fixltx2e}'}
In [3]:
iris_SiIV_1025_vel_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/SiIV_1393_vel_map.fits")
iris_SiIV_1025_intmap = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/SiIV_1393_int_map.fits")
iris_SiIV_1025_wid_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/SiIV_1393_vnth_map.fits")
iris_CII_1025_vel_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/CII_vel_map.fits")
In [4]:
iris2_Te_1025_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/iris2_Te_map.fits")
iris2_Te_1025_map_data = iris2_Te_1025_map.data
iris2_Te_1025_map_data[iris2_Te_1025_map_data <= 1000] = np.nan
iris2_Te_1025_map = sunpy.map.Map(iris2_Te_1025_map_data, iris2_Te_1025_map.meta)
iris2_Ne_1025_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/iris2_Ne_map.fits")
iris2_Ne_1025_map_data = iris2_Ne_1025_map.data
iris2_Ne_1025_map_data[iris2_Ne_1025_map_data <= 1e3] = np.nan
iris2_Ne_1025_map = sunpy.map.Map(iris2_Ne_1025_map_data, iris2_Ne_1025_map.meta)
iris2_vlos_1025_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/iris2_vlos_map.fits")
iris2_vnth_1025_map = sunpy.map.Map("../../src/IRIS/20221026/0026/fit_res/iris2_vturb_map.fits")
iris2_vnth_1025_map_data = iris2_vnth_1025_map.data
iris2_vnth_1025_map_data[iris2_vnth_1025_map_data <= 0.5] = np.nan
iris2_vnth_1025_map = sunpy.map.Map(iris2_vnth_1025_map_data, iris2_vnth_1025_map.meta)
In [5]:
chase_halpha_line_width_map = sunpy.map.Map("../../src/coalign_map/20221025/chase_haplha_line_width.fits")
with propagate_with_solar_surface(rotation_model='rigid'):
    chase_halpha_line_width_map = chase_halpha_line_width_map.reproject_to(iris_SiIV_1025_vel_map.wcs)
chase_halpha_line_width_map.meta["rsun_ref"] = 696000000.0
chase_halpha_line_width_map.plot_settings['cmap'] = "plasma"
chase_halpha_line_width_map.plot_settings['norm'] = ImageNormalize(vmin=0.9,vmax=1.35)
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
In [6]:
eis_FeXII_1025_vel_map = sunpy.map.Map("../../src/EIS/DHB_007_v2/20221025T2011/sunpymaps/eis_195_velmap_shift.fits") 
In [7]:
region_uf_1025 = Regions.read("../../sav/regions/eis_1025_east_pixel.reg")[0].to_sky(eis_FeXII_1025_vel_map.wcs)
region_fp_1025 = Regions.read("../../sav/regions/eis_1025_fp_pixel.reg")[0].to_sky(eis_FeXII_1025_vel_map.wcs)
region_moss_1025 = Regions.read("../../sav/regions/eis_1025_moss_pixel_0.reg")[0].to_sky(eis_FeXII_1025_vel_map.wcs) &\
                     Regions.read("../../sav/regions/eis_1025_moss_pixel_1.reg")[0].to_sky(eis_FeXII_1025_vel_map.wcs)
#CircleSkyRegion(center=SkyCoord(-220*u.arcsec, 200*u.arcsec, frame=iris_SiIV_1025_vel_map.coordinate_frame), radius=10*u.arcsec)
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
In [8]:
def get_region_mask(map, region, region_wcs):
    map_all_coords = sunpy.map.all_coordinates_from_map(map)
    with propagate_with_solar_surface(rotation_model='rigid'):
        if isinstance(region, CompoundSkyRegion):
            mask = np.where(region.region1.contains(map_all_coords,region_wcs) | region.region2.contains(map_all_coords,region_wcs))
        else:
            mask = np.where(region.contains(map_all_coords,region_wcs))
    
    return mask
In [9]:
def calc_and_plot_kde(data, ax, color, label, bins=100, alpha=0.5):
    data = data[np.isfinite(data)]
    kde = gaussian_kde(data)
    x = np.linspace(data.min(), data.max(), bins)
    ax.plot(x,kde(x), color=color, label=label)
    ax.fill_between(x, 0, kde(x), color=color+[alpha],)
    return kde
In [10]:
def plot_map_and_hist(map, regions, regions_wcs, ax_map, ax_hist, cmap, 
                      hist_colors=[[246./255,179./255,85./255],
                                    [88./255,178./255,220./255],
                                    [144./255,180./255,75./255]], 
                      hist_labels=["E Upflow", "Footpoint", "Moss"], hist_bins=100, hist_alphas=0.5,
                      norm=None, return_data=False):
    
    if not isinstance(regions, list):
        regions = [regions]
    if not isinstance(hist_colors, list):
        hist_colors = [hist_colors]*len(regions)
    if not isinstance(hist_labels, list):
        hist_labels = [hist_labels]*len(regions)
    if not isinstance(hist_bins, list):
        hist_bins = [hist_bins]*len(regions)
    if not isinstance(hist_alphas, list):
        hist_alphas = [hist_alphas]*len(regions)
    
    region_masks = []
    for region in regions:
        region_masks.append(get_region_mask(map, region, regions_wcs))

    im = map.plot(axes=ax_map, cmap=cmap, title=None, norm=norm,
                  interpolation="none")

    ax_bounds = ax_map.axis()
    for region, color, label, alpha in zip(regions, hist_colors, hist_labels, hist_alphas):
        with propagate_with_solar_surface(rotation_model='rigid'):
            if isinstance(region, CompoundSkyRegion):
                region.region1.to_pixel(map.wcs).plot(ax=ax_map,facecolor=color+[alpha],fill=True,
                                                    edgecolor=color,lw=1.5,label=label)
                region.region2.to_pixel(map.wcs).plot(ax=ax_map,facecolor=color+[alpha],fill=True,
                                                    edgecolor=color,lw=1.5,label=label)
            else:
                region.to_pixel(map.wcs).plot(ax=ax_map,facecolor=color+[alpha],fill=True,
                                                    edgecolor=color,lw=1.5,label=label)
    ax_map.axis(ax_bounds)
    ax_map.grid(False)

    wcs_scalebar(ax_map, 10*u.arcsec, r"$10^{\prime\prime}$", frame=True, borderpad=0.0,
        bbox_props=dict(boxstyle='round,pad=0',facecolor='white', edgecolor='#91989F', alpha=0.7))

    clb, clb_ax = plot_colorbar(im, ax_map,
                                bbox_to_anchor=(0.07,1.03,0.86,0.07), orientation='horizontal',
                                fontsize=10,scilimits=(-2,2),)

    clb_ax.tick_params(top=True, bottom=False, labeltop=True, labelbottom=False,
                        length=3)
    clb_ax.xaxis.tick_top()
    clb_ax.xaxis.set_label_position('top') 
    clb_ax.tick_params(which="major", pad=1)

    
    for region_mask, hist_color, hist_label, hist_bin, hist_alpha in \
        zip(region_masks, hist_colors, hist_labels, hist_bins, hist_alphas):
        calc_and_plot_kde(map.data[region_mask], ax_hist, hist_color, hist_label,
                          bins=hist_bin, alpha=hist_alpha)  

    ax_map.coords[0].set_ticks_visible(False)
    ax_map.coords[1].set_ticks_visible(False)  
    ax_map.coords[0].set_ticklabel_visible(False)
    ax_map.coords[1].set_ticklabel_visible(False)
    ax_map.coords[1].axislabels.set_visible(True)


    ax_hist.set_yticks([])

    if return_data:
        return clb_ax, map.data[region_masks[0]]
    else:
        return clb_ax

Figure 10¶

(You may have to pull down to see the notebook preview of the figure)

back to top

In [11]:
with rc_context(ms_style_dict):
    fig = plt.figure(figsize=(10.5,6.5), layout='constrained')
    gs = fig.add_gridspec(4, 4, width_ratios=[1,1,1,1], height_ratios=[1, 0.45]*2)

    ax_iris_SiIV_1025_vel_map = fig.add_subplot(gs[0,0], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vel_hist = fig.add_subplot(gs[1,0])

    clb_SiIV_vel_ax, SiIV_vel_data = plot_map_and_hist(iris_SiIV_1025_vel_map, [region_uf_1025, region_fp_1025, region_moss_1025], iris_SiIV_1025_vel_map.wcs,
                        ax_iris_SiIV_1025_vel_map, ax_iris_SiIV_1025_vel_hist, "coolwarm", 
                        norm=ImageNormalize(vmin=-20, vmax=20), return_data=True)

    ax_iris_SiIV_1025_vel_hist.set_xlim(-10,20)
    ax_iris_SiIV_1025_vel_hist.set_xticks([-5,0,5,10,15])

    ax_iris_SiIV_1025_vel_hist.legend(loc='upper left', 
                                      frameon=True, handlelength=0.5,
                                      handletextpad=0.2, 
                                      )
    
    clb_SiIV_vel_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")
    ax_iris_SiIV_1025_vel_hist.set_ylabel(r"$\mathrm{KDE}$")

    ax_iris_SiIV_1025_vnth_map = fig.add_subplot(gs[0,1], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vnth_hist = fig.add_subplot(gs[1,1])

    clb_SiIV_wid_ax, SiIV_wid_data = plot_map_and_hist(iris_SiIV_1025_wid_map, [region_uf_1025, region_fp_1025, region_moss_1025], iris_SiIV_1025_vel_map.wcs,
                ax_iris_SiIV_1025_vnth_map, ax_iris_SiIV_1025_vnth_hist, cmcm.batlowK, 
                norm=ImageNormalize(vmin=5, vmax=35), return_data=True)
    
    ax_iris_SiIV_1025_vnth_hist.set_xlim(5,35)
    ax_iris_SiIV_1025_vnth_hist.set_xticks([10,20,30])

    clb_SiIV_wid_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $\xi\ \mathrm{(km\,s^{-1})}$")

    ax_iris_CII_1025_vel_map = fig.add_subplot(gs[0,2], projection=iris_CII_1025_vel_map)
    ax_iris_CII_1025_vel_hist = fig.add_subplot(gs[1,2])

    clb_CII_vel_ax = plot_map_and_hist(iris_CII_1025_vel_map, [region_uf_1025, region_fp_1025, region_moss_1025], iris_CII_1025_vel_map.wcs,
        ax_iris_CII_1025_vel_map, ax_iris_CII_1025_vel_hist, "coolwarm", 
        norm=ImageNormalize(vmin=-15, vmax=15))
    
    ax_iris_CII_1025_vel_hist.set_xlim(-10,15)
    ax_iris_CII_1025_vel_hist.set_xticks([-5,0,5,10])
    clb_CII_vel_ax.set_xlabel(r"C \textsc{ii} 133.4\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_Te_map = fig.add_subplot(gs[0,3], projection=iris2_Te_1025_map)
    ax_iris_iris2_Te_hist = fig.add_subplot(gs[1,3])

    clb_Te_ax = plot_map_and_hist(iris2_Te_1025_map/1000., [region_uf_1025, region_fp_1025, region_moss_1025], iris2_Te_1025_map.wcs,
        ax_iris_iris2_Te_map, ax_iris_iris2_Te_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=4.4, vmax=6.7))
    
    ax_iris_iris2_Te_hist.set_xlim(4.4,6.7)
    clb_Te_ax.set_xlabel(r"$T_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(kK)}$")

    ax_iris_iris2_Ne_map = fig.add_subplot(gs[2,0], projection=iris2_Ne_1025_map)
    ax_iris_iris2_Ne_hist = fig.add_subplot(gs[3,0])

    clb_ax_Ne = plot_map_and_hist(iris2_Ne_1025_map, [region_uf_1025, region_fp_1025, region_moss_1025], iris2_Ne_1025_map.wcs,
        ax_iris_iris2_Ne_map, ax_iris_iris2_Ne_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=5e10, vmax=1.3e12, stretch=AsinhStretch(0.1)))
    
    clb_ax_Ne.set_xticks([1e11,1e12])
    clb_ax_Ne.xaxis.set_major_formatter(ticker.LogFormatterSciNotation())

    
    ax_iris_iris2_Ne_hist.set_xlim(5e10,1.3e12)
    ax_iris_iris2_Ne_hist.set_xscale('log')
    ax_iris_iris2_Ne_hist.set_ylabel(r"$\mathrm{KDE}$")
    ax_iris_iris2_Ne_hist.set_xlabel(r"$N_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(cm^{-3})}$")

    ax_iris_iris2_vlos_map = fig.add_subplot(gs[2,1], projection=iris2_vlos_1025_map)
    ax_iris_iris2_vlos_hist = fig.add_subplot(gs[3,1])

    clb_ax_vlos = plot_map_and_hist(iris2_vlos_1025_map/1e5, [region_uf_1025, region_fp_1025, region_moss_1025], iris2_vlos_1025_map.wcs,
        ax_iris_iris2_vlos_map, ax_iris_iris2_vlos_hist, "coolwarm",
        norm=ImageNormalize(vmin=-3, vmax=3))
    
    ax_iris_iris2_vlos_hist.set_xlim(-3,3)
    ax_iris_iris2_vlos_hist.set_xticks([-2,-1,0,1,2])
    ax_iris_iris2_vlos_hist.set_xlabel(r"$v\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_vnth_map = fig.add_subplot(gs[2,2], projection=iris2_vnth_1025_map)
    ax_iris_iris2_vnth_hist = fig.add_subplot(gs[3,2])

    clb_ax_vnth = plot_map_and_hist(iris2_vnth_1025_map/1e5, [region_uf_1025, region_fp_1025, region_moss_1025], iris2_vnth_1025_map.wcs,
        ax_iris_iris2_vnth_map, ax_iris_iris2_vnth_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=1, vmax=10))
    
    ax_iris_iris2_vnth_hist.set_xlim(1,10)
    ax_iris_iris2_vnth_hist.set_xticks([2,4,6,8])
    ax_iris_iris2_vnth_hist.set_xlabel(r"$\xi\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_chase_halpha_line_width_map = fig.add_subplot(gs[2,3], projection=chase_halpha_line_width_map)
    ax_chase_halpha_line_width_hist = fig.add_subplot(gs[3,3])

    clb_ax_halpha = plot_map_and_hist(chase_halpha_line_width_map/10, [region_uf_1025, region_fp_1025, region_moss_1025], chase_halpha_line_width_map.wcs,
        ax_chase_halpha_line_width_map, ax_chase_halpha_line_width_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=0.09, vmax=0.135))
    
    ax_chase_halpha_line_width_hist.set_xlim(0.09,0.135)
    ax_chase_halpha_line_width_hist.set_xticks([0.1,0.11,0.12,0.13])
    ax_chase_halpha_line_width_hist.set_xlabel(r"$\mathrm{H}\alpha\ 656.3\,\mathrm{nm}\ \Delta\lambda\ \mathrm{(nm)}$")



    fig.get_layout_engine().set(w_pad=3/72., h_pad=3/72., hspace=0,
                wspace=0)
    
    plt.savefig("../../figs/ms_eis_eui_upflow/iris_chase_statistics.pdf", bbox_inches='tight', dpi=300)
    plt.show()
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
No description has been provided for this image
In [12]:
clb_SiIV_int_ax, SiIV_int_data = plot_map_and_hist(iris_SiIV_1025_intmap, [region_uf_1025, region_fp_1025, region_moss_1025], iris_SiIV_1025_vel_map.wcs,
    ax_iris_SiIV_1025_vel_map, ax_iris_SiIV_1025_vel_hist, cmcm.batlowK, 
    norm=ImageNormalize(vmin=0, vmax=2000), return_data=True)
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
/home/yjzhu/scripts/MyPy/fancy_colorbar.py:24: UserWarning: Adding colorbar to a different Figure <Figure size 1050x650 with 16 Axes> than <Figure size 640x480 with 0 Axes> which fig.colorbar is called on.
  clb = plt.colorbar(im,pad = 0.05,orientation=orientation,ax=ax,cax=clb_ax,**kwargs)
In [13]:
from scipy.stats import pearsonr
SiIV_good_data_mask = np.where(np.isfinite(SiIV_int_data) & np.isfinite(SiIV_vel_data) & np.isfinite(SiIV_wid_data))
print("Correlation between vel and int:", pearsonr(SiIV_vel_data[SiIV_good_data_mask], SiIV_int_data[SiIV_good_data_mask]))
print("Correlation between vel and wid:", pearsonr(SiIV_vel_data[SiIV_good_data_mask], SiIV_wid_data[SiIV_good_data_mask]))
print("Correlation between int and wid:", pearsonr(SiIV_int_data[SiIV_good_data_mask], SiIV_wid_data[SiIV_good_data_mask]))
Correlation between vel and int: PearsonRResult(statistic=-0.09936553303827284, pvalue=7.127038824890932e-25)
Correlation between vel and wid: PearsonRResult(statistic=0.02477811519387394, pvalue=0.01040103186852963)
Correlation between int and wid: PearsonRResult(statistic=0.2264313777242231, pvalue=2.2712946449570345e-124)
In [15]:
with rc_context(ms_style_dict):
    fig = plt.figure(figsize=(10.5,6.5), layout='constrained')
    gs = fig.add_gridspec(4, 4, width_ratios=[1,1,1,1], height_ratios=[1, 0.45]*2)

    ax_iris_SiIV_1025_vel_map = fig.add_subplot(gs[0,0], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vel_hist = fig.add_subplot(gs[1,0])

    clb_SiIV_vel_ax, SiIV_vel_data = plot_map_and_hist(iris_SiIV_1025_vel_map, [region_uf_1025, ], iris_SiIV_1025_vel_map.wcs,
                        ax_iris_SiIV_1025_vel_map, ax_iris_SiIV_1025_vel_hist, "coolwarm", 
                        norm=ImageNormalize(vmin=-20, vmax=20), return_data=True)

    ax_iris_SiIV_1025_vel_hist.set_xlim(-10,20)
    ax_iris_SiIV_1025_vel_hist.set_xticks([-5,0,5,10,15])

    ax_iris_SiIV_1025_vel_hist.legend(loc='upper left', 
                                      frameon=True, handlelength=0.5,
                                      handletextpad=0.2, 
                                      )
    
    clb_SiIV_vel_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")
    ax_iris_SiIV_1025_vel_hist.set_ylabel(r"$\mathrm{KDE}$")

    ax_iris_SiIV_1025_vnth_map = fig.add_subplot(gs[0,1], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vnth_hist = fig.add_subplot(gs[1,1])

    clb_SiIV_wid_ax, SiIV_wid_data = plot_map_and_hist(iris_SiIV_1025_wid_map, [region_uf_1025, ], iris_SiIV_1025_vel_map.wcs,
                ax_iris_SiIV_1025_vnth_map, ax_iris_SiIV_1025_vnth_hist, cmcm.batlowK, 
                norm=ImageNormalize(vmin=5, vmax=35), return_data=True)
    
    ax_iris_SiIV_1025_vnth_hist.set_xlim(5,35)
    ax_iris_SiIV_1025_vnth_hist.set_xticks([10,20,30])

    clb_SiIV_wid_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $\xi\ \mathrm{(km\,s^{-1})}$")

    ax_iris_CII_1025_vel_map = fig.add_subplot(gs[0,2], projection=iris_CII_1025_vel_map)
    ax_iris_CII_1025_vel_hist = fig.add_subplot(gs[1,2])

    clb_CII_vel_ax = plot_map_and_hist(iris_CII_1025_vel_map, [region_uf_1025, ], iris_CII_1025_vel_map.wcs,
        ax_iris_CII_1025_vel_map, ax_iris_CII_1025_vel_hist, "coolwarm", 
        norm=ImageNormalize(vmin=-15, vmax=15))
    
    ax_iris_CII_1025_vel_hist.set_xlim(-10,15)
    ax_iris_CII_1025_vel_hist.set_xticks([-5,0,5,10])
    clb_CII_vel_ax.set_xlabel(r"C \textsc{ii} 133.4\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_Te_map = fig.add_subplot(gs[0,3], projection=iris2_Te_1025_map)
    ax_iris_iris2_Te_hist = fig.add_subplot(gs[1,3])

    clb_Te_ax = plot_map_and_hist(iris2_Te_1025_map/1000., [region_uf_1025, ], iris2_Te_1025_map.wcs,
        ax_iris_iris2_Te_map, ax_iris_iris2_Te_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=4.4, vmax=6.7))
    
    ax_iris_iris2_Te_hist.set_xlim(4.4,6.7)
    clb_Te_ax.set_xlabel(r"$T_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(kK)}$")

    ax_iris_iris2_Ne_map = fig.add_subplot(gs[2,0], projection=iris2_Ne_1025_map)
    ax_iris_iris2_Ne_hist = fig.add_subplot(gs[3,0])

    clb_ax_Ne = plot_map_and_hist(iris2_Ne_1025_map, [region_uf_1025, ], iris2_Ne_1025_map.wcs,
        ax_iris_iris2_Ne_map, ax_iris_iris2_Ne_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=5e10, vmax=1.3e12, stretch=AsinhStretch(0.1)))
    
    clb_ax_Ne.set_xticks([1e11,1e12])
    clb_ax_Ne.xaxis.set_major_formatter(ticker.LogFormatterSciNotation())

    
    ax_iris_iris2_Ne_hist.set_xlim(5e10,1.3e12)
    ax_iris_iris2_Ne_hist.set_xscale('log')
    ax_iris_iris2_Ne_hist.set_ylabel(r"$\mathrm{KDE}$")
    ax_iris_iris2_Ne_hist.set_xlabel(r"$N_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(cm^{-3})}$")

    ax_iris_iris2_vlos_map = fig.add_subplot(gs[2,1], projection=iris2_vlos_1025_map)
    ax_iris_iris2_vlos_hist = fig.add_subplot(gs[3,1])

    clb_ax_vlos = plot_map_and_hist(iris2_vlos_1025_map/1e5, [region_uf_1025, ], iris2_vlos_1025_map.wcs,
        ax_iris_iris2_vlos_map, ax_iris_iris2_vlos_hist, "coolwarm",
        norm=ImageNormalize(vmin=-3, vmax=3))
    
    ax_iris_iris2_vlos_hist.set_xlim(-3,3)
    ax_iris_iris2_vlos_hist.set_xticks([-2,-1,0,1,2])
    ax_iris_iris2_vlos_hist.set_xlabel(r"$v\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_vnth_map = fig.add_subplot(gs[2,2], projection=iris2_vnth_1025_map)
    ax_iris_iris2_vnth_hist = fig.add_subplot(gs[3,2])

    clb_ax_vnth = plot_map_and_hist(iris2_vnth_1025_map/1e5, [region_uf_1025, ], iris2_vnth_1025_map.wcs,
        ax_iris_iris2_vnth_map, ax_iris_iris2_vnth_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=1, vmax=10))
    
    ax_iris_iris2_vnth_hist.set_xlim(1,10)
    ax_iris_iris2_vnth_hist.set_xticks([2,4,6,8])
    ax_iris_iris2_vnth_hist.set_xlabel(r"$\xi\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_chase_halpha_line_width_map = fig.add_subplot(gs[2,3], projection=chase_halpha_line_width_map)
    ax_chase_halpha_line_width_hist = fig.add_subplot(gs[3,3])

    clb_ax_halpha = plot_map_and_hist(chase_halpha_line_width_map/10, [region_uf_1025, ], chase_halpha_line_width_map.wcs,
        ax_chase_halpha_line_width_map, ax_chase_halpha_line_width_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=0.09, vmax=0.135))
    
    ax_chase_halpha_line_width_hist.set_xlim(0.09,0.135)
    ax_chase_halpha_line_width_hist.set_xticks([0.1,0.11,0.12,0.13])
    ax_chase_halpha_line_width_hist.set_xlabel(r"$\mathrm{H}\alpha\ 656.3\,\mathrm{nm}\ \Delta\lambda\ \mathrm{(nm)}$")



    fig.get_layout_engine().set(w_pad=3/72., h_pad=3/72., hspace=0,
                wspace=0)
    
    plt.savefig("../../figs/test_figs/iris_chase_statistics_0.pdf", bbox_inches='tight', dpi=300)
    plt.show()
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
No description has been provided for this image
In [16]:
with rc_context(ms_style_dict):
    fig = plt.figure(figsize=(10.5,6.5), layout='constrained')
    gs = fig.add_gridspec(4, 4, width_ratios=[1,1,1,1], height_ratios=[1, 0.45]*2)

    ax_iris_SiIV_1025_vel_map = fig.add_subplot(gs[0,0], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vel_hist = fig.add_subplot(gs[1,0])

    clb_SiIV_vel_ax, SiIV_vel_data = plot_map_and_hist(iris_SiIV_1025_vel_map, [region_uf_1025, region_fp_1025, ], iris_SiIV_1025_vel_map.wcs,
                        ax_iris_SiIV_1025_vel_map, ax_iris_SiIV_1025_vel_hist, "coolwarm", 
                        norm=ImageNormalize(vmin=-20, vmax=20), return_data=True)

    ax_iris_SiIV_1025_vel_hist.set_xlim(-10,20)
    ax_iris_SiIV_1025_vel_hist.set_xticks([-5,0,5,10,15])

    ax_iris_SiIV_1025_vel_hist.legend(loc='upper left', 
                                      frameon=True, handlelength=0.5,
                                      handletextpad=0.2, 
                                      )
    
    clb_SiIV_vel_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")
    ax_iris_SiIV_1025_vel_hist.set_ylabel(r"$\mathrm{KDE}$")

    ax_iris_SiIV_1025_vnth_map = fig.add_subplot(gs[0,1], projection=iris_SiIV_1025_vel_map)
    ax_iris_SiIV_1025_vnth_hist = fig.add_subplot(gs[1,1])

    clb_SiIV_wid_ax, SiIV_wid_data = plot_map_and_hist(iris_SiIV_1025_wid_map, [region_uf_1025, region_fp_1025, ], iris_SiIV_1025_vel_map.wcs,
                ax_iris_SiIV_1025_vnth_map, ax_iris_SiIV_1025_vnth_hist, cmcm.batlowK, 
                norm=ImageNormalize(vmin=5, vmax=35), return_data=True)
    
    ax_iris_SiIV_1025_vnth_hist.set_xlim(5,35)
    ax_iris_SiIV_1025_vnth_hist.set_xticks([10,20,30])

    clb_SiIV_wid_ax.set_xlabel(r"Si \textsc{iv} 139.3\,nm $\xi\ \mathrm{(km\,s^{-1})}$")

    ax_iris_CII_1025_vel_map = fig.add_subplot(gs[0,2], projection=iris_CII_1025_vel_map)
    ax_iris_CII_1025_vel_hist = fig.add_subplot(gs[1,2])

    clb_CII_vel_ax = plot_map_and_hist(iris_CII_1025_vel_map, [region_uf_1025, region_fp_1025, ], iris_CII_1025_vel_map.wcs,
        ax_iris_CII_1025_vel_map, ax_iris_CII_1025_vel_hist, "coolwarm", 
        norm=ImageNormalize(vmin=-15, vmax=15))
    
    ax_iris_CII_1025_vel_hist.set_xlim(-10,15)
    ax_iris_CII_1025_vel_hist.set_xticks([-5,0,5,10])
    clb_CII_vel_ax.set_xlabel(r"C \textsc{ii} 133.4\,nm $v_{\rm Doppler}\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_Te_map = fig.add_subplot(gs[0,3], projection=iris2_Te_1025_map)
    ax_iris_iris2_Te_hist = fig.add_subplot(gs[1,3])

    clb_Te_ax = plot_map_and_hist(iris2_Te_1025_map/1000., [region_uf_1025, region_fp_1025, ], iris2_Te_1025_map.wcs,
        ax_iris_iris2_Te_map, ax_iris_iris2_Te_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=4.4, vmax=6.7))
    
    ax_iris_iris2_Te_hist.set_xlim(4.4,6.7)
    clb_Te_ax.set_xlabel(r"$T_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(kK)}$")

    ax_iris_iris2_Ne_map = fig.add_subplot(gs[2,0], projection=iris2_Ne_1025_map)
    ax_iris_iris2_Ne_hist = fig.add_subplot(gs[3,0])

    clb_ax_Ne = plot_map_and_hist(iris2_Ne_1025_map, [region_uf_1025, region_fp_1025, ], iris2_Ne_1025_map.wcs,
        ax_iris_iris2_Ne_map, ax_iris_iris2_Ne_hist, cmcm.batlowK, 
        norm=ImageNormalize(vmin=5e10, vmax=1.3e12, stretch=AsinhStretch(0.1)))
    
    clb_ax_Ne.set_xticks([1e11,1e12])
    clb_ax_Ne.xaxis.set_major_formatter(ticker.LogFormatterSciNotation())

    
    ax_iris_iris2_Ne_hist.set_xlim(5e10,1.3e12)
    ax_iris_iris2_Ne_hist.set_xscale('log')
    ax_iris_iris2_Ne_hist.set_ylabel(r"$\mathrm{KDE}$")
    ax_iris_iris2_Ne_hist.set_xlabel(r"$N_e\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(cm^{-3})}$")

    ax_iris_iris2_vlos_map = fig.add_subplot(gs[2,1], projection=iris2_vlos_1025_map)
    ax_iris_iris2_vlos_hist = fig.add_subplot(gs[3,1])

    clb_ax_vlos = plot_map_and_hist(iris2_vlos_1025_map/1e5, [region_uf_1025, region_fp_1025, ], iris2_vlos_1025_map.wcs,
        ax_iris_iris2_vlos_map, ax_iris_iris2_vlos_hist, "coolwarm",
        norm=ImageNormalize(vmin=-3, vmax=3))
    
    ax_iris_iris2_vlos_hist.set_xlim(-3,3)
    ax_iris_iris2_vlos_hist.set_xticks([-2,-1,0,1,2])
    ax_iris_iris2_vlos_hist.set_xlabel(r"$v\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_iris_iris2_vnth_map = fig.add_subplot(gs[2,2], projection=iris2_vnth_1025_map)
    ax_iris_iris2_vnth_hist = fig.add_subplot(gs[3,2])

    clb_ax_vnth = plot_map_and_hist(iris2_vnth_1025_map/1e5, [region_uf_1025, region_fp_1025, ], iris2_vnth_1025_map.wcs,
        ax_iris_iris2_vnth_map, ax_iris_iris2_vnth_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=1, vmax=10))
    
    ax_iris_iris2_vnth_hist.set_xlim(1,10)
    ax_iris_iris2_vnth_hist.set_xticks([2,4,6,8])
    ax_iris_iris2_vnth_hist.set_xlabel(r"$\xi\ (\log\tau_{\rm 500\,nm}\in[-4.6,-4.2])\ \mathrm{(km\,s^{-1})}$")

    ax_chase_halpha_line_width_map = fig.add_subplot(gs[2,3], projection=chase_halpha_line_width_map)
    ax_chase_halpha_line_width_hist = fig.add_subplot(gs[3,3])

    clb_ax_halpha = plot_map_and_hist(chase_halpha_line_width_map/10, [region_uf_1025, region_fp_1025, ], chase_halpha_line_width_map.wcs,
        ax_chase_halpha_line_width_map, ax_chase_halpha_line_width_hist, cmcm.batlowK,
        norm=ImageNormalize(vmin=0.09, vmax=0.135))
    
    ax_chase_halpha_line_width_hist.set_xlim(0.09,0.135)
    ax_chase_halpha_line_width_hist.set_xticks([0.1,0.11,0.12,0.13])
    ax_chase_halpha_line_width_hist.set_xlabel(r"$\mathrm{H}\alpha\ 656.3\,\mathrm{nm}\ \Delta\lambda\ \mathrm{(nm)}$")



    fig.get_layout_engine().set(w_pad=3/72., h_pad=3/72., hspace=0,
                wspace=0)
    
    plt.savefig("../../figs/test_figs/iris_chase_statistics_1.pdf", bbox_inches='tight', dpi=300)
    plt.show()
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
WARNING: SunpyMetadataWarning: Missing metadata for observer: assuming Earth-based observer.
For frame 'heliographic_stonyhurst' the following metadata is missing: hglt_obs,dsun_obs,hgln_obs
For frame 'heliographic_carrington' the following metadata is missing: crln_obs,crlt_obs,dsun_obs
 [sunpy.map.mapbase]
No description has been provided for this image