Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ComradeBase"
uuid = "6d8c423b-a35f-4ef1-850c-862fe21f82c4"
authors = ["Paul Tiede <ptiede91@gmail.com> and contributors"]
version = "0.9.3"
version = "0.9.4"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
4 changes: 4 additions & 0 deletions src/ComradeBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export visibility,
flux, fieldofview, imagepixels, pixelsizes, IntensityMap,
named_dims


include("interface.jl")
include("executors.jl")
include("domain.jl")
include("multidomain.jl")
include("rectigrid.jl")
include("unstructured/domain.jl")
include("unstructured/map.jl")
Expand All @@ -32,7 +34,9 @@ const FluxMap2{T, N, E} = Union{
UnstructuredMap{T, <:AbstractVector, E},
}


include("visibilities.jl")
include("modifiers.jl")
# include("rrules.jl")

@setup_workload begin
Expand Down
6 changes: 6 additions & 0 deletions src/domain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ function MinimalHeader(source, ra, dec, mjd, freq)
return MinimalHeader(source, raT, decT, mjdT, freqT)
end

function DimensionalData.val(m::AbstractHeader)
n = propertynames(m)
pm = Base.Fix1(getproperty, m)
return NamedTuple{n}(map(pm, n))
end

"""
NoHeader

Expand Down
60 changes: 60 additions & 0 deletions src/fourierdual.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
$(TYPEDEF)

This defines an abstract cache that can be used to
hold or precompute some computations.
"""
abstract type AbstractFourierDualDomain <: AbstractDomain end

abstract type FourierTransform end


forward_plan(g::AbstractFourierDualDomain) = getfield(g, :plan_forward)
reverse_plan(g::AbstractFourierDualDomain) = getfield(g, :plan_reverse)
imgdomain(g::AbstractFourierDualDomain) = getfield(g, :imgdomain)
visdomain(g::AbstractFourierDualDomain) = getfield(g, :visdomain)
algorithm(g::AbstractFourierDualDomain) = getfield(g, :algorithm)

EnzymeRules.inactive(::typeof(forward_plan), args...) = nothing
EnzymeRules.inactive(::typeof(reverse_plan), args...) = nothing

abstract type AbstractPlan end
getplan(p::AbstractPlan) = getfield(p, :plan)
getphases(p::AbstractPlan) = getfield(p, :phases)
EnzymeRules.inactive(::typeof(getplan), args...) = nothing
EnzymeRules.inactive(::typeof(getphases), args...) = nothing

function create_plans(algorithm, imgdomain, visdomain)
plan_forward = create_forward_plan(algorithm, imgdomain, visdomain)
plan_reverse = inverse_plan(plan_forward)
return plan_forward, plan_reverse
end

function create_vismap(arr::AbstractArray, g::AbstractFourierDualDomain)
return ComradeBase.create_map(arr, visdomain(g))
end

function create_imgmap(arr::AbstractArray, g::AbstractFourierDualDomain)
return ComradeBase.create_map(arr, imgdomain(g))
end

function visibilitymap_analytic(m::AbstractModel, grid::AbstractFourierDualDomain)
return visibilitymap_analytic(m, visdomain(grid))
end

function visibilitymap_numeric(m::AbstractModel, grid::AbstractFourierDualDomain)
img = intensitymap_analytic(m, imgdomain(grid))
vis = applyft(forward_plan(grid), img)
return vis
end

function intensitymap_analytic(m::AbstractModel, grid::AbstractFourierDualDomain)
return intensitymap_analytic(m, imgdomain(grid))
end

function intensitymap_numeric(m::AbstractModel, grid::AbstractFourierDualDomain)
# This is because I want to make a grid that is the same size as the image
# so we revert to the standard method and not what ever was cached
img = intensitymap_numeric(m, imgdomain(grid))
return img
end
Loading
Loading