vidavis 0.1.4__py3-none-any.whl → 0.1.6__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.
vidavis/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.1.4'
1
+ __version__ = '0.1.6'
@@ -579,17 +579,18 @@ class MsRaster(MsPlot):
579
579
  return self._empty_plot
580
580
 
581
581
  def _create_empty_plot(self):
582
- ''' Create empty Overlay plot for DynamicMap with colormap params and required tools enabled '''
582
+ ''' Create empty Overlay plot for DynamicMap with colormap params enabled '''
583
583
  plot_params = self._raster_plot.get_plot_params()
584
584
  self._empty_plot = hv.Overlay(
585
585
  hv.QuadMesh([]).opts(
586
- colorbar=plot_params['style']['show_flagged_colorbar'],
587
- cmap=plot_params['style']['flagged_cmap'],
588
- responsive=True,
589
- ) * hv.QuadMesh([]).opts(
590
586
  colorbar=plot_params['style']['show_colorbar'],
591
- colorbar_position='left',
592
587
  cmap=plot_params['style']['unflagged_cmap'],
588
+ colorbar_position='left',
589
+ responsive=True,
590
+ ) * hv.QuadMesh([]).opts(
591
+ colorbar=plot_params['style']['show_flagged_colorbar'],
592
+ colorbar_position='right',
593
+ cmap=plot_params['style']['flagged_cmap'],
593
594
  responsive=True,
594
595
  )
595
596
  )
@@ -75,7 +75,6 @@ class MsPlot:
75
75
  self._last_points = None
76
76
  self._last_boxes = None
77
77
  self._locate_plot_options = {
78
- 'tools': ['hover'],
79
78
  'muted_alpha': 0,
80
79
  'selection_fill_alpha': 0.2, # dim selected areas of plot
81
80
  'nonselection_fill_alpha': 1.0, # do not dim unselected areas of plot
@@ -463,12 +462,14 @@ class MsPlot:
463
462
  x = get_locate_value(plot_data, plot_axes[0], x)
464
463
  y = get_locate_value(plot_data, plot_axes[1], y)
465
464
  cursor = (x, y)
466
- if data_changed(cursor, self._last_cursor):
467
- # new cursor position - update cursor location box
468
- update_cursor_location(cursor, plot_axes, plot_data, cursor_box)
469
- self._last_cursor = cursor
470
- return True
471
- return False
465
+
466
+ if not data_changed(cursor, self._last_cursor):
467
+ return False
468
+
469
+ # new cursor position - update cursor location box
470
+ update_cursor_location(cursor, plot_axes, plot_data, cursor_box)
471
+ self._last_cursor = cursor
472
+ return True
472
473
 
473
474
  def _locate_points(self, point_data, plot_data, points_tab):
474
475
  ''' Show points locations from point_draw tool '''
@@ -489,12 +490,14 @@ class MsPlot:
489
490
  points_to_locate = get_new_data(data_points, self._last_points)
490
491
  self._last_points = data_points
491
492
 
493
+ if not points_to_locate: # point deleted
494
+ return False
495
+
492
496
  if len(points_to_locate) == len(data_points):
493
497
  points_tab.clear() # clear for locating all points
494
498
 
495
- if points_to_locate:
496
- location_info = update_points_location(points_to_locate, self._get_plot_axes(), plot_data, points_tab)
497
- self._log_to_file_only(location_info)
499
+ location_info = update_points_location(points_to_locate, self._get_plot_axes(), plot_data, points_tab)
500
+ self._log_to_file_only(location_info)
498
501
  return True
499
502
 
500
503
  def _locate_boxes(self, boxes, plot_data, box_tab):
@@ -520,10 +523,12 @@ class MsPlot:
520
523
  boxes_to_locate = get_new_data(box_list, self._last_boxes)
521
524
  self._last_boxes = box_list
522
525
 
523
- if boxes_to_locate:
524
- box_tab.clear()
525
- location_info = update_boxes_location(boxes_to_locate, self._get_plot_axes(), plot_data, box_tab)
526
- self._log_to_file_only(location_info)
526
+ if not boxes_to_locate: # box deleted
527
+ return False
528
+
529
+ box_tab.clear()
530
+ location_info = update_boxes_location(boxes_to_locate, self._get_plot_axes(), plot_data, box_tab)
531
+ self._log_to_file_only(location_info)
527
532
  return True
528
533
 
529
534
  def _log_to_file_only(self, messages):
@@ -80,7 +80,8 @@ def style_selector(style_callback, color_range_callback):
80
80
  )
