Skip to content

Commit

Permalink
pickle tribe for backfiller for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
calum-chamberlain committed Dec 14, 2023
1 parent 02ef0c7 commit 1fb7f33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rt_eqcorrscan/reactor/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import logging
import gc
import pickle
import numpy as np
import traceback
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -63,7 +64,9 @@ def backfill(
f"log_to_screen={log_to_screen}, starttime={starttime}, endtime={endtime}")

# Read in tribe
new_tribe = Tribe().read("tribe.tgz")
with open("tribe.pkl", "rb") as f:
new_tribe = pickle.load(f)
# new_tribe = Tribe().read("tribe.tgz")
# Set up LocalClient in streams folder
st_client = LocalClient("streams")
# st_filename = "stream.ms" # Avoid reading in whole stream - expensive in memory
Expand Down
4 changes: 3 additions & 1 deletion rt_eqcorrscan/rt_match_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import copy
import numpy
import pickle
import gc
import glob
import subprocess
Expand Down Expand Up @@ -1181,7 +1182,8 @@ def backfill(
tribe = templates
else:
tribe = Tribe(templates)
tribe.write(f"{backfiller_name}/tribe.tgz")
with open(f"{backfiller_name}/tribe.pkl", "wb") as f:
pickle.dump(tribe, f)

del st_files
# Force garbage collection before creating new process
Expand Down

0 comments on commit 1fb7f33

Please sign in to comment.