sdfr 1.4.0__py3-none-win32.whl → 1.4.2__py3-none-win32.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.
sdfr/SDF.py CHANGED
@@ -367,7 +367,7 @@ class BlockList:
367
367
 
368
368
  block = h.contents.blocklist
369
369
  self.Header = get_header(h.contents)
370
- meshes = []
370
+ mesh_id_map = {}
371
371
  mesh_vars = []
372
372
  self._block_ids = {}
373
373
  self._block_names = {}
@@ -417,7 +417,7 @@ class BlockList:
417
417
  if block.datatype_out != 0:
418
418
  newblock = BlockLagrangianMesh(block)
419
419
  newblock_mid = block
420
- meshes.append(newblock)
420
+ mesh_id_map[newblock.id] = newblock
421
421
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_NAMEVALUE:
422
422
  newblock = BlockNameValue(block)
423
423
  elif (
@@ -430,7 +430,7 @@ class BlockList:
430
430
  if block.datatype_out != 0:
431
431
  newblock = BlockPlainMesh(block)
432
432
  newblock_mid = block
433
- meshes.append(newblock)
433
+ mesh_id_map[newblock.id] = newblock
434
434
  elif (
435
435
  blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_DERIVED
436
436
  or blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_VARIABLE
@@ -439,7 +439,7 @@ class BlockList:
439
439
  mesh_vars.append(newblock)
440
440
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_POINT_MESH:
441
441
  newblock = BlockPointMesh(block)
442
- meshes.append(newblock)
442
+ mesh_id_map[newblock.id] = newblock
443
443
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_RUN_INFO:
444
444
  self.Run_info = get_run_info(block)
445
445
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_STATION:
@@ -452,7 +452,8 @@ class BlockList:
452
452
  # print(name,SdfBlockType(blocktype).name)
453
453
  pass
454
454
  if newblock is not None:
455
- self.__dict__[name] = newblock
455
+ if not block.dont_display:
456
+ self.__dict__[name] = newblock
456
457
  self._block_ids.update({block.id.decode(): newblock})
457
458
  self._block_names.update({block.name.decode(): newblock})
458
459
  block = block.next
@@ -467,7 +468,8 @@ class BlockList:
467
468
  newblock = BlockLagrangianMesh(block_mid, mid=True)
468
469
  elif blocktype == SdfBlockType.SDF_BLOCKTYPE_PLAIN_MESH:
469
470
  newblock = BlockPlainMesh(block_mid, mid=True)
470
- self.__dict__[name] = newblock
471
+ if not newblock_mid.dont_display:
472
+ self.__dict__[name] = newblock
471
473
  nm = block_mid.id.decode() + "_mid"
472
474
  self._block_ids.update({nm: newblock})
473
475
  nm = block_mid.name.decode() + "_mid"
@@ -475,10 +477,8 @@ class BlockList:
475
477
 
476
478
  for var in mesh_vars:
477
479
  gid = var.grid_id
478
- for mesh in meshes:
479
- if mesh.id == gid:
480
- var._grid = mesh
481
- break
480
+ if gid in mesh_id_map:
481
+ var._grid = mesh_id_map[gid]
482
482
 
483
483
  def __del__(self):
484
484
  self._clib.sdf_stack_destroy.argtypes = [ct.c_void_p]
sdfr/__init__.py CHANGED
@@ -30,7 +30,10 @@ from .loadlib import (
30
30
 
31
31
  from importlib.metadata import version, PackageNotFoundError
32
32
 
33
- __version__ = version(_module_name)
33
+ try:
34
+ __version__ = version(_module_name)
35
+ except Exception:
36
+ __version__ = "0.0.0"
34
37
 
35
38
  __all__ = [
36
39
  "SDF",
sdfr/_commit_info.py CHANGED
@@ -1,2 +1,2 @@
1
- __commit_date__ = "Tue May 20 13:50:42 2025 +0100"
2
- __commit_id__ = "f5e130988f5c6f06f9fb34a23cefc953857a3908"
1
+ __commit_date__ = "Fri Jun 6 11:53:05 2025 +0100"
2
+ __commit_id__ = "5dcc8bbaddd76aaeb5f5c8d335b32f272fd3e05e"
sdfr/sdf_helper.py CHANGED
@@ -1262,19 +1262,31 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1262
1262
  ----------
1263
1263
  var : sdf.Block
1264
1264
  The SDF variable for the rays to plot
1265
+ rays : list
1266
+ A list of ray numbers to plot
1267
+ ray_start : integer
1268
+ The first ray number to plot
1269
+ ray_stop : integer
1270
+ The last ray number to plot
1265
1271
  skip : integer
1266
1272
  Number of rays to skip before selecting the next one to plot
1267
1273
  """
1268
1274
 
1269
- ray_start = -1
1270
- l = "ray_start"
1271
- if l in kwargs:
1272
- ray_start = kwargs[l]
1275
+ if rays:
1276
+ if isinstance(rays, int):
1277
+ rays = [rays]
1278
+ else:
1279
+ ray_start, ray_stop = None, None
1280
+
1281
+ l = "ray_start"
1282
+ if l in kwargs:
1283
+ ray_start = kwargs[l]
1284
+
1285
+ l = "ray_stop"
1286
+ if l in kwargs:
1287
+ ray_stop = kwargs[l]
1273
1288
 
1274
- ray_stop = 1e9
1275
- l = "ray_stop"
1276
- if l in kwargs:
1277
- ray_stop = kwargs[l]
1289
+ ray_slice = slice(ray_start, ray_stop, skip)
1278
1290
 
1279
1291
  if isinstance(var, sdf.BlockStitchedPath):
1280
1292
  v = var.data[0]
@@ -1303,27 +1315,26 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1303
1315
  v = var.data[0]
1304
1316
  vmin = v.data.min()
1305
1317
  vmax = v.data.max()
1306
- for iray, v in enumerate(var.data):
1307
- if iray < ray_start:
1308
- continue
1309
- if iray > ray_stop:
1310
- break
1311
- if iray % skip == 0:
1312
- vmin = min(vmin, v.data.min())
1313
- vmax = max(vmax, v.data.max())
1318
+ if rays:
1319
+ ray_list = [var.data[i] for i in rays]
1320
+ else:
1321
+ ray_list = var.data[ray_slice]
1322
+ for v in ray_list:
1323
+ vmin = min(vmin, v.data.min())
1324
+ vmax = max(vmax, v.data.max())
1314
1325
  if k0 not in kwargs:
1315
1326
  kwargs[k0] = vmin
1316
1327
  if k1 not in kwargs:
1317
1328
  kwargs[k1] = vmax
1318
1329
 
1319
- for iray, v in enumerate(var.data):
1320
- if iray < ray_start:
1321
- continue
1322
- if iray > ray_stop:
1323
- break
1324
- if iray % skip == 0:
1325
- plot_auto(v, update=False, **kwargs)
1326
- kwargs["hold"] = True
1330
+ if rays:
1331
+ ray_list = [var.data[i] for i in rays]
1332
+ else:
1333
+ ray_list = var.data[ray_slice]
1334
+
1335
+ for v in ray_list:
1336
+ plot_auto(v, update=False, **kwargs)
1337
+ kwargs["hold"] = True
1327
1338
 
1328
1339
  plot_auto(var.data[0], axis_only=True, **kwargs)
1329
1340
  kwargs["hold"] = True
@@ -1341,17 +1352,16 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1341
1352
  if k not in kwargs and not (k0 in kwargs and k1 in kwargs):
1342
1353
  vmin = var.data.min()
1343
1354
  vmax = var.data.max()
1344
- iray = -1
1345
- for k in data.keys():
1355
+
1356
+ if rays:
1357
+ ray_list = [data[i] for i in rays]
1358
+ else:
1359
+ ray_list = data[ray_slice]
1360
+
1361
+ for k in ray_list.keys():
1346
1362
  if k.startswith(start) and k.endswith(end):
1347
- iray += 1
1348
- if iray < ray_start:
1349
- continue
1350
- if iray > ray_stop:
1351
- break
1352
- if iray % skip == 0:
1353
- vmin = min(vmin, data[k].data.min())
1354
- vmax = max(vmax, data[k].data.max())
1363
+ vmin = min(vmin, data[k].data.min())
1364
+ vmax = max(vmax, data[k].data.max())
1355
1365
  if k0 not in kwargs:
1356
1366
  kwargs[k0] = vmin
1357
1367
  if k1 not in kwargs:
@@ -1367,17 +1377,15 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1367
1377
  + ")$"
1368
1378
  )
1369
1379
 
1370
- iray = -1
1371
- for k in data.keys():
1380
+ if rays:
1381
+ ray_list = [data[i] for i in rays]
1382
+ else:
1383
+ ray_list = data[ray_slice]
1384
+
1385
+ for k in ray_list.keys():
1372
1386
  if k.startswith(start) and k.endswith(end):
1373
- iray += 1
1374
- if iray < ray_start:
1375
- continue
1376
- if iray > ray_stop:
1377
- break
1378
- if iray % skip == 0:
1379
- plot_auto(data[k], hold=True, update=False, **kwargs)
1380
- kwargs["hold"] = True
1387
+ plot_auto(data[k], hold=True, update=False, **kwargs)
1388
+ kwargs["hold"] = True
1381
1389
 
1382
1390
  plot_auto(var, axis_only=True, **kwargs)
1383
1391
  kwargs["hold"] = True
sdfr/sdfc_shared.dll CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sdfr
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: Python module for processing SDF files
5
5
  Author-Email: Keith Bennett <k.bennett@warwick.ac.uk>
6
6
  Requires-Dist: numpy
@@ -0,0 +1,11 @@
1
+ sdfr/__init__.py,sha256=OxcJAJ0ADoE54vgqMQqxhoFWyU2ldb3fb-_LFyeZZfQ,1209
2
+ sdfr/_commit_info.py,sha256=jwTvStv8tg4Qb70lnQJKYmLqt8iKXFkCWyjp6Nny_v8,111
3
+ sdfr/loadlib.py,sha256=EMcnZhh68fS72Bjv8QtfDzPbowx1FfaqX4TPhDl-o94,2328
4
+ sdfr/SDF.py,sha256=bt4DOuOTmbc_lvtTBz7khVtbaFStiO6RKN2FAq3DjrI,31144
5
+ sdfr/sdf_helper.py,sha256=cI6F9531e7hbp6oe_hnjPi9pdl6QddsTbohqlNdyg6c,63755
6
+ sdfr/sdfc_shared.dll,sha256=gFEUnchXoZ0R7kaItozUs8g7oqDt6Qd1fxgLH5A-6P8,11264
7
+ sdfr-1.4.2.dist-info/METADATA,sha256=qv9qETHA5SXPuwveGOfKF2t8B3sUMBgvpV6j7hda6tI,370
8
+ sdfr-1.4.2.dist-info/WHEEL,sha256=2gMiQ9URLdcVSVn--wWLd3wXucnRxZtbu4ekGokbEAk,99
9
+ sdfr-1.4.2.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
10
+ sdfr-1.4.2.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
11
+ sdfr-1.4.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: scikit-build-core 0.11.3
2
+ Generator: scikit-build-core 0.11.4
3
3
  Root-Is-Purelib: false
4
4
  Tag: py3-none-win32
5
5
 
@@ -1,11 +0,0 @@
1
- sdfr/__init__.py,sha256=vSTzC03qtlxqcn-7dewmUa59NvhaZ-QqBi1svDCDzIo,1153
2
- sdfr/_commit_info.py,sha256=Y1T_D5xV7pPNpFclUlE2MHliyoyslJdRjgENYFLIdpY,112
3
- sdfr/loadlib.py,sha256=EMcnZhh68fS72Bjv8QtfDzPbowx1FfaqX4TPhDl-o94,2328
4
- sdfr/SDF.py,sha256=C-bS8EBSUhBYMmq9HSd1D8PoMnVOKV3rmURFwU4D5tY,31052
5
- sdfr/sdf_helper.py,sha256=jS4fxmq1y7PeryrPFuB_Lgu5n88-cNggaWMvQy4XqSA,63682
6
- sdfr/sdfc_shared.dll,sha256=h23N5g-5EuuyEGisbsrb_qhpr6xOoRwsxEEXIx11cWk,11264
7
- sdfr-1.4.0.dist-info/METADATA,sha256=lkxSLGXDi0cJXyueMbl5CWZelo3inMyLBplq13u0Sco,370
8
- sdfr-1.4.0.dist-info/WHEEL,sha256=MWx6St2fF6bImwReczHwY9SS3H0iODdNhwcweEl6Zjs,99
9
- sdfr-1.4.0.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
10
- sdfr-1.4.0.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
11
- sdfr-1.4.0.dist-info/RECORD,,