lavavu 1.8.45__cp38-cp38-win_amd64.whl → 1.8.62__cp38-cp38-win_amd64.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.
lavavu/LavaVuPython.py CHANGED
@@ -1,13 +1,10 @@
1
- # This file was automatically generated by SWIG (http://www.swig.org).
2
- # Version 4.0.2
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.1.0
3
3
  #
4
- # Do not make changes to this file unless you know what you are doing--modify
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
5
  # the SWIG interface file instead.
6
6
 
7
7
  from sys import version_info as _swig_python_version_info
8
- if _swig_python_version_info < (2, 7, 0):
9
- raise RuntimeError("Python 2.7 or later required")
10
-
11
8
  # Import the low-level C/C++ module
12
9
  if __package__ or "." in __name__:
13
10
  from . import _LavaVuPython
@@ -32,10 +29,10 @@ def _swig_repr(self):
32
29
 
33
30
  def _swig_setattr_nondynamic_instance_variable(set):
34
31
  def set_instance_attr(self, name, value):
35
- if name == "thisown":
36
- self.this.own(value)
37
- elif name == "this":
32
+ if name == "this":
38
33
  set(self, name, value)
34
+ elif name == "thisown":
35
+ self.this.own(value)
39
36
  elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
40
37
  set(self, name, value)
41
38
  else:
@@ -92,7 +89,6 @@ class SwigPyIterator(object):
92
89
 
93
90
  # Register SwigPyIterator in _LavaVuPython:
94
91
  _LavaVuPython.SwigPyIterator_swigregister(SwigPyIterator)
95
-
96
92
  SHARED_PTR_DISOWN = _LavaVuPython.SHARED_PTR_DISOWN
97
93
  class Line(object):
98
94
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
@@ -137,7 +133,6 @@ class Line(object):
137
133
 
138
134
  # Register Line in _LavaVuPython:
139
135
  _LavaVuPython.Line_swigregister(Line)
140
-
141
136
  class Array(object):
142
137
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
143
138
  __repr__ = _swig_repr
@@ -181,7 +176,6 @@ class Array(object):
181
176
 
182
177
  # Register Array in _LavaVuPython:
183
178
  _LavaVuPython.Array_swigregister(Array)
184
-
185
179
  class List(object):
186
180
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
187
181
  __repr__ = _swig_repr
@@ -225,7 +219,6 @@ class List(object):
225
219
 
226
220
  # Register List in _LavaVuPython:
227
221
  _LavaVuPython.List_swigregister(List)
228
-
229
222
  class GeomList(object):
230
223
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
231
224
  __repr__ = _swig_repr
@@ -269,7 +262,6 @@ class GeomList(object):
269
262
 
270
263
  # Register GeomList in _LavaVuPython:
271
264
  _LavaVuPython.GeomList_swigregister(GeomList)
272
-
273
265
  class ByteArray(object):
274
266
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
275
267
  __repr__ = _swig_repr
@@ -313,7 +305,6 @@ class ByteArray(object):
313
305
 
314
306
  # Register ByteArray in _LavaVuPython:
315
307
  _LavaVuPython.ByteArray_swigregister(ByteArray)
316
-
317
308
  lucMinType = _LavaVuPython.lucMinType
318
309
  lucLabelType = _LavaVuPython.lucLabelType
319
310
  lucPointType = _LavaVuPython.lucPointType
@@ -367,7 +358,6 @@ class Colour(object):
367
358
 
368
359
  # Register Colour in _LavaVuPython:
369
360
  _LavaVuPython.Colour_swigregister(Colour)
370
-
371
361
  class OpenGLViewer(object):
372
362
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
373
363
  __repr__ = _swig_repr
@@ -421,7 +411,6 @@ class DrawingObject(object):
421
411
 
422
412
  # Register DrawingObject in _LavaVuPython:
423
413
  _LavaVuPython.DrawingObject_swigregister(DrawingObject)
424
-
425
414
  class Model(object):
426
415
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
427
416
  __repr__ = _swig_repr
@@ -429,13 +418,12 @@ class Model(object):
429
418
  figures = property(_LavaVuPython.Model_figures_get, _LavaVuPython.Model_figures_set)
430
419
  figure = property(_LavaVuPython.Model_figure_get, _LavaVuPython.Model_figure_set)
431
420
 
432
- def __init__(self, session: "Session &"):
421
+ def __init__(self, session):
433
422
  _LavaVuPython.Model_swiginit(self, _LavaVuPython.new_Model(session))
434
423
  __swig_destroy__ = _LavaVuPython.delete_Model
435
424
 
436
425
  # Register Model in _LavaVuPython:
437
426
  _LavaVuPython.Model_swigregister(Model)
438
-
439
427
  class ColourMap(object):
440
428
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
441
429
  __repr__ = _swig_repr
@@ -451,9 +439,6 @@ class ColourMap(object):
451
439
 
