cubevis 0.5.29__py3-none-any.whl → 1.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.
- cubevis/__init__.py +13 -24
- cubevis/__js__/bokeh-3.6/cubevisjs.min.js +64 -0
- cubevis/__js__/{cubevisjs.min.js → bokeh-3.7/cubevisjs.min.js} +3 -3
- cubevis/__js__/bokeh-3.8/cubevisjs.min.js +64 -0
- cubevis/__js__/casalib.min.js +1 -1
- cubevis/__version__.py +1 -1
- cubevis/bokeh/__init__.py +16 -0
- cubevis/bokeh/annotations/_ev_poly_annotation.py +2 -1
- cubevis/bokeh/format/_wcs_ticks.py +6 -2
- cubevis/bokeh/models/__init__.py +1 -0
- cubevis/bokeh/models/_showable.py +352 -0
- cubevis/bokeh/models/_tip.py +2 -1
- cubevis/bokeh/models/_tip_button.py +2 -3
- cubevis/bokeh/sources/_data_pipe.py +6 -2
- cubevis/bokeh/sources/_image_data_source.py +6 -2
- cubevis/bokeh/sources/_image_pipe.py +4 -1
- cubevis/bokeh/sources/_spectra_data_source.py +6 -3
- cubevis/bokeh/sources/_updatable_data_source.py +6 -2
- cubevis/bokeh/state/__init__.py +4 -3
- cubevis/bokeh/state/_current.py +34 -0
- cubevis/bokeh/state/_initialize.py +282 -116
- cubevis/bokeh/state/_javascript.py +95 -21
- cubevis/bokeh/tools/_cbreset_tool.py +2 -1
- cubevis/bokeh/tools/_drag_tool.py +2 -1
- cubevis/bokeh/utils/__init__.py +0 -1
- cubevis/exe/_setting.py +1 -0
- cubevis/private/apps/__init__.py +4 -2
- cubevis/private/apps/_interactiveclean.mustache +6 -2
- cubevis/private/apps/_interactiveclean.py +6 -2
- cubevis/private/apps/_interactivecleanjpy.mustache +112 -0
- cubevis/private/apps/_interactivecleanjpy.py +1874 -0
- cubevis/private/casatasks/__init__.py +1 -0
- cubevis/private/casatasks/icleanjpy.py +1831 -0
- cubevis/toolbox/_app_context.py +5 -9
- cubevis/toolbox/_cube.py +6 -2
- cubevis/toolbox/_interactive_clean_ui.mustache +20 -31
- cubevis/toolbox/_interactive_clean_ui.py +20 -31
- cubevis/utils/__init__.py +120 -18
- cubevis/utils/_git.py +36 -0
- cubevis/utils/_jupyter.py +12 -0
- {cubevis-0.5.29.dist-info → cubevis-1.0.3.dist-info}/METADATA +3 -3
- {cubevis-0.5.29.dist-info → cubevis-1.0.3.dist-info}/RECORD +44 -39
- cubevis/__js__/bokeh-3.6.1.min.js +0 -728
- cubevis/__js__/bokeh-tables-3.6.1.min.js +0 -119
- cubevis/__js__/bokeh-widgets-3.6.1.min.js +0 -141
- {cubevis-0.5.29.dist-info → cubevis-1.0.3.dist-info}/WHEEL +0 -0
- {cubevis-0.5.29.dist-info → cubevis-1.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
########################################################################
|
|
2
|
+
#
|
|
3
|
+
#TASK XML> tclean -argfilter=interactive,fullsummary -argfilter:initParams=vis,imagename
|
|
4
|
+
# Copyright (C) 2022,2023,2024,2025
|
|
5
|
+
# Associated Universities, Inc. Washington DC, USA.
|
|
6
|
+
#
|
|
7
|
+
# This script is free software; you can redistribute it and/or modify it
|
|
8
|
+
# under the terms of the GNU Library General Public License as published by
|
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or (at your
|
|
10
|
+
# option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This library is distributed in the hope that it will be useful, but WITHOUT
|
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
|
|
15
|
+
# License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU Library General Public License
|
|
18
|
+
# along with this library; if not, write to the Free Software Foundation,
|
|
19
|
+
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
|
20
|
+
#
|
|
21
|
+
# Correspondence concerning AIPS++ should be adressed as follows:
|
|
22
|
+
# Internet email: casa-feedback@nrao.edu.
|
|
23
|
+
# Postal address: AIPS++ Project Office
|
|
24
|
+
# National Radio Astronomy Observatory
|
|
25
|
+
# 520 Edgemont Road
|
|
26
|
+
# Charlottesville, VA 22903-2475 USA
|
|
27
|
+
#
|
|
28
|
+
########################################################################
|
|
29
|
+
'''implementation of the ``InteractiveClean`` application for interactive control
|
|
30
|
+
of tclean'''
|
|
31
|
+
|
|
32
|
+
from pprint import pprint
|
|
33
|
+
|
|
34
|
+
import sys
|
|
35
|
+
from uuid import uuid4
|
|
36
|
+
from os.path import exists
|
|
37
|
+
from bokeh.plotting import show
|
|
38
|
+
from bokeh.io import output_notebook
|
|
39
|
+
from casatasks.private.imagerhelpers.input_parameters import ImagerParameters
|
|
40
|
+
|
|
41
|
+
from cubevis.bokeh.models import Showable
|
|
42
|
+
from cubevis.utils import find_pkg, load_pkg
|
|
43
|
+
from cubevis.toolbox import InteractiveCleanUI
|
|
44
|
+
from cubevis import exe
|
|
45
|
+
|
|
46
|
+
class InteractiveCleanJPY:
|
|
47
|
+
r'''InteractiveCleanJPY(...) implements interactive clean using Bokeh
|
|
48
|
+
{{docstring}}
|
|
49
|
+
'''
|
|
50
|
+
|
|
51
|
+
def __init__( self, vis, imagename{{# initParams}}, {{name}}={{default}}{{/ initParams}}, iclean_backend="PROD" ):
|
|
52
|
+
###
|
|
53
|
+
### iclean_backend can be used to select alternate backends for interactive clean. This could be used
|
|
54
|
+
### to enable a backend with extended features or it could be used to select a stub backend designed
|
|
55
|
+
### for testing
|
|
56
|
+
###
|
|
57
|
+
mod_specs = None
|
|
58
|
+
self._gclean_module = None
|
|
59
|
+
if iclean_backend == 'PROD':
|
|
60
|
+
mod_specs = find_pkg( "casatasks.private.imagerhelpers._gclean" )
|
|
61
|
+
else:
|
|
62
|
+
mod_specs = find_pkg( f"_gclean_{iclean_backend}" )
|
|
63
|
+
|
|
64
|
+
if mod_specs:
|
|
65
|
+
self._gclean_module = load_pkg(mod_specs[0])
|
|
66
|
+
else:
|
|
67
|
+
raise ImportError(f"Could not locate {iclean_backend} kind of iclean backend")
|
|
68
|
+
|
|
69
|
+
self._args = {{forwDict}}
|
|
70
|
+
self._gclean = self._gclean_module.gclean( **self._args )
|
|
71
|
+
self._gclean_paths = self._gclean.image_products( )
|
|
72
|
+
#self._residual_path = self._residual_path(self._clean['gclean'],imid)
|
|
73
|
+
#self._mask_path = self._mask_path(self._clean['gclean'],imid)
|
|
74
|
+
|
|
75
|
+
self._future = None
|
|
76
|
+
self._ui = InteractiveCleanUI(self._gclean, self._args)
|
|
77
|
+
|
|
78
|
+
def get_future(self):
|
|
79
|
+
if self._future is None:
|
|
80
|
+
raise RuntimeError( "interactive clean app has not been launched yet" )
|
|
81
|
+
return self._future
|
|
82
|
+
|
|
83
|
+
def __call__( self ):
|
|
84
|
+
'''Display GUI and process events until the user stops the application.
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
Create ``iclean`` object and display::
|
|
88
|
+
|
|
89
|
+
print( "Result: %s" %
|
|
90
|
+
iclean( vis='refim_point_withline.ms', imagename='test', imsize=512,
|
|
91
|
+
cell='12.0arcsec', specmode='cube',
|
|
92
|
+
interpolation='nearest', ... )( ) )
|
|
93
|
+
'''
|
|
94
|
+
###
|
|
95
|
+
### Output notebook is implied.
|
|
96
|
+
###
|
|
97
|
+
from bokeh.io.state import curstate
|
|
98
|
+
state = curstate()
|
|
99
|
+
if not state.notebook:
|
|
100
|
+
from bokeh.io import output_notebook
|
|
101
|
+
output_notebook( )
|
|
102
|
+
|
|
103
|
+
self._id = uuid4( )
|
|
104
|
+
context = exe.Context( exe.Mode.THREAD )
|
|
105
|
+
bokeh_ui, exec_task = self._ui( context, self._id )
|
|
106
|
+
|
|
107
|
+
def startup( ):
|
|
108
|
+
self._future = context.execute( exec_task, self._id )
|
|
109
|
+
|
|
110
|
+
### name is used in summary output of the Showable
|
|
111
|
+
showed = Showable(bokeh_ui, startup, self.get_future, name="iclean-jpy")
|
|
112
|
+
return showed
|