sdfr 1.4.9__py3-none-win_amd64.whl → 1.4.11__py3-none-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.
sdfr/__init__.py CHANGED
@@ -15,40 +15,25 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- from .SDF import (
19
- new,
20
- read,
21
- SdfBlockType,
22
- SdfGeometry,
23
- SdfStagger,
24
- SdfDataType,
25
- SdfBlock,
26
- SdfFile,
27
- RunInfo,
28
- BlockList,
29
- Block,
30
- BlockConstant,
31
- BlockPlainVariable,
32
- BlockPlainMesh,
33
- BlockLagrangianMesh,
34
- BlockPointMesh,
35
- BlockPointVariable,
36
- BlockNameValue,
37
- BlockArray,
38
- BlockData,
39
- BlockStitched,
40
- BlockStitchedPath,
41
- BlockStitchedMaterial,
42
- BlockStitchedMatvar,
43
- BlockStitchedSpecies,
44
- BlockStitchedTensor,
45
- )
18
+ from .SDF import _new as new
19
+ from .SDF import _read as read
20
+ from .SDF import _get_md5 as get_md5
21
+ from .SDF import _get_sha as get_sha
22
+ from .SDF import _add_cpu_split as add_cpu_split
23
+ from .SDF import _add_stitched as add_stitched
24
+ from .SDF import _add_stitched_vector as add_stitched_vector
25
+ from .SDF import _add_stitched_material as add_stitched_material
26
+ from .SDF import _add_stitched_matvar as add_stitched_matvar
27
+ from .SDF import _add_stitched_species as add_stitched_species
28
+ from .SDF import _add_runinfo as add_runinfo
29
+ from .SDF import _add_block as add_block
30
+ from .SDF import _write as write
46
31
  from . import sdf_helper
47
32
  from ._commit_info import (
48
33
  __commit_date__,
49
34
  __commit_id__,
50
35
  )
