cubevis 0.5.11__py3-none-any.whl → 0.5.13__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.

Potentially problematic release.


This version of cubevis might be problematic. Click here for more details.

cubevis/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.5.11'
1
+ __version__ = '0.5.13'
@@ -208,15 +208,19 @@ class ImagePipe(DataPipe):
208
208
  ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
209
209
  amin = image_plane.min( ) ## array min
210
210
  amax = image_plane.max( ) ## array max
211
- rg = [ amin if len(self.__quant_adjustments['bounds'][0]) == 0 else self.__quant_adjustments['bounds'][0][0],
212
- amax if len(self.__quant_adjustments['bounds'][1]) == 0 else self.__quant_adjustments['bounds'][1][0] ]
213
- umin = min(rg) ## user specified min
214
- umax = max(rg) ## user specified max
211
+
212
+ ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
213
+ ### Extract user bounds (use array bounds as fallback)
214
+ ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
215
+ umin = amin if len(self.__quant_adjustments['bounds'][0]) == 0 else self.__quant_adjustments['bounds'][0][0]
216
+ umax = amax if len(self.__quant_adjustments['bounds'][1]) == 0 else self.__quant_adjustments['bounds'][1][0]
217
+
218
+ ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
219
+ ### Handle cropping (when user bounds are narrower than data)
220
+ ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
215
221
  if umin > amin:
216
- ## elements that are masked to the minumum color for the image
217
222
  exclude_below = image_plane < umin
218
223
  if umax < amax:
219
- ## elements that are masked to the maximum color for the image
220
224
  exclude_above = image_plane > umax
221
225
 
222
226
  ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -240,13 +244,26 @@ class ImagePipe(DataPipe):
240
244
  else:
241
245
  normalize = 0 if umin > 0 else -umin
242
246
  result = np.ma.zeros(image_plane.shape,image_plane.dtype)
243
- result[included] = self.__quant_scaling[selected_scaling]( image_plane[included]+normalize if included is not None else image_plane+normalize,
244
- **self.__quant_adjustments['transfer']['args'] )
245
- if exclude_below is not None:
246
- result[exclude_below] = result[included].min( )
247
- if exclude_above is not None:
248
- result[exclude_above] = result[included].max( )
247
+
248
+ if included is not None:
249
+
250
+ result[included] = self.__quant_scaling[selected_scaling](
251
+ image_plane[included] + normalize,
252
+ **self.__quant_adjustments['transfer']['args']
253
+ )
254
+
255
+ # Set excluded regions to min/max of included values
256
+ if exclude_below is not None:
257
+ result[exclude_below] = result[included].min( )
258
+ if exclude_above is not None:
259
+ result[exclude_above] = result[included].max( )
260
+ else:
261
+ result = self.__quant_scaling[selected_scaling](
262
+ image_plane + normalize,
263
+ **self.__quant_adjustments['transfer']['args']
264
+ )
249
265
  else:
266
+
250
267
  result = image_plane
251
268
 
252
269
  ### --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -1,6 +1,6 @@
1
1
  ########################################################################
2
2
  #
3
- # Copyright (C) 2024
3
+ # Copyright (C) 2025
4
4
  # Associated Universities, Inc. Washington DC, USA.
5
5
  #
6
6
  # This script is free software; you can redistribute it and/or modify it
@@ -25,116 +25,6 @@
25
25
  # Charlottesville, VA 22903-2475 USA
26
26
  #
27
27
  ########################################################################
28
- '''casatasks provides on-the-fly creation of inp/go wrappers for tasks
29
- https://bayesianbrad.github.io/posts/2017_loader-finder-python.html
30
- '''
28
+ '''casatask equivalent bindings'''
31
29
 
