forked from EmmaAlexander/EMU-Zoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_cross_images.py
39 lines (30 loc) · 915 Bytes
/
extract_cross_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
"""
Created on Mon May 27 11:53:48 2024
A simple post-processing script to move cross images
@author: Soheb Mandhai
"""
import glob
import settings
import shutil as sh
import functools as ft
import numpy as np
import os
def reduce_list(string,snippet=""):
if len(string.split(snippet))>1:
return string
else:
return
def copy_item(old_dir,new_dir):
itm = old_dir.split("\\")[-1]
new_dir += "\\"+itm
sh.copy(old_dir,new_dir)
file_dir = settings.prefix+"/phase_1b_hr_rel/phase1b_for_release/"
new_dir = settings.prefix+"/phase_1b_hr_rel/final_release"
file_list = glob.glob(file_dir+"*")
reduced_list = list(map(ft.partial(reduce_list,snippet='_cross_'),file_list))
reduced_list = np.asarray(reduced_list)[np.where(np.asarray(reduced_list)!=None)[0]]
if os.path.isdir(new_dir)==False:
os.mkdir(new_dir)
for i in range(len(reduced_list)):
copy_item(reduced_list[i],new_dir)