Skip to content

Commit

Permalink
Add mpl to requirements
Browse files Browse the repository at this point in the history
Make improvements to docs
Update changelog
  • Loading branch information
Mulan-94 committed Jul 2, 2020
1 parent eaf7910 commit 13bb9b5
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 10 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
-----
**ragavi-gains**

- Support PDF and postscript static files
- Supports all ``matplotlib`` type static outputs
- Generate additional static plot for interactive plots with more than 30,000 points
- Multiple tables also supported with static plots
- Adds option ``all`` to plot all amplitude, phase, real and imaginary plots in a single plot

**ragavi-vis**

- Added colour bar to coloured iterated plots


0.4.0
-----
Expand Down
2 changes: 1 addition & 1 deletion docs/source/appendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Visibilites
===========
.. automodule:: ragavi.visibilities
:members:
:exclude-members: DataCoreProcessor, hv_plotter
:exclude-members: DataCoreProcessor, plotter
Binary file added docs/source/examples/gplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/gplot_all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/gplot_all_html.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/gplot_html.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/high_res_amp_scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/iter_amp_phase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/iter_colour_amp_phase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/low_res_amp_scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/single_amp_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/examples/single_colour_amp_phase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 57 additions & 7 deletions docs/source/gains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ This will yield an output HTML file, with plots in the order
| table4 | 0 | F |
+----------+--------+------+

Note
----
* At least a single field, spectral window and correlation **must** be selected in order for plots to show up.
* While antenna data can be made visible through clicking its corresponding legend, this behaviour is not linked to the field, SPW, correlation selection checkboxes. Therefore, clicking the legend for a specific antenna will make data from all fields, SPWs and correlation for that antenna visible. As a workaround, data points can be identified using tooltip information
* Unless **all** the available fields, SPWs and correlations have not been selected, the antenna legends will appear greyed-out. This is because a single legend is attached to multiple data for each of the available categories. Therefore, clicking on legends without meeting the preceeding condition may lead to some awkward results (a toggling effect).
.. note::
* At least a single field, spectral window and correlation **must** be selected in order for plots to show up.
* While antenna data can be made visible through clicking its corresponding legend, this behaviour is not linked to the field, SPW, correlation selection checkboxes. Therefore, clicking the legend for a specific antenna will make data from all fields, SPWs and correlation for that antenna visible. As a workaround, data points can be identified using tooltip information
* Unless **all** the available fields, SPWs and correlations have not been selected, the antenna legends will appear greyed-out. This is because a single legend is attached to multiple data for each of the available categories. Therefore, clicking on legends without meeting the preceeding condition may lead to some awkward results (a toggling effect).


Use in Jupyter Notebooks
Expand All @@ -61,9 +60,23 @@ Generating Static (Non-Interactive) Images
==========================================
It is possible to generate png, ps, pdf, svg with ``ragavi-gains`` via two methods. The first method involves generating the HTML format first and then using the save tool found in the toolbar to download the plots. This method requires minimal effort although it may be a necessary redundancy to achieve the static image goal.

It is necessary to point out that by default, ``ragavi`` uses the canvas image backend for interactive plots, due to performance issues associated with SVG image backend as stated in the Bokeh `docs`_.
The second method involves supplying the ``--plotname`` argument, including
the desired file extension. For example, ``--plotname test.png``. If only
this argument is supplied, then only a single static plot is generated. In
case of multiple tables, multiple static files will be generated. However,
in case one wants both static and interactive plots, both ``--htmlname`` and
``--plotname`` must be supplied.

By default, ``ragavi`` uses the canvas image backend for interactive plots, due to performance issues associated with SVG image backend as stated in the Bokeh `docs`_.
The default plots generated are always in HTML format.

.. warning::
If the gain tables supplied contain more than 30,000 points, interactive plots become extremely large and barely interactive (and unresponsive).

In an attempt to overcome this, ``ragavi-gains`` generates static plots,
in addition to interactive plots, in this case. It is advisable to
**avoid opening the large (upto hundreds of MBs) HTML as they may cause the browser to hang**. Instead, **inspect the static plot first** and **then make an interactive plot containing the antenna / field / corr etc. of your interest** by using the selection arguments provided.


