/
CMBLensing.jl
143 lines (126 loc) · 4.91 KB
/
CMBLensing.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
module CMBLensing
using Adapt
using Base.Broadcast: AbstractArrayStyle, ArrayStyle, Broadcasted, broadcasted,
DefaultArrayStyle, preprocess_args, Style, result_style
using Base.Iterators: flatten, product, repeated, cycle, countfrom
using Base.Threads
using Base: @kwdef, @propagate_inbounds, Bottom, OneTo, showarg, show_datatype,
show_default, show_vector, typed_vcat
using Combinatorics
using DataStructures
using DelimitedFiles
using Distributed: pmap, nworkers, myid, workers, addprocs, @everywhere, remotecall_wait, @spawnat
using FileIO
using FFTW
using InteractiveUtils
using IterTools: flagfirst
using JLD2: jldopen, JLDWriteSession
import KahanSummation
using Loess
using LinearAlgebra
using LinearAlgebra: diagzero, matprod, promote_op
using MacroTools: @capture, combinedef, isdef, isexpr, postwalk, splitdef
using Match
using Markdown
using Measurements
using Memoization
using OptimKit
using Pkg
using Printf
using ProgressMeter
using Random
using Random: seed!, AbstractRNG
using Roots
using RecipesBase
using Requires
using Setfield
using SparseArrays
using StaticArrays: @SMatrix, @SVector, SMatrix, StaticArray, StaticArrayStyle,
StaticMatrix, StaticVector, SVector, SArray, SizedArray
using Statistics
using StatsBase
using UnPack
using Zygote
using Zygote: unbroadcast, Numeric, @adjoint, @nograd
import Adapt: adapt_structure
import Base: +, -, *, \, /, ^, ~, ≈, <, <=, |, &,
abs, adjoint, all, any, axes, broadcast, broadcastable, BroadcastStyle, conj, copy, convert,
copy, copyto!, eltype, eps, fill!, getindex, getproperty, hash, hcat, hvcat, inv, isfinite,
iterate, keys, lastindex, length, literal_pow, mapreduce, materialize!,
materialize, one, permutedims, print_array, promote, promote_rule,
promote_rule, promote_type, propertynames, real, setindex!, setproperty!, show,
show_datatype, show_vector, similar, size, sqrt, string, sum, summary,
transpose, zero
import Base.Broadcast: instantiate, preprocess
import LinearAlgebra: checksquare, diag, dot, isnan, ldiv!, logdet, mul!, norm,
pinv, StructuredMatrixStyle, structured_broadcast_alloc, tr
import Measurements: ±
import Statistics: std
export
@BandpowerParamOp, @ismain, @namedtuple, @repeated, @unpack, animate,
argmaxf_lnP, BandPassOp, BaseDataSet, batch, batchindex, batchsize, beamCℓs, cache,
CachedLenseFlow, camb, cov_to_Cℓ, cpu, Cℓ_2D, Cℓ_to_Cov, DataSet, DerivBasis,
diag, Diagonal, DiagOp, dot, EBFourier, EBMap, Field, FieldArray, fieldinfo,
FieldMatrix, FieldOrOpArray, FieldOrOpMatrix, FieldOrOpRowVector,
FieldOrOpVector, FieldRowVector, FieldTuple, FieldVector, FieldVector,
firsthalf, Flat, FlatEB, FlatEBFourier, FlatEBMap, FlatField, FlatFieldFourier,
FlatFieldMap, FlatFourier, FlatIEBCov, FlatIEBFourier, FlatIEBMap,
FlatIQUFourier, FlatIQUMap, FlatMap, FlatQU, FlatQUFourier, FlatQUMap, FlatS0,
FlatS02, FlatS2, FlatS2Fourier, FlatS2Map, Fourier, fourier∂, FuncOp, get_Cℓ,
get_Cℓ, get_Dℓ, get_αℓⁿCℓ, get_ρℓ, get_ℓ⁴Cℓ, gradhess, gradient, HighPass,
IEBFourier, IEBMap, InterpolatedCℓs, IQUFourier, IQUMap,
lasthalf, LazyBinaryOp, LenseBasis, LenseFlow, LinOp, lnP, load_camb_Cℓs,
load_chains, load_sim, LowPass, make_mask, Map, MAP_joint, MAP_marg,
map∂, mean_std_and_errors, MidPass, mix, nan2zero, new_dataset, noiseCℓs,
OuterProdOp, ParamDependentOp, pixwin, PowerLens, QUFourier, QUMap, resimulate!,
resimulate, RK4Solver, S0, S02, S2, sample_joint, seed_for_storage!, shiftℓ,
simulate, SymmetricFuncOp, symplectic_integrate, Taylens, toCℓ, toDℓ,
tuple_adjoint, ud_grade, unbatch, unmix, Ð, Ł, δfϕ_δf̃ϕ, ℓ², ℓ⁴, ∇, ∇², ∇¹, ∇ᵢ,
∇⁰, ∇ⁱ, ∇₀, ∇₁, ⋅, ⨳
# generic stuff
include("util.jl")
include("util_fft.jl")
include("numerical_algorithms.jl")
include("generic.jl")
include("cls.jl")
include("field_tuples.jl")
include("field_vectors.jl")
include("specialops.jl")
include("flowops.jl")
# lensing
include("lenseflow.jl")
include("powerlens.jl")
# flat-sky maps
include("flat_fftgrid.jl")
include("flat_s0.jl")
include("flat_s2.jl")
include("flat_s0s2.jl")
include("flat_generic.jl")
include("flat_batch.jl")
include("masking.jl")
include("taylens.jl")
include("bilinearlens.jl")
# plotting
function animate end
@init @require PyPlot="d330b81b-6aea-500a-939a-2ce795aea3ee" include("plotting.jl")
include("plots.jl")
# sampling and maximizing the posteriors
include("dataset.jl")
include("posterior.jl")
include("maximization.jl")
include("sampling.jl")
include("chains.jl")
# other estimates
include("quadratic_estimate.jl")
# curved-sky
include("healpix.jl")
include("autodiff.jl")
# gpu
is_gpu_backed(x) = false
@init @require CUDA="052768ef-5323-5732-b1bb-66c8b64840ba" include("gpu.jl")
# misc init
# see https://github.com/timholy/ProgressMeter.jl/issues/71 and links therein
@init if ProgressMeter.@isdefined ijulia_behavior
ProgressMeter.ijulia_behavior(:clear)
end
end