mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Minor change.
parent
d78310476e
commit
0c750ec244
|
|
@ -478,6 +478,8 @@ class Mage8(Mage):
|
||||||
###########
|
###########
|
||||||
|
|
||||||
def read_bin(self, study, repertory, results, qlog = None):
|
def read_bin(self, study, repertory, results, qlog = None):
|
||||||
|
logger.info(f"read_bin: Start ...")
|
||||||
|
|
||||||
with mage_file_open(os.path.join(repertory, f"0.BIN"), "r") as f:
|
with mage_file_open(os.path.join(repertory, f"0.BIN"), "r") as f:
|
||||||
newline = lambda: np.fromfile(f, dtype=np.int32, count=1)
|
newline = lambda: np.fromfile(f, dtype=np.int32, count=1)
|
||||||
endline = lambda: np.fromfile(f, dtype=np.int32, count=1)
|
endline = lambda: np.fromfile(f, dtype=np.int32, count=1)
|
||||||
|
|
@ -523,16 +525,6 @@ class Mage8(Mage):
|
||||||
iprofiles = {}
|
iprofiles = {}
|
||||||
reach_offset = {}
|
reach_offset = {}
|
||||||
|
|
||||||
ip_to_r = lambda i: iprofiles[
|
|
||||||
next(
|
|
||||||
filter(
|
|
||||||
lambda k: k[0] <= i <= k[1],
|
|
||||||
iprofiles
|
|
||||||
)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
ip_to_ri = lambda r, i: i - reach_offset[r]
|
|
||||||
|
|
||||||
data = read_int(2*nb_reach)
|
data = read_int(2*nb_reach)
|
||||||
|
|
||||||
for i in range(nb_reach):
|
for i in range(nb_reach):
|
||||||
|
|
@ -568,6 +560,17 @@ class Mage8(Mage):
|
||||||
# Data
|
# Data
|
||||||
newline()
|
newline()
|
||||||
|
|
||||||
|
ip_to_r = lambda i: iprofiles[
|
||||||
|
next(
|
||||||
|
filter(
|
||||||
|
lambda k: k[0] <= i <= k[1],
|
||||||
|
iprofiles
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
ip_to_ri = lambda r, i: i - reach_offset[r]
|
||||||
|
|
||||||
|
ts = set()
|
||||||
end = False
|
end = False
|
||||||
while not end:
|
while not end:
|
||||||
n = read_int(1)[0]
|
n = read_int(1)[0]
|
||||||
|
|
@ -576,16 +579,20 @@ class Mage8(Mage):
|
||||||
data = read_float(n)
|
data = read_float(n)
|
||||||
|
|
||||||
logger.debug(f"read_bin: timestamp = {timestamp} sec")
|
logger.debug(f"read_bin: timestamp = {timestamp} sec")
|
||||||
for i, d in enumerate(data):
|
ts.add(timestamp)
|
||||||
# Get reach corresponding to profile ID
|
|
||||||
reach = ip_to_r(i)
|
|
||||||
# Get profile id in reach
|
|
||||||
ri = ip_to_ri(reach, i)
|
|
||||||
|
|
||||||
# Set data for profile RI
|
if key in ["Z", "Q"]:
|
||||||
reach.set(ri, timestamp, key, d)
|
for i, d in enumerate(data):
|
||||||
|
# Get reach corresponding to profile ID
|
||||||
|
reach = ip_to_r(i)
|
||||||
|
# Get profile id in reach
|
||||||
|
ri = ip_to_ri(reach, i)
|
||||||
|
|
||||||
|
# Set data for profile RI
|
||||||
|
reach.set(ri, timestamp, key, d)
|
||||||
|
|
||||||
endline()
|
endline()
|
||||||
end = newline().size <= 0
|
end = newline().size <= 0
|
||||||
|
|
||||||
logger.info(reachs[0].profiles[0]._data)
|
logger.debug(reachs[0].profiles[0]._data)
|
||||||
|
logger.info(f"read_bin: ... end with {len(ts)} timestamp read")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue