doppy 0.4.0__cp310-abi3-win_amd64.whl → 0.4.2__cp310-abi3-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.

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
@@ -19,8 +20,8 @@ class HaloSysParams:
19
20
  internal_relative_humidity: npt.NDArray[np.float64] # dim: (time, )
20
21
  supply_voltage: npt.NDArray[np.float64] # dim: (time, )
21
22
  acquisition_card_temperature: npt.NDArray[np.float64] # dim: (time, )
22
- pitch: npt.NDArray[np.float64] # dim: (time, )
23
- roll: npt.NDArray[np.float64] # dim: (time, )
23
+ platform_pitch_angle: npt.NDArray[np.float64] # dim: (time, ), unit: degrees
24
+ platform_roll_angle: npt.NDArray[np.float64] # dim: (time, ), unit: degrees
24
25
 
25
26
  @classmethod
26
27
  def from_src(cls, data: str | Path | bytes | BufferedIOBase) -> HaloSysParams:
@@ -46,8 +47,8 @@ class HaloSysParams:
46
47
  np.concatenate(tuple(r.internal_relative_humidity for r in raws)),
47
48
  np.concatenate(tuple(r.supply_voltage for r in raws)),
48
49
  np.concatenate(tuple(r.acquisition_card_temperature for r in raws)),
49
- np.concatenate(tuple(r.pitch for r in raws)),
50
- np.concatenate(tuple(r.roll for r in raws)),
50
+ np.concatenate(tuple(r.platform_pitch_angle for r in raws)),
51
+ np.concatenate(tuple(r.platform_roll_angle for r in raws)),
51
52
  )
52
53
 
53
54
  def __getitem__(
@@ -61,8 +62,8 @@ class HaloSysParams:
61
62
  self.internal_relative_humidity[index],
62
63
  self.supply_voltage[index],
63
64
  self.acquisition_card_temperature[index],
64
- self.pitch[index],
65
- self.roll[index],
65
+ self.platform_pitch_angle[index],
66
+ self.platform_roll_angle[index],
66
67
  )
67
68
  raise TypeError
68
69
 
@@ -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.pyd 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.2
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=YmWpU_2D2vkb1syNvT0rTWbwWIl_szfcfsJlDNquySI,4375
2
- doppy-0.4.0.dist-info/WHEEL,sha256=KwWTkx8j-9qpJhNDsJHbSlL5MdLAbyW_pNjgwYvZm70,95
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=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
1
+ doppy-0.4.2.dist-info/METADATA,sha256=qv6QzHEp1Dqs3UJE4QwRbEEEolyMI95HLWZ9wsliDzE,4375
2
+ doppy-0.4.2.dist-info/WHEEL,sha256=ff_aotEPDeP8au5CC0c1B8Qp-UHc3TEJkBgH6hZZ_jU,95
3
+ doppy-0.4.2.dist-info/entry_points.txt,sha256=9b_Ca7vJoh6AwL3W8qAPh_UmJ_1Pa6hi-TDfCTDjvSk,43
4
+ doppy-0.4.2.dist-info/licenses/LICENSE,sha256=RIAxFjJLTw0wQ3_SM73JoTeppoD99DJJ72cjvVuRrW4,1110
5
5
  doppy/bench.py,sha256=fLN2iS5mmoYH4qZjD80Vl1h9lp3C-KDfhj9fteWRPtM,260
6
6
  doppy/data/api.py,sha256=c3zbZI3IV7HnzhyFzJpUPOFT20eYFuQlJ5K_1ZEe1Pg,1921
7
7
  doppy/data/cache.py,sha256=ERFzH-KjLLXV8fCePsewTepKZXmLwtXxeazmHiFdA80,1203
@@ -18,12 +18,12 @@ doppy/product/__init__.py,sha256=xoBEXuhid-bvoof5Ogzpt1dKIhJgNMRyrAinCqUOUUI,241
18
18
  doppy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  doppy/raw/halo_bg.py,sha256=TrqJDUXa1atW2w4UDN9PPx2Mzrc7D9Q2Ndph0yB65p0,5988
20
20
  doppy/raw/halo_hpl.py,sha256=l9i_TTJ4BY5eE3qAEAiLKK-mXd-a2BseEyDUMvMEanI,19105
21
- doppy/raw/halo_sys_params.py,sha256=nT9r4F-H0Rf5njee5rYzzLTCm7vm3N_pdJqrW6RtyK4,4041
21
+ doppy/raw/halo_sys_params.py,sha256=9aZpAgaLFniADjYv7EO8wKtmBD6McJP2v7YUz94hrTM,5385
22
22
  doppy/raw/windcube.py,sha256=LB7Do9Bn4ygBy8tMBM9Rc1ZZKU_6WX88UHELKiTPJfQ,19550
23
23
  doppy/raw/wls70.py,sha256=J3ABVj_YrjSgmyRt6DGNoZUZIEZEzEoKaY5yiN9hE94,7717
24
24
  doppy/raw/__init__.py,sha256=ycT-_mCiI19b2TH33L74-Eq_MYUTPe3B8NhwNodSx1E,267
25
25
  doppy/utils.py,sha256=2PwDiO8GyMjsHC-EYcTGyN2mEfPaCi3hhEn2twETOl0,814
26
26
  doppy/__init__.py,sha256=Af7_8p3oN1nTqS9fo0mVKVuiKf5CAEK69uQa32CSFBA,197
27
27
  doppy/__main__.py,sha256=38hIWWfanILuBBGorQiAaleSC4qYJoIxuzVBkxf7Dng,371
28
- doppy/rs.pyd,sha256=mapeuiOknSrHqwJqRyKXtd46vkG_NtsnVredpQXN8fo,2135552
29
- doppy-0.4.0.dist-info/RECORD,,
28
+ doppy/rs.pyd,sha256=UAYl78Q6CnDyh7wWZlBeOeMuIr662OkyxmkLGA00l8c,2130944
29
+ doppy-0.4.2.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-win_amd64