In [1]:
Copied!
from vcat import ImageCube
import glob
#general settings:
useDIFMAP=True
from vcat import ImageCube
import glob
#general settings:
useDIFMAP=True
2025-09-07 21:24:13,564 - INFO - vcat - Logging initialized. Log file: Console only. 2025-09-07 21:24:13,565 - INFO - vcat - No environment variable VCAT_CONFIG found, will use defaults. 2025-09-07 21:24:13,565 - INFO - vcat - Using DIFMAP path: /usr/local/difmap/uvf_difmap_2.5g/
Thank you for using VCAT. Have fun with VLBI! If you are using this package please cite VCAT Team et al. 2025 ....
In [2]:
Copied!
#Import Multi-Epoch, Multi-Frequency Data as an ImageCube
fits_files=glob.glob("../dataset_example/0235+164/**/*.icn.fits",recursive=True)
uvf_files=glob.glob("../dataset_example/0235+164/**/*.uvf",recursive=True)
stokes_q_files=glob.glob("../dataset_example/0235+164/**/*.qcn.fits",recursive=True)
stokes_u_files=glob.glob("../dataset_example/0235+164/**/*.ucn.fits",recursive=True)
#Import the data as an ImageCube
#import data
im_cube=ImageCube().import_files(fits_files=fits_files,
uvf_files=uvf_files,
stokes_q_files=stokes_q_files,
stokes_u_files=stokes_u_files)
#print basic info
print(im_cube)
#Import Multi-Epoch, Multi-Frequency Data as an ImageCube
fits_files=glob.glob("../dataset_example/0235+164/**/*.icn.fits",recursive=True)
uvf_files=glob.glob("../dataset_example/0235+164/**/*.uvf",recursive=True)
stokes_q_files=glob.glob("../dataset_example/0235+164/**/*.qcn.fits",recursive=True)
stokes_u_files=glob.glob("../dataset_example/0235+164/**/*.ucn.fits",recursive=True)
#Import the data as an ImageCube
#import data
im_cube=ImageCube().import_files(fits_files=fits_files,
uvf_files=uvf_files,
stokes_q_files=stokes_q_files,
stokes_u_files=stokes_u_files)
#print basic info
print(im_cube)
2025-09-07 21:24:13,660 - INFO - vcat - Importing images: Processing: 100%|█████████████████████████████████| 6/6 [00:05<00:00, 1.15it/s] 2025-09-07 21:24:18,868 - INFO - vcat - Imported 6 images successfully.
ImageCube for source 0235+164 with 3 frequencies and 2 epochs. Frequencies [GHz]: 15 GHz, 24 GHz, 43 GHz Epochs: 2022-08-01, 2022-08-19
In [3]:
Copied!
#Create plot of the data
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
#Create plot of the data
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
Out[3]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7f58b31ff910>
In [4]:
Copied!
#You now have different operations available to apply directly to the ImageCube
#Let's start by regridding all images to the same grid
im_cube=im_cube.regrid(mode="all",npix=1024,pixel_size=0.1,useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
#You now have different operations available to apply directly to the ImageCube
#Let's start by regridding all images to the same grid
im_cube=im_cube.regrid(mode="all",npix=1024,pixel_size=0.1,useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
2025-09-07 21:24:29,670 - INFO - vcat - Regridding images Processing: 100%|█████████████████████████████████| 6/6 [00:26<00:00, 4.37s/it]
Out[4]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7f58d5715b80>
In [5]:
Copied!
#This doesn't look too good, but you can choose a custom grid per epoch or frequency
#Let's try this
im_cube=im_cube.regrid(mode="freq",npix=[1024,1024,1024],pixel_size=[0.02,0.01,0.005],useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
#This doesn't look too good, but you can choose a custom grid per epoch or frequency
#Let's try this
im_cube=im_cube.regrid(mode="freq",npix=[1024,1024,1024],pixel_size=[0.02,0.01,0.005],useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
2025-09-07 21:25:06,829 - INFO - vcat - Regridding images Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00, 4.46s/it] Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00, 4.25s/it] Processing: 100%|█████████████████████████████████| 2/2 [00:09<00:00, 4.64s/it]
Out[5]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7f58c61c4100>
In [6]:
Copied!
#You can also easily restore the images with a common beam
im_cube=im_cube.restore(mode="freq",useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
#You can also easily restore the images with a common beam
im_cube=im_cube.restore(mode="freq",useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
2025-09-07 21:25:43,933 - INFO - vcat - Determining common beam... 2025-09-07 21:25:44,949 - INFO - vcat - common beam calculated: [1.3327385097680164, 0.5383666820028091, -9.523150640325944] 2025-09-07 21:25:45,680 - INFO - vcat - common beam calculated: [0.8361407252710993, 0.3104388980597997, -12.665839643857128] 2025-09-07 21:25:46,436 - INFO - vcat - common beam calculated: [0.4901462083728129, 0.17363474893607803, -9.77784035823266] 2025-09-07 21:25:46,437 - INFO - vcat - Restoring images Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00, 4.35s/it] Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00, 4.02s/it] Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00, 4.31s/it] 2025-09-07 21:26:11,815 - INFO - vcat - Image modifications completed.
Out[6]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7f58b1cdcfa0>
In [7]:
Copied!
#As you can see, this setting used a seperate common beam per frequency.
#If you use mode="all" the common beam will be calculated for all images
#If you use mode="epoch" the common beam will be calculated for each epoch like so:
im_cube=im_cube.restore(mode="epoch",useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
#As you can see, this setting used a seperate common beam per frequency.
#If you use mode="all" the common beam will be calculated for all images
#If you use mode="epoch" the common beam will be calculated for each epoch like so:
im_cube=im_cube.restore(mode="epoch",useDIFMAP=useDIFMAP)
#plot the result
im_cube.plot(plot_mode="lin_pol",plot_evpa=True)
2025-09-07 21:26:23,066 - INFO - vcat - Determining common beam... 2025-09-07 21:26:25,694 - INFO - vcat - common beam calculated: [1.3326499289035556, 0.5383181920507557, -9.522621341313686] 2025-09-07 21:26:28,402 - INFO - vcat - common beam calculated: [1.3326499289035556, 0.5383181920507557, -9.522621341313686] 2025-09-07 21:26:28,403 - INFO - vcat - Restoring images Processing: 100%|█████████████████████████████████| 2/2 [00:27<00:00, 13.63s/it] 2025-09-07 21:26:55,659 - INFO - vcat - Image modifications completed.
Out[7]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7f58c61c4430>
In [ ]:
Copied!
In [ ]:
Copied!