doppy 0.4.0__cp310-abi3-macosx_11_0_arm64.whl → 0.4.1__cp310-abi3-macosx_11_0_arm64.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 doppy might be problematic. Click here for more details.

@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import io
4
+ import re
4
5
  from dataclasses import dataclass
5
6
  from datetime import datetime
6
7
  from io import BufferedIOBase
@@ -75,10 +76,40 @@ class HaloSysParams:
75
76
  return self[is_increasing]
76
77
 
77
78
 
79
+ def _correct_concatenated_rows(rows: list[bytes]) -> list[bytes]:
80
+ concat_pattern = re.compile(rb".*(\t[-+0-9]*\.[-+0-9]*\.[-+0-9]*\t).*")
81
+
82
+ matches = [concat_pattern.fullmatch(row) for row in rows]
83
+
84
+ if not any(matches):
85
+ return rows
86
+ elif not all(matches):
87
+ raise ValueError("Cannot correct the concatenated rows")
88
+
89
+ zero_column_pattern = re.compile(rb".*\t0\t.*")
90
+ if not all(zero_column_pattern.fullmatch(row) for row in rows):
91
+ raise ValueError(r"Concatenated rows are expected to have \t0\t pattern")
92
+ rows = [row.replace(b"\t0\t", b"\t") for row in rows]
93
+
94
+ new_rows = []
95
+ pattern = re.compile(rb"(.*\t[-+]?[0-9]+\.[0-9]+)([-+][0-9]+\.[0-9]+\t.*)")
96
+ pattern_nan = re.compile(rb"(.*\t)[-+]?[0-9]+\.[0-9]+\.[0-9]+(\t.*)")
97
+ for row in rows:
98
+ m = pattern.fullmatch(row)
99
+ if m:
100
+ new_rows.append(m.group(1) + b"\t" + m.group(2))
101
+ elif m_nan := pattern_nan.fullmatch(row):
102
+ new_rows.append(m_nan.group(1) + b"nan\tnan" + m_nan.group(2))
103
+ else:
104
+ raise ValueError("Cannot separate concatenated floats")
105
+ return new_rows
106
+
107
+
78
108
  def _from_src(data: BufferedIOBase) -> HaloSysParams:
79
109
  data_bytes = data.read().strip().replace(b",", b".").replace(b"\x00", b"")
80
110
  a = data_bytes.strip().split(b"\r\n")
81
- b = [r.split(b"\t") for r in a]
111
+ a = _correct_concatenated_rows(a)
112
+ b = [r.strip().split(b"\t") for r in a]
82
113
  arr = np.array(b)
83
114
  if arr.shape[1] != 7:
84
115
  raise ValueError("Unexpected data format")
doppy/rs.abi3.so CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doppy
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -1,7 +1,7 @@
1
- doppy-0.4.0.dist-info/METADATA,sha256=bnTR2j3JN6ZfhwrYNbhIj0i6HdM-zpergm-CCBQa_5I,4276
2
- doppy-0.4.0.dist-info/WHEEL,sha256=9pH0c92OgjhIvXK7g4XTh8KK6q5vYgxz1YCJsDe0sC0,103
3
- doppy-0.4.0.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
- doppy-0.4.0.dist-info/licenses/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
1
+ doppy-0.4.1.dist-info/METADATA,sha256=2QKdwdON6AE9MwHzhqjhAqAEOdv0VSd--jmsleS9veI,4276
2
+ doppy-0.4.1.dist-info/WHEEL,sha256=jgxTYcCP5fEsgDB4ai9yqIrFqOhaSksIcR8Z9RvlUtk,103
3
+ doppy-0.4.1.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.4.1.dist-info/licenses/LICENSE,sha256=V-0iroMNMI8ctnLgUau1kdFvwhkYhr9vi-5kWKxw2wc,1089
5
5
  doppy/options.py,sha256=73BDODO4OYHn2qOshhwz6u6G3J1kNd3uj6P0a3V4HBE,205
6
6
  doppy/__init__.py,sha256=Z9aEUlbPRWRUAoB8_-djkgrJuS4-6pjem4-mVSB6Z9I,191
7
7
  doppy/product/wind.py,sha256=hkSzAyi4tfPoGwUx8iE3l65oCDyzl_tRgtF2loxaEpY,16557
@@ -18,12 +18,12 @@ doppy/data/cache.py,sha256=cxCZ7HyEQt2EKAGEiMqx3wJ2-5Y3hEAEPQ_XB4gKlkk,1160
18
18
  doppy/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  doppy/data/api.py,sha256=QaVKj304OPcu8OF5xgtduQzDis8Srn-I6UgR9qb2u9E,1863
20
20
  doppy/data/exceptions.py,sha256=6CS6OHIWq8CqlxiceEvC1j0EfWUYoIfM7dW88apQVn4,89
21
- doppy/raw/halo_sys_params.py,sha256=DeOIIRtVdO7HnNY3FaI4u035ScI65jfDgUrEccLepEo,3937
21
+ doppy/raw/halo_sys_params.py,sha256=jB7sRsu3nNpk8_2tUnz4dseVszmnPoNL8gLbrGPZVuQ,5130
22
22
  doppy/raw/__init__.py,sha256=4pj4xSK9rA0XEfM79NsRBRYId7GaJRDCyPABxbEm63g,260
23
23
  doppy/raw/wls70.py,sha256=TePgyhmlWaUQCw1vkWh7uD7KT5EFMaDhNeVYoF2rspc,7510
24
24
  doppy/raw/halo_bg.py,sha256=8t9j-SUF1yJht3vrT6KAYJQyxcg3W-0zr8h0jAEhWes,5815
25
25
  doppy/raw/halo_hpl.py,sha256=yzVPQEATnDVf1K3N-mGLXR4_RuT-E94OVXathT2bHes,18580
26
26
  doppy/raw/windcube.py,sha256=vgkoXVgcbI2Or4BsFCeq2STdjUP49h3mBQLoDXdBQHM,19074
27
27
  doppy/__main__.py,sha256=zrKQJVj0k0ypBQCGK65Czt9G9FZ_qx3ussw6Q9VJ14g,346
28
- doppy/rs.abi3.so,sha256=o1UmwiBlSeRyDR2KeIm83bBpGJyTk9DdywuVjJUnTos,2583328
29
- doppy-0.4.0.dist-info/RECORD,,
28
+ doppy/rs.abi3.so,sha256=YPS3BcqHlphUOlLpu1U1KRS46BIEC7sa4WTlltmmLZg,2568576
29
+ doppy-0.4.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.7.7)
2
+ Generator: maturin (1.7.8)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-abi3-macosx_11_0_arm64