Source code for irfpy.mima.ql.panels

""" Collection of functions creating IMA quicklook panels
"""
import matplotlib.colors as mplcolors
import matplotlib.pyplot as plt
import numpy as np

from irfpy.imacommon.ql import axis_etdiagram, axis_etdiagram_max
from irfpy.mima import massring as mmassring

etdiagram = axis_etdiagram  # Alias for compatibility


[docs]def axis_pa_matrix(count3d, mass=None, ene=None, ax=None, vmin=0.1, vmax=100): if ax is None: fig = plt.figure() ax = fig.add_subplot(111) if mass is None: mass = [i for i in range(32)] if ene is None: ene = [i for i in range(96)] if count3d is None: ax.plot([0]) else: ### count3d.matrix is [M32, A16, E96, P16] matrix _matx = count3d.matrix[:, :, ene, :].sum(2) # (M32, A16, P16) az_pol = _matx[mass, :, :].sum(0) # (A16, P16) plt.pcolormesh(np.arange(17)-0.5, np.arange(17)-0.5, az_pol.T, vmin=vmin, vmax=vmax, norm=mplcolors.LogNorm()) ax.set_xlim(-0.5, 15.5) ax.set_ylim(-0.5, 15.5) return ax
[docs]def axis_em_matrix(count3d, energytable, polar=None, azim=None, mline=None, ax=None, vmin=0.1, vmax=100): ### E-M matrix if ax is None: fig = plt.figure() ax = fig.add_subplot(111) if polar is None: polar = [i for i in range(16)] if azim is None: azim = [i for i in range(16)] if mline is None: mline = [] for i in mline: mlines = mmassring.massline(i, 4, enestep=energytable)[1] ax.plot(mlines, energytable, 'k') if count3d is None: # No instant data pass else: ### count3d.matrix is [M32, A16, E96, P16] matrix. _matx = count3d.matrix[:, :, :, polar].sum(3) # (M32, A16, E96) mass_ene = _matx[:, azim, :].sum(1) # (M32, E96) plt.pcolormesh(np.arange(33)-0.5, energytable, mass_ene.T, vmin=vmin, vmax=vmax, norm=mplcolors.LogNorm()) ax.set_xlim(-0.5, 31.5) ax.set_ylim(1, 16000) ax.set_yscale('log') return ax