Skip to content

Commit

Permalink
Rename CorruptionModel to JonesModel
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Jul 26, 2023
1 parent 19d38fe commit 3039987
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Comrade.caltable(::Comrade.EHTObservation, ::AbstractVector)
Comrade.DesignMatrix
Comrade.JonesCache
Comrade.TransformCache
Comrade.CorruptionModel
Comrade.JonesModel
Comrade.VLBIModel
Comrade.CalPrior
Comrade.CalPrior(::NamedTuple, ::JonesCache)
Expand Down
2 changes: 1 addition & 1 deletion examples/hybrid_imaging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function instrument(θ, metadata)
gphase = exp.(1im.*gphase)
jgamp = jonesStokes(gvis, gcache)
jgphase = jonesStokes(gphase, gcachep)
return CorruptionModel(jgamp*jgphase)
return JonesModel(jgamp*jgphase)
end


Expand Down
2 changes: 1 addition & 1 deletion examples/imaging_pol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function instrument(θ, metadata)
J = Gp*Gr*D*jT
## form the complete Jones or RIME model. We use tcache here
## to set the reference basis of the model.
return CorruptionModel(J, tcache)
return JonesModel(J, tcache)
end

# Now, we define the model metadata required to build the model.
Expand Down
6 changes: 3 additions & 3 deletions examples/imaging_vis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ function instrument(θ, metadata)
gphase = exp.(1im.*gphase)
jgamp = jonesStokes(gvis, gcache)
jgphase = jonesStokes(gphase, gcachep)
return CorruptionModel(jgamp*jgphase)
return JonesModel(jgamp*jgphase)
end

# The model construction is very similar to [Imaging a Black Hole using only Closure Quantities](@ref),
# except we include a large scale gaussian since we want to model the zero baselines.
# For more information about the image model
# please read the closure-only example. Let's discuss the instrument model [`Comrade.CorruptionModel`](@ref).
# please read the closure-only example. Let's discuss the instrument model [`Comrade.JonesModel`](@ref).
# Thanks to the EHT pre-calibration, the gains are stable over scans. Therefore, we can
# model the gains on a scan-by-scan basis. To form the instrument model, we need our
# 1. Our (log) gain amplitudes and phases are given below by `lgamp` and `gphase`
# 2. Our function or cache that maps the gains from a list to the stations they impact `gcache.`
# 3. The set of [`Comrade.JonesPairs`](@ref) produced by [`jonesStokes`](@ref)
# These three ingredients then specify our instrument model. The instrument model can then be
# combined with our image model `cimg` to form the total `CorruptionModel`.
# combined with our image model `cimg` to form the total `JonesModel`.



Expand Down
2 changes: 1 addition & 1 deletion playground/hybrid_imaging_vis_gmrf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function instrument(θ, metadata)
gphase = exp.(1im.*gphase)
jgamp = jonesStokes(gvis, gcache)
jgphase = jonesStokes(gphase, gcachep)
return CorruptionModel(jgamp*jgphase)
return JonesModel(jgamp*jgphase)
end

# Before we move on, let's go into the `model` function a bit. This function takes two arguments
Expand Down
2 changes: 1 addition & 1 deletion playground/imaging_vis_grmf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function instrument(θ, metadata)
gphase = exp.(1im.*gphase)
jgamp = jonesStokes(gvis, gcache)
jgphase = jonesStokes(gphase, gcachep)
return CorruptionModel(jgamp*jgphase)
return JonesModel(jgamp*jgphase)
end


Expand Down
6 changes: 3 additions & 3 deletions playground/imaging_vis_standardize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ function instrument(θ, metadata)
gphase = exp.(1im.*gphase)
jgamp = jonesStokes(gvis, gcache)
jgphase = jonesStokes(gphase, gcachep)
return CorruptionModel(jgamp*jgphase)
return JonesModel(jgamp*jgphase)
end

# The model construction is very similar to [Imaging a Black Hole using only Closure Quantities](@ref),
# except we include a large scale gaussian since we want to model the zero baselines.
# For more information about the image model
# please read the closure-only example. Let's discuss the instrument model [`Comrade.CorruptionModel`](@ref).
# please read the closure-only example. Let's discuss the instrument model [`Comrade.JonesModel`](@ref).
# Thanks to the EHT pre-calibration, the gains are stable over scans. Therefore, we can
# model the gains on a scan-by-scan basis. To form the instrument model, we need our
# 1. Our (log) gain amplitudes and phases are given below by `lgamp` and `gphase`
# 2. Our function or cache that maps the gains from a list to the stations they impact `gcache.`
# 3. The set of [`Comrade.JonesPairs`](@ref) produced by [`jonesStokes`](@ref)
# These three ingredients then specify our instrument model. The instrument model can then be
# combined with our image model `cimg` to form the total `CorruptionModel`.
# combined with our image model `cimg` to form the total `JonesModel`.



