Fix #126, fix #127, fix #128, fix #131. Improved SDTmonitor. See the changelog. (#132)
Fix #126, fix #127, fix #128, fix #131. Improved SDTmonitor. See the changelog. (#132)

* Fix #126, fix #127, fix #128, fix #131. Changelog below.

Fix #126: moved the configuration file reading phase inside `MyHandler` initialization method.

Fix #127, improved the event handling strategy. When the initialization of the `MyHandler` object is completed, a processing thread is started. This threads waits for a file name to be enqueued and starts the processing phase as soon as it receives one. Every time a `created` or `modified` event is raised, the monitor waits for a time threshold of 50 milliseconds. If another event regarding the same file is raised, the monitor keep on waiting another 50 milliseconds, and so on. If no event regarding the same file is received, when 50ms had elapsed, the file gets enqueued for processing. This filtering strategy should be able to discriminate between file system operations and files updated by the backend on the fly (which should take more than 50ms to be updated with new data). Without this strategy, the same file would be enqueued multiple times with no significant difference between the two versions.

Fix #128, now the monitor does not perform an external call to `SDTPreprocess`, it imports the latter's main function and calls it with the same parameters from the processing thread. Since the call gets performed by a non-main thread, `matplotlib.pyplot` was raising some isssues using the `TKAgg` backend. To fix this, the monitor module now imports `pyplot` and set its backend to `Agg` manually. Without this fix, the issue could be propagated to the tests if the check on `DISPLAY` environment variable performed by the `utils` module sets the default matplotlib backend to `TKAgg`.

Fix #131, now the `index.html` page embed a javascript logic to update the images without forcing a page refresh by the browser. The images gets updated with no display flickering, this really helps the observers to pick even a little change in the displayed signal. It has been successfully tested with Mozilla Firefox and Chromium browsers on Linux Ubuntu 18.04 with default configurations.

* Catched an `ImportError` caused by missing matplotlib in SDTmonitor.

matteobachetti/srt-single-dish-tools