From d75f13fedbc641a299193f7bfd83d46585f01f11 Mon Sep 17 00:00:00 2001 From: IanHeywood Date: Wed, 31 Jan 2024 18:13:28 +0000 Subject: [PATCH 1/3] Lower case u,v,w for baseline coordinates in data mapper --- shade_ms/data_mappers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shade_ms/data_mappers.py b/shade_ms/data_mappers.py index cadee9a..d6b6d16 100644 --- a/shade_ms/data_mappers.py +++ b/shade_ms/data_mappers.py @@ -66,15 +66,15 @@ def __init__(self, fullname, unit, mapper, column=None, extras=[], conjugate=Fal CHAN = DataMapper("channel", "", column=False, axis=1, extras=["chans"], mapper=lambda x,chans: chans, const=True), FREQ = DataMapper("frequency", "Hz", column=False, axis=1, extras=["freqs"], mapper=lambda x, freqs: freqs, const=True), WAVEL = DataMapper("wavelength", "m", column=False, axis=1, extras=["wavel"], mapper=lambda x, wavel: wavel, const=True), - UV = DataMapper("uv-distance", "wavelengths", column="UVW", extras=["wavel"], + uv = DataMapper("uv-distance", "wavelengths", column="UVW", extras=["wavel"], mapper=lambda uvw, wavel: da.sqrt((uvw[:,:2]**2).sum(axis=1))/wavel), - U = DataMapper("u", "wavelengths", column="UVW", extras=["wavel"], + u = DataMapper("u", "wavelengths", column="UVW", extras=["wavel"], mapper=lambda uvw, wavel: uvw[:, 0] / wavel, conjugate=True), - V = DataMapper("v", "wavelengths", column="UVW", extras=["wavel"], + v = DataMapper("v", "wavelengths", column="UVW", extras=["wavel"], mapper=lambda uvw, wavel: uvw[:, 1] / wavel, conjugate=True), - W = DataMapper("w", "wavelengths", column="UVW", extras=["wavel"], + w = DataMapper("w", "wavelengths", column="UVW", extras=["wavel"], mapper=lambda uvw, wavel: uvw[:, 2] / wavel, conjugate=True), ) From a5256e291f65cf0a46291e29793ec5c0899c07b7 Mon Sep 17 00:00:00 2001 From: IanHeywood Date: Wed, 31 Jan 2024 18:15:36 +0000 Subject: [PATCH 2/3] Modified options Changed baseline coordinates to lower case, added note that upper case is required for Stokes parameters. --- shade_ms/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shade_ms/__main__.py b/shade_ms/__main__.py index c16d6ae..1e366ff 100644 --- a/shade_ms/__main__.py +++ b/shade_ms/__main__.py @@ -35,11 +35,12 @@ def cli(): group_opts = parser.add_argument_group("Plot types and data sources") group_opts.add_argument("-x", "--xaxis", action="append", help="""X axis of plot, e.g. "amp:CORRECTED_DATA" - This recognizes all column names (also CHAN, FREQ, CORR, ROW, WAVEL, U, V, W, UV) + This recognizes all column names (also CHAN, FREQ, CORR, ROW, WAVEL, u, v, w, uv) and, for complex columns, keywords such as 'amp', 'phase', 'real', 'imag'. You can also specify correlations, e.g. 'DATA:phase:XX', and do two-column arithmetic with "+-*/", e.g. 'DATA-MODEL_DATA:amp'. - Correlations may be specified by label, number, or as a Stokes parameter. + Correlations may be specified by label, number, or as a Stokes parameter + (upper case is required to avoid ambiguity with baseline coordinates). The order of specifiers does not matter.""") group_opts.add_argument("-y", "--yaxis", action="append", help="""Y axis to plot. From 061602b1d785e49400dc0c629c130fc41c53c8bd Mon Sep 17 00:00:00 2001 From: IanHeywood Date: Wed, 31 Jan 2024 18:21:16 +0000 Subject: [PATCH 3/3] Updated README --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e1dc744..ee693b9 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ $ shadems ### Changing the plot axes -* To change the plot axes you can provide selections via the `--xaxis` / `--yaxis` (or `-x` / `-y`) options. Existing Measurement Set columns (e.g. `DATA`, `CORRECTED_DATA`, `TIME`) as well as standard subsets and derivatives and (e.g. `CHAN`, `FREQ`, `U`, `V`) can be provided. Note the capitalised convention. +* To change the plot axes you can provide selections via the `--xaxis` / `--yaxis` (or `-x` / `-y`) options. Existing Measurement Set columns (e.g. `DATA`, `CORRECTED_DATA`, `TIME`) as well as standard subsets and derivatives and (e.g. `CHAN`, `FREQ`, `u`, `v`) can be provided. Note the capitalised convention. ``` $ shadems --xaxis FREQ --yaxis DATA:amp @@ -127,7 +127,7 @@ The example below will produce a plot per field. If no ``--field`` selection is provided, then `shadems` will iterate over all fields in the MS: ``` -$ shadems --xaxis CORRECTED_DATA:real,UV --yaxis CORRECTED_DATA:imag,CORRECTED_DATA:amp --field 0,2 --corr XX,YY --iter-field +$ shadems --xaxis CORRECTED_DATA:real,uv --yaxis CORRECTED_DATA:imag,CORRECTED_DATA:amp --field 0,2 --corr XX,YY --iter-field ``` * You can also iterate over SPWs, scans, correlations and (coming soon) antennas. @@ -137,7 +137,7 @@ $ shadems --xaxis CORRECTED_DATA:real,UV --yaxis CORRECTED_DATA:imag,CORRECTED_D * If you want to see how well your model fits your data then you can subtract the `MODEL_DATA` column from the `CORRECTED_DATA` column prior to plotting. For example, to show this residual product on a uv-distance plot: ``` -$ shadems --xaxis UV --yaxis CORRECTED_DATA-MODEL_DATA:amp --field 0 --corr XX,YY +$ shadems --xaxis uv --yaxis CORRECTED_DATA-MODEL_DATA:amp --field 0 --corr XX,YY ``` * ``CORRECTED_DATA/MODEL_DATA`` can also be useful. For the sake of completeness, ``*`` and ``+`` are also @@ -150,7 +150,7 @@ points in the plot according to the selected colourmap. You can instruct `shadem using the `--colour-by` switch. For example, to plot amplitude against uv-distance coloured by antenna 1: ``` -$ shadems --xaxis UV --yaxis DATA:amp:XX --colour-by ANTENNA1 +$ shadems --xaxis uv --yaxis DATA:amp:XX --colour-by ANTENNA1 ``` * The `--colour-by` option also supports full MS columns as well as metadata, allowing for @@ -159,7 +159,7 @@ you must specify explicit limits with ``--cmin`` and ``--cmax``. For example, to make a u,v coverage plot colourised by the corrected visibility amplitudes in XX: ``` -$ shadems --xaxis U --yaxis V --colour-by CORRECTED_DATA:amp:XX --cmin 0 --cmax 5 +$ shadems --xaxis u --yaxis v --colour-by CORRECTED_DATA:amp:XX --cmin 0 --cmax 5 ``` --- @@ -180,13 +180,14 @@ Plot types and data sources: -x XAXIS, --xaxis XAXIS X axis of plot, e.g. "amp:CORRECTED_DATA" This recognizes all column names (also CHAN, FREQ, CORR, - ROW, WAVEL, U, V, W, UV), and, for complex columns, + ROW, WAVEL, u, v, w, uv), and, for complex columns, keywords such as 'amp', 'phase', 'real', 'imag'. You can also specify correlations, e.g. 'DATA:phase:XX', and do two-column arithmetic with "+-*/", e.g. 'DATA- - MODEL_DATA:amp'. Correlations may be specified by - label, number, or as a Stokes parameter. The order of - specifiers does not matter. + MODEL_DATA:amp'. Correlations may be specified by label, + number, or as a Stokes parameter (upper case is required + to avoid ambiguity with baseline coordinates). The order + of specifiers does not matter -y YAXIS, --yaxis YAXIS Y axis to plot. Must be given the same number of times as --xaxis. Note that X/Y can employ different columns