Commit 0c750ec2 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Results: Minor change.

Showing with 25 additions and 18 deletions
+25 -18
...@@ -478,6 +478,8 @@ class Mage8(Mage): ...@@ -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): ...@@ -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): ...@@ -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): ...@@ -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) if key in ["Z", "Q"]:
# Get profile id in reach for i, d in enumerate(data):
ri = ip_to_ri(reach, i) # 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 # Set data for profile RI
reach.set(ri, timestamp, key, d) 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")
Supports Markdown
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