vidavis 0.0.13__py3-none-any.whl → 0.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,6 @@
2
2
  Class to create a raster plot of visibility/spectrum data using plot parameters.
3
3
  '''
4
4
 
5
- import holoviews as hv
6
-
7
5
  # hvPlot extensions used to plot xarray DataArray and pandas DataFrame
8
6
  # pylint: disable=unused-import
9
7
  import hvplot.xarray
@@ -120,10 +118,8 @@ class RasterPlot:
120
118
  if is_gui: # update data range for colorbar
121
119
  self._plot_params['data']['data_range'] = (xda.min().values.item(), xda.max().values.item())
122
120
 
123
- # Make Overlay plot with hover tools
124
- return (flagged_plot * unflagged_plot).opts(
125
- hv.opts.QuadMesh(tools=['hover'])
126
- )
121
+ # Make Overlay plot
122
+ return flagged_plot * unflagged_plot
127
123
 
128
124
  def _get_plot_title(self, data, plot_inputs, ms_name):
129
125
  ''' Form string containing ms name and selected values using data (xArray Dataset) '''
@@ -2,28 +2,31 @@
2
2
  Create interactive GUI for ms raster plotting
3
3
  '''
4
4
 
5
- import holoviews as hv
6
5
  import panel as pn
7
6
  from vidavis.plot.ms_plot._ms_plot_selectors import (file_selector, title_selector, style_selector,
8
7
  axis_selector, aggregation_selector, iteration_selector, selection_selector, plot_starter)
9
8
 
10
- def create_raster_gui(callbacks, data_dims, x_axis, y_axis):
11
- ''' Use Holoviz Panel to create a dashboard for plot inputs and raster plot display. '''
9
+ def create_raster_gui(callbacks, plot_info, empty_plot):
10
+ ''' Use Holoviz Panel to create a dashboard for plot inputs and raster plot display.
11
+ ms (str): path to MS, if set
12
+ plot_info (dict): with keys 'ms', 'data_dims', 'x_axis', 'y_axis'
13
+ empty_plot (hv.Overlay): QuadMesh overlay plot with no data
14
+ '''
12
15
  # Accordion of widgets for plot inputs
13
- selectors = get_plot_input_selectors(callbacks, data_dims, x_axis, y_axis)
16
+ selectors = get_plot_input_selectors(callbacks, plot_info)
14
17
 
15
18
  # Plot button and spinner while plotting
16
- init_plot = plot_starter(callbacks['plot_updating'])
19
+ init_plot = plot_starter(callbacks['update_plot'])
17
20
 
18
21
  # Dynamic map for plot, with callback when inputs change or location needed
19
- dmap, points = get_plot_dmap(callbacks, selectors, init_plot)
22
+ #dmap, points = get_plot_dmap(callbacks, selectors, init_plot)
20
23
 
21
24
  return pn.Row(
22
25
  pn.Tabs( # Row [0]
23
26
  ('Plot', # Tabs[0]
24
27
  pn.Column(
25
- dmap * points, # [0] plot with hv.Points overlay for point_draw
26
- pn.WidgetBox(), # [1] cursor location
28
+ pn.pane.HoloViews(empty_plot), # [0] plot
29
+ pn.WidgetBox(), # [1] cursor location
27
30
  )
28
31
  ),
29
32
  ('Plot Inputs', pn.Column()), # Tabs[1]
@@ -43,21 +46,22 @@ def create_raster_gui(callbacks, data_dims, x_axis, y_axis):
43
46
  sizing_mode='stretch_height',
44
47
  )
45
48
 
46
- def get_plot_input_selectors(callbacks, data_dims, x_axis, y_axis):
49
+ def get_plot_input_selectors(callbacks, plot_info):
47
50
  ''' Create accordion of widgets for plot inputs selection '''
48
51
  # Select MS
49
- file_selectors = file_selector('Path to MeasurementSet (ms or zarr) for plot', '~' , callbacks['filename'])
52
+ file_selectors = file_selector(callbacks, plot_info['ms'])
50
53
 
51
54
  # Select style - colormaps, colorbar, color limits
52
55
  style_selectors = style_selector(callbacks['style'], callbacks['color'])
53
56
 
54
57
  # Select x, y, and vis axis
55
- axis_selectors = axis_selector(x_axis, y_axis, data_dims, True, callbacks['axes'])
58
+ axis_selectors = axis_selector(plot_info, True, callbacks['axes'])
56
59
 
57
60
  # Select from ProcessingSet and MeasurementSet
58
61
  selection_selectors = selection_selector(callbacks['select_ps'], callbacks['select_ms'])
59
62
 
60
63
  # Generic axis options, updated when ms is set
64
+ data_dims = plot_info['data_dims'] if 'data_dims' in plot_info else None
61
65
  axis_options = data_dims if data_dims else []
62
66
 
63
67
  # Select aggregator and axes to aggregate
@@ -81,25 +85,3 @@ def get_plot_input_selectors(callbacks, data_dims, x_axis, y_axis):
81
85
  )
