Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anitagraser committed Jan 6, 2019
1 parent 73ae006 commit 8d3dc3b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sandbox/sample_aisdk_parallel.py
Expand Up @@ -42,7 +42,7 @@

XMIN, YMIN, XMAX, YMAX = 10.137673,57.111366,12.302739,58.461380 # 9.90353, 56.89971, 12.79016, 58.18372 # 10.30774, 57.25922, 12.13159, 58.03877 #
FILTER_BY_SHIPTYPE = True
SHIPTYPE = 'Cargo'
SHIPTYPE = 'Fishing'
DESIRED_NO_SAMPLES = 10
PAST_MINUTES = [1,3,5]
FUTURE_MINUTES = [1,2,3,5,10,15,20]
Expand Down Expand Up @@ -165,12 +165,9 @@ def create_sample(intersections_per_grid_cell, past, future, pool):
with open(OUTPUT.replace('sample.csv','sample_{}_{}_{}.csv'.format(SHIPTYPE, past, future)), 'w') as output:
output.write("id;start_secs;past_secs;future_secs;past_traj;future_pos;future_traj\n")
jobs = zip(intersections_per_grid_cell.values(), repeat(past), repeat(future))
counter = 0
for samples in pool.starmap(sampling_worker, jobs):
for sample in samples:
all_samples.append(sample)
counter += 1
print("{} of {} done!".format(counter,len(jobs)))
try:
output.write(str(sample))
except:
Expand All @@ -184,7 +181,7 @@ def create_sample(intersections_per_grid_cell, past, future, pool):
if __name__ == '__main__':
print("{} Started! ...".format(datetime.now()))
script_start = datetime.now()
pool = mp.Pool(4) # running out of memory :(
pool = mp.Pool(2) # running out of memory :(

try:
print("Loading pickled data from {} ...".format(TEMP_INTERSECTIONS))
Expand Down

0 comments on commit 8d3dc3b

Please sign in to comment.