11export SkyModel, FixedSkyModel
22
33
4- """
5- AbstractSkyModel
6-
7- The abstract type for Comrade Sky Models. For a concrete implementation see [`SkyModel`](@ref).
8-
9- Any subtype must implement the following methods
10-
11- - `set_array(m::AbstractSkyModel, array::AbstractArrayConfiguration)`: Sets the array configuration
12- for the sky model `m` and returns the observed sky model and prior.
13-
14- The following methods have default implementations:
15- - `idealvisibilities(m::AbstractSkyModel, x)`: Computes the ideal visibilities of the sky model `m`
16- given the model parameters `x`.
17- - `skymodel(m::AbstractSkyModel, x)`: Returns the sky model image given the model parameters `x`.
18- - `domain(m::AbstractSkyModel)`: Returns the domain of the sky model `m`.
19- """
20- abstract type AbstractSkyModel end
21-
22-
234struct SkyModel{F, P, G <: AbstractDomain , A <: FourierTransform , M} <: AbstractSkyModel
245 f:: F
256 prior:: P
@@ -28,16 +9,6 @@ struct SkyModel{F, P, G <: AbstractDomain, A <: FourierTransform, M} <: Abstract
289 metadata:: M
2910end
3011
31- function Base. show(io:: IO , mime:: MIME"text/plain" , m:: AbstractSkyModel )
32- T = typeof(m)
33- ST = split(split(" $T " , ' {' )[1 ], " ." )[end ]
34- printstyled(io, ST; bold = true , color = :blue)
35- println(io)
36- println(io, " with map: $(m. f) " )
37- GT = typeof(m. grid)
38- SGT = split(" $GT " , ' {' )[1 ]
39- return print(io, " on grid: $SGT " )
40- end
4112
4213"""
4314 SkyModel(f, prior, grid::AbstractRectiGrid; algorithm = NFFTAlg(), metadata=nothing)
@@ -72,15 +43,6 @@ function VLBISkyModels.FourierDualDomain(grid::AbstractRectiGrid, array::Abstrac
7243 return FourierDualDomain(grid, domain(array; executor), alg)
7344end
7445
75- struct ObservedSkyModel{F, G <: VLBISkyModels.AbstractDomain , M} <: AbstractSkyModel
76- f:: F
77- grid:: G
78- metadata:: M
79- end
80-
81- function domain(m:: AbstractSkyModel ; kwargs... )
82- return getfield(m, :grid)
83- end
8446
8547# If we are using a analytic model then we don't need to plan the FT and we
8648# can save some memory by not storing the plans.
@@ -110,69 +72,3 @@ function ObservedSkyModel(m::SkyModel, arr::AbstractArrayConfiguration)
11072 end
11173 return ObservedSkyModel(m. f, g, m. metadata)
11274end
113-
114-
115- function set_array(m:: AbstractSkyModel , array:: AbstractArrayConfiguration )
116- return ObservedSkyModel(m, array), m. prior
117- end
118-
119- """
120- idealvisibilities(m::AbstractSkyModel, x)
121-
122- Computes the ideal non-corrupted visibilities of the sky model `m` given the model parameters `x`.
123- """
124- function idealvisibilities(m:: AbstractSkyModel , x)
125- skym = skymodel(m, x. sky)
126- return visibilitymap(skym, domain(m))
127- end
128-
129- function skymodel(m:: AbstractSkyModel , x)
130- return m. f(x, m. metadata)
131- end
132-
133- """
134- FixedSkyModel(m::AbstractModel, grid::AbstractRectiGrid; algorithm = NFFTAlg())
135-
136- Construct a sky model that has no free parameters. This is useful for models where the
137- image structure is known apriori but the instrument model is unknown.
138-
139- # Arguments
140-
141- - `m` : The fixed sky model.
142- - `grid` : The domain on which the model is defined. This defines the field of view and resolution
143- of the model. Note that if `f` produces a analytic model then this field of view isn't used
144- directly in the computation of the visibilities.
145-
146- # Optional Arguments
147- - `algorithm` : The Fourier transform algorithm used to compute the visibilities. The default is
148- `NFFTAlg()` which uses a non-uniform fast Fourier transform. Other options can be found by using
149- `subtypes(VLBISkyModels.FourierTransform)`
150- """
151- Base. @kwdef struct FixedSkyModel{M <: AbstractModel , G, A <: FourierTransform } <: AbstractSkyModel
152- model:: M
153- grid:: G
154- algorithm:: A = NFFTAlg()
155- end
156-
157- function FixedSkyModel(m:: AbstractModel , grid:: AbstractRectiGrid ; algorithm = NFFTAlg())
158- return FixedSkyModel(m, grid, algorithm)
159- end
160-
161- function ObservedSkyModel(m:: FixedSkyModel , arr:: AbstractArrayConfiguration )
162- gfour = FourierDualDomain(m. grid, arr, m. algorithm)
163- img = intensitymap(m. model, gfour)
164- vis = visibilitymap(m. model, gfour)
165- return ObservedSkyModel(m, gfour, (; img, vis))
166- end
167-
168- function set_array(m:: FixedSkyModel , array:: AbstractArrayConfiguration )
169- return ObservedSkyModel(m, array), NamedTuple()
170- end
171-
172- function idealvisibilities(m:: ObservedSkyModel{<:FixedSkyModel} , x)
173- return m. metadata. vis
174- end
175-
176- function skymodel(m:: ObservedSkyModel{<:FixedSkyModel} , x)
177- return m. f. model
178- end
0 commit comments