51
- from .loadlib import (
36
+ from ._loadlib import (
52
37
  __library_commit_date__,
53
38
  __library_commit_id__,
54
39
  )
@@ -67,33 +52,22 @@ __all__ = [
67
52
  "new",
68
53
  "read",
69
54
  "sdf_helper",
70
- "SdfBlockType",
71
- "SdfGeometry",
72
- "SdfStagger",
73
- "SdfDataType",
74
- "SdfBlock",
75
- "SdfFile",
76
- "RunInfo",
77
- "BlockList",
78
- "Block",
79
- "BlockConstant",
80
- "BlockPlainVariable",
81
- "BlockPlainMesh",
82
- "BlockLagrangianMesh",
83
- "BlockPointMesh",
84
- "BlockPointVariable",
85
- "BlockNameValue",
86
- "BlockArray",
87
- "BlockData",
88
- "BlockStitched",
89
- "BlockStitchedPath",
90
- "BlockStitchedMaterial",
91
- "BlockStitchedMatvar",
92
- "BlockStitchedSpecies",
93
- "BlockStitchedTensor",
55
+ "get_md5",
56
+ "get_sha",
57
+ "add_cpu_split",
58
+ "add_stitched",
59
+ "add_stitched_vector",
60
+ "add_stitched_material",
61
+ "add_stitched_matvar",
62
+ "add_stitched_species",
63
+ "add_runinfo",
64
+ "add_block",
65
+ "write",
94
66
  "__library_commit_date__",
95
67
  "__library_commit_id__",
96
68
  "__version__",
97
69
  "__commit_date__",
98
70
  "__commit_id__",
99
71
  ]
72
+
73
+ del version
sdfr/_commit_info.py CHANGED
@@ -1,2 +1,2 @@
1
- __commit_date__ = "Thu Oct 2 11:17:38 2025 +0100"
2
- __commit_id__ = "1f88901d0f4d4e9c9a1a0627969174db9de9188f"
1
+ __commit_date__ = "Fri Oct 24 20:14:50 2025 +0100"
2
+ __commit_id__ = "a17cbc89aabb147999f508583cb3cd40e0278a1f"
sdfr/sdf_helper.py CHANGED
@@ -34,6 +34,7 @@ except Exception:
34
34
 
35
35
  try:
36
36
  import sdfr as sdf
37
+ import sdfr.SDF as SDF
37
38
 
38
39
  got_sdf = True
39
40
  except ImportError:
@@ -257,7 +258,7 @@ def get_file_list(wkd=None, base=None, block=None):
257
258
  automatically attempt to detect if this field is base or block
258
259
  base : str
259
260
  A representative filename or directory
260
- block : sdf.Block or sdf.BlockList
261
+ block : SDF.Block or SDF.BlockList
261
262
  A representative sdf dataset or block
262
263
 
263
264
  Returns
@@ -276,8 +277,8 @@ def get_file_list(wkd=None, base=None, block=None):
276
277
  elif os.path.exists(wkd):
277
278
  base = wkd
278
279
  elif (
279
- isinstance(wkd, sdf.BlockList)
280
- or isinstance(wkd, sdf.Block)
280
+ isinstance(wkd, SDF.BlockList)
281
+ or isinstance(wkd, SDF.Block)
281
282
  or type(wkd) is dict
282
283
  ):
283
284
  block = wkd
@@ -319,7 +320,7 @@ def get_job_id(file_list=None, base=None, block=None):
319
320
  automatically attempt to detect if this field is base or block
320
321
  base : str
321
322
  A representative filename or directory
322
- block : sdf.Block or sdf.BlockList
323
+ block : SDF.Block or SDF.BlockList
323
324
  A representative sdf dataset or block
324
325
 
325
326
  Returns
@@ -333,8 +334,8 @@ def get_job_id(file_list=None, base=None, block=None):
333
334
  base = file_list
334
335
  file_list = None
335
336
  elif (
336
- isinstance(file_list, sdf.BlockList)
337
- or isinstance(file_list, sdf.Block)
337
+ isinstance(file_list, SDF.BlockList)
338
+ or isinstance(file_list, SDF.Block)
338
339
  or type(file_list) is dict
339
340
  ):
340
341
  block = file_list
@@ -381,7 +382,7 @@ def get_files(wkd=None, base=None, block=None, varname=None, fast=True):
381
382
  automatically attempt to detect if this field is base or block
382
383
  base : str
383
384
  A representative filename or directory
384
- block : sdf.Block or sdf.BlockList
385
+ block : SDF.Block or SDF.BlockList
385
386
  A representative sdf dataset or block
386
387
  varname : str
387
388
  A variable name that must be present in the file
@@ -401,8 +402,8 @@ def get_files(wkd=None, base=None, block=None, varname=None, fast=True):
401
402
  elif os.path.exists(wkd):
402
403
  base = wkd
403
404
  elif (
404
- isinstance(wkd, sdf.BlockList)
405
- or isinstance(wkd, sdf.Block)
405
+ isinstance(wkd, SDF.BlockList)
406
+ or isinstance(wkd, SDF.Block)
406
407
  or type(wkd) is dict
407
408
  ):
408
409
  block = wkd
@@ -461,14 +462,14 @@ def get_time(
461
462
  The directory in which to search
462
463
  base : str
463
464
  A representative filename or directory
464
- block : sdf.Block or sdf.BlockList
465
+ block : SDF.Block or SDF.BlockList
465
466
  A representative sdf dataset or block
466
467
  fast : bool
467
468
  Use a faster but less thorough method for returning first/last
468
469
 
469
470
  Returns
470
471
  -------
471
- data : sdf.BlockList
472
+ data : SDF.BlockList
472
473
  An SDF dataset
473
474
  """
474
475
  global data, wkdir
@@ -551,14 +552,14 @@ def get_step(
551
552
  The directory in which to search
552
553
  base : str
553
554
  A representative filename or directory
554
- block : sdf.Block or sdf.BlockList
555
+ block : SDF.Block or SDF.BlockList
555
556
  A representative sdf dataset or block
556
557
  fast : bool
557
558
  Use a faster but less thorough method for returning first/last
558
559
 
559
560
  Returns
560
561
  -------
561
- data : sdf.BlockList
562
+ data : SDF.BlockList
562
563
  An SDF dataset
563
564
  """
564
565
  global data, wkdir
@@ -632,12 +633,12 @@ def get_latest(wkd=None, base=None, block=None):
632
633
  automatically attempt to detect if this field is base or block
633
634
  base : str
634
635
  A representative filename or directory
635
- block : sdf.Block or sdf.BlockList
636
+ block : SDF.Block or SDF.BlockList
636
637
  A representative sdf dataset or block
637
638
 
638
639
  Returns
639
640
  -------
640
- data : sdf.BlockList
641
+ data : SDF.BlockList
641
642
  An SDF dataset
642
643
  """
643
644
  return get_step(last=True, wkd=wkd, base=base, block=base)
@@ -715,9 +716,9 @@ def plot_auto(*args, **kwargs):
715
716
  )
716
717
  return
717
718
  if len(dims) == 1:
718
- if isinstance(args[0], sdf.BlockStitchedPath):
719
+ if isinstance(args[0], SDF.BlockStitchedPath):
719
720
  plot_rays(*args, **kwargs)
720
- elif isinstance(args[0], sdf.BlockStitched):
721
+ elif isinstance(args[0], SDF.BlockStitched):
721
722
  newargs = list(args[:])
722
723
  for block in args[0].data:
723
724
  newargs[0] = block
@@ -725,10 +726,12 @@ def plot_auto(*args, **kwargs):
725
726
  elif len(args[0].grid.dims) == 1:
726
727
  plot1d(*args, **kwargs)
727
728
  else:
729
+ if isinstance(args[0], SDF.BlockPointVariable):
730
+ kwargs["add_lines"] = False
728
731
  plot_path(*args, **kwargs)
729
- elif isinstance(args[0], sdf.BlockLagrangianMesh) and dims[1] == 1:
732
+ elif isinstance(args[0], SDF.BlockLagrangianMesh) and dims[1] == 1:
730
733
  plot_path(*args, **kwargs)
731
- elif isinstance(args[0], sdf.BlockStitchedPath):
734
+ elif isinstance(args[0], SDF.BlockStitchedPath):
732
735
  plot_rays(*args, **kwargs)
733
736
  elif len(dims) == 2:
734
737
  k = "set_ylabel"
@@ -843,8 +846,8 @@ def plot1d(
843
846
  # This is an attempt to get both axes to use the same scale
844
847
  # I'm not at all confident that it always does the right thing
845
848
  if xscale == 0 and yscale == 0:
846
- xlen = max(abs(X[0]), abs(X[-1]))
847
- ylen = max(abs(Y[0]), abs(Y[-1]))
849
+ xlen = max(X) - min(X)
850
+ ylen = max(Y) - min(Y)
848
851
  ratio1 = ylen / xlen
849
852
  ratio2 = xlen / ylen
850
853
  if ratio1 >= 1 and ratio1 < 1e3:
@@ -855,14 +858,14 @@ def plot1d(
855
858
  yscale = ylen
856
859
 
857
860
  if xscale == 0:
858
- length = max(abs(X[0]), abs(X[-1]))
859
- mult_x, sym_x = get_si_prefix(length)
861
+ xlen = max(X) - min(X)
862
+ mult_x, sym_x = get_si_prefix(xlen)
860
863
  else:
861
864
  mult_x, sym_x = get_si_prefix(xscale)
862
865
 
863
866
  if yscale == 0:
864
- length = max(abs(Y[0]), abs(Y[-1]))
865
- mult_y, sym_y = get_si_prefix(length)
867
+ ylen = max(Y) - min(Y)
868
+ mult_y, sym_y = get_si_prefix(ylen)
866
869
  else:
867
870
  mult_y, sym_y = get_si_prefix(yscale)
868
871
 
@@ -913,13 +916,14 @@ def plot_path(
913
916
  axis_only=False,
914
917
  clip_reflect=False,
915
918
  power=(-3, 3),
919
+ add_lines=True,
916
920
  **kwargs,
917
921
  ):
918
922
  """Plot an SDF path variable (eg. a laser ray)
919
923
 
920
924
  Parameters
921
925
  ----------
922
- var : sdf.Block
926
+ var : SDF.Block
923
927
  The SDF block for the path to plot
924
928
  xdir : integer
925
929
  The dimension to use for the x-direction. If the path is 2D then
@@ -963,7 +967,7 @@ def plot_path(
963
967
  If set to true then update the axis limits for this path
964
968
  axis_only : logical
965
969
  If set to true then only update the axis limits for this path
966
- svar : sdf.Block
970
+ svar : SDF.Block
967
971
  If set, use the extents of this variable to set the axis range for
968
972
  this plot
969
973
  clip_reflect : logical
@@ -1002,7 +1006,7 @@ def plot_path(
1002
1006
  return
1003
1007
 
1004
1008
  isvar = True
1005
- if isinstance(var, sdf.BlockLagrangianMesh):
1009
+ if isinstance(var, SDF.BlockLagrangianMesh):
1006
1010
  isvar = False
1007
1011
  add_cbar = False
1008
1012
 
@@ -1125,37 +1129,50 @@ def plot_path(
1125
1129
  segments = np.concatenate([points[:-1], points[1:]], axis=1)
1126
1130
 
1127
1131
  if isvar:
1128
- if not hold or plot_path.norm_values is None:
1129
- k = "vmin"
1130
- k1 = "vrange"
1131
- if k in kwargs:
1132
- vmin = kwargs[k]
1133
- elif k1 in kwargs:
1134
- vmin = kwargs[k1][0]
1135
- else:
1136
- vmin = c.min()
1132
+ k = "vmin"
1133
+ k1 = "vrange"
1134
+ if k in kwargs:
1135
+ vmin = kwargs[k]
1136
+ elif k1 in kwargs:
1137
+ vmin = kwargs[k1][0]
1138
+ else:
1139
+ vmin = c.min()
1137
1140
 
1138
- k = "vmax"
1139
- if k in kwargs:
1140
- vmax = kwargs[k]
1141
- elif k1 in kwargs:
1142
- vmax = kwargs[k1][1]
1143
- else:
1144
- vmax = c.max()
1141
+ k = "vmax"
1142
+ if k in kwargs:
1143
+ vmax = kwargs[k]
1144
+ elif k1 in kwargs:
1145
+ vmax = kwargs[k1][1]
1146
+ else:
1147
+ vmax = c.max()
1145
1148
 
1149
+ if not hold or plot_path.norm_values is None:
1146
1150
  plot_path.norm_values = plt.Normalize(vmin, vmax)
1147
1151
 
1148
- kk = {}
1149
- k = "lw"
1150
- if k in kwargs:
1151
- kk[k] = kwargs[k]
1152
- k = "linewidth"
1153
- if k in kwargs:
1154
- kk[k] = kwargs[k]
1155
- lc = LineCollection(segments, norm=plot_path.norm_values, **kk)
1156
- if isvar:
1157
- lc.set_array(c)
1158
- im = subplot.add_collection(lc)
1152
+ im = None
1153
+ if add_lines:
1154
+ kk = {}
1155
+ k = "lw"
1156
+ if k in kwargs:
1157
+ kk[k] = kwargs[k]
1158
+ k = "linewidth"
1159
+ if k in kwargs:
1160
+ kk[k] = kwargs[k]
1161
+ lc = LineCollection(segments, norm=plot_path.norm_values, **kk)
1162
+ if isvar:
1163
+ lc.set_array(c)
1164
+ im = subplot.add_collection(lc)
1165
+
1166
+ s = None
1167
+ for k in "markersize", "ms":
1168
+ if k in kwargs:
1169
+ s = kwargs[k]
1170
+ if not add_lines or s is not None:
1171
+ if s is None:
1172
+ s = 1
1173
+ im1 = subplot.scatter(X, Y, c=c, s=s, vmin=vmin, vmax=vmax)
1174
+ if im is None:
1175
+ im = im1
1159
1176
 
1160
1177
  if not hold:
1161
1178
  subplot.set_xlabel(
@@ -1260,7 +1277,7 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1260
1277
 
1261
1278
  Parameters
1262
1279
  ----------
1263
- var : sdf.Block
1280
+ var : SDF.Block
1264
1281
  The SDF variable for the rays to plot
1265
1282
  rays : list
1266
1283
  A list of ray numbers to plot
@@ -1288,13 +1305,13 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1288
1305
 
1289
1306
  ray_slice = slice(ray_start, ray_stop, skip)
1290
1307
 
1291
- if isinstance(var, sdf.BlockStitchedPath):
1308
+ if isinstance(var, SDF.BlockStitchedPath):
1292
1309
  v = var.data[0]
1293
1310
  lab = "_label"
1294
1311
  if lab not in kwargs:
1295
1312
  kwargs[lab] = var.name
1296
1313
 
1297
- if isinstance(v, sdf.BlockStitchedPath):
1314
+ if isinstance(v, SDF.BlockStitchedPath):
1298
1315
  for v in var.data:
1299
1316
  plot_rays(v, skip=skip, rays=rays, **kwargs)
1300
1317
  kwargs["hold"] = True
@@ -1305,7 +1322,7 @@ def plot_rays(var, skip=1, rays=None, **kwargs):
1305
1322
  else:
1306
1323
  ray_list = var.data[ray_slice]
1307
1324
 
1308
- if not isinstance(v, sdf.BlockLagrangianMesh):
1325
+ if not isinstance(v, SDF.BlockLagrangianMesh):
1309
1326
  k = "cbar_label"
1310
1327
  if k not in kwargs or (
1311
1328
  kwargs[k] and not isinstance(kwargs[k], str)
@@ -2110,8 +2127,8 @@ def getdata(fname, wkd=None, verbose=True, squeeze=False):
2110
2127
 
2111
2128
  # Export particle arrays
2112
2129
  for k, value in data.__dict__.items():
2113
- if not isinstance(value, sdf.BlockPointVariable) and not isinstance(
2114
- value, sdf.BlockPointMesh
2130
+ if not isinstance(value, SDF.BlockPointVariable) and not isinstance(
2131
+ value, SDF.BlockPointMesh
2115
2132
  ):
2116
2133
  continue
2117
2134
  key = re.sub(r"[^a-z0-9]", "_", value.id.lower())
@@ -2120,7 +2137,7 @@ def getdata(fname, wkd=None, verbose=True, squeeze=False):
2120
2137
  else:
2121
2138
  var = value
2122
2139
  dims = str(tuple(int(i) for i in value.dims))
2123
- if isinstance(value, sdf.BlockPointVariable):
2140
+ if isinstance(value, SDF.BlockPointVariable):
2124
2141
  if verbose:
2125
2142
  print(key + dims + " = " + value.name)
2126
2143
  globals()[key] = var
@@ -2192,7 +2209,7 @@ def ogrid(skip=None, **kwargs):
2192
2209
  def plotgrid(fname=None, iso=None, title=True):
2193
2210
  global grid
2194
2211
  if (
2195
- isinstance(fname, sdf.BlockList)
2212
+ isinstance(fname, SDF.BlockList)
2196
2213
  or isinstance(fname, dict)
2197
2214
  or hasattr(fname, "grid")
2198
2215
  ):
sdfr/sdfc_shared.dll CHANGED
Binary file
sdfr/sdfc_shared.lib CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sdfr
3
- Version: 1.4.9
3
+ Version: 1.4.11
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,12 @@
1
+ sdfr/__init__.py,sha256=byZ_OGeZGE0_DRH62zS-hFQywi6HJw2ZlVnGmOXNvX8,2081
2
+ sdfr/_commit_info.py,sha256=96ZUGx8sEOcIDbLXfq38l0Av4I1g637NlWE6lg1VsRk,112
3
+ sdfr/_loadlib.py,sha256=AFOSSEuTAu0kMLlVvtE4t_0gDwDF3VQ5HN-nwdNiMDs,2119
4
+ sdfr/SDF.py,sha256=kihp-ljrQlGirTz21GlDudFeEZolMExHFTCUndUmwM0,62747
5
+ sdfr/sdf_helper.py,sha256=Rr4GSF3Sbz7h1q85Z-LWmU6U8ODPZdvzPiZjXZEqans,64086
6
+ sdfr/sdfc_shared.dll,sha256=4cWL8Hst02X7V0XBv7PNdGLrxYFEd7OLv9mPYxPucg0,122880
7
+ sdfr/sdfc_shared.lib,sha256=9tcMgpAVuMTrxheQtOnOEytYiwKn0yzw1AIzzf4JHVs,4270
8
+ sdfr-1.4.11.dist-info/METADATA,sha256=Wr2KjkKHueiOlBs0jEiAQMxPNr6-fFW87YAgTraKB_A,371
9
+ sdfr-1.4.11.dist-info/WHEEL,sha256=7cuQBrKlgrMjywT6nmSZIIhuOog1xNCTkMyVVbw2aow,103
10
+ sdfr-1.4.11.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
11
+ sdfr-1.4.11.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
12
+ sdfr-1.4.11.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- sdfr/__init__.py,sha256=VqHDw9qAiI5qU03pxo6NeCu6hoCzdg98sl7_74ScIHQ,2275
2
- sdfr/_commit_info.py,sha256=s4cYEkpaJ0-14DfIO16Ggeyv78Z1dJEPsKk4StY1bg8,111
3
- sdfr/loadlib.py,sha256=AFOSSEuTAu0kMLlVvtE4t_0gDwDF3VQ5HN-nwdNiMDs,2119
4
- sdfr/SDF.py,sha256=0ltv9XrbR5-WWGmumXO8urGMwS3S_xwSRlnEunkfgxc,43412
5
- sdfr/sdf_helper.py,sha256=Qg4Jhp69xvoochKt6lNKB6KxqnEnD4vG9GRO5LG0Stk,63666
6
- sdfr/sdfc_shared.dll,sha256=gr81ZvzAb5j-xE5hSHNKF2uoV5TzIN7_8ushNKIVAxQ,122368
7
- sdfr/sdfc_shared.lib,sha256=YfbcZ3vBjFYNo0VRChTdIm6GNiU0lTOtSbjq3PLwWow,4270
8
- sdfr-1.4.9.dist-info/METADATA,sha256=3GF_CJWVjNwP2RVtzUGtZFy7ac4iffykuSDib1TtRoI,370
9
- sdfr-1.4.9.dist-info/WHEEL,sha256=7cuQBrKlgrMjywT6nmSZIIhuOog1xNCTkMyVVbw2aow,103
10
- sdfr-1.4.9.dist-info/licenses/LICENSE,sha256=gpLeavs1KxgJFrpL_uVDh0MoDvPfJoZ89A5dSCl4P5U,1652
11
- sdfr-1.4.9.dist-info/licenses/LICENSE_README.txt,sha256=KlBSoHArwoXbiygx3IJTjtgM7hLNO9o8ZMlZV77nrXs,235
12
- sdfr-1.4.9.dist-info/RECORD,,
File without changes
File without changes