452
440
  # Register ColourMap in _LavaVuPython:
453
441
  _LavaVuPython.ColourMap_swigregister(ColourMap)
454
- ColourMap_getDefaultMapNames = _LavaVuPython.ColourMap_getDefaultMapNames
455
- ColourMap_getDefaultMap = _LavaVuPython.ColourMap_getDefaultMap
456
-
457
442
  class GeomData(object):
458
443
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
459
444
  __repr__ = _swig_repr
@@ -463,13 +448,12 @@ class GeomData(object):
463
448
  step = property(_LavaVuPython.GeomData_step_get, _LavaVuPython.GeomData_step_set)
464
449
  type = property(_LavaVuPython.GeomData_type_get, _LavaVuPython.GeomData_type_set)
465
450
 
466
- def __init__(self, draw: "DrawingObject", type: "lucGeometryType"):
451
+ def __init__(self, draw, type):
467
452
  _LavaVuPython.GeomData_swiginit(self, _LavaVuPython.new_GeomData(draw, type))
468
453
  __swig_destroy__ = _LavaVuPython.delete_GeomData
469
454
 
470
455
  # Register GeomData in _LavaVuPython:
471
456
  _LavaVuPython.GeomData_swigregister(GeomData)
472
-
473
457
  class LavaVu(object):
474
458
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
475
459
  __repr__ = _swig_repr
@@ -480,8 +464,8 @@ class LavaVu(object):
480
464
  binpath = property(_LavaVuPython.LavaVu_binpath_get, _LavaVuPython.LavaVu_binpath_set)
481
465
  unprocessed = property(_LavaVuPython.LavaVu_unprocessed_get, _LavaVuPython.LavaVu_unprocessed_set)
482
466
 
483
- def __init__(self, binpath: "std::string", havecontext: "bool"=False, omegalib: "bool"=False):
484
- _LavaVuPython.LavaVu_swiginit(self, _LavaVuPython.new_LavaVu(binpath, havecontext, omegalib))
467
+ def __init__(self, binpath, havecontext=False):
468
+ _LavaVuPython.LavaVu_swiginit(self, _LavaVuPython.new_LavaVu(binpath, havecontext))
485
469
  __swig_destroy__ = _LavaVuPython.delete_LavaVu
486
470
  destroy = _swig_new_instance_method(_LavaVuPython.LavaVu_destroy)
487
471
  resize = _swig_new_instance_method(_LavaVuPython.LavaVu_resize)
@@ -508,6 +492,7 @@ class LavaVu(object):
508
492
  getTimeSteps = _swig_new_instance_method(_LavaVuPython.LavaVu_getTimeSteps)
509
493
  addTimeStep = _swig_new_instance_method(_LavaVuPython.LavaVu_addTimeStep)
510
494
  resetViews = _swig_new_instance_method(_LavaVuPython.LavaVu_resetViews)
495
+ addViewport = _swig_new_instance_method(_LavaVuPython.LavaVu_addViewport)
511
496
  setObject = _swig_new_instance_method(_LavaVuPython.LavaVu_setObject)
512
497
  createObject = _swig_new_instance_method(_LavaVuPython.LavaVu_createObject)
513
498
  getObject = _swig_new_instance_method(_LavaVuPython.LavaVu_getObject)
@@ -555,14 +540,13 @@ class LavaVu(object):
555
540
 
556
541
  # Register LavaVu in _LavaVuPython:
557
542
  _LavaVuPython.LavaVu_swigregister(LavaVu)
558
-
559
543
  rawImageWrite = _LavaVuPython.rawImageWrite
560
544
  class VideoEncoder(object):
561
545
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
562
546
  __repr__ = _swig_repr
563
547
  filename = property(_LavaVuPython.VideoEncoder_filename_get, _LavaVuPython.VideoEncoder_filename_set)
564
548
 
565
- def __init__(self, fn: "std::string const &", fps: "int", quality: "int"=3):
549
+ def __init__(self, fn, fps, quality=3):
566
550
  _LavaVuPython.VideoEncoder_swiginit(self, _LavaVuPython.new_VideoEncoder(fn, fps, quality))
567
551
  __swig_destroy__ = _LavaVuPython.delete_VideoEncoder
568
552
  open = _swig_new_instance_method(_LavaVuPython.VideoEncoder_open)
@@ -574,5 +558,3 @@ class VideoEncoder(object):
574
558
  # Register VideoEncoder in _LavaVuPython:
575
559
  _LavaVuPython.VideoEncoder_swigregister(VideoEncoder)
576
560
 
577
-
578
-
Binary file
lavavu/amalgamate.py CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env python
2
2
 
3
+ #sudo apt install emscripten
4
+ #make clean
5
+ #make emscripten
6
+
3
7
  #Creates amalgamated js and css for emscripten web viewer
