vcat
  • VCAT Documention

Example Notebooks

  • Tutorial Overview
  • Plotting Images
  • Modifying Images
  • Plotting ImageCubes
  • Modifying ImageCubes
  • Alignment
  • Model Component Analysis
  • Ridgeline Fitting
  • Stacking
  • Turnover Frequency

Code Documentation

  • Code Overview
  • ImageData
  • ImageCube
  • vcat.helpers

About

  • License
  • Release Notes
vcat
  • Example Notebooks
  • Stacking
  • Edit on GitHub

In [1]:
Copied!
from vcat import ImageCube
import glob

useDIFMAP=True
from vcat import ImageCube import glob useDIFMAP=True
2025-09-07 21:36:19,717 - INFO - vcat - Logging initialized. Log file: Console only.
2025-09-07 21:36:19,718 - INFO - vcat - No environment variable VCAT_CONFIG found, will use defaults.
2025-09-07 21:36:19,719 - 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!
#Let's load some full polarization test data
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 files
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)

#plot it
im_cube.plot(plot_mode="lin_pol",plot_evpa=True,mode="freq",xlim=[[3,-3],[2,-2],[1,-1]],ylim=[[-3,3],[-2,2],[-1,1]])
#Let's load some full polarization test data 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 files 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) #plot it im_cube.plot(plot_mode="lin_pol",plot_evpa=True,mode="freq",xlim=[[3,-3],[2,-2],[1,-1]],ylim=[[-3,3],[-2,2],[-1,1]])
2025-09-07 21:36:19,822 - INFO - vcat - Importing images:
Processing: 100%|█████████████████████████████████| 6/6 [00:05<00:00,  1.18it/s]
2025-09-07 21:36:24,923 - INFO - vcat - Imported 6 images successfully.
No description has been provided for this image
Out[2]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7fadf17b18b0>
In [3]:
Copied!
#Let's restore them with a common beam per frequency and align them on the brightest pixel
im_cube=im_cube.align(method="brightest",mode="freq",useDIFMAP=useDIFMAP)

#and then perform the stacking (stokes I and polarization will be stacked)
stack=im_cube.stack(mode="freq")

#now we will plot the stacked images
stack.plot(plot_mode="lin_pol",plot_evpa=True,mode="freq",xlim=[[3,-3],[2,-2],[1,-1]],ylim=[[-3,3],[-2,2],[-1,1]])
#Let's restore them with a common beam per frequency and align them on the brightest pixel im_cube=im_cube.align(method="brightest",mode="freq",useDIFMAP=useDIFMAP) #and then perform the stacking (stokes I and polarization will be stacked) stack=im_cube.stack(mode="freq") #now we will plot the stacked images stack.plot(plot_mode="lin_pol",plot_evpa=True,mode="freq",xlim=[[3,-3],[2,-2],[1,-1]],ylim=[[-3,3],[-2,2],[-1,1]])
2025-09-07 21:36:36,992 - INFO - vcat - common beam calculated: [1.3327385097680164, 0.5383666820028091, -9.523150640325944]
2025-09-07 21:36:37,756 - INFO - vcat - common beam calculated: [0.8361407252710993, 0.3104388980597997, -12.665839643857128]
2025-09-07 21:36:38,532 - INFO - vcat - common beam calculated: [0.4901462083728129, 0.17363474893607803, -9.77784035823266]
2025-09-07 21:36:38,532 - INFO - vcat - Regridding images
Processing: 100%|██████████████████████████████| 2/2 [00:00<00:00, 25653.24it/s]
2025-09-07 21:36:38,534 - INFO - vcat - Restoring images
Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00,  4.19s/it]
2025-09-07 21:36:46,918 - INFO - vcat - Image modifications completed.
2025-09-07 21:36:46,922 - INFO - vcat - will apply shift (x,y): [-0.0500000008338108 : 0.0] mas
2025-09-07 21:36:51,142 - INFO - vcat - Regridding images
Processing: 100%|██████████████████████████████| 2/2 [00:00<00:00, 31300.78it/s]
2025-09-07 21:36:51,144 - INFO - vcat - Restoring images
Processing: 100%|█████████████████████████████████| 2/2 [00:07<00:00,  3.87s/it]
2025-09-07 21:36:58,879 - INFO - vcat - Image modifications completed.
2025-09-07 21:36:58,882 - INFO - vcat - will apply shift (x,y): [0.0 : 0.0] mas
2025-09-07 21:37:02,949 - INFO - vcat - Regridding images
Processing: 100%|██████████████████████████████| 2/2 [00:00<00:00, 43018.50it/s]
2025-09-07 21:37:02,952 - INFO - vcat - Restoring images
Processing: 100%|█████████████████████████████████| 2/2 [00:08<00:00,  4.19s/it]
2025-09-07 21:37:11,339 - INFO - vcat - Image modifications completed.
2025-09-07 21:37:11,342 - INFO - vcat - will apply shift (x,y): [-0.01000000002363732 : 0.0] mas
2025-09-07 21:37:15,849 - INFO - vcat - Stacking images for 15.4 GHz.
2025-09-07 21:37:15,859 - INFO - vcat - Stacking Polarization 0.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 138.94it/s]
2025-09-07 21:37:15,893 - INFO - vcat - Stacking Polarization 1.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 189.71it/s]
2025-09-07 21:37:15,922 - INFO - vcat - Stacking Polarization 2.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 174.92it/s]
2025-09-07 21:37:15,981 - INFO - vcat - Stacking images for 23.8 GHz.
2025-09-07 21:37:15,990 - INFO - vcat - Stacking Polarization 0.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 219.26it/s]
2025-09-07 21:37:16,015 - INFO - vcat - Stacking Polarization 1.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 224.38it/s]
2025-09-07 21:37:16,040 - INFO - vcat - Stacking Polarization 2.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 200.74it/s]
2025-09-07 21:37:16,078 - INFO - vcat - Stacking images for 43.2 GHz.
2025-09-07 21:37:16,086 - INFO - vcat - Stacking Polarization 0.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 193.81it/s]
2025-09-07 21:37:16,111 - INFO - vcat - Stacking Polarization 1.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 184.04it/s]
2025-09-07 21:37:16,137 - INFO - vcat - Stacking Polarization 2.
100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 194.55it/s]
No description has been provided for this image
Out[3]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7fadc5ebebe0>
In [4]:
Copied!
#The stacked ImageCube/ImageData behaves like a usual ImageData object, but without corresponding .uvf file
#The observing epoch for a stacked image is arbitrary and therefore automatically set to 3000-01-01
print(stack)

#In general you can continue with the stacked image to perform ridgeline fitting or other analysis steps
#The stacked ImageCube/ImageData behaves like a usual ImageData object, but without corresponding .uvf file #The observing epoch for a stacked image is arbitrary and therefore automatically set to 3000-01-01 print(stack) #In general you can continue with the stacked image to perform ridgeline fitting or other analysis steps
ImageCube for source 0235+164 with 3 frequencies and 1 epoch.
Frequencies [GHz]: 15 GHz, 24 GHz, 43 GHz
Epoch: 3000-01-01
In [ ]:
Copied!

Previous Next

Built with MkDocs using a theme provided by Read the Docs.
GitHub « Previous Next »