Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Refactored logging, and added tests (#338).
- Updated bespoke sdintimaging task, to align with latest CASA version (#347).
- If we don't have any model flux, then overwrite minimum number of major cycles (#359).

### Fixed

Expand Down
20 changes: 18 additions & 2 deletions phangsPipeline/casaImagingRoutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ def clean_loop(
previous_flux = current_flux
current_flux = model_stats['sum'][0]

# In some cases, we may want to overwrite forcing a
# minimum number of loops
force_overwrite_min_loops = False

delta_flux = (current_flux - previous_flux)
if use_absolute_delta:
delta_flux = abs(delta_flux)
Expand All @@ -968,6 +972,9 @@ def clean_loop(
if np.isnan(frac_delta_flux) and loop > 0:
frac_delta_flux = 0

# At this point, doing more loops won't change anything
force_overwrite_min_loops = True

# Check whether the model flux convergence criteria is met

if convergence_fracflux is not None:
Expand All @@ -986,6 +993,12 @@ def clean_loop(
if cumulative_niter >= max_total_niter:
proceed = False

# If there's no change in the flux, then running for more loops
# won't do anything
if delta_flux == 0:
proceed = False
force_overwrite_min_loops = True

# If requested, stop if the integrated model flux becomes
# negative.

Expand Down Expand Up @@ -1034,12 +1047,15 @@ def clean_loop(
noise_conv = None

# Enforce minimum and maximum limits on number of loops. These
# override other convergence criteria.
# override other convergence criteria in most cases.

if loop >= max_loops:
proceed = False
if loop < min_loops:
proceed = True
if force_overwrite_min_loops:
proceed = False
else:
proceed = True

# Generate a record line and print the current status to the screen

Expand Down
Loading