Skip to content

Commit

Permalink
Rework linmos call
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecThomson committed Jan 15, 2025
1 parent bec4679 commit 5006266
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions flint/prefect/flows/polarisation_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def process_science_fields_pol(
fixed_beam_shape=pol_field_options.fixed_beam_shape,
)

linmos_result_list: list[PrefectFuture[LinmosResult]] = []
stokes_beam_cubes: dict[str, list[PrefectFuture[Path]]] = {}
for polarisation, image_set_list in image_sets_dict.items():
with tags(f"polarisation-{polarisation}"):

Check warning on line 135 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L133-L135

Added lines #L133 - L135 were not covered by tests
# Get the individual Stokes parameters in case of joint imaging
Expand Down Expand Up @@ -171,15 +171,26 @@ def process_science_fields_pol(
remove_original_images=True,
)
beam_cubes.append(cube_path)
stokes_beam_cubes[stokes] = beam_cubes

Check warning on line 174 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L173-L174

Added lines #L173 - L174 were not covered by tests

linmos_result = task_linmos_images.submit(
images=beam_cubes,
container=pol_field_options.yandasoft_container,
holofile=pol_field_options.holofile,
cutoff=pol_field_options.pb_cutoff,
field_summary=field_summary,
)
linmos_result_list.append(linmos_result)
linmos_result_list: list[PrefectFuture[LinmosResult]] = []

Check warning on line 176 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L176

Added line #L176 was not covered by tests
# We run linmos now to ensure we have Stokes I images for leakage correction
# If we have not imaged Stokes I, we cannot do leakage correction
force_remove_leakage: bool | None = None
if "i" not in stokes_beam_cubes.keys():
force_remove_leakage = False

Check warning on line 181 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L179-L181

Added lines #L179 - L181 were not covered by tests

for stokes, beam_cubes in stokes_beam_cubes.items():
linmos_result = task_linmos_images.submit(

Check warning on line 184 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L183-L184

Added lines #L183 - L184 were not covered by tests
images=beam_cubes,
container=pol_field_options.yandasoft_container,
holofile=pol_field_options.holofile,
cutoff=pol_field_options.pb_cutoff,
field_summary=field_summary,
stokesi_images=stokes_beam_cubes.get("i"),
force_remove_leakage=force_remove_leakage,
)
linmos_result_list.append(linmos_result)

Check warning on line 193 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L193

Added line #L193 was not covered by tests

# wait for all linmos results to be completed
_ = [linmos_result.result() for linmos_result in linmos_result_list]

Check warning on line 196 in flint/prefect/flows/polarisation_pipeline.py

View check run for this annotation

Codecov / codecov/patch

flint/prefect/flows/polarisation_pipeline.py#L196

Added line #L196 was not covered by tests
Expand Down

0 comments on commit 5006266

Please sign in to comment.