33 lines
885 B
Python
33 lines
885 B
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
# \file SaveFig.py
|
|
# \brief TODO
|
|
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
|
# \version 0.1
|
|
# \date 09 avril 2018
|
|
#
|
|
# TODO details
|
|
|
|
from ld2dap.core import Output
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
class ShowFig(Output):
|
|
def __init__(self, fname, bbox_inches='tight', pad_inches=1):
|
|
super().__init__(self.__class__.__name__)
|
|
self.fname = fname
|
|
self.bbox_inches = bbox_inches
|
|
self.pad_inches = pad_inches
|
|
|
|
def _process(self, data, metadata):
|
|
im_size = 2
|
|
fig = plt.figure(figsize=(16*im_size,3*im_size))
|
|
f1 = fig.add_subplot(111)
|
|
img = f1.imshow(data[:,:,-1])
|
|
plt.colorbar(img)
|
|
if metadata is not None:
|
|
print (metadata[0].desc)
|
|
f1.set_title(' > '.join(metadata[0].desc[-1]))
|
|
plt.show()
|
|
plt.close(fig)
|