82
86
  selectors.toggle = True
83
87
  return selectors
84
-
85
- def get_plot_dmap(callbacks, selectors, init_plot):
86
- ''' Dynamic map for updating plot from callback function '''
87
- # Connect plot to filename and plot button; add streams for cursor position, drawn points, and selected box
88
- # 'update_plot' callback must have parameters (ms, do_plot, x, y, data, bounds)
89
- points = hv.Points([]).opts(
90
- size=5,
91
- fill_color='white'
92
- )
93
- dmap = hv.DynamicMap(
94
- pn.bind(
95
- callbacks['update_plot'],
96
- ms=selectors[0][0][0],
97
- do_plot=init_plot[0],
98
- ),
99
- streams=[
100
- hv.streams.PointerXY(), # cursor location (x, y)
101
- hv.streams.PointDraw(source=points), # fixed cursor location (data)
102
- hv.streams.BoundsXY() # box location (bounds)
103
- ]
104
- )
105
- return dmap, points
@@ -0,0 +1,113 @@
1
+ '''
2
+ Class to check and hold inputs for raster plot.
3
+ '''
4
+
5
+ from vidavis.plot.ms_plot._check_raster_inputs import check_inputs
6
+
7
+ class RasterPlotInputs:
8
+ '''
9
+ Class to set inputs for raster plots from MsRaster functions or GUI.
10
+ '''
11
+
12
+ def __init__(self):
13
+ self._plot_inputs = {'selection': {}}
14
+
15
+ def get_inputs(self):
16
+ ''' Getter for stored plot inputs '''
17
+ return self._plot_inputs
18
+
19
+ def get_input(self, name):
20
+ ''' Getter for stored plot input by name '''
21
+ try:
22
+ return self._plot_inputs[name]
23
+ except KeyError:
24
+ return None
25
+
26
+ def set_input(self, name, value):
27
+ ''' Set plot input by name and value '''
28
+ self._plot_inputs[name] = value
29
+ if name == 'selection' and 'data_group_name' in value:
30
+ self._plot_inputs['data_group'] = value['data_group_name']
31
+
32
+ def set_selection(self, selection):
33
+ ''' Add selection dict to existing selection in plot inputs '''
34
+ self._plot_inputs['selection'] |= selection
35
+ if 'data_group_name' in selection:
36
+ self._plot_inputs['data_group'] = selection['data_group_name']
37
+
38
+ def get_selection(self, key):
39
+ ''' Return value for selection key '''
40
+ try:
41
+ return self.get_input('selection')[key]
42
+ except KeyError:
43
+ return None
44
+
45
+ def set_inputs(self, plot_inputs):
46
+ ''' Setter for storing plot inputs from MsRaster.plot() '''
47
+ check_inputs(plot_inputs)
48
+ for key, val in plot_inputs.items():
49
+ self._plot_inputs[key] = val
50
+
51
+ def remove_input(self, name):
52
+ ''' Remove plot input with name, if it exists '''
53
+ if name == 'selection':
54
+ self._plot_inputs['selection'] = {}
55
+ else:
56
+ try:
57
+ del self._plot_inputs[name]
58
+ except KeyError:
59
+ pass
60
+
61
+ def check_inputs(self):
62
+ ''' Check input values are valid, adjust for data dims '''
63
+ check_inputs(self._plot_inputs)
64
+
65
+ def is_layout(self):
66
+ ''' Determine if plot is a layout using plot inputs '''
67
+ # Check if subplots is a layout
68
+ subplots = self.get_input('subplots')
69
+ if subplots is None or subplots == (1, 1):
70
+ return False
71
+
72
+ # Subplots is a layout, check if multi plot
73
+ if not self.get_input('clear_plots'):
74
+ return True
75
+
76
+ # Check if iteration set and iter_range more than one plot
77
+ iter_length = 0
78
+ if self.get_input('iter_axis') is not None:
79
+ iter_range = self.get_input('iter_range')
80
+ if iter_range is None or iter_range[1] == -1:
81
+ iter_range = self.get_input('auto_iter_range')
82
+ iter_length = len(range(iter_range[0], iter_range[1] + 1))
83
+ return iter_length > 1
84
+
85
+ #--------------
86
+ # GUI CALLBACKS
87
+ #--------------
88
+
89
+ def set_color_inputs(self, color_mode, color_range):
90
+ ''' Set style params from gui '''
91
+ color_mode = color_mode.split()[0]
92
+ color_mode = None if color_mode == 'No' else color_mode
93
+ self.set_input('color_mode', color_mode)
94
+ self.set_input('color_range', color_range)
95
+
96
+ def set_axis_inputs(self, x_axis, y_axis, vis_axis):
97
+ ''' Set plot axis inputs from gui '''
98
+ self.set_input('x_axis', x_axis)
99
+ self.set_input('y_axis', y_axis)
100
+ self.set_input('vis_axis', vis_axis)
101
+
102
+ def set_aggregation_inputs(self, aggregator, agg_axes):
103
+ ''' Set aggregation inputs from gui '''
104
+ aggregator = None if aggregator== 'None' else aggregator
105
+ self.set_input('aggregator', aggregator)
106
+ self.set_input('agg_axis', agg_axes) # ignored if aggregator not set
107
+
108
+ def set_iteration_inputs(self, iter_axis, iter_range, subplot_rows, subplot_columns):
109
+ ''' Set iteration inputs from gui '''
110
+ iter_axis = None if iter_axis == 'None' else iter_axis
111
+ self.set_input('iter_axis', iter_axis)
112
+ self.set_input('iter_range', iter_range)
113
+ self.set_input('subplots', (subplot_rows, subplot_columns))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vidavis
3
- Version: 0.0.13
3
+ Version: 0.0.15
4
4
  Summary: Radio astronomy visibility data visualization
