cubevis 0.5.17__tar.gz → 0.5.19__tar.gz
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.
Potentially problematic release.
This version of cubevis might be problematic. Click here for more details.
- {cubevis-0.5.17 → cubevis-0.5.19}/PKG-INFO +1 -1
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_createmask.py +2 -2
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_createregion.py +2 -2
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_interactiveclean.mustache +19 -10
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_interactiveclean.py +19 -10
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/toolbox/_cube.py +2 -2
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/__init__.py +1 -14
- cubevis-0.5.19/cubevis/utils/_jupyter.py +92 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/pyproject.toml +1 -1
- {cubevis-0.5.17 → cubevis-0.5.19}/LICENSE +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/LICENSE.rst +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/20px/fast-backward.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/20px/fast-forward.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/20px/step-backward.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/20px/step-forward.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/add-chan.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/add-chan.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/add-cube.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/add-cube.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/drag.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/drag.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/mask-selected.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/mask.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/mask.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/new-layer-sm-selected.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/new-layer-sm-selected.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/new-layer-sm.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/new-layer-sm.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/reset.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/reset.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/sub-chan.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/sub-chan.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/sub-cube.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/sub-cube.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/zoom-to-fit.png +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__icons__/zoom-to-fit.svg +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__js__/bokeh-3.6.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__js__/bokeh-tables-3.6.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__js__/bokeh-widgets-3.6.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__js__/casalib.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/__js__/cubevisjs.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/annotations/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/annotations/_ev_poly_annotation.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/components/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/format/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/format/_time_ticks.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/format/_wcs_ticks.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/models/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/models/_edit_span.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/models/_ev_text_input.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/models/_tip.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/models/_tip_button.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/_data_pipe.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/_image_data_source.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/_image_pipe.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/_spectra_data_source.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/sources/_updatable_data_source.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/_initialize.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/_javascript.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/_palette.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/_session.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/bokeh-2.4.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/bokeh-gl-2.4.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/bokeh-tables-2.4.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/bokeh-widgets-2.4.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/casaguijs-v0.0.4.0-b2.4.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/casaguijs-v0.0.5.0-b2.4.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/casaguijs-v0.0.6.0-b2.4.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/state/js/casalib-v0.0.1.min.js +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/tools/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/tools/_cbreset_tool.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/tools/_drag_tool.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/utils/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/utils/_axes_labels.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/bokeh/utils/_svg_icon.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/data/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/data/casaimage/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/_gclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_interactiveclean_wrappers.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_plotants.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/apps/_plotbandpass.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casashell/createmask.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casashell/iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casatasks/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casatasks/createmask.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casatasks/createregion.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/private/casatasks/iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/readme.rst +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/remote/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/remote/_gclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/remote/_local.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/remote/_remote_kernel.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/toolbox/__init__.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/toolbox/_app_context.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/toolbox/_region_list.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_ResourceManager.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_contextmgrchain.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_conversion.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_copydoc.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_docenum.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_import_protected_module.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_logging.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_pkgs.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_regions.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_static.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/cubevis/utils/_tiles.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/readme.rst +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/alma-many-chan/alma-many-chan.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/basic-websockets-demo/client.html +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/basic-websockets-demo/client.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/basic-websockets-demo/server.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/createmask-demo/run-createmask.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/createregion-demo/run-createregion.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image-slider-spectra-done-stats.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image-slider-spectra-done.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image-slider-spectra.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image-slider.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/m100_interactive.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/mask0-iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/run-gclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/run-iclean-obj.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/run-iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-demo/vla-sim-jet-iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-first-look/run-fl-cont.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-first-look/run-fl-line.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-outlier/run-iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-outlier/test_outlier.txt +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/iclean-remote/iclean_remote_webserver.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/large-cube/run-largecube.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/svg-test.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/updatable-data-source/direct-plot.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/updatable-data-source/simple-update.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/updatable-data-source/updated-plot.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/uranus-demo/uranus-iclean.py +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/websocket-reconnect/client.html +0 -0
- {cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/websocket-reconnect/server.py +0 -0
|
@@ -41,7 +41,7 @@ from bokeh.io import reset_output as reset_bokeh_output
|
|
|
41
41
|
from bokeh.io import output_notebook
|
|
42
42
|
from bokeh.models.dom import HTML
|
|
43
43
|
from bokeh.models.ui.tooltips import Tooltip
|
|
44
|
-
from cubevis.utils import resource_manager, reset_resource_manager,
|
|
44
|
+
from cubevis.utils import resource_manager, reset_resource_manager, is_interactive_jupyter
|
|
45
45
|
from cubevis.data import casaimage
|
|
46
46
|
from cubevis.bokeh.models import TipButton, Tip
|
|
47
47
|
from cubevis.utils import ContextMgrChain as CMC
|
|
@@ -395,7 +395,7 @@ class CreateMask:
|
|
|
395
395
|
itergroups[document._casa_image_name].active = document._casa_last_control_tab''' ) )
|
|
396
396
|
|
|
397
397
|
# Change display type depending on runtime environment
|
|
398
|
-
if
|
|
398
|
+
if is_interactive_jupyter( ):
|
|
399
399
|
output_notebook()
|
|
400
400
|
else:
|
|
401
401
|
### Directory is created when an HTTP server is running
|
|
@@ -41,7 +41,7 @@ from bokeh.io import curdoc
|
|
|
41
41
|
from bokeh.io import reset_output as reset_bokeh_output
|
|
42
42
|
from bokeh.models.dom import HTML
|
|
43
43
|
from bokeh.models.ui.tooltips import Tooltip
|
|
44
|
-
from cubevis.utils import resource_manager, reset_resource_manager,
|
|
44
|
+
from cubevis.utils import resource_manager, reset_resource_manager, is_interactive_jupyter
|
|
45
45
|
from cubevis.data import casaimage
|
|
46
46
|
from cubevis.bokeh.models import TipButton, Tip
|
|
47
47
|
from cubevis.utils import ContextMgrChain as CMC
|
|
@@ -448,7 +448,7 @@ class CreateRegion:
|
|
|
448
448
|
itergroups[document._casa_image_name].active = document._casa_last_control_tab''' ) )
|
|
449
449
|
|
|
450
450
|
# Change display type depending on runtime environment
|
|
451
|
-
if
|
|
451
|
+
if is_interactive_jupyter( ):
|
|
452
452
|
output_notebook()
|
|
453
453
|
else:
|
|
454
454
|
### Directory is created when an HTTP server is running
|
|
@@ -54,7 +54,7 @@ from bokeh.models.dom import HTML
|
|
|
54
54
|
|
|
55
55
|
from bokeh.models.ui.tooltips import Tooltip
|
|
56
56
|
from cubevis.bokeh.models import TipButton, Tip, EvTextInput
|
|
57
|
-
from cubevis.utils import resource_manager, reset_resource_manager,
|
|
57
|
+
from cubevis.utils import resource_manager, reset_resource_manager, is_interactive_jupyter, find_pkg, load_pkg
|
|
58
58
|
from cubevis.utils import ContextMgrChain as CMC
|
|
59
59
|
|
|
60
60
|
# pylint: disable=no-name-in-module
|
|
@@ -106,6 +106,12 @@ class InteractiveClean:
|
|
|
106
106
|
###
|
|
107
107
|
self._error_result = None
|
|
108
108
|
|
|
109
|
+
###
|
|
110
|
+
### iclean results
|
|
111
|
+
###
|
|
112
|
+
self.__result = None
|
|
113
|
+
self.__result_from_gui = None
|
|
114
|
+
|
|
109
115
|
'''
|
|
110
116
|
_gen_port_fwd_cmd()
|
|
111
117
|
|
|
@@ -193,7 +199,7 @@ class InteractiveClean:
|
|
|
193
199
|
###
|
|
194
200
|
### whether or not the session is being run from a jupyter notebook or script
|
|
195
201
|
###
|
|
196
|
-
self._is_notebook =
|
|
202
|
+
self._is_notebook = is_interactive_jupyter()
|
|
197
203
|
|
|
198
204
|
##
|
|
199
205
|
## the http port for serving GUI in webpage if not running in script
|
|
@@ -476,7 +482,7 @@ class InteractiveClean:
|
|
|
476
482
|
iteration_limit = int(msg['value']['iteration']['niter'])
|
|
477
483
|
stopdesc, stopcode, majordone, majorleft, iterleft, self._convergence_data = await self._clean['gclean'].__anext__( )
|
|
478
484
|
|
|
479
|
-
clean_cmds = self._clean['gclean'].
|
|
485
|
+
clean_cmds = self._clean['gclean']._log( )
|
|
480
486
|
|
|
481
487
|
for key, value in self._convergence_data.items( ):
|
|
482
488
|
|
|
@@ -833,7 +839,7 @@ class InteractiveClean:
|
|
|
833
839
|
body {
|
|
834
840
|
counter-reset: section;
|
|
835
841
|
}
|
|
836
|
-
p:not([
|
|
842
|
+
p:not([no-num]):before {
|
|
837
843
|
font-weight: bold;
|
|
838
844
|
counter-increment: section;
|
|
839
845
|
content: "" counter(section) ": ";
|
|
@@ -842,7 +848,7 @@ class InteractiveClean:
|
|
|
842
848
|
</head>
|
|
843
849
|
<body>
|
|
844
850
|
<h1>Interactive Clean History</h1>
|
|
845
|
-
` + elem.map((x) => x.startsWith('#') ? `<p
|
|
851
|
+
` + elem.map((x) => x.startsWith('#') ? `<p no-num>${x}</p>` : `<p>${x}</p>`).join('\\n') + '</body>\\n</html>'
|
|
846
852
|
}
|
|
847
853
|
let b = cb_obj.origin
|
|
848
854
|
if ( ! b._window || b._window.closed ) {
|
|
@@ -855,7 +861,7 @@ class InteractiveClean:
|
|
|
855
861
|
### Setup script that will be called when the user closes the
|
|
856
862
|
### browser tab that is running interactive clean
|
|
857
863
|
###
|
|
858
|
-
initial_log = self._clean['gclean'].
|
|
864
|
+
initial_log = self._clean['gclean']._log( )
|
|
859
865
|
|
|
860
866
|
self._pipe['control'].init_script=CustomJS( args=dict( ctrl_pipe=self._pipe['control'],
|
|
861
867
|
ids=self._clean_ids,
|
|
@@ -1044,7 +1050,7 @@ class InteractiveClean:
|
|
|
1044
1050
|
###
|
|
1045
1051
|
raise RuntimeError(f'''gclean failure "%s" not returned: {imdetails["converge"]}''' % ('major' if imdetails['converge']['major'] is None else 'chan'))
|
|
1046
1052
|
|
|
1047
|
-
self._clean['cmds'].extend(self._clean['gclean'].
|
|
1053
|
+
self._clean['cmds'].extend(self._clean['gclean']._log( ))
|
|
1048
1054
|
|
|
1049
1055
|
self._initial_clean_params['nmajor'] = majorleft
|
|
1050
1056
|
self._initial_clean_params['niter'] = iterleft
|
|
@@ -1152,9 +1158,12 @@ class InteractiveClean:
|
|
|
1152
1158
|
if self.__result_future is None:
|
|
1153
1159
|
raise RuntimeError( 'no interactive clean result is available' )
|
|
1154
1160
|
|
|
1155
|
-
self.
|
|
1161
|
+
if self.__result is None:
|
|
1162
|
+
### restore returns full return dictionary
|
|
1163
|
+
self.__result_from_gui = self.__result_future.result( )
|
|
1164
|
+
self.__result = self._clean['gclean'].restore( )
|
|
1156
1165
|
|
|
1157
|
-
return self.
|
|
1166
|
+
return self.__result
|
|
1158
1167
|
|
|
1159
1168
|
def masks( self ):
|
|
1160
1169
|
'''Retrieves the masks which were used with interactive clean.
|
|
@@ -1187,7 +1196,7 @@ class InteractiveClean:
|
|
|
1187
1196
|
-------
|
|
1188
1197
|
list[str] tclean calls made during the interactive clean session.
|
|
1189
1198
|
'''
|
|
1190
|
-
return self._clean.
|
|
1199
|
+
return self._clean['gclean']._log( True )
|
|
1191
1200
|
|
|
1192
1201
|
def _initialize_javascript( self ):
|
|
1193
1202
|
self._js = { ### initialize state
|
|
@@ -53,7 +53,7 @@ from bokeh.models.dom import HTML
|
|
|
53
53
|
|
|
54
54
|
from bokeh.models.ui.tooltips import Tooltip
|
|
55
55
|
from cubevis.bokeh.models import TipButton, Tip, EvTextInput
|
|
56
|
-
from cubevis.utils import resource_manager, reset_resource_manager,
|
|
56
|
+
from cubevis.utils import resource_manager, reset_resource_manager, is_interactive_jupyter, find_pkg, load_pkg
|
|
57
57
|
from cubevis.utils import ContextMgrChain as CMC
|
|
58
58
|
|
|
59
59
|
# pylint: disable=no-name-in-module
|
|
@@ -1868,6 +1868,12 @@ class InteractiveClean:
|
|
|
1868
1868
|
###
|
|
1869
1869
|
self._error_result = None
|
|
1870
1870
|
|
|
1871
|
+
###
|
|
1872
|
+
### iclean results
|
|
1873
|
+
###
|
|
1874
|
+
self.__result = None
|
|
1875
|
+
self.__result_from_gui = None
|
|
1876
|
+
|
|
1871
1877
|
'''
|
|
1872
1878
|
_gen_port_fwd_cmd()
|
|
1873
1879
|
|
|
@@ -1955,7 +1961,7 @@ class InteractiveClean:
|
|
|
1955
1961
|
###
|
|
1956
1962
|
### whether or not the session is being run from a jupyter notebook or script
|
|
1957
1963
|
###
|
|
1958
|
-
self._is_notebook =
|
|
1964
|
+
self._is_notebook = is_interactive_jupyter()
|
|
1959
1965
|
|
|
1960
1966
|
##
|
|
1961
1967
|
## the http port for serving GUI in webpage if not running in script
|
|
@@ -2238,7 +2244,7 @@ class InteractiveClean:
|
|
|
2238
2244
|
iteration_limit = int(msg['value']['iteration']['niter'])
|
|
2239
2245
|
stopdesc, stopcode, majordone, majorleft, iterleft, self._convergence_data = await self._clean['gclean'].__anext__( )
|
|
2240
2246
|
|
|
2241
|
-
clean_cmds = self._clean['gclean'].
|
|
2247
|
+
clean_cmds = self._clean['gclean']._log( )
|
|
2242
2248
|
|
|
2243
2249
|
for key, value in self._convergence_data.items( ):
|
|
2244
2250
|
|
|
@@ -2595,7 +2601,7 @@ class InteractiveClean:
|
|
|
2595
2601
|
body {
|
|
2596
2602
|
counter-reset: section;
|
|
2597
2603
|
}
|
|
2598
|
-
p:not([
|
|
2604
|
+
p:not([no-num]):before {
|
|
2599
2605
|
font-weight: bold;
|
|
2600
2606
|
counter-increment: section;
|
|
2601
2607
|
content: "" counter(section) ": ";
|
|
@@ -2604,7 +2610,7 @@ class InteractiveClean:
|
|
|
2604
2610
|
</head>
|
|
2605
2611
|
<body>
|
|
2606
2612
|
<h1>Interactive Clean History</h1>
|
|
2607
|
-
` + elem.map((x) => x.startsWith('#') ? `<p
|
|
2613
|
+
` + elem.map((x) => x.startsWith('#') ? `<p no-num>${x}</p>` : `<p>${x}</p>`).join('\\n') + '</body>\\n</html>'
|
|
2608
2614
|
}
|
|
2609
2615
|
let b = cb_obj.origin
|
|
2610
2616
|
if ( ! b._window || b._window.closed ) {
|
|
@@ -2617,7 +2623,7 @@ class InteractiveClean:
|
|
|
2617
2623
|
### Setup script that will be called when the user closes the
|
|
2618
2624
|
### browser tab that is running interactive clean
|
|
2619
2625
|
###
|
|
2620
|
-
initial_log = self._clean['gclean'].
|
|
2626
|
+
initial_log = self._clean['gclean']._log( )
|
|
2621
2627
|
|
|
2622
2628
|
self._pipe['control'].init_script=CustomJS( args=dict( ctrl_pipe=self._pipe['control'],
|
|
2623
2629
|
ids=self._clean_ids,
|
|
@@ -2806,7 +2812,7 @@ class InteractiveClean:
|
|
|
2806
2812
|
###
|
|
2807
2813
|
raise RuntimeError(f'''gclean failure "%s" not returned: {imdetails["converge"]}''' % ('major' if imdetails['converge']['major'] is None else 'chan'))
|
|
2808
2814
|
|
|
2809
|
-
self._clean['cmds'].extend(self._clean['gclean'].
|
|
2815
|
+
self._clean['cmds'].extend(self._clean['gclean']._log( ))
|
|
2810
2816
|
|
|
2811
2817
|
self._initial_clean_params['nmajor'] = majorleft
|
|
2812
2818
|
self._initial_clean_params['niter'] = iterleft
|
|
@@ -2914,9 +2920,12 @@ class InteractiveClean:
|
|
|
2914
2920
|
if self.__result_future is None:
|
|
2915
2921
|
raise RuntimeError( 'no interactive clean result is available' )
|
|
2916
2922
|
|
|
2917
|
-
self.
|
|
2923
|
+
if self.__result is None:
|
|
2924
|
+
### restore returns full return dictionary
|
|
2925
|
+
self.__result_from_gui = self.__result_future.result( )
|
|
2926
|
+
self.__result = self._clean['gclean'].restore( )
|
|
2918
2927
|
|
|
2919
|
-
return self.
|
|
2928
|
+
return self.__result
|
|
2920
2929
|
|
|
2921
2930
|
def masks( self ):
|
|
2922
2931
|
'''Retrieves the masks which were used with interactive clean.
|
|
@@ -2949,7 +2958,7 @@ class InteractiveClean:
|
|
|
2949
2958
|
-------
|
|
2950
2959
|
list[str] tclean calls made during the interactive clean session.
|
|
2951
2960
|
'''
|
|
2952
|
-
return self._clean.
|
|
2961
|
+
return self._clean['gclean']._log( True )
|
|
2953
2962
|
|
|
2954
2963
|
def _initialize_javascript( self ):
|
|
2955
2964
|
self._js = { ### initialize state
|
|
@@ -54,7 +54,7 @@ from cubevis.bokeh.sources import ImageDataSource, ImagePipe, DataPipe
|
|
|
54
54
|
from cubevis.bokeh.format import WcsTicks
|
|
55
55
|
from cubevis.bokeh.models import EditSpan
|
|
56
56
|
from ..data import casaimage
|
|
57
|
-
from ..utils import pack_arrays, find_ws_address, set_attributes, resource_manager, polygon_indexes,
|
|
57
|
+
from ..utils import pack_arrays, find_ws_address, set_attributes, resource_manager, polygon_indexes, is_interactive_jupyter
|
|
58
58
|
from ..bokeh.models import EvTextInput
|
|
59
59
|
from ..bokeh.tools import CBResetTool
|
|
60
60
|
from ..bokeh.state import available_palettes, find_palette, default_palette
|
|
@@ -100,7 +100,7 @@ class CubeMask:
|
|
|
100
100
|
self.COUNT = 1
|
|
101
101
|
self.CCOUNT = 1
|
|
102
102
|
|
|
103
|
-
self._is_notebook =
|
|
103
|
+
self._is_notebook = is_interactive_jupyter()
|
|
104
104
|
#self._color = '#00FF00' # anti-green user feedback (issue #40 2024-05-02 13:08:32)
|
|
105
105
|
self._region_style=dict( fill_alpha=0, hover_fill_alpha=0.3,
|
|
106
106
|
fill_color='white', hover_fill_color='white',
|
|
@@ -43,6 +43,7 @@ from ._regions import polygon_indexes
|
|
|
43
43
|
from ._docenum import DocEnum
|
|
44
44
|
from ._copydoc import copydoc
|
|
45
45
|
from ._pkgs import find_pkg, load_pkg
|
|
46
|
+
from ._jupyter import is_interactive_jupyter
|
|
46
47
|
|
|
47
48
|
from astropy import units
|
|
48
49
|
from regions import PixCoord
|
|
@@ -604,17 +605,3 @@ def set_attributes(obj, **kw):
|
|
|
604
605
|
return obj
|
|
605
606
|
|
|
606
607
|
|
|
607
|
-
def is_notebook() -> bool:
|
|
608
|
-
try:
|
|
609
|
-
shell = get_ipython().__class__.__name__
|
|
610
|
-
if shell == 'ZMQInteractiveShell':
|
|
611
|
-
return True # Jupyter notebook or qtconsole
|
|
612
|
-
elif shell == 'TerminalInteractiveShell':
|
|
613
|
-
return False # Terminal running IPython
|
|
614
|
-
else:
|
|
615
|
-
if get_ipython().__class__.__module__ == 'google.colab._shell':
|
|
616
|
-
return True # Google Colab
|
|
617
|
-
else:
|
|
618
|
-
return False # Other type (?)
|
|
619
|
-
except NameError:
|
|
620
|
-
return False
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
#def is_notebook() -> bool:
|
|
3
|
+
# try:
|
|
4
|
+
# shell = get_ipython().__class__.__name__
|
|
5
|
+
# if shell == 'ZMQInteractiveShell':
|
|
6
|
+
# return True # Jupyter notebook or qtconsole
|
|
7
|
+
# elif shell == 'TerminalInteractiveShell':
|
|
8
|
+
# return False # Terminal running IPython
|
|
9
|
+
# else:
|
|
10
|
+
# if get_ipython().__class__.__module__ == 'google.colab._shell':
|
|
11
|
+
# return True # Google Colab
|
|
12
|
+
# else:
|
|
13
|
+
# return False # Other type (?)
|
|
14
|
+
# except NameError:
|
|
15
|
+
# return False
|
|
16
|
+
|
|
17
|
+
def is_interactive_jupyter( ) -> bool:
|
|
18
|
+
"""
|
|
19
|
+
Detect if running in an interactive Jupyter notebook with frontend connection.
|
|
20
|
+
|
|
21
|
+
This function distinguishes between:
|
|
22
|
+
- Interactive Jupyter notebook/lab with frontend (returns True)
|
|
23
|
+
- Standalone Jupyter kernel without frontend (returns False)
|
|
24
|
+
- Regular Python interpreter (returns False)
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
bool: True if running in interactive Jupyter with frontend, False otherwise
|
|
28
|
+
"""
|
|
29
|
+
try:
|
|
30
|
+
from IPython import get_ipython
|
|
31
|
+
ipython = get_ipython()
|
|
32
|
+
|
|
33
|
+
if ipython is None:
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
# Check if we're in a ZMQ-based shell (kernel)
|
|
37
|
+
if ipython.__class__.__name__ != 'ZMQInteractiveShell':
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
# Check for active frontend connection
|
|
41
|
+
if hasattr(ipython, 'kernel') and ipython.kernel is not None:
|
|
42
|
+
kernel = ipython.kernel
|
|
43
|
+
|
|
44
|
+
# Method 1: Check if there are active connections
|
|
45
|
+
if hasattr(kernel, 'shell_socket') and kernel.shell_socket is not None:
|
|
46
|
+
# For newer Jupyter versions, check connection count
|
|
47
|
+
if hasattr(kernel, 'connection_count'):
|
|
48
|
+
return kernel.connection_count > 0
|
|
49
|
+
|
|
50
|
+
# For older versions, check if socket is connected
|
|
51
|
+
try:
|
|
52
|
+
# Try to get socket state - if it fails, likely no frontend
|
|
53
|
+
socket_state = kernel.shell_socket.closed
|
|
54
|
+
return not socket_state
|
|
55
|
+
except AttributeError:
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
# Method 2: Check parent message (indicates interactive execution)
|
|
59
|
+
if hasattr(kernel, 'get_parent') and callable(kernel.get_parent):
|
|
60
|
+
try:
|
|
61
|
+
parent = kernel.get_parent()
|
|
62
|
+
# If there's a parent message, we're likely in interactive mode
|
|
63
|
+
return parent is not None and len(parent) > 0
|
|
64
|
+
except Exception:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
# Method 3: Check for execution context
|
|
68
|
+
if hasattr(kernel, '_parent_ident') and kernel._parent_ident:
|
|
69
|
+
return True
|
|
70
|
+
|
|
71
|
+
# Fallback: Check for common Jupyter notebook environment indicators
|
|
72
|
+
# This catches cases where kernel introspection doesn't work
|
|
73
|
+
import os
|
|
74
|
+
jupyter_indicators = [
|
|
75
|
+
'JPY_PARENT_PID', # JupyterLab/Notebook sets this
|
|
76
|
+
'JUPYTER_RUNTIME_DIR',
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
for indicator in jupyter_indicators:
|
|
80
|
+
if indicator in os.environ:
|
|
81
|
+
# Additional check: see if we can import notebook-specific modules
|
|
82
|
+
try:
|
|
83
|
+
import IPython.display
|
|
84
|
+
# If we can import display and have env indicators, likely interactive
|
|
85
|
+
return True
|
|
86
|
+
except ImportError:
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
return False
|
|
90
|
+
|
|
91
|
+
except ImportError:
|
|
92
|
+
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cubevis-0.5.17 → cubevis-0.5.19}/tests/manual/cubemask-demo/image-slider-spectra-done-stats.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|