|
59 | 59 |
|
60 | 60 | function idealmaps(::DualData, m::AbstractSkyModel, x) |
61 | 61 | skym = skymodel(m, x.sky) |
62 | | - dmap = dualmap(skym, domain(m)) |
63 | | - return ComradeBase.imgmap(dmap), ComradeBase.vismap(dmap) |
| 62 | + # We include this special method to sometime optimize the dualmap computation |
| 63 | + # for specific sky models |
| 64 | + img, vis = fastdualmap(skym, domain(m)) |
| 65 | + return img, vis |
64 | 66 | end |
65 | 67 |
|
| 68 | +function fastdualmap(skym::AbstractModel, grid::VLBISkyModels.AbstractFourierDualDomain) |
| 69 | + dm = dualmap(skym, grid) |
| 70 | + return ComradeBase.imgmap(dm), ComradeBase.vismap(dm) |
| 71 | +end |
| 72 | + |
| 73 | +function fastdualmap(skym::ContinuousImage, grid::VLBISkyModels.AbstractFourierDualDomain) |
| 74 | + VLBISkyModels.checkgrid(axisdims(skym), imgdomain(grid)) || |
| 75 | + throw(DomainError("Image domain does not match skymodel image domain")) |
| 76 | + img = VLBISkyModels.make_map(m) |
| 77 | + return img, visibilitymap(skym, grid) |
| 78 | +end |
| 79 | + |
| 80 | + |
| 81 | +function fastdualmap(skym::VLBISkyModels.CompositeModel{<:ContinuousImage}, grid::VLBISkyModels.AbstractFourierDualDomain) |
| 82 | + VLBISkyModels.checkgrid(axisdims(skym.m1), ComradeBase.imgdomain(grid)) || throw(DomainError("Image domain does not match skymodel image domain")) |
| 83 | + img = VLBISkyModels.make_map(skym.m1) |
| 84 | + img2 = intensitymap(skym.m2, grid) |
| 85 | + img2 .+= img #copy into this one because img will alias otherwise |
| 86 | + return img, visibilitymap(skym, grid) |
| 87 | +end |
| 88 | + |
| 89 | +fastdualmap(m::VLBISkyModels.CompositeModel{M1, <:ContinuousImage}, grid::VLBISkyModels.AbstractFourierDualDomain) where {M1} = |
| 90 | + fastdualmap(swap(m), grid) |
| 91 | + |
| 92 | + |
66 | 93 | function skymodel(m::AbstractSkyModel, x) |
67 | 94 | return m.f(x, m.metadata) |
68 | 95 | end |
|
0 commit comments