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):
|
||||
logger.info(f"read_bin: Start ...")
|
||||
|
||||
with mage_file_open(os.path.join(repertory, f"0.BIN"), "r") as f:
|
||||
newline = 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 = {}
|
||||
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)
|
||||
|
||||
for i in range(nb_reach):
|
||||
|
|
@ -568,6 +560,17 @@ class Mage8(Mage):
|
|||
# Data
|
||||
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
|
||||
while not end:
|
||||
n = read_int(1)[0]
|
||||
|
|
@ -576,16 +579,20 @@ class Mage8(Mage):
|
|||
data = read_float(n)
|
||||
|
||||
logger.debug(f"read_bin: timestamp = {timestamp} sec")
|
||||
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)
|
||||
ts.add(timestamp)
|
||||
|
||||
# Set data for profile RI
|
||||
reach.set(ri, timestamp, key, d)
|
||||
if key in ["Z", "Q"]:
|
||||
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()
|
||||
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