From 0f481fbf79cf8104b84e49ee9ee5f4e23a9fec70 Mon Sep 17 00:00:00 2001 From: Paul Tiede Date: Tue, 25 Jul 2023 13:51:50 -0400 Subject: [PATCH] update docs --- .github/workflows/Documentation.yml | 1 + docs/Project.toml | 1 + docs/make.jl | 4 +++- docs/src/api.md | 13 ++++------- docs/src/base_api.md | 1 - examples/data.jl | 9 ++++---- examples/hybrid_imaging.jl | 4 ++-- examples/imaging_closures.jl | 2 +- examples/imaging_pol.jl | 2 +- examples/imaging_vis.jl | 2 +- src/observations/observations.jl | 35 +++++++++++++++++++++++++++++ 11 files changed, 54 insertions(+), 20 deletions(-) diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 6c06322c..aed07189 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -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 diff --git a/docs/Project.toml b/docs/Project.toml index 3335d668..3576fff2 100755 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -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] diff --git a/docs/make.jl b/docs/make.jl index acfdcc09..5c46124c 100755 --- a/docs/make.jl +++ b/docs/make.jl @@ -8,6 +8,8 @@ using Pyehtim using Zygote using Comrade using ComradeBase +using VLBISkyModels +using InteractiveUtils using Literate using Pkg @@ -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[ diff --git a/docs/src/api.md b/docs/src/api.md index a25e1d12..2304a7f9 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -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 ``` @@ -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 ``` diff --git a/docs/src/base_api.md b/docs/src/base_api.md index 06090883..3047f8a4 100644 --- a/docs/src/base_api.md +++ b/docs/src/base_api.md @@ -105,7 +105,6 @@ PolarizedTypes.CoherencyMatrix PolarizedTypes.evpa PolarizedTypes.m̆ PolarizedTypes.linearpol -PolarizedTypes.SingleStokes PolarizedTypes.innerprod PolarizedTypes.basis_components PolarizedTypes.basis_transform diff --git a/examples/data.jl b/examples/data.jl index c57aac2d..c4dc3b49 100644 --- a/examples/data.jl +++ b/examples/data.jl @@ -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 diff --git a/examples/hybrid_imaging.jl b/examples/hybrid_imaging.jl index 37010704..0ccd3b4f 100644 --- a/examples/hybrid_imaging.jl +++ b/examples/hybrid_imaging.jl @@ -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] @@ -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) diff --git a/examples/imaging_closures.jl b/examples/imaging_closures.jl index c25319d2..f6c83128 100644 --- a/examples/imaging_closures.jl +++ b/examples/imaging_closures.jl @@ -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 diff --git a/examples/imaging_pol.jl b/examples/imaging_pol.jl index 6fee4d07..93735894 100644 --- a/examples/imaging_pol.jl +++ b/examples/imaging_pol.jl @@ -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) diff --git a/examples/imaging_vis.jl b/examples/imaging_vis.jl index 4d5489c0..c2eb3398 100644 --- a/examples/imaging_vis.jl +++ b/examples/imaging_vis.jl @@ -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 diff --git a/src/observations/observations.jl b/src/observations/observations.jl index 4e9415c6..fabeff56 100755 --- a/src/observations/observations.jl +++ b/src/observations/observations.jl @@ -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