32
- from importlib.abc import Loader as _Loader, MetaPathFinder as _MetaPathFinder
33
-
34
- import subprocess
35
- import re
36
- import os
37
- import sys
38
-
39
- class CasaTasks_Loader(_Loader):
40
-
41
- def __init__( self, java, jarpath, args, templ, xml ):
42
- self.__java = java
43
- self.__jarpath = jarpath
44
- self.__args = args
45
- self.__templ = templ
46
- self.__xml = xml
47
-
48
- def create_module(self, spec):
49
- return None
50
-
51
- def exec_module(self, module):
52
- python_source = subprocess.run( [ self.__java, '-jar', self.__jarpath ] + self.__args + [self.__templ, self.__xml], stdout=subprocess.PIPE ).stdout.decode('utf-8')
53
- exec( python_source, module.__dict__ )
54
-
55
-
56
- class CasaTasks_Finder(_MetaPathFinder):
57
-
58
- def __init__( self ):
59
- super(CasaTasks_Finder, self).__init__( )
60
- self.__java = None
61
- self.__source_dir = os.path.dirname(__file__)
62
- self.__jarpath = None
63
- self.__jarfile_name = "xml-casa-assembly-1.86.jar"
64
- self.__task_xml_files = None
65
-
66
- def __which( self, program ):
67
- def is_exe(fpath):
68
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
69
-
70
- fpath, fname = os.path.split(program)
71
- if fpath:
72
- if is_exe(program):
73
- return os.path.realpath(program)
74
- else:
75
- os.environ.get("PATH", "")
76
- for path in os.environ.get("PATH", "").split(os.pathsep):
77
- exe_file = os.path.join(path, program)
78
- if is_exe(exe_file):
79
- return os.path.realpath(exe_file)
80
- return None
81
-
82
- def __find_parameters( self, taskname ):
83
- templ = os.path.join( self.__source_dir, f'''{taskname}.mustache''' )
84
- if os.path.isfile(templ):
85
- ### <TASK>.mustache exists -------------------------------------------------------------------------------------------------------------
86
- with open(templ) as f:
87
- header = [ (m.group(1), m.group(2), m.group(0)) for m in [ re.match( "^\#+\s*TASK XML\s*>\s*(\S+)(.*)", next(f) ) for _ in range(5) ] if m ]
88
- if len(header) == 1:
89
- ### <TASK>.mustache has processing specification line --------------------------------------------------------------------------
90
- task = os.path.splitext(header[0][0])[0]
91
- if task in self.__task_xml_files:
92
- ### <TASK>.mustache has processing specification line and includes valid CASA task name ------------------------------------
93
- return templ, self.__task_xml_files[task], header[0][1].split( )
94
- elif taskname in self.__task_xml_files:
95
- ### <TASK>.mustache has processing specification line and <TASK> is a valid CASA task --------------------------------------
96
- return templ, self.__task_xml_files[taskname], header[0][1].split( )
97
- elif taskname in self.__task_xml_files:
98
- ### <TASK>.mustache does not have a processing specification line but <TASK> is a valid CASA task-------------------------------
99
- return templ, self.__task_xml_files[taskname], [ ]
100
-
101
- if taskname in self.__task_xml_files:
102
- ### <TASK>.mustache does not exist but <TASK> is a valid CASA task ---------------------------------------------------------------------
103
- templ = os.path.join( self.__source_dir, f'''generic.mustache''' )
104
- if os.path.isfile(templ):
105
- ### <TASK> is a valid CASA task and generic.mustache exists ------------------------------------------------------------------------
106
- with open(templ) as f:
107
- header = [ (m.group(1), m.group(2), m.group(0)) for m in [ re.match( "^\#+\s*TASK XML\s*>\s*(\S+)(.*)", next(f) ) for _ in range(5) ] if m ]
108
- if len(header) == 1:
109
- ### <TASK> is a valid CASA task, generic.mustache exists and has a processing specification line ---------------------------
110
- return templ, self.__task_xml_files[taskname], header[0][1].split( )
111
- else:
112
- ### <TASK> is a valid CASA task, generic.mustache exists but does not have a processing specification line -----------------
113
- return templ, self.__task_xml_files[taskname], [ ]
114
-
115
- return None, None, [ ]
116
-
117
- def find_spec(self, fullname, path, target = None):
118
-
119
- if fullname.startswith('cubevis.private.casatasks.'):
120
- if self.__java is None:
121
- self.__java = self.__which( "java" )
122
- if self.__jarpath is None:
123
- p = os.path.join( os.path.dirname(os.path.dirname(__file__)), "__java__", self.__jarfile_name )
124
- if os.path.isfile(p):
125
- self.__jarpath = p
126
- if self.__task_xml_files is None:
127
- try:
128
- from casatasks import xml_interface_defs
129
- self.__task_xml_files = { k:v for (k,v) in xml_interface_defs( ).items( ) if os.path.isfile(v) }
130
- except: pass
131
-
132
- module = fullname.split(sep='.')[-1]
133
- templ, xml, args = self.__find_parameters( fullname.split(sep='.')[-1] )
134
- if templ is not None and xml is not None:
135
- from importlib.machinery import ModuleSpec
136
- return ModuleSpec( fullname, CasaTasks_Loader( self.__java, self.__jarpath, args, templ, xml ) )
137
-
138
- return None
139
-
140
- sys.meta_path.append(CasaTasks_Finder( ))
30
+ from .iclean import iclean
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cubevis
3
- Version: 0.5.11
3
+ Version: 0.5.13
4
4
  Summary: visualization toolkit and apps for casa
