vidavis 0.0.1__py3-none-any.whl → 0.0.3__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.0.1'
1
+ __version__ = '0.0.3'
@@ -24,8 +24,9 @@ class MsRaster(MsPlot):
24
24
  Plot MeasurementSet data as raster plot.
25
25
 
26
26
  Args:
27
- ms (str): path to MSv2 (.ms) or MSv4 (.zarr) file. Required when show_gui=False.
27
+ ms (str, None): path to MSv2 (.ms) or MSv4 (.zarr) file. Default None. Required when show_gui=False.
28
28
  log_level (str): logging threshold. Options include 'debug', 'info', 'warning', 'error', 'critical'. Default 'info'.
29
+ log_to_file (bool): whether to write log messages to log file "msraster-<timestamp>.log". Default True.
29
30
  show_gui (bool): whether to launch the interactive GUI in a browser tab. Default False.
30
31
 
31
32
  Example:
@@ -39,8 +40,8 @@ class MsRaster(MsPlot):
39
40
  msr.save() # saves as {ms name}_raster.png
40
41
  '''
41
42
 
42
- def __init__(self, ms=None, log_level="info", show_gui=False):
43
- super().__init__(ms, log_level, show_gui, "MsRaster")
43
+ def __init__(self, ms=None, log_level="info", log_to_file=True, show_gui=False):
44
+ super().__init__(ms, log_level, log_to_file, show_gui, "MsRaster")
44
45
  self._raster_plot = RasterPlot()
45
46
 
46
47
  # Calculations for color limits
@@ -211,11 +212,7 @@ class MsRaster(MsPlot):
211
212
 
212
213
  # Get data dimensions if valid MS is set to check input axes
213
214
  if 'data_dims' in self._ms_info:
214
- data_dims = self._ms_info['data_dims']
215
- if 'baseline_id' in data_dims:
216
- data_dims.remove('baseline_id')
217
- data_dims.append('baseline')
218
- inputs['data_dims'] = data_dims
215
+ inputs['data_dims'] = self._ms_info['data_dims'] if 'data_dims' in self._ms_info else None
219
216
 
220
217
  # Validate input arguments then set
221
218
  check_inputs(inputs)
@@ -279,6 +276,10 @@ class MsRaster(MsPlot):
279
276
  ms_name = self._ms_info['basename'] # for title
280
277
  self._raster_plot.set_plot_params(raster_data, plot_inputs, ms_name)
281
278
 
279
+ # Show plot inputs in log
280
+ super()._set_plot_params(plot_inputs | self._raster_plot.get_plot_params()['style'])
281
+ self._logger.info("MsRaster plot parameters: %s", ", ".join(self._plot_params))
282
+
282
283
  # Make plot. Add data min/max if GUI is shown to update color limits range.
283
284
  return self._raster_plot.raster_plot(raster_data, self._logger, self._show_gui)
284
285
 
@@ -475,8 +476,9 @@ class MsRaster(MsPlot):
475
476
 
476
477
  # Layout plot and input widgets in a row
477
478
  self._gui_layout = pn.Row(
478
- pn.Column( # [0]
479
- dmap,
479
+ pn.Tabs( # [0]
480
+ ('Plot', dmap), # [0]
481
+ ('Plot Inputs', pn.Column()), # [1]
480
482
  sizing_mode='stretch_width',
481
483
  ),
482
484
  pn.Spacer(width=10), # [1]
@@ -544,6 +546,9 @@ class MsRaster(MsPlot):
544
546
  # Subparam values changed but not applied to plot
545
547
  gui_plot = self._last_gui_plot
546
548
 
549
+ # Update plot inputs for gui
550
+ self._set_plot_params(self._plot_inputs | style_inputs)
551
+
547
552
  # Save inputs to see if changed
548
553
  self._last_plot_inputs = self._plot_inputs.copy()
549
554
  self._last_style_inputs = style_inputs.copy()
@@ -556,7 +561,8 @@ class MsRaster(MsPlot):
556
561
  # Save plot if no new plot
557
562
  self._last_gui_plot = gui_plot
558
563
 
559
- # Change plot button and stop spinner
564
+ # Add plot inputs, change plot button to outline, and stop spinner
565
+ self._update_plot_inputs()
560
566
  self._update_plot_status(False)
561
567
  self._update_plot_spinner(False)
562
568
 
@@ -636,15 +642,16 @@ class MsRaster(MsPlot):
636
642
  return self._empty_plot
637
643
 
638
644
  def _create_empty_plot(self):
639
- ''' Create empty Overlay plot for DynamicMap with default color params and hover enabled '''
645
+ ''' Create empty Overlay plot for DynamicMap with colormap params and hover enabled '''
640
646
  plot_params = self._raster_plot.get_plot_params()
641
647
  plot = hv.Overlay(
642
648
  hv.QuadMesh([]).opts(
643
- colorbar=False,
649
+ colorbar=plot_params['style']['show_flagged_colorbar'],
644
650
  cmap=plot_params['style']['flagged_cmap'],
645
651
  responsive=True,
646
652
  ) * hv.QuadMesh([]).opts(
647
653
  colorbar=plot_params['style']['show_colorbar'],
654
+ colorbar_position='left',
648
655
  cmap=plot_params['style']['unflagged_cmap'],
649
656
  responsive=True,
650
657
  )
@@ -708,17 +715,37 @@ class MsRaster(MsPlot):
708
715
  ''' Set gui options from ms data '''
709
716
  if 'data_dims' in self._ms_info:
710
717
  data_dims = self._ms_info['data_dims']
711
-
712
- # Update options for x_axis and y_axis selectors
713
718
  axis_selectors = self._get_selector('axes')
714
- axis_selectors.objects[0][0].options = data_dims
715
- axis_selectors.objects[0][1].options = data_dims
719
+
720
+ # Update options for x_axis selector
721
+ x_axis_selector = axis_selectors.objects[0][0]
722
+ x_axis_value = x_axis_selector.value
723
+ x_axis_selector.options = data_dims
724
+ if x_axis_value in data_dims:
725
+ x_axis_selector.value = x_axis_value
726
+ else:
727
+ x_axis_selector.value = data_dims[1]
728
+
729
+ # Update options for y_axis selector
730
+ y_axis_selector = axis_selectors.objects[0][1]
731
+ y_axis_value = y_axis_selector.value
732
+ y_axis_selector.options = data_dims
733
+ if y_axis_value in data_dims:
734
+ y_axis_selector.value = y_axis_value
735
+ else:
736
+ y_axis_selector.value = data_dims[0]
716
737
 
717
738
  # Update options for vis_axis selector
739
+ vis_axis_selector = axis_selectors.objects[2]
740
+ vis_axis_value = vis_axis_selector.value
718
741
  if self._data.get_correlated_data('base') == 'SPECTRUM':
719
- axis_selectors.objects[1].options = SPECTRUM_AXIS_OPTIONS
742
+ vis_axis_selector.options = SPECTRUM_AXIS_OPTIONS
720
743
  else:
721
- axis_selectors.objects[1].options = VIS_AXIS_OPTIONS
744
+ vis_axis_selector.options = VIS_AXIS_OPTIONS
745
+ if vis_axis_value in vis_axis_selector.options:
746
+ vis_axis_selector.value = vis_axis_value
747
+ else:
748
+ vis_axis_selector.value = VIS_AXIS_OPTIONS[0]
722
749
 
723
750
  # Update options for selection selector
724
751
  selection_selectors = self._get_selector('sel')
@@ -841,6 +868,14 @@ class MsRaster(MsPlot):
841
868
  button = self._gui_layout[2][2][0]
842
869
  button.button_style = 'solid' if inputs_changed else 'outline'
843
870
 
871
+ def _update_plot_inputs(self):
872
+ ''' Show inputs for raster plot in GUI '''
873
+ if self._plot_params:
874
+ inputs_column = self._gui_layout[0][1]
875
+ inputs_column.clear()
876
+ for param in self._plot_params:
877
+ inputs_column.append(pn.pane.Str(param))
878
+
844
879
  ###
845
880
  ### Callbacks for widgets which update plot inputs
846
881
  ###
@@ -105,15 +105,16 @@ class PsData:
105
105
  return len(self._get_ps_xdt())
106
106
 
107
107
  def get_max_dims(self):
108
- ''' Returns maximum length of data dimensions in selected ps_xdt (if selected) '''
108
+ ''' Returns maximum length of dimensions in selected ProcessingSet (if selected) '''
109
109
  ps_xdt = self._get_ps_xdt()
110
110
  return ps_xdt.xr_ps.get_max_dims()
111
111
 
112
112
  def get_data_dimensions(self):
113
- ''' Return the maximum dimensions in selected ProcessingSet (if selected) '''
113
+ ''' Return names of the data dimensions. '''
114
114
  dims = list(self.get_max_dims().keys())
115
115
  if 'uvw_label' in dims:
116
116
  dims.remove('uvw_label') # not a VISIBILITY/SPECTRUM data dim
117
+ dims = ['baseline' if dim=='baseline_id' else dim for dim in dims]
117
118
  return dims
118
119
 
119
120
  def get_dimension_values(self, dimension):
@@ -24,13 +24,14 @@ class MsPlot:
24
24
 
25
25
  ''' Base class for MS plots with common functionality '''
26
26
 
27
- def __init__(self, ms=None, log_level="info", show_gui=False, app_name="MsPlot"):
27
+ # pylint: disable=too-many-arguments, too-many-positional-arguments
28
+ def __init__(self, ms=None, log_level="info", log_to_file=False, show_gui=False, app_name="MsPlot"):
28
29
  if not ms and not show_gui:
29
30
  raise RuntimeError("Must provide ms/zarr path if gui not shown.")
30
31
 
31
32
  # Set logger: use toolviper logger else casalog else python logger
32
33
  if _HAVE_TOOLVIPER:
33
- self._logger = setup_logger(app_name, log_to_term=True, log_to_file=False, log_level=log_level.upper())
34
+ self._logger = setup_logger(app_name, log_to_term=True, log_to_file=log_to_file, log_file=app_name.lower(), log_level=log_level.upper())
34
35
  else:
35
36
  self._logger = get_logger()
36
37
  self._logger.setLevel(log_level.upper())
@@ -49,6 +50,7 @@ class MsPlot:
49
50
 
50
51
  # Initialize plot inputs and params
51
52
  self._plot_inputs = {'selection': {}}
53
+ self._plot_params = None
52
54
 
53
55
  # Initialize plots
54
56
  self._plot_init = False
@@ -59,6 +61,7 @@ class MsPlot:
59
61
  self._data = None
60
62
  self._ms_info = {}
61
63
  self._set_ms(ms)
64
+ # pylint: enable=too-many-arguments, too-many-positional-arguments
62
65
 
63
66
  def summary(self, data_group='base', columns=None):
64
67
  ''' Print ProcessingSet summary.
