Commit 205616f2 authored by Kirill Smelkov's avatar Kirill Smelkov

kpi: Rework ΣMeasurement to define itself via dtypes instead of types

ΣMeasurement used to extract types of fields of Measurement to define
same fields of itself. However with upcoming Stat and StatT "generic"
types, they can be used with several underlying dtypes, e.g.
Stat(dtype=int32) and Stat(dtype=float64), so using just a type class
when copying definition of a field will loose information.

-> Fix that by always using dtype of a field as definitive source of
   what it is.

NOTE that dtype has .type attribute which refers to attached type class
that represents scalars of that dtype.
parent 89f29e90
......@@ -234,10 +234,10 @@ class Interval(np.void):
class ΣMeasurement(np.void):
_ = []
for name in Measurement._dtype.names:
typ = Measurement._dtype.fields[name][0].type
dtyp = Measurement._dtype.fields[name][0]
if not name.startswith('X.'): # X.Tstart, X.δT
typ = np.dtype([('value', typ), ('τ_na', Measurement.Ttime)])
_.append((name, typ))
dtyp = np.dtype([('value', dtyp), ('τ_na', Measurement.Ttime)])
_.append((name, dtyp))
_dtype = np.dtype(_)
del _
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment