def convert_copy_npz(self): npz_dir = os.path.join(self.cf.pp_dir+'_npz') print("converting to npz dir", npz_dir) os.makedirs(npz_dir, exist_ok=True) dmanager.pack_dataset(self.cf.pp_dir, destination=npz_dir, recursive=True, verbose=False) if hasattr(self, 'pp_dir_merged'): subprocess.call('rsync -avh --exclude="*.npy" {} {}'.format(self.pp_dir_merged, npz_dir), shell=True) if hasattr(self, 'pp_dir_sa'): subprocess.call('rsync -avh --exclude="*.npy" {} {}'.format(self.pp_dir_sa, npz_dir), shell=True)
def convert_copy_npz(self): """ Convert a copy of generated .npy-files to npz and save in .npz-directory given in configs. """ if hasattr(self.cf, "pp_npz_dir") and self.cf.pp_npz_dir: for out_dir, group_df in self.df.groupby("out_dir"): rel_dir = os.path.relpath(out_dir, self.cf.pp_rootdir).split(os.sep) npz_out_dir = os.path.join(self.cf.pp_npz_dir, str(os.sep).join(rel_dir)) print("npz out dir: ", npz_out_dir) os.makedirs(npz_out_dir, exist_ok=True) group_df.to_pickle(os.path.join(npz_out_dir, 'info_df.pickle')) dmanager.pack_dataset(out_dir, npz_out_dir, recursive=True, verbose=False) else: print( "Did not convert .npy-files to .npz because npz directory not set in configs." )