5
5
  License: LGPL
6
6
  Author-email: Darrell Schiebel <darrell@schiebel.us>,Pam Harris <pharris@nrao.edu>
@@ -45,7 +45,7 @@ cubevis/bokeh/models/_tip_button.py,sha256=Dw4aO37o0J3n6EoaJ3ui1y8d04qNn3x2dbKiw
45
45
  cubevis/bokeh/sources/__init__.py,sha256=4FsudFuVU4o7VG5OG3K1tiMoxIXcJWNz_K9yzMDE8ls,1581
46
46
  cubevis/bokeh/sources/_data_pipe.py,sha256=PI4vZ_4eywHJfGEanyx-eMJvoeuMrPdMcF_ZbScYSi8,13779
47
47
  cubevis/bokeh/sources/_image_data_source.py,sha256=ezgTWHtHMpbT-jAd1F_xnq3jdcvIGbqNvN9MTbTOnNs,3537
48
- cubevis/bokeh/sources/_image_pipe.py,sha256=4v1-fuE-2LnL18hArkvurQeIy0TsaiX0H0_3iN-n4Xw,27770
48
+ cubevis/bokeh/sources/_image_pipe.py,sha256=4pvoy517N199OMD_q40NkPChsGPSMaR58hw1Gb348NU,28475
49
49
  cubevis/bokeh/sources/_spectra_data_source.py,sha256=Tbq4JczbmWfW9OPTzY2OuCMPOrr9yGQ1xVB63QTHnOw,2200
50
50
  cubevis/bokeh/sources/_updatable_data_source.py,sha256=KlEUTFI26tC7FLu5KF0U36CjjyBmNhSro0-PrLSi7i8,10709
51
51
  cubevis/bokeh/state/__init__.py,sha256=pUzr7PWrFKhGa8G1ogrGqBywrT8nUJ5kh3vKr0z4Zao,1628
@@ -88,7 +88,6 @@ cubevis/plot/ms_plot/_ms_plot_selectors.py,sha256=bus0R6R8BNS6Y2dMxVngf6v54AIZTd
88
88
  cubevis/plot/ms_plot/_raster_plot.py,sha256=OtEDX5cjNZ65Wn1vB8vTxEr1JZejyXgE9nW_liUNAwc,12958
89
89
  cubevis/plot/ms_plot/_raster_plot_inputs.py,sha256=yUFob7t4JMXTwHjzNWZMEMLCvQdJ55SyWj3mZBxHgos,5173
90
90
  cubevis/plot/ms_plot/_xds_plot_axes.py,sha256=EeWvAbiKV33nEWdI8V3M0uwLTnycq4bFYBOyVWkxCu0,4429
