Initial commit

This commit is contained in:
2026-04-10 16:46:45 +08:00
commit 4fd1b0a203
165 changed files with 25698 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import sys, os
import multiprocessing
import subprocess, json
exec_str="python ../no_ray/image_correct_get_sample_chtc.py "
merge_str="python ../no_ray/image_correct_combine_sample_chtc.py {} {}"
def run_command(command):
print(command)
subprocess.run(command,shell=True)
def main():
config_file = sys.argv[1]
total_count = int(sys.argv[2])
worker_count = min(os.cpu_count()-1,total_count)
with open(config_file, 'r') as outfile:
config_dict = json.load(outfile)
h5_folder=config_dict["export"]["output_dir"]
if total_count > len(config_dict["input_files"]):
print("Out of upper bound")
return
pool = multiprocessing.Pool(processes=worker_count)
commands = [f"{exec_str} {config_file} {order}" for order in range(total_count)]
pool.map(run_command, commands)
pool.close()
pool.join() # Wait for all subprocesses to finish
print('All extractions are done.')
subprocess.run(merge_str.format(config_file,h5_folder),shell=True)
if __name__== "__main__":
main()