Skip to content

Commit

Permalink
remove pop (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisac committed Feb 26, 2021
1 parent 9ee646f commit 618f59a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion strawberryfields/tdm/tdmprogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def reshape_samples(all_samples, modes, N, timebins):
# calculate the total number of samples and the order in which they were measured
num_of_values = len([i for j in all_samples.values() for i in j])
mode_order = _get_mode_order(num_of_values, modes, N, timebins)
idx_tracker = {i: 0 for i in mode_order}

# iterate backwards through all_samples and add them into the correct mode
new_samples = dict()
Expand All @@ -204,7 +205,8 @@ def reshape_samples(all_samples, modes, N, timebins):
# create an entry for the new mode with a nested list for each timebin
new_samples[mode_idx] = [[] for _ in range(timebins)]

sample = all_samples[mode].pop(0)[0]
sample = all_samples[mode][idx_tracker[mode]][0]
idx_tracker[mode] += 1
new_samples[mode_idx][timebin_idx].append(sample)

# populate each spatial mode in one timebin before moving on to the next timebin
Expand Down

0 comments on commit 618f59a

Please sign in to comment.