30 lines
818 B
Python
30 lines
818 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 core import Output
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
class SaveFig(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
|
|
plt.figure(figsize=(16*im_size,3*im_size))
|
|
plt.imshow(data[:,:,-1])
|
|
plt.colorbar()
|
|
if metadata is not None:
|
|
plt.title(metadata[-1])
|
|
plt.savefig(self.fname, bbox_inches=self.bbox_inches, pad_inches=self.pad_inches)
|