5
5
  License: LGPL
6
6
  Author-email: Darrell Schiebel <darrell@schiebel.us>,Pam Harris <pharris@nrao.edu>
@@ -1,7 +1,7 @@
1
1
  vidavis/LICENSE.rst,sha256=qzGpkvhDzf_MgF1PIn6rCmYPrcEhkfrBUchosLJj-U4,26371
2
2
  vidavis/__init__.py,sha256=FVM92yTXUplR7tVHiGao0Y3Hd80pRTrwVIYDLjzICws,1709
3
3
  vidavis/apps/__init__.py,sha256=ZQ5v1VFtjn3ztmuOHLOk5WbC1uLNIgL9rbHQ4v0zJwY,87
4
- vidavis/apps/_ms_raster.py,sha256=bWe7N7lbwNYzPl1n-_Y_qBErDddxVe8jnPRYqOxylSI,48397
4
+ vidavis/apps/_ms_raster.py,sha256=wyY7WS9L4zPXtGMYt_v8dze4HP7xEUQrHUS7phMYTss,40972
5
5
  vidavis/bokeh/__init__.py,sha256=gdPPxBCe0enCSjvPFxkgMlhpVnAMFXKcw9GN28tVdXM,95
6
6
  vidavis/bokeh/_palette.py,sha256=gzfJHuUgqxd8hJpZe-gQPFTCPq9f5I8uLEkHAK5FNDM,2480
