Fix a high priority bug with the masking system which was introduced in the switch to reconstructors classes

This commit is contained in:
2025-10-24 15:11:46 +02:00
parent fbfbf4fa87
commit e38ebd7372
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ class Reconstructor:
sim_patterns = self.model.forward(*inp)
# Calculate the loss
if hasattr(self, 'mask'):
if hasattr(self.model, 'mask'):
loss = self.model.loss(pats,
sim_patterns,
mask=self.model.mask)
+4
View File
@@ -52,6 +52,10 @@ def test_lab_ptycho(lab_ptycho_cxi, reconstruction_device, show_plot):
print('\nTesting performance on the standard transmission ptycho dataset')
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(lab_ptycho_cxi)
# Test the masking system
dataset.mask[110:115,65:70] = 0
dataset.patterns[...,~dataset.mask] = t.max(dataset.patterns)
model = cdtools.models.FancyPtycho.from_dataset(
dataset,
n_modes=3,