Skip to content

Commit

Permalink
use set.update instead of set.union in in ExplorationReport
Browse files Browse the repository at this point in the history
Signed-off-by: zjgemi <[email protected]>
  • Loading branch information
zjgemi committed Sep 11, 2024
1 parent 79e26af commit 9c6d487
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dpgen2/exploration/report/report_adaptive_lower.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def clear(
):
self.ntraj = 0
self.nframes = 0
self.candi = []
self.accur = []
self.candi = set()
self.accur = set()
self.failed = []
self.candi_picked = []
self.model_devi = None
Expand All @@ -239,7 +239,7 @@ def record(
ii, md_f[ii], md_v[ii]
)
self.nframes += add_nframes
self.accur += add_accur
self.accur.update(add_accur)
self.failed += add_failed
coll_f += add_f
coll_v += add_v
Expand Down Expand Up @@ -268,11 +268,11 @@ def record(
self.level_f_lo = coll_f[-numb_candi_f][0]
# add to candidate set
for ii in range(len(coll_f) - numb_candi_f, len(coll_f)):
self.candi.append(tuple(coll_f[ii][1:]))
self.candi.add(tuple(coll_f[ii][1:]))
for ii in range(len(coll_v) - numb_candi_v, len(coll_v)):
self.candi.append(tuple(coll_v[ii][1:]))
self.candi.add(tuple(coll_v[ii][1:]))
# accurate set is substracted by the candidate set
self.accur = list(set(self.accur) - set(self.candi))
self.accur = self.accur - self.candi
self.model_devi = model_devi

def _record_one_traj(
Expand Down Expand Up @@ -300,7 +300,7 @@ def _record_one_traj(
nframes = md_f.shape[0]
assert nframes == md_v.shape[0]
failed = []
accur = []
accur = set()
coll_f = []
coll_v = []
for ii in range(nframes):
Expand All @@ -311,7 +311,7 @@ def _record_one_traj(
coll_v.append([md_v[ii], tt, ii])
# now accur takes all non-failed frames,
# will be substracted by candidate later
accur.append((tt, ii))
accur.add((tt, ii))
return nframes, accur, failed, coll_f, coll_v

def _sequence_conv(
Expand Down

0 comments on commit 9c6d487

Please sign in to comment.