Giter Site home page Giter Site logo

fabienbaron / oitools.jl Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 9.0 15.67 MB

A collection of tools to load, visualize, model-fit and image optical interferometry data coming from CHARA, NPOI and VLTI

License: GNU Lesser General Public License v3.0

Julia 100.00%
optical interferometry

oitools.jl's Introduction

OITOOLS: the All-in-One Tool Package for Optical Interferometry

Status Documentation License Build

oitools-logo

OITOOLS is a Julia package to read, plot, model-fit and image optical interferometric data coming from astronomical arrays such as CHARA, VLTI, and NPOI. Note that despite having the same name as JMMC's oitools, they are completely unrelated and were developed independently.

Installation

If you're new to Julia, you may want to install OITOOLS and its dependencies without learning about activate/instantiate. You will only have to do this one.

using Pkg; 
pkg"registry add General"  # if not yet any registries
pkg"registry add https://github.com/emmt/EmmtRegistry"
Pkg.add(url="https://github.com/fabienbaron/OIFITS.jl", rev="t4");
Pkg.add(url="https://github.com/fabienbaron/OITOOLS.jl.git")
# Then check everything got installed properly
using OITOOLS

Plotting and loading data

  • Load and filter data on the fly: split by spectral channel or time

  • All the classic plots: uv coverage, V2, T3, etc. by baseline or wavelengths

uv coverage V2
uvplot v2plot

Image reconstruction

  • Classic image reconstruction

2004bc1 2004bc2 2004bc3

  • Polychromatic and dynamical imaging with several regularizations

  • The ROTIR package uses OITOOLS to do stellar surface imaging with:

    • light curve inversion
    • Doppler imaging
    • interferometric imaging

rotir

Model fitting

  • Fast multiple component fitting.

  • Polychromatic models

    • Power and black-body laws
    • Spectral line fitting
    • Add your own laws!
  • Dynamical models (time variable parameters)

  • Optimization with several libraries

    • Levenberg for classic error analysis
    • NLOpt for flexibility in the parameter search (local and global optimizers including Nelder Mead and Genetic Algorithm)
    • UltraNest for Bayesan model selection
  • Derive boostrap errors

    • Boostrap by baseline, time, or wavelengths
  • Quickly make images from models.

Observation planning

ASPRO-like Gantt chart chara_plan-like plots
gantt chara_plan

Simulations

  • Can simulate fake data from models or images

  • Can create your own telescope and/or instrumental configurations

How to speed up the use of OITOOLS with PackageCompiler

Julia compiles your code on the fly, and OITOOLS functions are no exception. The so-called "time to first plot" will significantly decrease if you take the time to compile OITOOLS with PackageCompiler, The functions that will be accelerated are in precompile_oitools.jl from the OITOOLS.jl/demos/ directory. Feel free to add OITOOLS functions that you frequenly use. To precompile OITOOLS:

using PackageCompiler
create_sysimage([:OITOOLS], sysimage_path="oitools.so", precompile_execution_file="precompile_oitools.jl")

then launch julia with

julia --sysimage oitools.so

Package install for development

Here is a quick scropt to install all the packages needed to develop OITOOLS:

using Pkg; 
#Install python packages
Pkg.add("Conda"); 
using Conda; 
Conda.add("ultranest", channel="conda-forge"); 
Conda.add("astroquery", channel="astropy");
# Install mainstream Julia packages
Pkg.add(["CFITSIO","AstroTime","Crayons", "Dates","DelimitedFiles","Documenter","DocumenterTools","FFTW", "FITSIO","Glob","LaTeXStrings","LinearAlgebra","NFFT","NLopt","UltraNest","LsqFit","NearestNeighbors","PyCall","PyPlot","Random","SparseArrays","SpecialFunctions","Statistics","Parameters", "Match", "ProgressMeter"]); 
# Install Eric Thiebaut's packages
Pkg.Registry.add(RegistrySpec(url = "https://github.com/emmt/EmmtRegistry"))
Pkg.add(["ArrayTools", "LazyAlgebra", "OptimPackNextGen"]);
# Install FB's packages
Pkg.add(url="https://github.com/fabienbaron/OIFITS.jl", rev="t4");
Pkg.add(url="https://github.com/fabienbaron/OITOOLS.jl.git")
# Then check everything got installed properly
using OITOOLS

oitools.jl's People

Contributors

baronfabien avatar bensetterholm avatar bkloppenborg avatar fabienbaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oitools.jl's Issues

ERROR: MethodError: no method matching +(::Vector{Float64}, ::Float64)

Facing this issue after updating the packages:

