Skip to content

Commit

Permalink
remove split approach
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Apr 8, 2024
1 parent d07a0db commit 28479c5
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions aces/imaging/write_tclean_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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"]]
Expand Down

0 comments on commit 28479c5

Please sign in to comment.