91
- cubevis/private/__java__/xml-casa-assembly-1.86.jar,sha256=dBT_OxPtczAfWKRaOrHWwNZbDfEjtKkuQGuFOaKOczA,8041045
92
91
  cubevis/private/_gclean.py,sha256=ExdR6cRxSa6Xne2veGNKhbTtx-tXUIWr2htzEmEZ9Z4,41107
93
92
  cubevis/private/apps/__init__.py,sha256=-9U6o-SClwJolGDnFhlH1au4tz-w4HgRcyT4_OQ_Z7E,2510
94
93
  cubevis/private/apps/_createmask.py,sha256=bKFpME5MYhLh7HxlJZINBTwG25t0_T_d1nYrWYAWYPA,23527
@@ -101,7 +100,7 @@ cubevis/private/apps/_plotants.py,sha256=top6VWVd_sE48IVPH_sIg3_sQeDl5tadi5DL7r5
101
100
  cubevis/private/apps/_plotbandpass.py,sha256=NwOgKSRnpLw9Pt3KIdBpoV78q1OnjCvj6lWFqeyICt8,185
102
101
  cubevis/private/casashell/createmask.py,sha256=C1eSUUsttSGghjZ5aDUVhRxnjir5MlYXVyxzEYLcI3k,14457
103
102
  cubevis/private/casashell/iclean.py,sha256=FUrCMrfXuTjUHFBA0PVEctDXlHsZrMZBePwZ_otDwxI,294787
104
- cubevis/private/casatasks/__init__.py,sha256=yLL13GDxSxIkqjjap_sJO_aGVaBUW9gXMwlAlPli97g,6963
103
+ cubevis/private/casatasks/__init__.py,sha256=Uzt9uNiTl0ORavzuoIDJ8gfYUhdWwAAj1D2VJ3wAvvQ,1333
105
104
  cubevis/private/casatasks/createmask.py,sha256=qtp8IvFCB1BG2pqRbyP8CmTr-RRqLMBSjMIO86mZ7WA,3770
106
105
  cubevis/private/casatasks/createregion.py,sha256=f2KIrkbbdczZk3EHd3x9ZTUaewdjSxlRge-Es8BivNk,3355
107
106
  cubevis/private/casatasks/iclean.py,sha256=YO9RRtWVD3MxizqxTB-7yPD8NkX-mvbsB2yTyRcrvT0,152997
@@ -126,8 +125,8 @@ cubevis/utils/_pkgs.py,sha256=mu2CCzndmJZYP81UkFhxveW_CisWLUvagJVolHOEVgM,2294
126
125
  cubevis/utils/_regions.py,sha256=TdAg4ZUUyhg3nFmX9_KLboqmc0LkyOdEW8M1WDR5Udk,1669
127
126
  cubevis/utils/_static.py,sha256=rN-sqXNqQ5R2M3wmPHU1GPP5OTyyWQlUPRuimCrht-g,2347
128
127
  cubevis/utils/_tiles.py,sha256=A9W1X61VOhBMTOKXVajzOIoiV2FBdO5N2SFB9SUpDOo,7336
129
- cubevis/__version__.py,sha256=IB1CJxlYThFf3KnjTGeCxoPXiCTJ_Y8r_YEqVfavyqQ,22
130
- cubevis-0.5.11.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
131
- cubevis-0.5.11.dist-info/METADATA,sha256=aJ3zH7H6h5nmNT9NndGFo8vlt0nbxq9mbW0oa_Ikkck,2629
132
- cubevis-0.5.11.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
133
- cubevis-0.5.11.dist-info/RECORD,,
128
+ cubevis/__version__.py,sha256=OYo7Ah0wICBCFc4dNdr54AMBYTK_lp1kbfjO8-QZR9E,22
129
+ cubevis-0.5.13.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
130
+ cubevis-0.5.13.dist-info/METADATA,sha256=M40RMt0Lxgq23-vGyqIEYLW_sdbUhzTPkf_N8pHxUpI,2629
131
+ cubevis-0.5.13.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
132
+ cubevis-0.5.13.dist-info/RECORD,,