Skip to content

Commit

Permalink
set RNG seed at top level of worker module
Browse files Browse the repository at this point in the history
  • Loading branch information
nanli-emory committed May 3, 2024
1 parent 12dca26 commit 37ea0f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions histoqc/_worker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""histoqc worker functions"""
import os
import shutil

import numpy as np
from histoqc.BaseImage import BaseImage
from histoqc._pipeline import load_pipeline
from histoqc._pipeline import setup_plotting_backend
Expand All @@ -18,7 +18,9 @@ def worker_setup(c):
def worker(idx, file_name, *,
process_queue, config, outdir, log_manager, lock, shared_dict, num_files, force, seed):
"""pipeline worker function"""

# set the seed
if seed is not None:
np.random.seed(seed)
# --- output directory preparation --------------------------------
fname_outdir = os.path.join(outdir, os.path.basename(file_name))
if os.path.isdir(fname_outdir): # directory exists
Expand Down

0 comments on commit 37ea0f3

Please sign in to comment.