diff --git a/sats_receiver/utils.py b/sats_receiver/utils.py index c9931e6..93aeb34 100644 --- a/sats_receiver/utils.py +++ b/sats_receiver/utils.py @@ -652,7 +652,14 @@ def plot(self, out_fn, vmin=None, vmax=None): fig = plt.colorbar(aspect=50, pad=0.1) fig.set_label('Power, dB') - plt.savefig(out_fn, bbox_inches='tight', dpi=200) + plt.savefig(out_fn, bbox_inches='tight', dpi=200, format='png', transparent=0) + i = Image.open(out_fn).convert('RGB') + kw = {} + if out_fn.suffix == '.png': + kw.update(optimize=1) + elif out_fn.suffix == '.jpg': + kw.update(optimize=1, subsampling=2, quality=95) + i.save(out_fn, **kw) plt.close() def spec_compress(self): diff --git a/tools/client_server/server.py b/tools/client_server/server.py index 026eb50..eb69226 100644 --- a/tools/client_server/server.py +++ b/tools/client_server/server.py @@ -176,13 +176,13 @@ def action(self): elif dtype == Decode.RAW: try: - self._draw_wr(fp, params) + self._draw_wf(fp, params) except: self.log.exception('waterfall') elif dtype == Decode.PROTO_RAW: try: - self._draw_wr(fp, params) + self._draw_wf(fp, params) except: self.log.error('waterfall') @@ -194,7 +194,7 @@ def action(self): self.log.info('%s done: %s', params['sat_name'], res.name) - def _draw_wr(self, fp, params): + def _draw_wf(self, fp, params): self.log.info('Draw Waterfall') wf = 0 @@ -206,7 +206,7 @@ def _draw_wr(self, fp, params): elif ftype != RawFileType.AUDIO: self.log.warning('Unknown filetype: %s', ftype) if wf: - wf.plot(fp.with_stem(f'{fp.stem}_{ftype.name}_wf').with_suffix('.png'), -110, -50) + wf.plot(fp.with_stem(f'{fp.stem}_{ftype.name}_wf').with_suffix('.jpg'))#, -110, -50) class MyTCPHandler(socketserver.StreamRequestHandler): @@ -412,7 +412,7 @@ def setup_logging(q, log_lvl): pil_logger.setLevel(logging.DEBUG + 2) gr_logger = gr.gr.logging() - gr_logger.set_default_level(gr.gr.log_levels.info) + gr_logger.set_default_level(gr.gr.log_levels.err) if __name__ == '__main__':