julia> params, x = reconstruct_sparco_gray(x_start, params_start, data, ft, regularizers=regularizers, weights=[1.0, 0.0, 1.0], verb=true, maxiter=200); #grey environment
ERROR: MethodError: no method matching +(::Vector{Float64}, ::Float64)
For element-wise addition, use broadcasting with dot syntax: array .+ scalar

Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...)
   @ Base operators.jl:578
  +(::T, ::T) where T<:Union{Float16, Float32, Float64}
   @ Base float.jl:408
  +(::Distributions.Cauchy, ::Real)
   @ Distributions ~/.julia/packages/Distributions/fYgbJ/src/univariate/continuous/cauchy.jl:104
  ...

Stacktrace:
 [1] +
   @ ./operators.jl:578 [inlined]
 [2] chi2_sparco_nfft_fg(x::Vector{Float64}, g::Vector{Float64}, ftplan::Vector{NFFT.NFFTPlan{Float64, 2, 1}}, data::OIdata, nparams::Int64; verb::Bool, weights::Vector{Float64})
   @ OITOOLS ~/.julia/packages/OITOOLS/LybQ9/src/oichi2.jl:1125
 [3] crit_sparco_nfft_fg(x::Vector{Float64}, g::Vector{Float64}, ftplan::Vector{NFFT.NFFTPlan{Float64, 2, 1}}, data::OIdata, nparams::Int64; weights::Vector{Float64}, cvis::Vector{Any}, printcolor::Symbol, regularizers::Vector{Vector{Any}}, verb::Bool)
   @ OITOOLS ~/.julia/packages/OITOOLS/LybQ9/src/oichi2.jl:1213
 [4] (::OITOOLS.var"#184#185"{Bool, Vector{Vector{Any}}, Vector{Float64}, Vector{Float64}, OIdata, Vector{NFFT.NFFTPlan{Float64, 2, 1}}})(x::Vector{Float64}, g::Vector{Float64})
   @ OITOOLS ~/.julia/packages/OITOOLS/LybQ9/src/oichi2.jl:1223
 [5] _vmlmb!(fg!::OITOOLS.var"#184#185"{Bool, Vector{Vector{Any}}, Vector{Float64}, Vector{Float64}, OIdata, Vector{NFFT.NFFTPlan{Float64, 2, 1}}}, x::Vector{Float64}, mem::Int64, flags::UInt64, lo::Float64, hi::Float64, bounds::UInt64, autodiff::Bool, method::Int64, fmin::Float64, maxiter::Int64, maxeval::Int64, xatol::Float64, xrtol::Float64, fatol::Float64, frtol::Float64, gatol::Float64, grtol::Float64, epsilon::Float64, verb::Int64, printer::typeof(OptimPackNextGen.QuasiNewton.print_iteration), output::Base.TTY, lnsrch::OptimPackNextGen.LineSearches.MoreToraldoLineSearch{Float64})
   @ OptimPackNextGen.QuasiNewton ~/.julia/packages/OptimPackNextGen/vQFZk/src/quasinewton.jl:391
 [6] vmlmb!(fg!::OITOOLS.var"#184#185"{Bool, Vector{Vector{Any}}, Vector{Float64}, Vector{Float64}, OIdata, Vector{NFFT.NFFTPlan{Float64, 2, 1}}}, x::Vector{Float64}; mem::Int64, lower::Int64, upper::Float64, autodiff::Bool, blmvm::Bool, fmin::Float64, maxiter::Int64, maxeval::Int64, xtol::Tuple{Int64, Float64}, ftol::Tuple{Int64, Float64}, gtol::Tuple{Int64, Float64}, epsilon::Float64, verb::Bool, printer::typeof(OptimPackNextGen.QuasiNewton.print_iteration), output::Base.TTY, lnsrch::Nothing)
   @ OptimPackNextGen.QuasiNewton ~/.julia/packages/OptimPackNextGen/vQFZk/src/quasinewton.jl:287
 [7] #vmlmb#1
   @ ~/.julia/packages/OptimPackNextGen/vQFZk/src/quasinewton.jl:215 [inlined]
 [8] reconstruct_sparco_gray(x_start::Vector{Float64}, params_start::Vector{Float64}, data::OIdata, ft::Vector{NFFT.NFFTPlan{Float64, 2, 1}}; printcolor::Symbol, verb::Bool, maxiter::Int64, regularizers::Vector{Vector{Any}}, weights::Vector{Float64}, ftol::Tuple{Int64, Float64}, xtol::Tuple{Int64, Float64}, gtol::Tuple{Int64, Float64})
   @ OITOOLS ~/.julia/packages/OITOOLS/LybQ9/src/oichi2.jl:1224
 [9] top-level scope
   @ REPL[13]:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.