4
8
  filenames = ["dat.gui.min.js", "OK-min.js", "baseviewer.js", "menu.js", "emscripten.js", "LavaVu.js"]
5
9
  with open("html/LavaVu-amalgamated.js", "w") as text_file:
lavavu/convert.py CHANGED
@@ -58,7 +58,7 @@ def default_sample_grid(vrange, res=8):
58
58
  print("Sample grid RES:",RES)
59
59
  return RES
60
60
 
61
- def points_to_volume(verts, res=8, kdtree=False, normed=False, clamp=None, boundingbox=None):
61
+ def points_to_volume(verts, weights=None, res=8, kdtree=False, normed=True, clamp=None, boundingbox=None):
62
62
  """
63
63
  Convert object vertices to a volume by interpolating points to a grid
64
64
 
@@ -68,7 +68,7 @@ def points_to_volume(verts, res=8, kdtree=False, normed=False, clamp=None, bound
68
68
 
69
69
  Default is to use numpy.histogramdd method, pass kdtree=True to use scipy.spatial.KDTree
70
70
 
71
- TODO: support colour data too, converted density field becomes alpha channel
71
+ TODO: support colour data too, converted density field becomes alpha channel (actually, use weights)
72
72
 
73
73
  Returns
74
74
  -------
@@ -80,11 +80,11 @@ def points_to_volume(verts, res=8, kdtree=False, normed=False, clamp=None, bound
80
80
 
81
81
  """
82
82
  if kdtree:
83
- return points_to_volume_tree(verts, res)
83
+ return points_to_volume_tree(verts, weights, res)
84
84
  else:
85
- return points_to_volume_histogram(verts, res, normed, clamp, boundingbox)
85
+ return points_to_volume_histogram(verts, weights, res, normed, clamp, boundingbox)
86
86
 
87
- def points_to_volume_histogram(verts, res=8, normed=False, clamp=None, boundingbox=None):
87
+ def points_to_volume_histogram(verts, weights, res=8, normed=True, clamp=None, boundingbox=None):
88
88
  """
89
89
  Using numpy.histogramdd to create 3d histogram volume grid
90
90
  (Easily the fastest, but less control over output)
@@ -102,12 +102,18 @@ def points_to_volume_histogram(verts, res=8, normed=False, clamp=None, boundingb
102
102
  vrange = numpy.array(boundingbox[1]) - numpy.array(boundingbox[0])
103
103
  RES = default_sample_grid(vrange, res)
104
104
 
105
+ if weights is not None:
106
+ weights = weights.ravel()
107
+ #Normalise (should be done by histogramdd anyway if normed=True)
108
+ weights = (weights - weights.min()) / (weights.max() - weights.min())
109
+ #print(verts.shape, weights.shape, weights.min(), weights.max())
110
+
105
111
  #H, edges = numpy.histogramdd(verts, bins=RES)
106
112
  if boundingbox is None:
107
- H, edges = numpy.histogramdd(verts, bins=RES, normed=normed) #density=True for newer numpy
113
+ H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, normed=normed) #density=True for newer numpy
108
114
  else:
109
115
  rg = ((vmin[0], vmax[0]), (vmin[1], vmax[1]), (vmin[2], vmax[2])) #provide bounding box as range
110
- H, edges = numpy.histogramdd(verts, bins=RES, range=rg, normed=normed) #density=True for newer numpy
116
+ H, edges = numpy.histogramdd(verts, weights=weights, bins=RES, range=rg, normed=normed) #density=True for newer numpy
111
117
 
112
118
  #Reverse ordering X,Y,Z to Z,Y,X for volume data
113
119
  values = H.transpose()
@@ -196,7 +202,7 @@ def points_to_volume_tree(verts, res=8):
196
202
  return (values, lmin, lmax)
197
203
 
198
204
 
199
- def points_to_volume_3D(vol, objects, res=8, kdtree=False, blur=0, pad=None, normed=False, clamp=None):
205
+ def points_to_volume_3D(vol, objects, res=8, kdtree=False, blur=0, pad=None, normed=True, clamp=None, weights=None):
200
206
  """
201
207
  Interpolate points to grid and load into passed volume object
202
208
 