81
81
 
82
82
  color_range_slider = pn.widgets.RangeSlider(
83
- name="Colorbar range",
83
+ name="Set manual color range",
84
+ align=('start', 'end'), # (horizontal, vertical) to place left (h=start) and bottom (v=end)
84
85
  )
85
86
 
86
87
  select_color_range = pn.bind(color_range_callback, color_mode_selector, color_range_slider)
@@ -95,31 +95,31 @@ class RasterPlot:
95
95
  return None
96
96
 
97
97
  data_params = self._plot_params['data']
98
- plot_params = self._plot_params['plot']
99
-
100
- x_axis = plot_params['axis_labels']['x']['axis']
101
- y_axis = plot_params['axis_labels']['y']['axis']
102
- c_axis = plot_params['axis_labels']['c']['axis']
103
-
104
- # Set plot axes to numeric coordinates if needed
105
- xds = set_index_coordinates(data, (x_axis, y_axis))
98
+ axis_labels = self._plot_params['plot']['axis_labels']
106
99
 
107
100
  # Prefix c_axis name with aggregator
108
- xda_name = c_axis
101
+ xda_name = axis_labels['c']['axis']
109
102
  if data_params['aggregator']:
110
103
  xda_name = "_".join([data_params['aggregator'], xda_name])
111
104
 
112
- # Plot unflagged and flagged data
113
- xda = xds[data_params['correlated_data']].where(xds.FLAG == 0.0).rename(xda_name)
114
- unflagged_plot = self._plot_xda(xda)
115
- flagged_xda = xds[data_params['correlated_data']].where(xds.FLAG == 1.0).rename("flagged_" + xda_name)
116
- flagged_plot = self._plot_xda(flagged_xda, True)
117
-
105
+ # Set plot axes to numeric coordinates if needed
106
+ xds = set_index_coordinates(data, (axis_labels['x']['axis'], axis_labels['y']['axis']))
107
+ xda = xds[data_params['correlated_data']].rename(xda_name)
108
+
109
+ # Calculate data range for flagged and unflagged data for color limits
110
+ unflagged_xda = xda.where(xds.FLAG == 0.0)
111
+ flagged_xda = xda.where(xds.FLAG == 1.0).rename("flagged " + xda_name)
112
+ unflagged_data_range = (unflagged_xda.min().values.item(), unflagged_xda.max().values.item())
113
+ flagged_data_range = (flagged_xda.min().values.item(), flagged_xda.max().values.item())
118
114
  if is_gui: # update data range for colorbar
119
- self._plot_params['data']['data_range'] = (xda.min().values.item(), xda.max().values.item())
115
+ self._plot_params['data']['data_range'] = unflagged_data_range
116
+
117
+ # Plot all data as unflagged (with hover tool), then overlay flagged data
118
+ unflagged_plot = self._plot_xda(xda, False, unflagged_data_range)
119
+ flagged_plot = self._plot_xda(flagged_xda, True, flagged_data_range)
120
120
 
121
121
  # Make Overlay plot
122
- return flagged_plot * unflagged_plot
122
+ return unflagged_plot.opts(tools=['hover']) * flagged_plot.opts(tools=[])
123
123
 
124
124
  def _get_plot_title(self, data, plot_inputs, ms_name):
125
125
  ''' Form string containing ms name and selected values using data (xArray Dataset) '''
@@ -172,34 +172,34 @@ class RasterPlot:
172
172
  self._plot_params['plot']['axis_labels'][axis]['label'] = axis_labels[1]
173
173
  self._plot_params['plot']['axis_labels'][axis]['ticks'] = axis_labels[2]
174
174
 
175
- def _plot_xda(self, xda, is_flagged=False):
176
- # Returns Quadmesh plot if raster 2D data, Scatter plot if raster 1D data, or None if no data
177
- plot_params = self._plot_params['plot']
178
- style_params = self._plot_params['style']
175
+ def _plot_xda(self, xda, is_flagged=False, data_range=None):
176
+ ''' Return Quadmesh plot if raster 2D data, Scatter plot if raster 1D data, or None if no data '''
177
+ # Color limits
178
+ c_lim = self._plot_params['plot']['color_limits']
179
+ c_lim = data_range if c_lim is None else c_lim
179
180
 
