Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Jul 25, 2023
1 parent 865a3f2 commit 0f481fb
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
sudo apt-get update
sudo apt-get install libhdf5-dev
sudo apt-get install --reinstall libxcb-xinerama0
sudo apt-get install qt5-default
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Pyehtim = "3d61700d-6e5b-419a-8e22-9c066cf00468"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
VLBISkyModels = "d6343c73-7174-4e0f-bb64-562643efbeca"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
Expand Down
4 changes: 3 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using Pyehtim
using Zygote
using Comrade
using ComradeBase
using VLBISkyModels
using InteractiveUtils

using Literate
using Pkg
Expand Down Expand Up @@ -57,7 +59,7 @@ makedocs(;
modules=[ComradeBase, Comrade,
ComradeOptimization, ComradeAHMC,
ComradeNested, ComradeDynesty,
ComradeAdaptMCMC, PolarizedTypes],
ComradeAdaptMCMC, PolarizedTypes, VLBISkyModels],
repo="https://github.com/ptiede/Comrade.jl/blob/{commit}{path}#{line}",
sitename="Comrade.jl",
pages=Any[
Expand Down
13 changes: 4 additions & 9 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ VLBISkyModels.NFFTAlg(::Comrade.EHTObservation)
### Polarized Models

```@docs
ComradeBase.mbreve
ComradeBase.evpa(pimg::ComradeBase.AbstractPolarizedModel, p)
PolarizedTypes.mbreve
PolarizedTypes.m̆
PolarizedTypes.evpa
PolarizedTypes.linearpol
```


Expand Down Expand Up @@ -145,20 +147,13 @@ Comrade.IsCube
## Misc

```@docs
Comrade.μas2rad
Comrade.rad2μas
Comrade.NonAnalyticTest
Comrade.station_tuple
Comrade.center_image
Comrade.convolve!
Comrade.convolve
Comrade.dirty_image
Comrade.dirty_beam
```

## Internal (Not Public API)
```@docs
VLBISkyModels.ThreadedModel
Comrade.extract_FRs
```

1 change: 0 additions & 1 deletion docs/src/base_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ PolarizedTypes.CoherencyMatrix
PolarizedTypes.evpa
PolarizedTypes.m̆
PolarizedTypes.linearpol
PolarizedTypes.SingleStokes
PolarizedTypes.innerprod
PolarizedTypes.basis_components
PolarizedTypes.basis_transform
Expand Down
9 changes: 5 additions & 4 deletions examples/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ lcamp = extract_table(obs, LogClosureAmplitudes(; snrcut=3.0)) # extract minima
# For polarization we first load the data in the cirular polarization basis
# Additionally, we load the array table at the same time to load the telescope mounts.
obseht = Pyehtim.load_uvfits_and_array(
joinpath(dirname(pathof(Comrade)), "..", "examples", "SR1_M87_2017_096_lo_hops_netcal_StokesI.uvfits"),
joinpath(dirname(pathof(Comrade)), "..", "examples", "PolarizedExamples/polarized_gaussian_all_corruptions.uvfits"),
polrep="circ")
joinpath(dirname(pathof(Comrade)), "..", "examples", "PolarizedExamples/polarized_gaussian_all_corruptions.uvfits"),
joinpath(dirname(pathof(Comrade)), "..", "examples", "PolarizedExamples/array.txt"),
polrep="circ"
)
obs = Pyehtim.scan_average(obseht)
dcoh = extract_table(obs, Coherencies())
coh = extract_table(obs, Coherencies())


# !!! warning
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid_imaging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ plot(img, title="MAP Image")
using ComradeAHMC
using Zygote
metric = DiagEuclideanMetric(ndim)
chain, stats = sample(rng, post, AHMC(;metric, autodiff=Val(:Zygote)), 1000; nadapts=500, init_params=xopt)
chain, stats = sample(rng, post, AHMC(;metric, autodiff=Val(:Zygote)), 700; nadapts=500, init_params=xopt)
# We then remove the adaptation/warmup phase from our chain
chain = chain[501:end]
stats = stats[501:end]
Expand All @@ -283,7 +283,7 @@ stats = stats[501:end]
# so the posterior is not sampling from the correct stationary distribution.

using StatsBase
msamples = skymodel.(Ref(post), chain[begin:10:end]);
msamples = skymodel.(Ref(post), chain[begin:2:end]);

# The mean image is then given by
imgs = intensitymap.(msamples, fovxy, fovxy, 128, 128)
Expand Down
2 changes: 1 addition & 1 deletion examples/imaging_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ plot(img, title="MAP Image")
using ComradeAHMC
using Zygote
metric = DiagEuclideanMetric(ndim)
chain, stats = sample(post, AHMC(;metric, autodiff=Val(:Zygote)), 2_000; nadapts=1_000, init_params=xopt)
chain, stats = sample(post, AHMC(;metric, autodiff=Val(:Zygote)), 700; nadapts=500, init_params=xopt)


# !!! warning
Expand Down
2 changes: 1 addition & 1 deletion examples/imaging_pol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function instrument(θ, metadata)
## Now construct the basis transformation cache
jT = jonesT(tcache)

# Gain product parameters
## Gain product parameters
gPa = exp.(lgp .+ 0im)
gRa = exp.(lgp .+ lgr .+ 0im)
Gp = jonesG(gPa, gRa, scancache)
Expand Down
2 changes: 1 addition & 1 deletion examples/imaging_vis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ plot(gt, layout=(3,3), size=(600,500))
#-
using ComradeAHMC
metric = DiagEuclideanMetric(ndim)
chain, stats = sample(rng, post, AHMC(;metric, autodiff=Val(:Zygote)), 1_000; nadapts=500, init_params=xopt)
chain, stats = sample(rng, post, AHMC(;metric, autodiff=Val(:Zygote)), 700; nadapts=500, init_params=xopt)

#-
# !!! note
Expand Down
35 changes: 35 additions & 0 deletions src/observations/observations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,45 @@ function extract_table(obs, dataproduct::Coherencies)
end

# internal methods to extract information from `obs`
"""
extract_cphase(obs; kwargs...)
Extracts the closure phases from an `obs`.
This is an internal method for dispatch. Only use this if
interfacing Comrade with a new data type.
"""
function extract_cphase end
"""
extract_lcamp(obs; kwargs...)
Extracts the log-closure amplitudes from an `obs`.
This is an internal method for dispatch. Only use this if
interfacing Comrade with a new data type.
"""
function extract_lcamp end
"""
extract_amp(obs; kwargs...)
Extracts the visibility amplitudes from an `obs`.
This is an internal method for dispatch. Only use this if
interfacing Comrade with a new data type.
"""
function extract_amp end
"""
extract_vis(obs; kwargs...)
Extracts the stokes I complex visibilities from an obs.
This is an internal method for dispatch. Only use this if
interfacing Comrade with a new data type.
"""
function extract_vis end
"""
extract_coherency(obs; kwargs...)
Extracts the full coherency matrix from an observation.
This is an internal method for dispatch. Only use this if
interfacing Comrade with a new data type.
"""
function extract_coherency end


Expand Down

0 comments on commit 0f481fb

Please sign in to comment.