@@ -205,16 +211,19 @@ def points_to_volume_3D(vol, objects, res=8, kdtree=False, blur=0, pad=None, nor
205
211
  points_to_volume()
206
212
  """
207
213
  lv = vol.parent #Get the viewer from passed object
208
- lv.hide(objects) #Hide the converted objects
214
+ #lv.hide(objects) #Hide the converted objects
209
215
 
210
216
  #Get vertices from lavavu objects
211
- pverts, bb_all = lv.get_all_vertices(objects)
217
+ if weights:
218
+ pverts, bb_all, weights = lv.get_all_vertices(objects, weights)
219
+ else:
220
+ pverts, bb_all = lv.get_all_vertices(objects)
212
221
 
213
222
  #blur = False
214
223
  #Use bounding box of full model?
215
224
  #vmin, vmax, vrange = min_max_range([lv["min"], lv["max"]])
216
225
  #bb_all == (vmin, vmax)
217
- vdata, vmin, vmax = points_to_volume(pverts, res, kdtree, normed, clamp, bb_all)
226
+ vdata, vmin, vmax = points_to_volume(pverts, weights, res, kdtree, normed, clamp, bb_all)
218
227
 
219
228
  if blur > 0:
220
229
  if pad == None:
@@ -234,7 +243,7 @@ def points_to_volume_3D(vol, objects, res=8, kdtree=False, blur=0, pad=None, nor
234
243
  vol.values(values)
235
244
  vol.vertices((vmin, vmax))
236
245
 
237
- def points_to_volume_4D(vol, objects, res=8, kdtree=False, blur=False, normed=False, clamp=None):
246
+ def points_to_volume_4D(vol, objects, res=8, kdtree=False, blur=0, pad=None, normed=True, clamp=None, weights=None):
238
247
  """
239
248
  Interpolate points to grid at each timestep
240
249
 
@@ -247,8 +256,11 @@ def points_to_volume_4D(vol, objects, res=8, kdtree=False, blur=False, normed=Fa
247
256
  for step in lv.steps:
248
257
  print("TIMESTEP:",step)
249
258
  lv.timestep(step)
259
+ #TODO: timestep data not changing!!!
260
+ print(lv.step)
261
+ lv.display((200,150))
250
262
 
251
- points_to_volume_3D(vol, objects, res, kdtree, blur, normed, clamp)
263
+ points_to_volume_3D(vol, objects, res, kdtree, blur, pad, normed, clamp, weights)
252
264
 
253
265
  def colour2rgb(c):
254
266
  return [c & 255, (c >> 8) & 255, (c >> 16) & 255]
@@ -804,7 +816,7 @@ def export_any(filepath, source, name=None):
804
816
  f.write(gltf[fn])
805
817
  """
806
818
 
807
- def read_any(filepath, lv):
819
+ def read_any(filepath, lv, scaling=None):
808
820
  """
809
821
  Load using trimesh, supports GLTF etc
810
822
 
@@ -823,10 +835,21 @@ def read_any(filepath, lv):
823
835
  idx = int(idx)
824
836
 
825
837
  if idx == 0:
826
- tris = lv.triangles(name)
838
+ #Texturing for multiple objects is broken when loaded with triangles() renderer
839
+ #tris = lv.triangles(name)
840
+ #Use surface() instead and textures work as expected
841
+ tris = lv.surface(name)
827
842
  else:
828
843
  tris.append()
829
844
 
845
+ if scaling:
846
+ import numpy as np
847
+ matrix = np.eye(4)
848
+ matrix[0, 0] = scaling
849
+ matrix[1, 1] = scaling
850
+ matrix[2, 2] = scaling
851
+ geometry.apply_transform(matrix)
852
+
830
853
  tris.vertices(geometry.vertices)
831
854
  tris.normals(geometry.vertex_normals)
832
855
  tris.indices(geometry.faces)
@@ -841,13 +864,25 @@ def read_any(filepath, lv):
841
864
  tris.colours(geometry.visual.vertex_colors)
842
865
  #Load single colour material
843
866
  elif hasattr(geometry.visual, "material"):
844
- #print("HAVE MATERIAL")
845
- #print(geometry.visual.material)
846
- #print(geometry.visual.material.baseColorFactor)
847
- if idx == 0:
848
- #Can set as prop, but only works for single el
849
- tris["colour"] = geometry.visual.material.baseColorFactor
850
- else:
851
- tris.colours(geometry.visual.material.baseColorFactor)
867
+ if hasattr(geometry.visual.material, "baseColorTexture"):
868
+ #print("HAVE TEXTURE")
869
+ #print(geometry.visual.material)
870
+ #if hasattr(geometry.visual, "image"):
871
+ #print(geometry.visual.image)
872
+ #print(dir(geometry.visual.material))
873
+ #print(hasattr(geometry.visual, "material"))
874
+ #print(geometry.visual.material.baseColorTexture)
875
+ tris.texture(geometry.visual.material.baseColorTexture)
876
+ elif hasattr(geometry.visual.material, "baseColorFactor"):
877
+ #print("HAVE MATERIAL")
878
+ #print(geometry.visual.material)
879
+ #print(geometry.visual.material.baseColorFactor)
880
+ if idx == 0:
881
+ #Can set as prop, but only works for single el
882
+ tris["colour"] = geometry.visual.material.baseColorFactor
883
+ else:
884
+ tris.colours(geometry.visual.material.baseColorFactor)
885
+
886
+ idx += 1 #Inc index?
852
887
 
853
888
  return tris
lavavu/dict.json CHANGED
@@ -1445,6 +1445,22 @@
1445
1445
  true
1446
1446
  ]
1447
1447
  },
