From 24234acf5fcb77e46f2e6ee728615537740b7df1 Mon Sep 17 00:00:00 2001 From: Elias Oakes Date: Mon, 8 Jun 2026 23:42:20 -0400 Subject: [PATCH] Fix stokes passed as integer string to imsubimage in 4D mosaic path imsubimage expects a polarization name like 'I', not an integer index like '0'. Fix by reading stokes labels from the already-open myia_sum coordinate system. Add changelog entry --- CHANGELOG.md | 1 + phangsPipeline/casaMosaicRoutines.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11bc122f..c03be3db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Large-cube memory issues with channel-wise processing (#323) - Fixed TP crash when different atmospheric correction types are used (#343). - Calculation of additional number of channels in regrid mstransform call (#344). +- Fix stokes passed as integer string to imsubimage in 4D mosaic path (#349). ### Dependencies - Bump actions/upload-artifact from 6 to 7 (#313). diff --git a/phangsPipeline/casaMosaicRoutines.py b/phangsPipeline/casaMosaicRoutines.py index 3aa3f879..38caa59b 100644 --- a/phangsPipeline/casaMosaicRoutines.py +++ b/phangsPipeline/casaMosaicRoutines.py @@ -1207,7 +1207,11 @@ def mosaic_aligned_data( nchan = cube_shape[2] total = nstokes * nchan logger.info(f'Processing {nstokes} Stokes x {nchan} channels = {total} planes') - + + csys_tmp = myia_sum.coordsys() + stokes_labels = csys_tmp.stokes() + csys_tmp.done() + counter = 0 for istokes in range(nstokes): for ichan in range(nchan): @@ -1222,7 +1226,7 @@ def mosaic_aligned_data( for idx, im in enumerate(local_imlist): temp_chan = f'temp_ch{ichan}_st{istokes}_img{idx}' casaStuff.imsubimage(imagename=im, outfile=temp_chan, - chans=str(ichan), stokes=str(istokes), + chans=str(ichan), stokes=stokes_labels[istokes], dropdeg=False) temp_chan_images.append(temp_chan)