Skip to content

Commit

Permalink
move should zero data
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Nov 26, 2024
1 parent 824bf07 commit cfee369
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions autoarray/dataset/imaging/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@ def apply_noise_scaling(
If True, the data values in the masked region are set to zero.
"""

if signal_to_noise_value is None:
noise_map = self.noise_map.native
noise_map[mask == False] = noise_value
else:
noise_map = np.where(
mask == False,
np.abs(self.data.native) / signal_to_noise_value,
self.noise_map.native,
)

if should_zero_data:
data = np.where(np.invert(mask), 0.0, self.data.native)
else:
Expand All @@ -394,16 +404,6 @@ def apply_noise_scaling(
pixel_scales=self.data.pixel_scales,
)

if signal_to_noise_value is None:
noise_map = self.noise_map.native
noise_map[mask == False] = noise_value
else:
noise_map = np.where(
mask == False,
np.abs(data.native) / signal_to_noise_value,
self.noise_map.native,
)

noise_map = Array2D.no_mask(
values=noise_map,
shape_native=self.data.shape_native,
Expand Down

0 comments on commit cfee369

Please sign in to comment.