1448
+ "rotation": {
1449
+ "default": [
1450
+ 0.0,
1451
+ 0.0,
1452
+ 0.0,
1453
+ 1.0
1454
+ ],
1455
+ "target": "object,shape",
1456
+ "type": "quaternion",
1457
+ "desc": "Shape rotation about Y axis, applies to all shape objects, [x,y,z,y] or [X,Y,Z]",
1458
+ "strict": true,
1459
+ "redraw": 0,
1460
+ "control": [
1461
+ true
1462
+ ]
1463
+ },
1448
1464
  "colourbar": {
1449
1465
  "default": false,
1450
1466
  "target": "colourbar",
@@ -1680,7 +1696,7 @@
1680
1696
  ],
1681
1697
  "target": "view",
1682
1698
  "type": "quaternion",
1683
- "desc": "Camera rotation quaternion [x,y,z,w]",
1699
+ "desc": "Camera rotation quaternion [x,y,z,w], if applied to an object rotates the object, can be quaternion or Euler angles [x,y,z] in this case",
1684
1700
  "strict": true,
1685
1701
  "redraw": 0,
1686
1702
  "control": [
@@ -1839,6 +1855,22 @@
1839
1855
  true
1840
1856
  ]
1841
1857
  },
1858
+ "port": {
1859
+ "default": [
1860
+ 0,
1861
+ 0,
1862
+ 1.0,
1863
+ 1.0
1864
+ ],
1865
+ "target": "view",
1866
+ "type": "real[4]",
1867
+ "desc": "Viewport position and dimensions array [x,y,width,height] in normalised coords [0,1]",
1868
+ "strict": true,
1869
+ "redraw": 0,
1870
+ "control": [
1871
+ false
1872
+ ]
1873
+ },
1842
1874
  "min": {
1843
1875
  "default": [
1844
1876
  0,
@@ -1871,7 +1903,7 @@
1871
1903
  },
1872
1904
  "title": {
1873
1905
  "default": "",
1874
- "target": "global",
1906
+ "target": "view",
1875
1907
  "type": "string",
1876
1908
  "desc": "Title to display at top centre of view",
1877
1909
  "strict": true,
lavavu/html/webview.html CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  <input id="fileinput" type="file" style="visibility:hidden" onchange="useFileInput(this)" />
29
29
 
30
- <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.8.45/LavaVu-amalgamated.min.js"></script>
30
+ <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.8.62/LavaVu-amalgamated.min.js"></script>
31
31
  <!--script src="dat.gui.min.js"></script>
32
32
  <script src="OK-min.js"></script>
33
33
 
lavavu/lavavu.py CHANGED
@@ -335,30 +335,51 @@ def matplotlib_colourmap(name, samples=16):
335
335
  list
336
336
  List of colours ready to be loaded by colourmap()
337
337
  """
338
+ if not isinstance(name, str):
339
+ #Assume passed a Matplotlib colourmap object directly
340
+ return matplotlib_cmap(name, samples)
338
341
  try:
339
342
  import matplotlib.pyplot as plt
340
343
  cmap = plt.get_cmap(name)
341
- if hasattr(cmap, 'colors'):
342
- #Reduce length? many MPL maps have 256 samples,
343
- #unnecessary since we are already interpolating
344
- #Can disable this by setting samples=None
345
- data = cmap.colors
346
- if len(data) == 256 and samples is not None:
347
- subsample = int(256/samples)
348
- data = data[0::subsample]
349
- return data
350
- #Get colour samples when no list provided
351
- if samples == None: samples = 16
352
- colours = []
353
- for i in range(samples):
354
- pos = i/float(samples-1)
355
- colours.append(cmap(pos))
356
- return colours
344
+ return matplotlib_cmap(cmap, samples)
357
345
  except (Exception) as e:
358
346
  #Assume single colour value, just return it
359
347
  return name
360
348
  return []
361
349
 
350
+ def matplotlib_cmap(cmap, samples=16):
351
+ """
352
+ Import a colourmap from a matplotlib
353
+
354
+ Parameters
355
+ ----------
356
+ cmap : Matplotlib colormap object
357
+ The matplotlib colourmap to import
358
+ samples : int
359
+ Number of samples to take for LinearSegmentedColormap type
360
+
361
+ Returns
362
+ -------
363
+ list
364
+ List of colours ready to be loaded by colourmap()
365
+ """
366
+ if hasattr(cmap, 'colors'):
367
+ #Reduce length? many MPL maps have 256 samples,
368
+ #unnecessary since we are already interpolating
369
+ #Can disable this by setting samples=None
370
+ data = cmap.colors
371
+ if len(data) == 256 and samples is not None:
372
+ subsample = int(256/samples)
373
+ data = data[0::subsample]
374
+ return data
375
+ #Get colour samples when no list provided
376
+ if samples == None: samples = 16
377
+ colours = []
378
+ for i in range(samples):
379
+ pos = i/float(samples-1)
380
+ colours.append(cmap(pos))
381
+ return colours
382
+
362
383
  #Wrapper class for a set of properties
363
384
  #handles property updating via internal dict
364
385
  class Properties(dict):
@@ -513,7 +534,7 @@ class Object(dict):
513
534
  if key == "colourmap":
514
535
  if isinstance(value, LavaVuPython.ColourMap) or isinstance(value, ColourMap):
515
536
  value = value.name #Use name instead of object when setting colourmap on object
516
- elif not self.parent.app.getColourMap(value):
537
+ elif not self.parent.app.getColourMap(value if value is not None else 0):
517
538
  #Not found by passed id/name/ref, use the value to set map data
518
539
  cmap = self.colourmap(value)
519
540
  value = cmap.name
@@ -1108,7 +1129,7 @@ class Object(dict):
1108
1129
  self.parent.app.clearTexture(self.ref)
1109
1130
  return
1110
1131
  if isinstance(data, str):
1111
- self.parent.app.setTexture(self.ref, data)
1132
+ self.parent.app.setTexture(self.ref, data, flip, filter, bgr)
1112
1133
  return
1113
1134
 
1114
1135
  data = _convert(data)
@@ -2000,14 +2021,10 @@ class _LavaVuWrapper(LavaVuPython.LavaVu):
2000
2021
 
2001
2022
  #OpenGL context creation options
2002
2023
  havecontext = False
2003
- omegalib = False
2004
2024
  self.use_moderngl = False
2005
2025
  self.use_moderngl_window = False
2006
2026
  if "provided" in context:
2007
2027
  havecontext = True
2008
- elif "omegalib" in context:
2009
- havecontext = True
2010
- omegalib = True
2011
2028
  elif "moderngl" in context:
2012
2029
  if moderngl is not None:
2013
2030
  havecontext = True
@@ -2022,7 +2039,7 @@ class _LavaVuWrapper(LavaVuPython.LavaVu):
2022
2039
  self.wnd = None
2023
2040
  self.ctx = None
2024
2041
 
2025
- super(_LavaVuWrapper, self).__init__(binpath, havecontext, omegalib)
2042
+ super(_LavaVuWrapper, self).__init__(binpath, havecontext)
2026
2043
 
2027
2044
  self._thread = threaded
2028
2045
  self._q = []
@@ -2661,7 +2678,7 @@ class Viewer(dict):
2661
2678
  OpenGL context type, *"default"* will create a context and window based on available configurations.
2662
2679
  *"provided"* specifies a user provided context, set this if you have already created and activated the context.
2663
2680
  *"moderngl"* creates a context in python using the moderngl module (experimental).
2664
- *"moderngl."* creates a context and a window in python using the moderngl module (experimental) specify class after separator, eg: moderngl.headless, moderngl.pyglet, moderngl.pyqt5. *"omegalib"* is for use in multi-display VR mode.
2681
+ *"moderngl."* creates a context and a window in python using the moderngl module (experimental) specify class after separator, eg: moderngl.headless, moderngl.pyglet, moderngl.pyqt5.
2665
2682
  port : int
2666
2683
  Web server port, open server on specific port for control/interaction
2667
2684
  Viewer will be run in a separate thread, all rendering will be done in this thread
@@ -3270,6 +3287,28 @@ class Viewer(dict):
3270
3287
  #Return wrapper obj
3271
3288
  return obj
3272
3289
 
3290
+ def viewport(self, x=0.0, y=0.0, width=1.0, height=1.0, replace=False, **kwargs):
3291
+ """
3292
+ Add a viewport object
3293
+
3294
+ Parameters
3295
+ ----------
3296
+ x : float
3297
+ x offset as fraction of window size [0,1]
3298
+ y : float
3299
+ y offset as fraction of window size [0,1]
3300
+ width : float
3301
+ width as fraction of window size [0,1]
3302
+ height : float
3303
+ height as fraction of window size [0,1]
3304
+ replace : bool
3305
+ Set to True to replace the active viewport instead of adding a new viewport
3306
+
3307
+ Subsequent kwargs are passed as properties dict
3308
+ """
3309
+ #Adds a new viewport, kwargs passed to properties dict
3310
+ self.app.addViewport(x, y, width, height, replace, _convert_args(kwargs))
3311
+
3273
3312
  def add(self, name=None, **kwargs):
3274
3313
  """
3275
3314
  Add a visualisation object
@@ -4883,7 +4922,11 @@ class DrawData(object):
4883
4922
  #Attempt to return an array with the correct shape
4884
4923
  dims = [0.,0.,0.]
4885
4924
  if "dims" in self._obj.dict:
4886
- dims = self._obj.dict["dims"][::-1]
4925
+ dims = self._obj.dict["dims"]
4926
+ if isinstance(dims, list) or isinstance(dims, tuple):
4927
+ dims = dims[::-1] #Reversed
4928
+ else:
4929
+ dims = [dims] #Scalar to list
4887
4930
  if self.data.width > 1:
4888
4931
  #print("OBJECT W,H,D: ",self.data.width, self.data.height, self.data.depth)
4889
4932
  #dims = [self.data.depth, self.data.height, self.data.width]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lavavu
3
- Version: 1.8.45
3
+ Version: 1.8.62
4
4
  Summary: Python interface to LavaVu OpenGL 3D scientific visualisation utilities
5
5
  Home-page: https://github.com/lavavu/LavaVu
6
6
  Author: Owen Kaluza
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.8
26
26
  Classifier: Framework :: Jupyter
27
27
  Classifier: Framework :: IPython
28
28
  License-File: LICENSE.md
29
- Requires-Dist: numpy (>=1.11)
29
+ Requires-Dist: numpy >=1.11
30
30
  Requires-Dist: aiohttp
31
31
  Requires-Dist: jupyter-server-proxy
32
32
 
@@ -1,8 +1,8 @@
1
- lavavu/LavaVuPython.py,sha256=qIY8brmfEEtCyO83E0SEagZgFFtDnp0NB2QK_xHzq8A,34022
2
- lavavu/_LavaVuPython.cp38-win_amd64.pyd,sha256=qCZkAZtvg0WY29o6mKodA4BpgRw6yOWTX0sB0E75flY,3114496
1
+ lavavu/LavaVuPython.py,sha256=I27VeH0GoGE2uIZ92UgoysGnQe5peBW_e-YEsA4Y1Q0,33691
2
+ lavavu/_LavaVuPython.cp38-win_amd64.pyd,sha256=o2OOYnaXa9OkekJ0h1A0D4Lvrl7uSF1JkG8J2HHsa8o,3101696
3
3
  lavavu/__init__.py,sha256=ZOkoA9N5M5swxkeLDlrc9NGFQ1PggLWW4GheseTtq8I,206
4
4
  lavavu/__main__.py,sha256=9L7Rfhb_U9Oqkop7MVJ4fi9XUnx4t2vpajOMKNNVunc,247
5
- lavavu/amalgamate.py,sha256=zRij7CoRMAP5xne36GcwhyCdHo3Msvtsm8BmwbBUawg,538
5
+ lavavu/amalgamate.py,sha256=goS8OLot2q400zRMMRoksYkaNyBgRJlrpU1UxSKwLmA,601
6
6
  lavavu/aserver.py,sha256=2b6Sj-dxoL2IfvNLolqhC-yhMv4m4Xw7I6jYO-DDTbE,12286
7
7
  lavavu/avcodec-58.dll,sha256=Yrvy4kZBIyUw-d1yhU32wxwRSNwkQeU7HvL_sBbpisY,50103296
8
8
  lavavu/avdevice-58.dll,sha256=VgLrv5NWSD4u-hlKHkTE5ciLMUNTxlZljLavR9AlTkQ,2760192
@@ -10,11 +10,11 @@ lavavu/avfilter-7.dll,sha256=cKwN6yDGzmf6XB5HXM1QVV4fc_HfhjAd3dBvV5YVdbk,1095731
10
10
  lavavu/avformat-58.dll,sha256=PB5bD4mq62vBBY8tdagrGaYD2AQjaz3Lgc6wpp0UIr0,11094016
11
11
  lavavu/avutil-56.dll,sha256=VsAhkveudbox9BBMuLEjnJ6yzoyJDoy2SzgPnMgMug0,866304
12
12
  lavavu/control.py,sha256=TyisNZc6RuuO1O1IHW4b4BqK4oil9uuxWNfKEp-04v0,67267
13
- lavavu/convert.py,sha256=TowKrDaD50Tf5wypEy0DEV4yviwVRESdb6H48_JDEfg,34641
14
- lavavu/dict.json,sha256=_XB5sbeJQlGL8erS-HeojwLsTGt_7M-jiDIIWg6Bnmk,54502
13
+ lavavu/convert.py,sha256=LBMvZrxJDhJYPbeTJEs7PpBs3zXkeIPtbzHs-Wxr8FI,36402
14
+ lavavu/dict.json,sha256=6WjVWKKKfF5ieZK2AfWldrl4c7BCo8tEgigJR5CpCqQ,55239
15
15
  lavavu/font.bin,sha256=fvi5zkvmq6gh9v3jXedBVuxNJWKmHtbjECzv6eT9wb4,225360
16
16
  lavavu/glfw3.dll,sha256=zI-Qy4RDHQo4mYYgW4QLREz-WZ5l5HCXJzyksyTy0bY,83456
17
- lavavu/lavavu.py,sha256=mLcv9riuBaCpu9lR8v0GZh_Bn634lxoLnUcuwd16dSY,205310
17
+ lavavu/lavavu.py,sha256=Ix2bOQG450uRVjGXGpWwsJRFWZAP112TgXyiLK_1x2E,206683
18
18
  lavavu/liblzma.dll,sha256=_n95XbzYpeaXq6wB884fmpf8nqs2Ot9gyxUL_CS2TCI,154624
19
19
  lavavu/points.py,sha256=bp5XFMUHShjeRW7XUNgq8uxj3wjk4EE-qnWEJjAn-uM,6062
20
20
  lavavu/postproc-55.dll,sha256=DwfCHwxbuZiEzRcfbh5aa-5Ax3xIsWkxEN0achBvJPU,133120
@@ -46,7 +46,7 @@ lavavu/html/server.js,sha256=WXuAnY6aE4h8vYs4U2sl4Xq5RjrkuDi-mIgM-x3Nkj0,7325
46
46
  lavavu/html/stats.min.js,sha256=q9kZjkwmWu8F8HV-4m2EfZRJXQBzyibceJoz-tDgB94,1970
47
47
  lavavu/html/styles.css,sha256=8JE8l7zcc0PV8CfOQpfDyhM226-Sq9eDLXvTCe-wSgw,3041
48
48
  lavavu/html/webview-template.html,sha256=E5w7pd91z0WL3244PQxDKMNZorWzoRT5G7wuBHXJc6Y,1573
49
- lavavu/html/webview.html,sha256=6pfyeJ1oIcW3fW5ASRmvRu1umDqqoYLjAR2XwglU-Vc,1565
49
+ lavavu/html/webview.html,sha256=9k5imVr3B2J4PYgvsYPI6OwUavpV6F-IisB7twqfHCI,1565
50
50
  lavavu/shaders/default.frag,sha256=AlGMo01JdaOsXx6Gq7s1WADi2b-vyX9XMSB91AcJvuA,278
51
51
  lavavu/shaders/default.vert,sha256=SKC2BkE2axNjJL2j5QYjU2bj6mMXs8Wq02XgMTiOeFo,334
52
52
  lavavu/shaders/fontShader.frag,sha256=0GGFFg6S4v0p_1gDTIATDmc19jrCl7xIgH9PpxcXEcE,469
@@ -59,9 +59,9 @@ lavavu/shaders/triShader.frag,sha256=eVGp_ttGMVgKnDYRwByvx_PN80EYiSz61jeuAD8JJvw
59
59
  lavavu/shaders/triShader.vert,sha256=tzgJjqbhKDgVngUJvMVL1ehYvwxAMFLQ-WtKEYU3in0,1175
60
60
  lavavu/shaders/volumeShader.frag,sha256=PLTei6fN_uLxPD35LHbBQVe_S7TanxdBqcW5khslQMI,16583
61
61
  lavavu/shaders/volumeShader.vert,sha256=CroiEfEIe7pP66w14KwmKxfbTuKN6EuXYbZJvt_bfHk,83
62
- lavavu-1.8.45.dist-info/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
63
- lavavu-1.8.45.dist-info/METADATA,sha256=Z69ODTOFSXyodbxgzbCwdcnsqAMWwZ94yPavkT5a1pE,1346
64
- lavavu-1.8.45.dist-info/WHEEL,sha256=F2aDWtWrilNM3-px1vBtJOEd7aRVTetQfFuDYmYbAUQ,100
65
- lavavu-1.8.45.dist-info/entry_points.txt,sha256=LgxRUxcd5pH9w3yYRyTYyGm8xwAlnyvS_CKaisWHDWc,70
66
- lavavu-1.8.45.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
67
- lavavu-1.8.45.dist-info/RECORD,,
62
+ lavavu-1.8.62.dist-info/LICENSE.md,sha256=zHOh_qOPkfR76vdrTRP7J-BqPieAIWVDTl2ZP0SN6lQ,8782
63
+ lavavu-1.8.62.dist-info/METADATA,sha256=K9x1MZydFjc2kAEMMJbU9zZb7MoZBYGeYOmZnDaI1gM,1344
64
+ lavavu-1.8.62.dist-info/WHEEL,sha256=3SeyPJ5-Us2Ct5GSftUVKtLSlm-bNefW4m5qd0GLzww,100
65
+ lavavu-1.8.62.dist-info/entry_points.txt,sha256=LgxRUxcd5pH9w3yYRyTYyGm8xwAlnyvS_CKaisWHDWc,70
66
+ lavavu-1.8.62.dist-info/top_level.txt,sha256=JptS0k1nlBumjLs_0hITr3_XUJhxqvKBXD2jGho3E3A,7
67
+ lavavu-1.8.62.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp38-cp38-win_amd64
5
5