7
7
  vidavis/data/__init__.py,sha256=-RDRe0PYK6vPlhdRV2Dy1vGbnDGoXWDATmfxaR-gXcE,48
@@ -9,31 +9,32 @@ vidavis/data/measurement_set/__init__.py,sha256=7pnjaRYgQ88pydsMw1Z9sUiuO2udunRV
9
9
  vidavis/data/measurement_set/_ms_data.py,sha256=7ATsPbGFAv8WtWk_PRxlfoLdqapd6eMvnpYTgtdEDjE,7726
10
10
  vidavis/data/measurement_set/processing_set/__init__.py,sha256=TVQe5Nl4APCB2E1T1giAkOvSxg7OBNcOm9-BeZelY2Q,95
11
11
  vidavis/data/measurement_set/processing_set/_ps_concat.py,sha256=uTuxE7krTu6SS7lwV9ITMsAxJ4BJhKOU9dLlQ9L1oNY,3513
12
- vidavis/data/measurement_set/processing_set/_ps_coords.py,sha256=pdmojL-_55x3CjFcMIMuIqsI4ADG-TlLxc-RTgBQZC8,3640
12
+ vidavis/data/measurement_set/processing_set/_ps_coords.py,sha256=SDp-0ebd94QjO_jPv00weiYmp-OD1XqsCzWvNc0D-94,3747
13
13
  vidavis/data/measurement_set/processing_set/_ps_data.py,sha256=2Ss3iUdyIgtMuMTpl9mAGt4K89zgDmRsoTjbjurpDmc,11353
14
14
  vidavis/data/measurement_set/processing_set/_ps_io.py,sha256=VeNi-s1hozgCAGAGHs4NUXtlVFwUh-mkqrY9iYWOfW4,1717
15
- vidavis/data/measurement_set/processing_set/_ps_raster_data.py,sha256=6mU_V68lvJvIktEuyE5tWlyj7GaRmOnkCWSjHXc5lWs,7249
16
- vidavis/data/measurement_set/processing_set/_ps_select.py,sha256=GhAPxZ5mwvmUhCqKETVkhecjbwfrtDAG7-ibM19GDg0,10831
15
+ vidavis/data/measurement_set/processing_set/_ps_raster_data.py,sha256=m7d0qe5bS-XjGD_1mrpRn9dTobwG8WDidCmAaLP2TWQ,7378
16
+ vidavis/data/measurement_set/processing_set/_ps_select.py,sha256=AtEsLy3bSHEyFUFKM-OO6_-YwUdWOWcGkXkEgFxMaEE,10859
17
17
  vidavis/data/measurement_set/processing_set/_ps_stats.py,sha256=4uLImKCANXLUM8jO8nFbBFMwfusS-JjsZ0ttbDFPrSE,8166
18
18
  vidavis/data/measurement_set/processing_set/_xds_data.py,sha256=qLO2VkLINkSAQ7CGRFmpWQYpHrP4XoJJkwA4pp9DO8M,5253
19
19
  vidavis/plot/__init__.py,sha256=thxe5vAGdpEiqoKPHLJoWUqKMVrUVx0ajpsGf5pVP98,95
20
20
  vidavis/plot/ms_plot/__init__.py,sha256=wY0_7gY9M6K1D6tKQsr89L_uSs3seJlD-uicx7dx5Mo,74
21
21
  vidavis/plot/ms_plot/_check_raster_inputs.py,sha256=a7u5wlDKTxWYW36-Xp3xd4c756SbYURdFkGHbUaX440,4786
22
- vidavis/plot/ms_plot/_locate_points.py,sha256=GvuS5kDhIYancc314ofLoYtoRhT_jagG8HpzchhdPds,7474
23
- vidavis/plot/ms_plot/_ms_plot.py,sha256=RShzvWzHq7iA9awuaWO8GiB1NkWuYkcNOMdToLWPnes,13246
22
+ vidavis/plot/ms_plot/_locate_points.py,sha256=mWXGeUoXPLFdyxR2hCCAZkNtEhtPmZ39mm1-C92TPmE,10898
23
+ vidavis/plot/ms_plot/_ms_plot.py,sha256=tpUWFto-tuSehj-aXHuvGJpdc9yq2m4bmt1EsSWkVjI,18865
24
24
  vidavis/plot/ms_plot/_ms_plot_constants.py,sha256=cX_TQhKJ3hJzPuRYmuRJxue1sjq82yl_ZN2_w6TshmI,930
