EHTImages.intensityimage_metadata_compat
— Constantintensityimage_metadata_compat::NamedTuple
A tuple of available values for some of keys in intensityimage_metadata_default
.
EHTImages.intensityimage_metadata_default
— Constantintensityimage_metadata_default::NamedTuple
A tuple for the default metadata keys and values for AbstractIntensityImage
.
EHTImages.intensityimage_metadata_type
— Constantintensityimage_metadata_default::NamedTuple
A tuple of types for metadata keys in intensityimage_metadata_default
.
EHTImages.ncd_intensity_defaultgroup
— Constantncd_intensity_defaultgroup::String
Default group name of the EHT Intensity Image NetCDF4 format.
EHTImages.ncd_intensity_dimnames
— Constantncd_intensity_dimnames::NamedTuple
A named tuple relating Symbols to actual strings for the dimension of the EHT Intensity Image NetCDF4 format. keys are :x, :y
for x and y axis, :p
for polarization, :f
for frequency, :t
for time.
EHTImages.ncd_intensity_metadata_typeconv
— Constantncd_intensity_metadata_typeconv::NamedTuple
A named tuple relating Symbols to types of the corresponding variables of the EHT Intensity Image NetCDF4 format.
EHTImages.ncd_intensity_vardims
— Constantncd_intensity_vartypes::NamedTuple
A named tuple relating Symbols to types of the corresponding variables of the EHT Intensity Image NetCDF4 format.
EHTImages.ncd_intensity_varnames
— Constantncd_intensity_varnames::NamedTuple
A named tuple relating Symbols to names of the corresponding variables of the EHT Intensity Image NetCDF4 format.
EHTImages.ncd_intensity_vartypes
— Constantncd_intensity_vartypes::NamedTuple
A named tuple relating Symbols to types of the corresponding variables of the EHT Intensity Image NetCDF4 format.
EHTImages.AbstractImageDataSet
— Typeabstract type AbstractImageDataSet
The abstract type for image data sets handled in this module. AbstractImageDataSet works as an Abstract Array-ish. To make it, each image type needs to have four following methods. (see: Julia Documentation for "Interfaces")
Mandatory Methods that need to be defined
default_metadata
: Return the default metadata for the image data set.isdiskdata
: Determines whether the data is disk-based or memory-based. ReturnIsDiskData()
if data is disk-based, while returnNotDiskData()
if data is memory-based.isopen
: Check if data is accessible, return true for accessible data and false if data is not accessible. This is relevant if image is based on disk data.iswritable
: Check if data is accessible, returntrue
for accessible data andfalse
if data is not accessible. This is relevant if image is based on disk data.
Methods provided
size
: returning a tuple containing the dimension ofAbstractImageDataSet.data
getindex
: scalar or vector indexingsetindex!
: scalar or vector indexing assignmentfirstindex
: returning the first index, used inX[begin]
lastindex
: returning the last index, used inX[end]
IndexStyle
: returning the index style
EHTImages.AbstractIntensityImage
— Typeabstract type AbstractIntensityImage <: AbstractImageDataSet
This defines a basic interface for intensity images. It is a subtype of AbstractImageDataSet
.
Mandatory fields
data
: 5 dimensional array for intensity [x, y, polarization, frequency, time]p
: 1 dimensional array for polarization codes in string (coordinate for polarization axis)f
: 1 dimensional array for frequency in Hz (coordinate for frequency axis)t
: 1 dimensional array for time in modified Julian dates (coordinate for time axis)metadata
: Dict-like object to stock metadata
Mandatory methods need to be defined.
See also documentations for AbstractImageDataSet
.
EHTImages.DataStorageType
— Typeabstract type DataStorageType
Internal type for specifying the nature of the location of data.
EHTImages.DiskIntensityImage
— Typemutable struct DiskIntensityImage <: AbstractIntensityImage
A data type for five dimensional images of which data are all stored in disk using the NetCDF4 format. This format relies on NCDatasets
to provide an easy access of data through many useful methods in the NCDatasets
package. Note that this data type could be either mutable or immutable depending on the access mode to the NetCDF4 file.
filename::Any
: name of the corresponding NetCDF4 file Default: nothinggroup::Any
: group name of the corresponding image data set Default: nothingdata::Any
: five dimensional intensity disbrituion. Default: nothingmetadata::Any
: metadata. Default: nothingt::Any
: polarization code, giving the parization axis (:p
). Default: nothingf::Any
: central frequency in Hz, giving the frequency axis (:f
). Default: nothingp::Any
: central modified Julian date, giving the time axis (:t
). Default: nothingdataset::Any
: Default: nothing
EHTImages.IntensityImage
— Typestruct IntensityImage <: AbstractIntensityImage
A data type for five dimensional images of which data are all stored in the memory. This format relies on EHTDimensionalData.DimArray
to provide an easy access of data through many useful methods in EHTDimensionalData
and its origin DimensionalData
packages. Note that this data type is immutable.
dimstack::DimensionalData.DimStack
:DimArray
storing all ofdata
,p
,f
,t
andmetadata
.data::Array{Float64, 5}
: the five dimensional intensity disbrituion. Alias todimstack.intensity.data
.metadata::OrderedCollections.OrderedDict{Symbol, Any}
: metadata. Aliast todimarray.metadata
.p::Vector{String}
: the polarization code, giving the polarization axis (:p
) ofdimarray
. Alias todimarray.dims[3].val.data
.f::Vector{Float64}
: the central frequency in Hz, giving the frequency axis (:f
) ofdimarray
. Alias todimarray.dims[4].val.data
.t::Vector{Float64}
: the central modified Julian date, giving the time axis (:t
) ofdimarray
. Alias todimarray.dims[5].val.data
.
EHTImages.IsDiskData
— Typestruct IsDiskData <: EHTImages.DataStorageType
Defines a trait that a states that data is disk based.
EHTImages.NotDiskData
— Typestruct NotDiskData <: EHTImages.DataStorageType
Defines a trait that a states that data is memory based.
Base.close
— Methodclose(image::DiskIntensityImage)
Close the access to the associated NetCDF4 file. This function is an alias to close!(image).
Base.isopen
— Methodisopen(_::AbstractImageDataSet) -> Bool
Check if data is accessible, return true
for accessible data and false
if data is not accessible. This is relevant if image is based on disk data.
Base.iswritable
— Methodiswritable(_::AbstractImageDataSet) -> Bool
Check if data is accessible, return true
for accessible data and false
if data is not accessible. This is relevant if image is based on disk data.
ComradeBase.imagepixels
— Methodimagepixels(metadata) --> grid <: VLBISkyModels.AbstractDims
imagepixels(::AbstractIntensityImage) --> grid <: VLBISkyModels.AbstractDims
Create the grid instance for Comrade.
EHTImages.close!
— Methodclose!(image::DiskIntensityImage)
Close the access to the associated NetCDF4 file.
EHTImages.copy_metadata!
— Methodcopy_metadata!(image::AbstractIntensityImage, uvdataset::AbstractUVDataSet)
copy metadata from the given uvdataset.
EHTImages.default_metadata
— Methoddefault_metadata(::Type{<:AbstractImageDataSet}) -> OrderedDict{Symbol, Any}
default_metadata(::AbstractImageDataSet) -> OrderedDict{Symbol, Any}
Return default metadata for the image data set.
EHTImages.default_metadata
— Methoddefault_metadata(dataset) -> OrderedDict
Return the default metadata of the given dataset.
EHTImages.define_ncd_intensity_dimensions!
— Functiondefine_ncd_intensity_dimensions!(ncd[, nx, ny, np, nf, nt])
Define NetCDF4 dimensions based on the given size of the image data.
EHTImages.define_ncd_intensity_variables!
— Methoddefine_ncd_intensity_variables!(ncd)
Define NetCDF4 variables based on EHT NetCDF4 Image Format.
EHTImages.diskintensityimage
— Methoddiskintensityimage(filename, nx, dx, angunit; keywords) -> DiskIntensityImage
Create a blank DiskIntensityImage
object. Return DiskIntensityImage
data loaded with :read mode.
Arguments
filename::AbstractString
: NetCDF4 file where image data will be created.nx::Integer
: the number of pixels along with the horizontal axis. Must be positive.dx::Real
: the pixel size of the horizontal axis. Must be positive.angunit::Union{Unitful.Quantity, Unitful.Units or String}=rad
: the angular unit fordx
anddy
.
Keywords
ny::Real=nx
: the number of pixels along with the vertical axis. Must be positive.dy::Real=dx
: the pixel size of the vertical axis. Must be positive.ixref::Real=(nx + 1) / 2
,iyref::Real=(ny + 1) / 2
: index of the reference pixels along with the horizontal and vertical axises, respectively. Default values set to the center of the field of the view.pol::Symbol=:single
: number of polarizations. Availables are:single
or:full
(i.e. four) polarizations.freq::Vector{Float64}=[1.0]
: a vector for frequencies in the unit of Hzmjd::Vector{Float64}=[0.0]
: a vector for time in the unit of MJD.metadata::AbstractDict=default_metadata(AbstractIntensityImage)
: other metadata. Note that the above keywords and arguments will overwrite the values of the conflicting keys in thismetadata
argument.mode::Symbol=:create
: The access mode to NCDataset. Available modes are:read
,:append
,:create
. See help forEHTNCDBase.ncdmodes
for details.group::AbstractString=EHTImage.ncd_intensity_defaultgroup
: The group of the image data in the input NetCDF4 file.
EHTImages.get_bconv
— Methodget_bconv(image::AbstractIntensityImage;
fluxunit::Union{Unitful.Quantity,Unitful.Units,String}=Jy,
saunit::Union{Unitful.Quantity,Unitful.Units,String}="pixel")
get a conversion factor from Jy/pixel (used in AbstractIntensityImage.data) to an arbitrary unit for the intensity. fluxunit is for the unit of the flux density (e.g. Jy, mJy, μJy) or brightness temperture (e.g. K), while saunit is for the unit of the solid angle (pixel, beam, mas, μJy).
EHTImages.get_fov
— Functionget_fov(::AbstractIntensityImage, angunit) --> Tuple
get_fov(metadata, angunit) --> Tuple
Returning the field of the view for the grids along with x and y axis in the given angular unit specified by angunit. The input could be a intensity image data set or its metadata.
Arguments
angunit::Union{Unitful.Quantity,Unitful.Units,String}=rad
: Angular units of the output pixel grids.
EHTImages.get_uvgrid
— Functionget_uvgrid(image::AbstractIntensityImage, dofftshift=true)
get_uvgrid(metadata, dofftshift::Bool=true)
returning u and v grids corresponding to the image field of view and pixel size.
EHTImages.get_xygrid
— Functionget_xygrid(::AbstractIntensityImage, angunit) --> Tuple{StepRangeLen, StepRangeLen}
get_xygrid(metadata, angunit) --> Tuple{StepRangeLen, StepRangeLen}
Returning 1-dimensional StepRangeLen objects for the grids along with x and y axis in the given angular unit specified by angunit. The input could be a intensity image data set or its metadata.
Arguments
angunit::Union{Unitful.Quantity,Unitful.Units,String}=rad
: Angular units of the output pixel grids.
EHTImages.intensityimage
— Methodintensityimage(nx, dx, angunit; keywords) -> IntensityImage
Create and return a blank IntensityImage
object.
Arguments
nx::Integer
: the number of pixels along with the horizontal axis. Must be positive.dx::Real
: the pixel size of the horizontal axis. Must be positive.angunit::Union{Unitful.Quantity, Unitful.Units or String}=rad
: the angular unit fordx
anddy
.
Keywords
ny::Real=nx
: the number of pixels along with the vertical axis. Must be positive.dy::Real=dx
: the pixel size of the vertical axis. Must be positive.ixref::Real=(nx + 1) / 2
,iyref::Real=(ny + 1) / 2
: index of the reference pixels along with the horizontal and vertical axises, respectively. Default values set to the center of the field of the view.p::Symbol=:single
: number of parizations. Availables are:single
or:full
(i.e. four) parizations.f::Vector{Float64}=[1.0]
: a vector for fuencies in the unit of Hzt::Vector{Float64}=[0.0]
: a vector for time in the unit of t.metadata::AbstractDict=default_metadata(AbstractIntensityImage)
: other metadata. Note that the above keywords and arguments will overwrite the values of the conflicting keys in thismetadata
argument.
EHTImages.intensitymap2d
— Functionintensitymap2d(im::AbstractIntensityImage, pidx=1, fidx=1, tidx=1) --> VLBISkyModels.IntensityMap
create a two-dimensional Comrade.IntensityMap model.
** Arguments **
pidx, fidx, tidx::Integer
: indices for polarizaiton, frequency and time, respectively.
EHTImages.intensitymap4d
— Functionintensitymap4d(im::AbstractIntensityImage, pidx=1) --> VLBISkyModels.IntensityMap
create a four-dimensional Comrade.IntensityMap model.
** Arguments **
pidx::Integer
: the polarization index.
EHTImages.isdiskdata
— Methodisdiskdata(_::AbstractImageDataSet) -> EHTImages.IsDiskData
Determines whether the data is disk-based or memory-based. Return IsDiskData()
if data is disk-based, while return NotDiskData()
if data is memory-based.
EHTImages.load
— Methodload(image::NCImage) --> DDImage
Load image data from the input disk image to memory.
Arguments
image::NCImage
: Input NCImage.
EHTImages.load_fits
— Functionload_fits(filename::AbstractString, hduid::Integer=1) -> IntensityImage
load_fits(fits::FITS, hduid::Integer=1) -> IntensityImage
load_fits(hdu::ImageHDU) -> IntensityImage
Load the input FITS image into IntensityImage
(in-memory image data).
Arguments
filename::AbstractString
: name of the input FITS filehduid::Integer=1
: ID of the HDU to be loaded. Default to the primary HDU.hdu::ImageHDU
: HDU to be loaded.
EHTImages.load_image
— Methodload_image(filename; [group, mode]) -> DiskIntensityImage
Load image data from the specified group in the given NetCDF4 file with the specified access mode.
Arguments
filename::AbstractString
: The input NetCDF4 file.group::AbstractString=EHTImage.ncd_intensity_defaultgroup
The group of the image data in the input NetCDF4 file.mode::Symbol=:read
: The access mode to NCDataset. Available modes are:read
,:append
,:create
. See help forEHTImage.ncdmodes
for details.
EHTImages.open!
— Functionopen!(image[, mode])
Load image data from NCDataset specified in the input image object with the given access mode. If image data are already opened, it will close it and reload data again.
Arguments
image::DiskIntensityImage
: The input image object.mode::Symbol=:read
: The access mode to NCDataset. Available modes are:read
,:append
,:create
. See help forEHTImage.ncdmodes
for details.
EHTImages.save_fits!
— Functionsave_fits[!](image::AbstractIntensityImage, filename::AbstractString, idx=(1, 1); fitstype::Symbol=:casa)
Saving the image into a FITS file in a specifed format.
Arguments
image::AbstractIntensityImage
: the input imagefilename::AbstractString
: the name of the output FITS fileidx
: the index of the saved image. Should be (frequency index, time index). Default to(1,1)
.
Keywords
fitstype::Symbol
: the format type of the output FITS. Availables are:casa
(CASA compatible).
EHTImages.save_netcdf!
— Methodsave_netcdf!(image, filename; [mode, group])
Save image data to NetCDF4 format.
Arguments
image::AbstractIntensityImage
Input image datafilename::AbstractString
: NetCDF4 file where image data will be saved.mode::Symbol=:create
: The access mode to NCDataset. Available modes are:append
and:create
. See help forEHTNCDBase.ncdmodes
for details.group::AbstractString=EHTImage.ncd_intensity_defaultgroup
: The group of the image data in the input NetCDF4 file.
EHTImages.save_netcdf
— Methodsave_netcdf(image, filename; [mode=:create, group="image"]) => DiskIntensityImage
Save image data to NetCDF4 format. Saved data will be loaded and returned with :read
access mode.
Arguments
image::AbstractIntensityImage
Input image datafilename::AbstractString
: NetCDF4 file where image data will be saved.mode::Symbol=:create
: The access mode to NCDataset. Available modes are:read
,:append
,:create
. See help forEHTNCDBase.ncdmodes
for details.group::AbstractString=EHTImage.ncd_intensity_defaultgroup
: The group of the image data in the input NetCDF4 file.
EHTImages.set_ncd_intensity_metadata!
— Methodset_ncd_intensity_metadata!(ncd)
Set NetCDF4 metadata based on EHT NetCDF4 Image Format.
EHTImages.stokesintensitymap2d
— Functionstokesintensitymap2d(im::AbstractIntensityImage, fidx=1, tidx=1) --> VLBISkyModels.StokesIntensityMap
create a 2D Comrade.StokesIntensityMap model.
** Arguments **
fidx, tidx::Integer
: indices for frequency and time, respectively.
EHTImages.stokesintensitymap4d
— Methodstokesintensitymap2d(im::AbstractIntensityImage) --> VLBISkyModels.StokesIntensityMap
create a 4D Comrade.StokesIntensityMap model.
PythonPlot.imshow
— Methodimshow(::AbstractIntensityImage; kwargs..., imshowkwargs...)
Plot an image using PythonPlot. imshowkwargs
are passed to PythonPlot.imshow. Returns a dictionary that contains all python objects generated in the plot.
Keyword Arguments
angunit
: angular unit for the axes. If nothing, the unit in the image metadata is used. If a Unitful unit, it can be any angular unit.fluxunit
:saunit
: unit for the solid angle.idx
: index of the image to plot. (polarization, frequency, time)cmap
: colormap to use.scale
: scaling of the image. Can be :log, :gamma or :linear.gamma
: gamma value for the :gamma scaling.dyrange
: dynamic range for the :log scaling.vmax
: maximum value for the :linear and :gamma scaling.vmin
: minimum value for the :linear and :gamma scaling.relative
: if true, the vmin and vmax are relative to the maximum value.axisoff
: if true, turn off the axis.axislabel
: if true, plot the axis labels.add_colorbar
: if true, add a colorbar.interpolation
: interpolation method for the image.