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
  • Plotting ImageCubes
  • Edit on GitHub

In [1]:
Copied!
from vcat import ImageCube
import glob
from IPython.display import Video

#general settings:
useDIFMAP=True
difmap_path="/usr/local/difmap/uvf_difmap_2.5g/"
from vcat import ImageCube import glob from IPython.display import Video #general settings: useDIFMAP=True difmap_path="/usr/local/difmap/uvf_difmap_2.5g/"
2025-09-07 21:07:56,046 - INFO - vcat - Logging initialized. Log file: Console only.
2025-09-07 21:07:56,047 - INFO - vcat - No environment variable VCAT_CONFIG found, will use defaults.
2025-09-07 21:07:56,047 - 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
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,
                                difmap_path=difmap_path)

#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 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, difmap_path=difmap_path) #print basic info print(im_cube)
2025-09-07 21:07:56,158 - INFO - vcat - Importing images:
Processing: 100%|█████████████████████████████████| 6/6 [00:05<00:00,  1.12it/s]
2025-09-07 21:08:01,522 - 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)
No description has been provided for this image
Out[3]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7fe732355670>
In [4]:
Copied!
#We can choose to swap the plot axis and have frequency displayed vertically and epochs horizontally
swap_axis=True

#Additionally we have the same options as for the ImageData plot for every image, but also per epoch and frequency
#Let's say we want adjust the plot limits for every frequency separately, this can be done as follows
mode="freq"
xlim=[[5,-5],[3,-3],[2,-2]] #provide xlim for every frequency, ascending order
ylim=[[-5,5],[-3,3],[-2,2]] #provide ylim for every frequency, ascending order

im_cube.plot(swap_axis=True,mode=mode,xlim=xlim,ylim=ylim,plot_mode="lin_pol",plot_evpa=True)
#We can choose to swap the plot axis and have frequency displayed vertically and epochs horizontally swap_axis=True #Additionally we have the same options as for the ImageData plot for every image, but also per epoch and frequency #Let's say we want adjust the plot limits for every frequency separately, this can be done as follows mode="freq" xlim=[[5,-5],[3,-3],[2,-2]] #provide xlim for every frequency, ascending order ylim=[[-5,5],[-3,3],[-2,2]] #provide ylim for every frequency, ascending order im_cube.plot(swap_axis=True,mode=mode,xlim=xlim,ylim=ylim,plot_mode="lin_pol",plot_evpa=True)
No description has been provided for this image
Out[4]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7fe779a44220>
In [5]:
Copied!
#Currently the colormaps and contours of every image are treated independently, but we can combine them
shared_colormap="freq" #to use the same contours and colormap for every frequeny (other options 'all','epoch')
shared_sigma="max" #to use the maximum noise cut from the combined images (otherwise minimum)

#Additionally, if you want to plot a shared colorbar, this is possible using
shared_colorbar=True

#this effect becomes better visible in total intensity, so we will use
plot_mode="stokes_i"

#and we need to turn on the colormap in general
im_colormap=True
im_color="viridis"

#let's create the plot
im_cube.plot(mode=mode,xlim=xlim,ylim=ylim,plot_mode="stokes_i",im_colormap=im_colormap,im_color=im_color,
             shared_colormap=shared_colormap,shared_sigma=shared_sigma,shared_colorbar=shared_colorbar)
#Currently the colormaps and contours of every image are treated independently, but we can combine them shared_colormap="freq" #to use the same contours and colormap for every frequeny (other options 'all','epoch') shared_sigma="max" #to use the maximum noise cut from the combined images (otherwise minimum) #Additionally, if you want to plot a shared colorbar, this is possible using shared_colorbar=True #this effect becomes better visible in total intensity, so we will use plot_mode="stokes_i" #and we need to turn on the colormap in general im_colormap=True im_color="viridis" #let's create the plot im_cube.plot(mode=mode,xlim=xlim,ylim=ylim,plot_mode="stokes_i",im_colormap=im_colormap,im_color=im_color, shared_colormap=shared_colormap,shared_sigma=shared_sigma,shared_colorbar=shared_colorbar)
No description has been provided for this image
Out[5]:
<vcat.plots.multi_fits_image.MultiFitsImage at 0x7fe7302c84f0>
In [9]:
Copied!
#In addition to plotting images, we can also plot the evolution of given parameters across time and frequencies
#Let's say we want to plot the flux density
values="flux" #additional options are 'linpol','frac_pol', 'evpa', 'noise', 'polnoise'

#additionally, we can specify colors and markers for the different frequencies, ascending
colors=["blue","red","orange"] #color for every frequency
markers=[".","*","+"] #markertype for every frequency

im_cube.plot_evolution("flux",colors=colors,markers=markers)
#In addition to plotting images, we can also plot the evolution of given parameters across time and frequencies #Let's say we want to plot the flux density values="flux" #additional options are 'linpol','frac_pol', 'evpa', 'noise', 'polnoise' #additionally, we can specify colors and markers for the different frequencies, ascending colors=["blue","red","orange"] #color for every frequency markers=[".","*","+"] #markertype for every frequency im_cube.plot_evolution("flux",colors=colors,markers=markers)
No description has been provided for this image
Out[9]:
<vcat.plots.evolution_plot.EvolutionPlot at 0x7fe714ed42b0>
In [7]:
Copied!
#If you're feeling fancy, you can also create interpolated videos between the images (including all above plot options)

#Let's say we want to create a linpol movie for 15 GHz between the two epochs:
n_frames=200 #number of frames
interval=50 #interval in ms between the frames
freq=15 #let's choose 15GHz
save="movie.mp4" #Choose file name

#additional plot options
xlim=[5,-5]
ylim=[-5,5]
plot_mode="lin_pol"
plot_evpa=True

#Let's render the movie (NOTE: This may take some time, depending on n_frames!)
im_cube.movie(freq=freq,n_frames=n_frames,interval=interval,save=save,xlim=xlim,ylim=ylim,
              plot_mode=plot_mode,plot_evpa=plot_evpa)

#And display it
Video(save, embed=True)
#If you're feeling fancy, you can also create interpolated videos between the images (including all above plot options) #Let's say we want to create a linpol movie for 15 GHz between the two epochs: n_frames=200 #number of frames interval=50 #interval in ms between the frames freq=15 #let's choose 15GHz save="movie.mp4" #Choose file name #additional plot options xlim=[5,-5] ylim=[-5,5] plot_mode="lin_pol" plot_evpa=True #Let's render the movie (NOTE: This may take some time, depending on n_frames!) im_cube.movie(freq=freq,n_frames=n_frames,interval=interval,save=save,xlim=xlim,ylim=ylim, plot_mode=plot_mode,plot_evpa=plot_evpa) #And display it Video(save, embed=True)
2025-09-07 21:08:43,525 - INFO - vcat - Creating movie
Processing:   0%|                                       | 0/200 [00:00<?, ?it/s]2025-09-07 21:08:43,527 - INFO - matplotlib.animation - Animation.save using <class 'matplotlib.animation.FFMpegWriter'>
2025-09-07 21:08:43,527 - INFO - matplotlib.animation - MovieWriter._run: running command: ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1440 -pix_fmt rgba -r 20 -loglevel error -i pipe: -vcodec h264 -pix_fmt yuv420p -y movie.mp4
Processing: 201it [09:30,  2.96s/it]                                            2025-09-07 21:18:17,191 - INFO - vcat - Movie for 15GHz exported as 'movie.mp4'
Processing: 201it [09:33,  2.85s/it]
Out[7]:
Your browser does not support the video tag.
No description has been provided for this image
In [ ]:
Copied!

Previous Next

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