25
- vidavis/plot/ms_plot/_ms_plot_selectors.py,sha256=BZQwARvMPdk78n6Rh2tOaSc8GenZBrxHZb14oFD9gJM,10785
26
- vidavis/plot/ms_plot/_plot_inputs.py,sha256=pZL63n9FHSoo9cntf7lppQj44nkpiwnCz6VH-9Oh6ho,671
27
- vidavis/plot/ms_plot/_raster_plot.py,sha256=lNa9i_eJ8F8Fc2zcHLRcaxKKOELk3x_QmXT__T76pg8,10999
28
- vidavis/plot/ms_plot/_raster_plot_gui.py,sha256=Kb0BLmkwtYHCqlVaSipbTTStst8RYggqwf1Wf5v8F4Q,4261
25
+ vidavis/plot/ms_plot/_ms_plot_selectors.py,sha256=jBjthBjfXDf6W19HG8j8Pzxxzmnte5apeVDjsMy-dDg,11146
26
+ vidavis/plot/ms_plot/_plot_inputs.py,sha256=GeErBB3pYz6ecJiMTGQMNXkPeMLbWbYGmqL5dr8A46Q,687
27
+ vidavis/plot/ms_plot/_raster_plot.py,sha256=Uv0D-P7PyvcMBqFHqmbNxnDkUMekVok511WIvaA-JB0,10894
28
+ vidavis/plot/ms_plot/_raster_plot_gui.py,sha256=3oEfZqOI3sgxfCQx9t3i679TffV2466-KBUrJ-m8uik,3546
29
+ vidavis/plot/ms_plot/_raster_plot_inputs.py,sha256=kxR6-1Qn4IyQ4FjgpVZ9HEZ7EnPHxJZWomb0n_zaRwo,4071
29
30
  vidavis/plot/ms_plot/_time_ticks.py,sha256=j-DcPh7RfGE8iX2bPjLQDQPIbiAbmjiEWQnKmdMWA3I,1773
30
31
  vidavis/plot/ms_plot/_xds_plot_axes.py,sha256=EeWvAbiKV33nEWdI8V3M0uwLTnycq4bFYBOyVWkxCu0,4429
31
32
  vidavis/toolbox/__init__.py,sha256=jqFa-eziVz_frNnXxwjJFK36qNpz1H38s-VlpBcq-R8,1402
32
33
  vidavis/toolbox/_app_context.py,sha256=H7gtF8RrAH46FqDcMobv3KM1Osbnapgu6aTG-m3VCWA,3049
33
34
  vidavis/toolbox/_logging.py,sha256=OEisrd8FM8VTNBMc7neLh9ekelf29ZILYB5pScebly0,2739
34
35
  vidavis/toolbox/_static.py,sha256=HJLMtClppgOJXWAtV6Umn5EqN80u0oZiIouQ1JsB9PM,2346
35
- vidavis/__version__.py,sha256=6iFz7cldtJZlw_FSwnt97X1e8jfQ-fdVhcVMqnAiWh8,22
36
- vidavis-0.0.13.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
37
- vidavis-0.0.13.dist-info/METADATA,sha256=7fBkDctO-V9veQD-m1BbnimzfHgH-PXvEvmhNE_7z3I,2238
38
- vidavis-0.0.13.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
39
- vidavis-0.0.13.dist-info/RECORD,,
36
+ vidavis/__version__.py,sha256=YtkQ0xJuRN_ZjjhJ2kXBIkzEenORzuw78h9h_vJ-MGY,22
37
+ vidavis-0.0.15.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
38
+ vidavis-0.0.15.dist-info/METADATA,sha256=TmHASCjUzIjDPZzY8Mgce0h6p7Jg569JPfvXjfdpabA,2238
39
+ vidavis-0.0.15.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
40
+ vidavis-0.0.15.dist-info/RECORD,,