@@ -150,7 +153,14 @@ class MsPlot:
150
153
  plot = hv.render(layout_plot)
151
154
 
152
155
  self._plots_locked = False
153
- show(plot)
156
+ if self._plot_params:
157
+ column = pn.Column()
158
+ for param in self._plot_params:
159
+ column.append(pn.pane.Str(param))
160
+ tabs = pn.Tabs(('Plot', plot), ('Plot Inputs', column))
161
+ tabs.show(title=self._app_name, threaded=True)
162
+ else:
163
+ show(plot)
154
164
 
155
165
  def save(self, filename='ms_plot.png', fmt='auto', width=900, height=600):
156
166
  '''
@@ -262,3 +272,14 @@ class MsPlot:
262
272
  self._logger.warning(message)
263
273
  if self._show_gui:
264
274
  self._toast = pn.state.notifications.warning(message, duration=duration)
275
+
276
+ def _set_plot_params(self, plot_params):
277
+ ''' Set list of plot parameters as key=value string, for logging or browser display '''
278
+ plot_inputs = plot_params.copy()
279
+ for key in ['self', '__class__', 'data_dims']:
280
+ # Remove keys from using function locals()
281
+ try:
282
+ del plot_inputs[key]
283
+ except KeyError:
284
+ pass
285
+ self._plot_params = sorted([f"{key}={value}" for key, value in plot_inputs.items()])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vidavis
3
- Version: 0.0.1
3
+ Version: 0.0.3
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>
@@ -13,8 +13,8 @@ Description-Content-Type: text/x-rst
13
13
  vidavis - VIsibility DAta VISualization
14
14
  =======================================
15
15
 
16
- This is a **pre-alpha** package. All applications are currently in various
17
- phases of *prototyping*.
16
+ This is a **pre-alpha** package. All applications are in various phases of
17
+ *prototyping*.
18
18
 
19
19
  Introduction
20
20
  ------------
@@ -30,8 +30,8 @@ The `Bokeh <https://bokeh.org/>`_ plots are created with
30
30
  `hvPlot <https://hvplot.holoviz.org/>`_ and optionally shown in a
31
31
  `Panel <https://panel.holoviz.org/>`_-based GUI.
32
32
 
33
- The **MsRaster** application creates raster plots of visibility data. See
34
- example below.
33
+ The first application added to **vidavis** is **MsRaster**, which creates raster
34
+ plots of visibility data. See example below.
35
35
 
36
36
  Installation
37
37
  ------------
@@ -54,6 +54,9 @@ Install
54
54
 
55
55
  - :code:`pip install vidavis`
56
56
 
57
+ MSv2 Conversion
58
+ ^^^^^^^^^^^^^^^
59
+
57
60
  To enable conversion from MSv2 to MSv4 with **python-casacore** use (this only works for Linux):
58
61
 
59
62
  - :code:`pip install "xradio[python-casacore]"`
@@ -62,19 +65,22 @@ On macOS it is required to pre-install `python-casacore` using:
62
65
 
63
66
  - :code:`conda install -c conda-forge python-casacore`
64
67
 
68
+ Exporting Plots
69
+ ^^^^^^^^^^^^^^^
65
70
 
66
- To enable exporting plots to file using preferred web driver:
71
+ To enable exporting plots to file without showing the plot, using preferred web
72
+ driver:
67
73
 
68
- **Selenium** with **geckodriver** and **Firefox** (to ensure compatible versions)::
74
+ **Selenium** with **geckodriver** and **Firefox** (to ensure compatible versions):
69
75
 
70
76
  - :code:`conda install -c conda-forge selenium firefox geckodriver`
71
77
 
72
78
  **Selenium** with **ChromeDriver** (Chrome), with the executable
73
- **chromedriver** in your PATH::
79
+ **chromedriver** in your PATH:
74
80
 
75
81
  - :code:`conda install -c conda-forge selenium python-chromedriver-binary`
76
82
 
77
- or::
83
+ or:
78
84
 
79
85
  - :code:`pip install selenium chromedriver-binary`
80
86
 
@@ -1,7 +1,7 @@
1
1
  vidavis/LICENSE.rst,sha256=qzGpkvhDzf_MgF1PIn6rCmYPrcEhkfrBUchosLJj-U4,26371
2
2
  vidavis/__init__.py,sha256=k3gZarCQxuW9qtnnU06ERZrfW08AE6z0GheGQ9far3Y,1696
3
3
  vidavis/apps/__init__.py,sha256=Yjm30SyCmoV5E4HgkctsNMZwYAXuumJGYZU7eOjiDbU,1336
4
- vidavis/apps/_ms_raster.py,sha256=zvz9IUxdSgg5hSV9TUKbAg-XHTs6ML3RGXcNrjDSwNU,43271
4
+ vidavis/apps/_ms_raster.py,sha256=hILrhGrE48JaEZRfMQ3iDCzUU4WSQxpkOuVRr4LXJYk,45002
5
5
  vidavis/bokeh/__init__.py,sha256=XvuKcU9-bAv1CPb_O81VJTNLlHQC-zBg_Ig9_q4RkM4,1371
6
6
  vidavis/bokeh/state/__init__.py,sha256=TwXVPmEg2FAcBOJh1mdqRRhxjJvEyw6bnz0elEkToSg,1476
7
7
  vidavis/bokeh/state/_palette.py,sha256=gzfJHuUgqxd8hJpZe-gQPFTCPq9f5I8uLEkHAK5FNDM,2480
@@ -11,7 +11,7 @@ vidavis/data/measurement_set/_ms_data.py,sha256=7ATsPbGFAv8WtWk_PRxlfoLdqapd6eMv
11
11
  vidavis/data/measurement_set/processing_set/__init__.py,sha256=34JvSyeSa1yeQ_WptnzPCvBxgWvWBOOLti6y7k2jvlE,523
12
12
  vidavis/data/measurement_set/processing_set/_ps_concat.py,sha256=bCRsYFJQTp65QEAk_wGZQ2rZNkn6E3Gg2gKKFQfV5mw,3499
13
13
  vidavis/data/measurement_set/processing_set/_ps_coords.py,sha256=pdmojL-_55x3CjFcMIMuIqsI4ADG-TlLxc-RTgBQZC8,3640
14
- vidavis/data/measurement_set/processing_set/_ps_data.py,sha256=0m1CoK4PYIjrmh6IaXueTcFq-kzxcnuVXgQnbSStKCE,10723
14
+ vidavis/data/measurement_set/processing_set/_ps_data.py,sha256=4-LXSk9ROnmWG8vZmSuBD7ObRIyNSTTfyjmYlULikpE,10767
15
15
  vidavis/data/measurement_set/processing_set/_ps_io.py,sha256=i-YkHEOPpqLLbUv6Gd29EQfJfq_Hgs0055vDwc3Hmbo,1709
16
16
  vidavis/data/measurement_set/processing_set/_ps_raster_data.py,sha256=6mU_V68lvJvIktEuyE5tWlyj7GaRmOnkCWSjHXc5lWs,7249
17
17
  vidavis/data/measurement_set/processing_set/_ps_select.py,sha256=GhAPxZ5mwvmUhCqKETVkhecjbwfrtDAG7-ibM19GDg0,10831
@@ -19,7 +19,7 @@ vidavis/data/measurement_set/processing_set/_ps_stats.py,sha256=4uLImKCANXLUM8jO
19
19
  vidavis/data/measurement_set/processing_set/_xds_data.py,sha256=qLO2VkLINkSAQ7CGRFmpWQYpHrP4XoJJkwA4pp9DO8M,5253
20
20
  vidavis/plot/__init__.py,sha256=nlvKDuKy4s5nufpoYINzZW5kf1MIcmheAnzo82i-GXo,93
21
21
  vidavis/plot/ms_plot/__init__.py,sha256=f2okSBxRB-GgdiJGUE5ZfPgKY2_dzDkGfX91GxRUE94,658
22
- vidavis/plot/ms_plot/_ms_plot.py,sha256=N85Ldy05y5FffNipcBWNFjJgVYu0r10hDNe9F-ogRFk,10402
22
+ vidavis/plot/ms_plot/_ms_plot.py,sha256=pS-l6-cxmnsIa4Dm-yyPkgimh7sFSl6qBIpXxK9HV_Y,11414
23
23
  vidavis/plot/ms_plot/_ms_plot_constants.py,sha256=cX_TQhKJ3hJzPuRYmuRJxue1sjq82yl_ZN2_w6TshmI,930
24
24
  vidavis/plot/ms_plot/_ms_plot_selectors.py,sha256=S8zEpqiRfV6r5m1gSz8MdmMxKSmoqW-9U6YnYmbRVf4,10791
25
25
  vidavis/plot/ms_plot/_raster_plot.py,sha256=lNa9i_eJ8F8Fc2zcHLRcaxKKOELk3x_QmXT__T76pg8,10999
@@ -30,8 +30,8 @@ vidavis/toolbox/__init__.py,sha256=MoyrDjzcdMDDa7Rc5WyITD01DcpQ2_VdQEdB7g3Hg9c,1
30
30
  vidavis/toolbox/_app_context.py,sha256=H7gtF8RrAH46FqDcMobv3KM1Osbnapgu6aTG-m3VCWA,3049
31
31
  vidavis/toolbox/_logging.py,sha256=OEisrd8FM8VTNBMc7neLh9ekelf29ZILYB5pScebly0,2739
32
32
  vidavis/toolbox/_static.py,sha256=HJLMtClppgOJXWAtV6Umn5EqN80u0oZiIouQ1JsB9PM,2346
33
- vidavis/__version__.py,sha256=07NzQXBgNlnw5kSN6ZYxE9By-_RuH3Jyy58Z74sIio0,21
34
- vidavis-0.0.1.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
35
- vidavis-0.0.1.dist-info/METADATA,sha256=OwsSFPTZltsnaVgcPIlah49UsrcHI6kf_GL6NmtnghA,2735
36
- vidavis-0.0.1.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
37
- vidavis-0.0.1.dist-info/RECORD,,
33
+ vidavis/__version__.py,sha256=kQOJvtmpbHGE0oVJv6oubUfigE6lAOQFBGPyh3SkWZI,21
34
+ vidavis-0.0.3.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
35
+ vidavis-0.0.3.dist-info/METADATA,sha256=aYakK6qhQatXmw7Eu3lY40QfIY8KFRRomTejlAQXMOo,2850
36
+ vidavis-0.0.3.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
37
+ vidavis-0.0.3.dist-info/RECORD,,