Help
====
Expand Down Expand Up @@ -109,7 +122,7 @@ The full help output for ``ragavi-gains`` is:
https://colorcet.holoviz.org/user_guide/index.html .
Defaults to coolwarm
-d , --doplot Plot complex values as amplitude & phase (ap) or real
and imaginary (ri). Defaults to ap.
and imaginary (ri) or both (all). Defaults to ap.
--debug Enable debug messages
-g [ [ ...]], --gaintype [ [ ...]]
Type of table(s) to be plotted. Can be specified as a
Expand All @@ -129,7 +142,44 @@ The full help output for ``ragavi-gains`` is:
the type of plot. If foo.png, the output will be PNG,
else if foo.svg, the output will be of the SVG format.
Examples
========
This subsection demonstrates the kind of plots that are generated
Interactive plots
-----------------
Command:
:code:`ragavi-gains --table test.B0 --doplot ap --htmlname test`
.. image:: examples/gplot_html.png
:width: 800
:alt: Interactive plot with ``--doplot ap``
Command:
:code:`ragavi-gains --table test.B0 --doplot all --htmlname test`
.. image:: examples/gplot_all_html.png
:width: 800
:alt: Interactive plot with ``--doplot all``
Static plots
------------
Command:
:code:`ragavi-gains --table test.B0 --doplot ap --plotname test.png`
.. image:: examples/gplot.png
:width: 800
:alt: Static plot with ``--doplot ap`` and ``--plotname test.png``
Command:
:code:`ragavi-gains --table test.B0 --doplot all --plotname test.png`
.. image:: examples/gplot_all.png
:width: 800
:alt: Static plot with ``--doplot all`` and ``--plotname test.png``
Useful function
===============
Expand Down
2 changes: 1 addition & 1 deletion docs/source/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Utilities
*********
Some utilities useful internally and externally from ``ragavi``

.. automodule:: ragavi.vis_utils
.. automodule:: ragavi.utils
:members:
58 changes: 58 additions & 0 deletions docs/source/vis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ It is also possible to colour over some axis (most of the iteration axes are
supported as shown in the table above) and this can be activated through the
:code:`-ca / --colour-axis` argument. Please note that the mandatory arguments are :code:`--xaxis`, :code:`--yaxis`, :code:`--ms`.

.. note::
Output files genrated by ``ragavi-vis`` can be very large for iterated plots because of the resolution of each generated plot. For this reason, unless ``--canvas-width`` and ``--canvas-height`` are explicitly provided, ``ragavi-gains`` will automatically shrink the canvas sizes to 200 by 200 in order to minimise the resulting output.


Averaging
=========
Expand Down Expand Up @@ -190,6 +193,61 @@ The output of the help is as follows:
to ensure that: num-cores * mem-limit < total RAM
available
Examples
========
Some example plots generated by ``ragavi-vis``
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis time --yaxis amp`
.. image:: examples/single_amp_time.png
:width: 800
:alt: amplitude vs time
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis phase --yaxis amp --colour-axis antenna1`
.. image:: examples/single_colour_amp_phase.png
:width: 800
:alt: amplitude vs phase coloured by antenna1
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis phase --yaxis amp --iter-axis scan`
.. image:: examples/iter_amp_phase.png
:width: 800
:alt: amplitude vs phase iterated by scan
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis phase --yaxis amp --iter-axis scan --colour-axis corr`
.. image:: examples/iter_colour_amp_phase.png
:width: 800
:alt: amplitude vs phase iterated by scan coloured by corr
In some cases, the plot generated may have data points that are small and bordering invisible, such as the one below
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis scan --yaxis amp --cmap bmy`
.. image:: examples/high_res_amp_scan.png
:width: 800
:alt: amplitude vs phase iterated by scan coloured by corr
A work around for such a case, is to reduce the resolution of the resulting
image, by providing the ``--canvas-width`` and ``--canvas-height`` arguments.
The image above, was generating using the default values 1080 and 720
respectively. If this is changed to 100 and 100, the resulting plot albeit
coarse, is clearer as shown below
Command:
:code:`ragavi-vis --ms dir/test.ms --xaxis scan --yaxis amp --cmap bmy --canvas-width 100 --canvas-height 100`
.. image:: examples/low_res_amp_scan.png
:width: 800
:alt: amplitude vs scan
.. _Codex: https://codex-africanus.readthedocs.io/en/latest/
.. _help: https://ragavi.readthedocs.io/en/dev/vis.html#help
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dask[complete]
dask-ms[xarray]
datashader
future
matplotlib
numpy>=1.15
python-casacore
xarray

0 comments on commit 13bb9b5

Please sign in to comment.