Goal
[1]:
msname = "./AS110/scienceData.RACS_0012+00.SB45305.RACS_0012+00.beam00_averaged_cal.leakage.ms/"
Imaging with ASKAP imager
[2]:
from taitale import taitale_env
env = taitale_env(
image = "csirocass/askapsoft",
tag = "1.17.6-openmpi4"
)
[3]:
from taitale.askap import imager, mslist
mslist(env=env, args=f"--full {msname}", logfile="mslist.txt")
Starting mslist
mslist complete
[4]:
!cat mslist.txt
Debug: registered context Global=0
2025-02-14 10:05:29 INFO Observer: Project:
2025-02-14 10:05:29 INFO + Observation: ASKAP(36 antennas)
2025-02-14 10:05:29 INFO MSMetaData::_computeScanAndSubScanProperties Computing scan and subscan properties...
2025-02-14 10:05:29 INFO Data records: 21312 Total elapsed time = 318.505 seconds
2025-02-14 10:05:29 INFO + Observed from 29-Oct-2022/14:11:38.4 to 29-Oct-2022/14:16:56.9 (UTC)
2025-02-14 10:05:29 INFO
2025-02-14 10:05:29 INFO Fields: 1
2025-02-14 10:05:29 INFO + ID Code Name RA Decl Epoch nRows
2025-02-14 10:05:29 INFO + 0 RACS_0012+00 00:12:24.827000 +00.00.00.00000 J2000 21312
2025-02-14 10:05:29 INFO Spectral Windows: (1 unique spectral windows and 1 unique polarization setups)
2025-02-14 10:05:29 INFO + SpwID Name #Chans Frame Ch0(MHz) ChanWid(kHz) TotBW(kHz) CtrFreq(MHz) Corrs
2025-02-14 10:05:29 INFO + 0 NO_NAME 288 TOPO 743.991 1000.000 288000.0 887.4907 XX XY YX YY
2025-02-14 10:05:29 INFO The SOURCE table is absent: see the FIELD table
2025-02-14 10:05:29 INFO + Antennas: 36 'name'='station'
2025-02-14 10:05:29 INFO + ID= 0-3: 'ak01'='ASKAP', 'ak02'='ASKAP', 'ak03'='ASKAP', 'ak04'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 4-7: 'ak05'='ASKAP', 'ak06'='ASKAP', 'ak07'='ASKAP', 'ak08'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 8-11: 'ak09'='ASKAP', 'ak10'='ASKAP', 'ak11'='ASKAP', 'ak12'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 12-15: 'ak13'='ASKAP', 'ak14'='ASKAP', 'ak15'='ASKAP', 'ak16'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 16-19: 'ak17'='ASKAP', 'ak18'='ASKAP', 'ak19'='ASKAP', 'ak20'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 20-23: 'ak21'='ASKAP', 'ak22'='ASKAP', 'ak23'='ASKAP', 'ak24'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 24-27: 'ak25'='ASKAP', 'ak26'='ASKAP', 'ak27'='ASKAP', 'ak28'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 28-31: 'ak29'='ASKAP', 'ak30'='ASKAP', 'ak31'='ASKAP', 'ak32'='ASKAP',
2025-02-14 10:05:29 INFO + ID= 32-35: 'ak33'='ASKAP', 'ak34'='ASKAP', 'ak35'='ASKAP', 'ak36'='ASKAP'
2025-02-14 10:05:29 INFO The HISTORY table is empty
[5]:
source_name = "RACS_0012+00"
image_name = f"image.i.{source_name}"
nchan = 288
ra="00:12:24.827000"
dec="+00.00.00.00000"
direction=f"[{ra}, {dec}, J2000]"
[7]:
from taitale.askap import imager
imaging_workers = 1
nchanpercore = nchan // imaging_workers
print(f"channels: {nchan}")
print(f"nchanpercore: {nchanpercore}")
print(f"mpi_workers: {imaging_workers}")
# Default parset for Clean used
imager(
env=env,
workers=imaging_workers+1,
parset="./parsets/cimager.in",
args={
"dataset": f"./{msname}",
"Images.Names": image_name,
f"Images.{image_name}.direction": direction,
f"Images.{image_name}.nchan": 1,
f"Images.{image_name}.nterms": 2,
"Images.shape": "[2048, 2048]",
"Images.cellsize": "['2.5arcsec', '2.5arcsec']",
"nchanpercore": nchanpercore,
"restore": True,
}
)
channels: 288
nchanpercore: 288
mpi_workers: 1
Starting imager
Debug: registered context Global=0
Debug: registered context Global=0
imager complete
[28]:
# Let's have a look at our image
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from astropy.io import fits
from astropy.wcs import WCS
%matplotlib inline
file = f'image.i.{source_name}.taylor.0.restored.fits'
# Using one of the files to setup WCS projection
hdu = fits.open(file)[0]
wcs = WCS(hdu.header, naxis=2)
fig, ax = plt.subplots(1, 1, figsize=(6, 6), subplot_kw=dict(projection=wcs))
print(fits.info(file))
hdu = fits.open(file)[0]
im = ax.imshow(hdu.data[0,0,:,:], origin='lower', cmap='viridis')
# , norm=mcolors.PowerNorm(0.3))
ax.set_xlabel('RA')
ax.set_ylabel('Dec')
ax.set_autoscale_on(False)
ax.set_title(file)
# plt.colorbar(im, ax=ax)
plt.show()
Filename: image.i.RACS_0012+00.taylor.0.restored.fits
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 64 (2048, 2048, 1, 1) float32
None
Imaging the same data with wsclean
Note: This example is using an image of wsclean made by the community
[16]:
# Note: This is a community image
wsclean_env = taitale_env(
runtime="container",
image="docker.io/alecthomson/wsclean",
tag="v3.5",
)
[17]:
wsclean_env
[17]:
{'runtime': 'container',
'engine': 'podman',
'image': 'docker.io/alecthomson/wsclean',
'tag': 'v3.5',
'workload_manager': 'mpi',
'dirty': 'False',
'user_defaults': True,
'dryrun': 'False',
'ipy': 'False',
'mpi': {'workload_exec': 'mpiexec -n {workers} {cmd}'},
'slurm': {'workload_exec': 'srun --nodes={nodes} --ntasks={workers} {cmd}'},
'native': {'exec': '{workload_exec} > {logfile}{pipestderr}'},
'container': {'exec': '{engine} run --rm -v $PWD:/wsclean/:U {image}:{tag} {workload_exec} > {logfile}{pipestderr}'}}
[26]:
from taitale.tools import wsclean
wsclean(
env=wsclean_env,
args="-no-update-model-required -verbose "
"-size 2048 2048 -scale 2.5arcsec -pol I -mgain 0.85 -niter 50000 "
"-auto-threshold 3 -log-time "
f"-no-mf-weighting -name wsclean-{source_name} {msname}"
)
Starting wsclean
wsclean complete
[29]:
# Let's have a look at our image
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from astropy.io import fits
from astropy.wcs import WCS
%matplotlib inline
file = f'wsclean-RACS_0012+00-image.fits'
# Using one of the files to setup WCS projection
hdu = fits.open(file)[0]
wcs = WCS(hdu.header, naxis=2)
fig, ax = plt.subplots(1, 1, figsize=(6, 6), subplot_kw=dict(projection=wcs))
print(fits.info(file))
hdu = fits.open(file)[0]
im = ax.imshow(hdu.data[0,0,:,:], origin='lower', cmap='viridis')
# , norm=mcolors.PowerNorm(0.3))
ax.set_xlabel('RA')
ax.set_ylabel('Dec')
ax.set_autoscale_on(False)
ax.set_title(file)
# plt.colorbar(im, ax=ax)
plt.show()
Filename: wsclean-RACS_0012+00-image.fits
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 67 (2048, 2048, 1, 1) float32
None
[ ]: