pyglaze 0.4.0__py3-none-any.whl → 0.4.1__py3-none-any.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.
pyglaze/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.0"
1
+ __version__ = "0.4.1"
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
16
16
  __all__ = ["Pulse"]
17
17
 
18
18
 
19
- @dataclass
19
+ @dataclass(frozen=True)
20
20
  class Pulse:
21
21
  """Data class for a THz pulse. The pulse is expected to be preprocessed such that times are uniformly spaced.
22
22
 
@@ -41,6 +41,24 @@ class Pulse:
41
41
  and np.array_equal(self.signal, obj.signal)
42
42
  )
43
43
 
44
+ def __hash__(self: Pulse) -> int:
45
+ """Return a hash based on the contents of ``time`` and ``signal``.
46
+
47
+ The hash combines shape, dtype and raw bytes of both arrays, ensuring that
48
+ two :class:`Pulse` instances that compare equal also have identical hashes.
49
+
50
+ """
51
+ return hash(
52
+ (
53
+ self.time.shape,
54
+ self.time.dtype.str,
55
+ self.time.tobytes(),
56
+ self.signal.shape,
57
+ self.signal.dtype.str,
58
+ self.signal.tobytes(),
59
+ )
60
+ )
61
+
44
62
  @property
45
63
  def fft(self: Pulse) -> ComplexArray:
46
64
  """Return the Fourier Transform of a signal."""
@@ -97,7 +115,7 @@ class Pulse:
97
115
 
98
116
  Note that the energy is not the same as the physical energy of the pulse, but rather the integral of the square of the pulse.
99
117
  """
100
- return cast("float", np.trapz(self.signal * self.signal, x=self.time)) # noqa: NPY201 - trapz removed in numpy 2.0
118
+ return cast("float", np.trapezoid(self.signal * self.signal, x=self.time)) # type: ignore[attr-defined, unused-ignore]
101
119
 
102
120
  @classmethod
103
121
  def from_dict(
@@ -163,8 +181,10 @@ class Pulse:
163
181
  ]
164
182
 
165
183
  if translate_to_zero:
166
- for scan in roughly_aligned:
167
- scan.time = scan.time - scan.time[0]
184
+ roughly_aligned = [
185
+ s.timeshift(scale=1.0, offset=-s.time[0]) for s in roughly_aligned
186
+ ]
187
+
168
188
  zerocrossings = [p.estimate_zero_crossing() for p in roughly_aligned]
169
189
  mean_zerocrossing = cast("float", np.mean(zerocrossings))
170
190
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyglaze
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Pyglaze is a library used to operate the devices of Glaze Technologies
5
5
  Author: GLAZE Technologies ApS
6
6
  License: BSD 3-Clause License
@@ -35,10 +35,10 @@ Project-URL: Homepage, https://www.glazetech.dk/
35
35
  Project-URL: Documentation, https://glazetech.github.io/pyglaze/latest
36
36
  Project-URL: Repository, https://github.com/GlazeTech/pyglaze
37
37
  Project-URL: Issues, https://github.com/GlazeTech/pyglaze/issues
38
- Requires-Python: <3.13,>=3.9
38
+ Requires-Python: <3.14,>=3.9
39
39
  Description-Content-Type: text/markdown
40
40
  License-File: LICENSE
41
- Requires-Dist: numpy<2.0.0,>=1.26.4
41
+ Requires-Dist: numpy>=1.26.4
42
42
  Requires-Dist: pyserial>=3.5
43
43
  Requires-Dist: scipy>=1.7.3
44
44
  Requires-Dist: bitstring>=4.1.2
@@ -1,7 +1,7 @@
1
- pyglaze/__init__.py,sha256=42STGor_9nKYXumfeV5tiyD_M8VdcddX7CEexmibPBk,22
1
+ pyglaze/__init__.py,sha256=pMtTmSUht-XtbR_7Doz6bsQqopJJd8rZ8I8zy2HwwoA,22
2
2
  pyglaze/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pyglaze/datamodels/__init__.py,sha256=DJLByl2C7pC4RM4Uh6PW-McM5RIGBjcopzGywCKhSlI,111
4
- pyglaze/datamodels/pulse.py,sha256=ygC9Vfdn7ULzu-JndtODuEwmD8cDXnlOoEcliwJPsxg,22565
4
+ pyglaze/datamodels/pulse.py,sha256=QeVw_GYe9BuEvwr7A40pC23ZFx3rgR-soYqu3vm58DE,23192
5
5
  pyglaze/datamodels/waveform.py,sha256=T0wV7saJNPowwQs518VLypul-p1bg_1REPTflw8UNzM,5810
6
6
  pyglaze/device/__init__.py,sha256=rxF1h54dHTwq5JVvLjxDeirY4njMfr8c9qs0yJ5GRhE,119
7
7
  pyglaze/device/ampcom.py,sha256=ecnkrMI1wFatTvPQjlZ5LTG2xkrTLIVkOw1hU_Hojso,10714
@@ -19,8 +19,8 @@ pyglaze/scanning/_asyncscanner.py,sha256=cS-XOGWaFsYJ5ShkchyHQo8HtPCADGEGnf-isHx
19
19
  pyglaze/scanning/_exceptions.py,sha256=vS28Dijj76jVuF6cSDBKqM9SQIa9rbIyUaHF-RA3PyM,213
20
20
  pyglaze/scanning/client.py,sha256=xgsZLRFVe_rcLQD7AIcztKZ_wY6mp3v4ID3Zq40SbP0,2459
21
21
  pyglaze/scanning/scanner.py,sha256=69Bawx3m6toHH3bhHSRduVN527-aeveFI9l6WcaKWs8,7712
22
- pyglaze-0.4.0.dist-info/licenses/LICENSE,sha256=LCP3sGBX7LxuQopcjeug1fW4tngWCHF4zB7QCgB28xM,1504
23
- pyglaze-0.4.0.dist-info/METADATA,sha256=SIF4aktj9-ogBuAb9AraranYA5POn6O4aVhlKUnz01w,3515
24
- pyglaze-0.4.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
- pyglaze-0.4.0.dist-info/top_level.txt,sha256=X7d5rqVVuWNmtK4-Uh4sgOLlqye8vaHZOr5RYba0REo,8
26
- pyglaze-0.4.0.dist-info/RECORD,,
22
+ pyglaze-0.4.1.dist-info/licenses/LICENSE,sha256=LCP3sGBX7LxuQopcjeug1fW4tngWCHF4zB7QCgB28xM,1504
23
+ pyglaze-0.4.1.dist-info/METADATA,sha256=bcQPzXT80qllfMgwMU-yXoob8RSdNaDzQ1xnBnwBTfs,3508
24
+ pyglaze-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ pyglaze-0.4.1.dist-info/top_level.txt,sha256=X7d5rqVVuWNmtK4-Uh4sgOLlqye8vaHZOr5RYba0REo,8
26
+ pyglaze-0.4.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5