180
- x_axis = plot_params['axis_labels']['x']['axis']
181
- y_axis = plot_params['axis_labels']['y']['axis']
182
- c_label = plot_params['axis_labels']['c']['label']
183
- c_lim = plot_params['color_limits']
181
+ axis_labels = self._plot_params['plot']['axis_labels']
182
+ x_axis = axis_labels['x']['axis']
183
+ y_axis = axis_labels['y']['axis']
184
+ c_label = axis_labels['c']['label']
184
185
 
186
+ # Set time formatter
185
187
  x_formatter = get_time_formatter() if x_axis == 'time' else None
186
188
  y_formatter = get_time_formatter() if y_axis == 'time' else None
187
189
 
190
+ # Show colorbar
191
+ show_colorbar = False
188
192
  if xda.count().values > 0:
189
- if is_flagged:
190
- show_colorbar = style_params['show_flagged_colorbar']
191
- else :
192
- show_colorbar = style_params['show_colorbar']
193
- else:
194
- show_colorbar = False
193
+ show_colorbar = self._plot_params['style']['show_flagged_colorbar'] if is_flagged else self._plot_params['style']['show_colorbar']
195
194
 
195
+ # Set colorbar label and map
196
196
  if is_flagged:
197
197
  c_label = "Flagged " + c_label
198
- colormap = style_params['flagged_cmap']
199
- plot_params['flagged_colorbar'] = show_colorbar
198
+ colormap = self._plot_params['style']['flagged_cmap']
199
+ self._plot_params['plot']['flagged_colorbar'] = show_colorbar
200
200
  else:
201
- colormap = style_params['unflagged_cmap']
202
- plot_params['unflagged_colorbar'] = show_colorbar
201
+ colormap = self._plot_params['style']['unflagged_cmap']
202
+ self._plot_params['plot']['unflagged_colorbar'] = show_colorbar
203
203
 
204
204
  if xda[x_axis].size > 1 and xda[y_axis].size > 1:
205
205
  # Raster 2D data
@@ -209,16 +209,16 @@ class RasterPlot:
209
209
  clim=c_lim,
210
210
  cmap=colormap,
211
211
  clabel=c_label,
212
- title=plot_params['title'],
213
- xlabel=plot_params['axis_labels']['x']['label'],
214
- ylabel=plot_params['axis_labels']['y']['label'],
212
+ title=self._plot_params['plot']['title'],
213
+ xlabel=axis_labels['x']['label'],
214
+ ylabel=axis_labels['y']['label'],
215
215
  xformatter=x_formatter,
216
216
  yformatter=y_formatter,
217
- xticks=plot_params['axis_labels']['x']['ticks'],
218
- yticks=plot_params['axis_labels']['y']['ticks'],
217
+ xticks=axis_labels['x']['ticks'],
218
+ yticks=axis_labels['y']['ticks'],
219
219
  rot=45, # angle for x axis labels
220
220
  colorbar=show_colorbar,
221
- responsive=True, # resize to fill browser window if True
221
+ responsive=True, # resize to fill browser window
222
222
  )
223
223
  else:
224
224
  # Cannot raster 1D data, use scatter from pandas dataframe
@@ -227,16 +227,16 @@ class RasterPlot:
227
227
  x=x_axis,
228
228
  y=y_axis,
229
229
  c=xda.name,
230
- clim=plot_params['color_limits'],
230
+ clim=c_lim,
231
231
  cmap=colormap,
232
232
  clabel=c_label,
233
- title=plot_params['title'],
234
- xlabel=plot_params['axis_labels']['x']['label'],
235
- ylabel=plot_params['axis_labels']['y']['label'],
233
+ title=self._plot_params['plot']['title'],
234
+ xlabel=axis_labels['x']['label'],
235
+ ylabel=axis_labels['y']['label'],
236
236
  xformatter=x_formatter,
237
237
  yformatter=y_formatter,
238
- xticks=plot_params['axis_labels']['x']['ticks'],
239
- yticks=plot_params['axis_labels']['y']['ticks'],
238
+ xticks=axis_labels['x']['ticks'],
239
+ yticks=axis_labels['y']['ticks'],
240
240
  rot=45,
241
241
  marker='s', # square
242
242
  responsive=True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vidavis
3
- Version: 0.1.4
3
+ Version: 0.1.6
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>
@@ -11,6 +11,7 @@ Requires-Dist: hvplot
11
11
  Requires-Dist: matplotlib
12
12
  Requires-Dist: panel==1.8.2
13
13
  Requires-Dist: selenium
14
+ Requires-Dist: xradio[casacore]
14
15
  Description-Content-Type: text/x-rst
15
16
 
