3 Commits
Author SHA1 Message Date
swim 7a79b49611 Removed saving .mat files; takes up too much space 2026-08-09 22:55:03 +09:00
swim f96018ed3c helper notebook for checking convergence; new TODO 2026-08-09 22:39:35 +09:00
swim a835afa902 iteration numbers fix 2026-08-05 16:48:02 +09:00
4 changed files with 180 additions and 6 deletions
+7 -2
View File
@@ -1,8 +1,13 @@
- tag publish version for Si reconstruction TODO:
- Clean up BO states - Clean up BO states
- unify `BOEngine.__init__()`
- BO train_x/y transfer between engines for single job - BO train_x/y transfer between engines for single job
- multi-GPU dispatcher - multi-GPU dispatcher
- template job sequences / yamls - template job sequences / yamls
- mobo
- metric() function(s) for each ptycho engine - metric() function(s) for each ptycho engine
- FRC score
- fold_slice: load diffractions / hdf5 files; change only param per job - fold_slice: load diffractions / hdf5 files; change only param per job
- Possibly restructure PtychoEngine.__init__() to load data but not params - restructure `FoldSlicePtychoEngine.__init__()` to load data but not params
- write new `prepare_data.m`
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -39,9 +39,9 @@ def sobo_pipeline(config):
print(f"SOBO sampling; iteration {RANDOM_ITERS + j}") print(f"SOBO sampling; iteration {RANDOM_ITERS + j}")
job_config = sobo.ask() job_config = sobo.ask()
ptycho_engine = PTYCHOENGINE(job_config) ptycho_engine = PTYCHOENGINE(job_config)
ptycho_engine.run(run_id=f"bo-{j:03d}") ptycho_engine.run(run_id=f"bo-{RANDOM_ITERS + j:03d}")
y_value = ptycho_engine.metric(METRIC) y_value = ptycho_engine.metric(METRIC)
sobo.tell(job_config, y_value) sobo.tell(job_config, y_value)
with open(bo_txt, "a") as f: with open(bo_txt, "a") as f:
p = [f'{job_config['ptycho']['params'][key]:.2f}' for key in sobo.params] p = [f'{job_config['ptycho']['params'][key]:.2f}' for key in sobo.params]
f.write(f"{j: 8d}\t{y_value:.4f}\t{"\t".join(p)}\n") f.write(f"{RANDOM_ITERS + j: 8d}\t{y_value:.4f}\t{"\t".join(p)}\n")
+2 -2
View File
@@ -81,9 +81,9 @@ class FoldSlicePtychoEngine(PtychoEngine):
self._output = loadmat(mat_path) self._output = loadmat(mat_path)
log_fourier_error = self._log_fourier_metric() log_fourier_error = self._log_fourier_metric()
os.makedirs(os.path.join(self.config['io']['result_dir'], "mat"), exist_ok=True) # os.makedirs(os.path.join(self.config['io']['result_dir'], "mat"), exist_ok=True)
os.makedirs(os.path.join(self.config['io']['result_dir'], "tiff"), exist_ok=True) os.makedirs(os.path.join(self.config['io']['result_dir'], "tiff"), exist_ok=True)
shutil.copy(mat_path, os.path.join(self.config['io']['result_dir'], "mat", f"{log_fourier_error:.4f}_{run_id}.mat")) # shutil.copy(mat_path, os.path.join(self.config['io']['result_dir'], "mat", f"{log_fourier_error:.4f}_{run_id}.mat")) # saving .mat files takes a lot of space (expect 20+ GB for 64*64 scan size, 300 iterations)
shutil.copy(image_path, os.path.join(self.config['io']['result_dir'], "tiff", f"{log_fourier_error:.4f}_{run_id}.tiff")) shutil.copy(image_path, os.path.join(self.config['io']['result_dir'], "tiff", f"{log_fourier_error:.4f}_{run_id}.tiff"))