From 28479c5702917990b19406efb051f231a4480511 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Sun, 7 Apr 2024 22:27:28 -0400 Subject: [PATCH] remove split approach --- aces/imaging/write_tclean_scripts.py | 42 +++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/aces/imaging/write_tclean_scripts.py b/aces/imaging/write_tclean_scripts.py index 82661807..c8fea7c1 100644 --- a/aces/imaging/write_tclean_scripts.py +++ b/aces/imaging/write_tclean_scripts.py @@ -153,24 +153,29 @@ def main(): if 'aggregate' in spwsel: def rename(x): - x = x.replace(".ms", f"_{spwsel}.ms") + # x = x.replace(".ms", f"_{spwsel}.ms") return os.path.join(tempdir_name, os.path.basename(x)) - splitcmd = "\n".join( - [textwrap.dedent( - f""" - split(vis="{x}", - outputvis="{rename(x)}", - spw="{spw_selection}", - width=10, - field='Sgr_A_star', - )\n - """) - for x, spw_selection in zip(tcpars['vis'], tcpars['spw']) - ] - ) - - splitcmd = copycmds = splitcmd + "\n".join( + # This was a great idea, but it totally didn't work because there are multiple steps involved + # You can't just split out the channels you want, you have to flag them, then average them, + # then remove the flags. + # splitcmd = "\n".join( + # [textwrap.dedent( + # f""" + # if not os.path.exists("{rename(x)}"): + # # split(), but w/mstransform + # mstransform(vis="{x}", + # outputvis="{rename(x)}", + # spw="{spw_selection}", + # field='Sgr_A_star', + # )\n + # """) + # for x, spw_selection in zip(tcpars['vis'], tcpars['spw']) + # ] + # ) + # splitcmd = copycmds = splitcmd + "\n".join( + + splitcmd = copycmds = "\n".join( ["import shutil"] + [textwrap.dedent( f""" @@ -217,9 +222,8 @@ def rename(x): spw={spw}) """) for vis in tcpars['vis']] - # for both aggregate & line: - # the spw selection should now be 'everything in the MS' - tcpars['spw'] = '' + # Only for lines + tcpars['spw'] = '' # all 'vis' must be renamed because of their new locations tcpars['vis'] = [rename(x) for x in tcpars["vis"]]