Commit c11400de authored by Carl Schaffer's avatar Carl Schaffer
Browse files

Merge branch 'penubral_thumbs' into 'master'

Penubral thumbs

See merge request !107
parents 5f0c3dfa 9c47faaf
__version__='2.1.0'
__version__='2.1.1'
from .generic import get_file_wrapper
\ No newline at end of file
import re
from glob import glob
from os.path import basename
import matplotlib.pyplot as plt
import numpy as np
from astropy.io.fits import open as fitsopen
from matplotlib.font_manager import FontProperties
from matplotlib.widgets import Slider, RadioButtons
from scipy.io.idl import readsav
from .GrisFitsFile import GrisFitsFile
......@@ -26,12 +29,14 @@ def plot_pen_mask(filename):
intensity = intensity[:, :mask.shape[1]]
aspect_ratio = mask.shape[0] / mask.shape[1]
shape_inches = (max([8 / aspect_ratio + .5, 3]), 8)
shape_inches = (max([8 / aspect_ratio + .5, 3]) + .5, 8)
dpi = 100
step_width = 0.135
n_pixels_x, n_pixels_y = mask.shape
extent = [0, n_pixels_y * step_width, 0, n_pixels_x * step_width]
color_map = 'jet'
color_map = plt.get_cmap("jet")
print(shape_inches)
fig = plt.figure(figsize=shape_inches, dpi=dpi)
ax = fig.subplots(1)
......@@ -48,13 +53,38 @@ def plot_pen_mask(filename):
kwargs = dict(
extent=extent,
levels=[-1.5, -.5, .5, 1.5, 2.5],
origin='upper',
cmap=color_map
)
ax.contourf(mask, **kwargs, alpha=.4)
ax.contour(mask, **kwargs)
ax.set_title("artifacts, quiet sun,\n penumbra and umbra")
fig.tight_layout()
contf = ax.contourf(mask, **kwargs, alpha=.4)
cont = ax.contour(mask, **kwargs)
# Create legend
labels = [
"Invalid",
"Quiet Sun",
"Penumbra",
"Umbra",
]
# legend proxy objects
proxy = []
for c in contf.collections:
rect = plt.Rectangle((0, 0), 1, 1, fc=c.get_facecolor()[0])
proxy.append(rect)
fontP = FontProperties()
fontP.set_size('small')
chartBox = ax.get_position()
ax.set_position([chartBox.x0, chartBox.y0, chartBox.width * 0.6, chartBox.height])
# ax.legend(proxy,labels,prop=fontP,loc='upper left', bbox_to_anchor=(1.45, 0.8), shadow=True, ncol=1)
fig.legend(proxy, labels, prop=fontP, loc='lower right', framealpha=1)
ax.set_title(".".join(basename(filename).split(".")[:-1]))
fig.tight_layout(pad=3)
plt.show()
return fig, ax
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment