Skip to content

Commit

Permalink
add last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdenker committed Sep 30, 2024
1 parent 65e128d commit 884a654
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 6 additions & 6 deletions bsrem_bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,24 @@ def update(self):
g.multiply(self.x + self.eps, out=self.x_update)
self.x_update.divide(self.average_sensitivity, out=self.x_update)


if self.update_filter is not None:
self.update_filter.apply(self.x_update)

if self.iteration == 0:
step_size = min(max(1/(self.x_update.norm() + 1e-3), 0.001), 3.0)
else:
delta_x = self.x - self.x_prev
delta_g = self.x_update_prev - self.x_update

dot_product = delta_g.dot(delta_x)
alpha_long = delta_x.norm()**2 / np.abs(dot_product)

alpha_long = delta_x.norm()**2 / np.abs(dot_product)

step_size = max(alpha_long, 0.001)
step_size = max(alpha_long, 0.002)

self.x_prev = self.x.copy()
self.x_update_prev = self.x_update.copy()

if self.update_filter is not None:
self.update_filter.apply(self.x_update)


self.x.sapyb(1.0, self.x_update, step_size, out=self.x)

Expand Down
15 changes: 8 additions & 7 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger('petric')
TEAM = os.getenv("GITHUB_REPOSITORY", "SyneRBI/PETRIC-").split("/PETRIC-", 1)[-1]
VERSION = os.getenv("GITHUB_REF_NAME", "")
OUTDIR = Path(f"/o/logs/{TEAM}/{VERSION}" if TEAM and VERSION else "./output/" + "Postprocessing_RDP_FullGD_BB_" + datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))
OUTDIR = Path(f"/o/logs/{TEAM}/{VERSION}" if TEAM and VERSION else "./output/" + "FullGD_" + datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))
if not (SRCDIR := Path("/mnt/share/petric")).is_dir():
SRCDIR = Path("./data")

Expand Down Expand Up @@ -265,10 +265,12 @@ def get_image(fname):
# create list of existing data
# NB: `MetricsWithTimeout` initialises `SaveIters` which creates `outdir`

data_dirs_metrics = [(SRCDIR / "Siemens_mMR_NEMA_IQ", OUTDIR / "Siemens_mMR_NEMA_IQ",
[MetricsWithTimeout(outdir=OUTDIR / "Siemens_mMR_NEMA_IQ", **DATA_SLICES['Siemens_mMR_NEMA_IQ'])]),
(SRCDIR / "Mediso_NEMA_IQ", OUTDIR / "Mediso_NEMA_IQ",
[MetricsWithTimeout(outdir=OUTDIR / "Mediso_NEMA_IQ", **DATA_SLICES['Mediso_NEMA_IQ'])]),
data_dirs_metrics = [ (SRCDIR / "Mediso_NEMA_IQ", OUTDIR / "Mediso_NEMA_IQ",
[MetricsWithTimeout(outdir=OUTDIR / "Mediso_NEMA_IQ", **DATA_SLICES['Mediso_NEMA_IQ'], seconds=40)]),
(SRCDIR / "Siemens_Vision600_thorax", OUTDIR / "Siemens_Vision600_thorax",
[MetricsWithTimeout(outdir=OUTDIR / "Siemens_Vision600_thorax", **DATA_SLICES['Siemens_Vision600_thorax'])]),
(SRCDIR / "Siemens_mMR_NEMA_IQ", OUTDIR / "Siemens_mMR_NEMA_IQ",
[MetricsWithTimeout(outdir=OUTDIR / "Siemens_mMR_NEMA_IQ", **DATA_SLICES['Siemens_mMR_NEMA_IQ'])]),
(SRCDIR / "NeuroLF_Hoffman_Dataset", OUTDIR / "NeuroLF_Hoffman_Dataset",
[MetricsWithTimeout(outdir=OUTDIR / "NeuroLF_Hoffman_Dataset", **DATA_SLICES['NeuroLF_Hoffman_Dataset'])]),
(SRCDIR / "Siemens_mMR_ACR", OUTDIR / "Siemens_mMR_ACR",
Expand All @@ -277,8 +279,7 @@ def get_image(fname):
[MetricsWithTimeout(outdir=OUTDIR / "Siemens_mMR_NEMA_IQ_lowcounts", **DATA_SLICES['Siemens_mMR_NEMA_IQ_lowcounts'])]),
(SRCDIR / "GE_DMI3_Torso",OUTDIR / "GE_Torso",
[MetricsWithTimeout(outdir=OUTDIR / "GE_Torso", **DATA_SLICES['GE_DMI3_Torso'])]),
(SRCDIR / "Siemens_Vision600_thorax", OUTDIR / "Siemens_Vision600_thorax",
[MetricsWithTimeout(outdir=OUTDIR / "Siemens_Vision600_thorax", **DATA_SLICES['Siemens_Vision600_thorax'])]),

]
else:
log.warning("Source directory does not exist: %s", SRCDIR)
Expand Down

0 comments on commit 884a654

Please sign in to comment.