Expand Down
12 changes: 6 additions & 6 deletions src/calibration/calibration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import Distributions
using Statistics
using PrettyTables

export CorruptionModel
export JonesModel

struct CorruptionModel{J, B}
struct JonesModel{J, B}
jones::J
refbasis::B
end

"""
CorruptionModel(jones::JonesPairs, refbasis = CirBasis())
CorruptionModel(jones::JonesPairs, tcache::TransformCache)
JonesModel(jones::JonesPairs, refbasis = CirBasis())
JonesModel(jones::JonesPairs, tcache::TransformCache)
Constructs the intrument corruption model using pairs of jones matrices `jones` and a
reference basis
"""
CorruptionModel(jones::J) where {J} = CorruptionModel{J, CirBasis}(jones, CirBasis())
JonesModel(jones::J) where {J} = JonesModel{J, CirBasis}(jones, CirBasis())



Expand Down Expand Up @@ -51,7 +51,7 @@ and the `model` which describes the on-sky polarized visibilities. The third arg
can either be the `tcache` that converts from the model coherency basis to the instrumental
basis, or just the `refbasis` that will be used when constructing the model coherency matrices.
"""
struct VLBIModel{J<:CorruptionModel, M<:AbstractModel} <: RIMEModel
struct VLBIModel{J<:JonesModel, M<:AbstractModel} <: RIMEModel
"""
The instrument model for the telescope. This is usually a sparse matrix that multiplies
the visibilties.
Expand Down
4 changes: 2 additions & 2 deletions src/calibration/jones.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export JonesCache, TrackSeg, ScanSeg, FixedSeg, IntegSeg, jonesG, jonesD, jonesT,
TransformCache, CorruptionModel, jonescache, station_tuple, jonesmap
TransformCache, JonesModel, jonescache, station_tuple, jonesmap

"""
$(TYPEDEF)
Expand Down Expand Up @@ -933,7 +933,7 @@ Returns a `JonesPair` of matrices that transform from the model coherency matric
to the on-sky coherency basis, this includes the feed rotation and choice of polarization feeds.
"""
jonesT(tcache::TransformCache) = JonesPairs(tcache.T1, tcache.T2)
CorruptionModel(jones::J, tcache::TransformCache) where {J} = CorruptionModel(jones, tcache.refbasis)
JonesModel(jones::J, tcache::TransformCache) where {J} = JonesModel(jones, tcache.refbasis)


"""
Expand Down
2 changes: 1 addition & 1 deletion test/Core/gains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ using Tables
gphar = CalPrior(gph_prior_0, gph_prior, jcache)

ga = fill(1.0, size(rand(gamp))...)
gm = Comrade.VLBIModel(CorruptionModel(jonesStokes(ga, jcache)), m)
gm = Comrade.VLBIModel(JonesModel(jonesStokes(ga, jcache)), m)

@inferred Comrade.intensity_point(gm, (X=0.0, Y=0.0))
@test gm.sky === m
Expand Down
2 changes: 1 addition & 1 deletion test/Core/observation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ using Pyehtim
plot(m, lcamp)
plot(m,cphase)
jt = jonesT(TransformCache(dcoh))
mp = Comrade.VLBIModel(CorruptionModel(jt), PolarizedModel(m, ZeroModel(), ZeroModel(), 0.1*Gaussian()))
mp = Comrade.VLBIModel(JonesModel(jt), PolarizedModel(m, ZeroModel(), ZeroModel(), 0.1*Gaussian()))
plot(mp, dcoh)
#residual(m, vis)
residual(m, amp)
Expand Down
2 changes: 1 addition & 1 deletion test/test_util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end

function test_instrumentmodel_polarized(θ, metadata)
jt = jonesT(metadata.tcache)
return CorruptionModel(jt, metadata.tcache)
return JonesModel(jt, metadata.tcache)
end

function test_model2(θ, metadata)
Expand Down

0 comments on commit 3039987

Please sign in to comment.