16
17
  vidavis - VIsibility DAta VISualization
@@ -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=I3IOV0FeWNSPA-u-J9-WiFYweve2GJcXujHUJcUo9lE,41693
4
+ vidavis/apps/_ms_raster.py,sha256=frY1OfmNhFEwOqa3Yf06CmBrO3WI7dwDVDCh7ZTDqNY,41717
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
@@ -20,11 +20,11 @@ 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
22
  vidavis/plot/ms_plot/_locate_points.py,sha256=J6JguBTPQLbz0BsUU3yY6U1wHnYQf2uvw06Q26gcRW0,10586
23
- vidavis/plot/ms_plot/_ms_plot.py,sha256=HGmtXkZNBvRZsT5A25K8VbV3HrkrhaUvi-Epo9prCk4,22492
23
+ vidavis/plot/ms_plot/_ms_plot.py,sha256=2TIpzTjZLmwwW8SCc3c84_8dqQ_ftZnpjSnULo5RQlw,22524
24
24
  vidavis/plot/ms_plot/_ms_plot_constants.py,sha256=xbn_dEx4QWbZIsUDziJifrT7pXwO2Qr2B5CHyAy16So,940
25
- vidavis/plot/ms_plot/_ms_plot_selectors.py,sha256=LeRLuOVkitzuOL--QRHXtoxJIz3DGjhjIjSfbOj7qyI,11146
25
+ vidavis/plot/ms_plot/_ms_plot_selectors.py,sha256=84rgzWFyqTl2sBcrbld_9C0iNvov43mj2Ev-YRmNTHU,11254
26
26
  vidavis/plot/ms_plot/_plot_inputs.py,sha256=GeErBB3pYz6ecJiMTGQMNXkPeMLbWbYGmqL5dr8A46Q,687
27
- vidavis/plot/ms_plot/_raster_plot.py,sha256=6TOZvKSh8oBI79K926zp8Cn5bzk4MJGPB_PQ5S-1H4M,10803
27
+ vidavis/plot/ms_plot/_raster_plot.py,sha256=9MU9W-rRRzfV3RTNsl030hf1DCIvYAZqnD0xJjz8yP8,11074
28
28
  vidavis/plot/ms_plot/_raster_plot_gui.py,sha256=Q6RwzZUJSFrq7vj-0aftrv_DcvgFwf0gjKHHkN5XlSg,3527
29
29
  vidavis/plot/ms_plot/_raster_plot_inputs.py,sha256=kxR6-1Qn4IyQ4FjgpVZ9HEZ7EnPHxJZWomb0n_zaRwo,4071
30
30
  vidavis/plot/ms_plot/_time_ticks.py,sha256=j-DcPh7RfGE8iX2bPjLQDQPIbiAbmjiEWQnKmdMWA3I,1773
@@ -33,8 +33,8 @@ vidavis/toolbox/__init__.py,sha256=jqFa-eziVz_frNnXxwjJFK36qNpz1H38s-VlpBcq-R8,1
33
33
  vidavis/toolbox/_app_context.py,sha256=H7gtF8RrAH46FqDcMobv3KM1Osbnapgu6aTG-m3VCWA,3049
34
34
  vidavis/toolbox/_logging.py,sha256=OEisrd8FM8VTNBMc7neLh9ekelf29ZILYB5pScebly0,2739
35
35
  vidavis/toolbox/_static.py,sha256=HJLMtClppgOJXWAtV6Umn5EqN80u0oZiIouQ1JsB9PM,2346
36
- vidavis/__version__.py,sha256=K0nJliLE8urvUSONsZC4x-EeWHUpKHvT74DFSIT6PZI,21
37
- vidavis-0.1.4.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
38
- vidavis-0.1.4.dist-info/METADATA,sha256=xQqyJjG6YpRXjSlviEhbIDE6KsQQoK1-Fps6r_5kENc,2268
39
- vidavis-0.1.4.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
40
- vidavis-0.1.4.dist-info/RECORD,,
36
+ vidavis/__version__.py,sha256=kBM8jwQ9r_ZMq7P43-SvMT6w6DhdPd9jFFTBA3HEZdg,21
37
+ vidavis-0.1.6.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
38
+ vidavis-0.1.6.dist-info/METADATA,sha256=hDIySvDuw73yRTjzr5fwqpZ0YmjF5DNmvujeZosnF8g,2300
39
+ vidavis-0.1.6.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
40
+ vidavis-0.1.6.dist-info/RECORD,,