From a047799506fdb5a1abc2798a1382ecfdab384814 Mon Sep 17 00:00:00 2001 From: Kazunori Akiyama Date: Fri, 10 Mar 2023 08:30:56 -0500 Subject: [PATCH] update the version --- Manifest.toml | 70 +++++++++++++++++++----------------- Project.toml | 4 ++- src/RMLImaging.jl | 5 +++ src/common.jl | 22 ++++++++++++ src/datamodels/visibility.jl | 2 +- 5 files changed, 69 insertions(+), 34 deletions(-) create mode 100644 src/common.jl diff --git a/Manifest.toml b/Manifest.toml index 71b422e..ab3415a 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,14 +1,14 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.8.0" +julia_version = "1.8.5" manifest_format = "2.0" -project_hash = "51401b543b94a43599d646cb3077b7c97d6ec4bf" +project_hash = "9737382c44b34c8ebba32c48a3523b17870b0cf2" [[deps.AbstractFFTs]] deps = ["ChainRulesCore", "LinearAlgebra"] -git-tree-sha1 = "69f7020bd72f069c219b5e8c236c1fa90d2cb409" +git-tree-sha1 = "16b6dbc4cf7caee4e1e75c49485ec67b667098a0" uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" -version = "1.2.1" +version = "1.3.1" [[deps.AbstractNFFTs]] deps = ["LinearAlgebra", "Printf"] @@ -44,9 +44,9 @@ version = "1.1.1" [[deps.ArrayInterface]] deps = ["Adapt", "LinearAlgebra", "Requires", "SnoopPrecompile", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "ec9c36854b569323551a6faf2f31fda15e3459a7" +git-tree-sha1 = "a89acc90c551067cd84119ff018619a1a76c6277" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.2.0" +version = "7.2.1" [[deps.ArrayInterfaceCore]] deps = ["LinearAlgebra", "SnoopPrecompile", "SparseArrays", "SuiteSparse"] @@ -149,14 +149,14 @@ version = "0.3.0" [[deps.Compat]] deps = ["Dates", "LinearAlgebra", "UUIDs"] -git-tree-sha1 = "61fdd77467a5c3ad071ef8277ac6bd6af7dd4c04" +git-tree-sha1 = "7a60c856b9fa189eb34f5f8a6f6b5529b7942957" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.6.0" +version = "4.6.1" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "0.5.2+0" +version = "1.0.1+0" [[deps.CompositionsBase]] git-tree-sha1 = "455419f7e328a1a2493cabc6428d79e951349769" @@ -237,9 +237,9 @@ version = "1.13.0" [[deps.DimensionalData]] deps = ["Adapt", "ArrayInterfaceCore", "ConstructionBase", "Dates", "Extents", "IntervalSets", "IteratorInterfaceExtensions", "LinearAlgebra", "Random", "RecipesBase", "SparseArrays", "Statistics", "TableTraits", "Tables"] -git-tree-sha1 = "5ebee0abcf1c3c514c67bd642f9c0b8192ad30ef" +git-tree-sha1 = "65e3e0f263ebacfdff5936db8b1a8fad207e30d2" uuid = "0703355e-b756-11e9-17c0-8b28908087d0" -version = "0.24.5" +version = "0.24.6" [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] @@ -274,6 +274,12 @@ git-tree-sha1 = "cd499d4eb498cb8208c32e5ff65fddde66a61d1c" uuid = "0d1a6071-c6ae-40ce-b68e-43bf1c0beb66" version = "0.1.0" +[[deps.EHTUVData]] +deps = ["Conda", "DataFrames", "Dates", "DimensionalData", "EHTUtils", "OrderedCollections", "PyCall", "Statistics", "Unitful", "UnitfulAngles", "UnitfulAstro"] +git-tree-sha1 = "e322c64e93c8c81f37bc7f898af7b0882b35fb0c" +uuid = "56783127-7e15-4e7d-9691-d34b50bc826a" +version = "0.1.0" + [[deps.EHTUtils]] deps = ["Dates", "Logging", "PhysicalConstants", "Unitful", "UnitfulAngles", "UnitfulAstro"] git-tree-sha1 = "771a8270bb64c6d93f4d538f44d6068e51b54c72" @@ -286,9 +292,9 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" version = "1.0.4" [[deps.ExprTools]] -git-tree-sha1 = "56559bbef6ca5ea0c0818fa5c90320398a6fbf8d" +git-tree-sha1 = "c1d06d129da9f55715c6c212866f5b1bddc5fa00" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" -version = "0.1.8" +version = "0.1.9" [[deps.Extents]] git-tree-sha1 = "5e1e4c53fa39afe63a7d356e30452249365fba99" @@ -297,9 +303,9 @@ version = "0.1.1" [[deps.FFTW]] deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] -git-tree-sha1 = "90630efff0894f8142308e334473eba54c433549" +git-tree-sha1 = "f9818144ce7c8c41edf5c4c179c684d92aa4d9fe" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.5.0" +version = "1.6.0" [[deps.FFTW_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -682,9 +688,9 @@ version = "1.7.4" [[deps.Optimization]] deps = ["ArrayInterface", "ConsoleProgressMonitor", "DocStringExtensions", "Logging", "LoggingExtras", "Pkg", "Printf", "ProgressLogging", "Reexport", "Requires", "SciMLBase", "SparseArrays", "TerminalLoggers"] -git-tree-sha1 = "2d145638f4029711871b4754aa8782f9b7116d76" +git-tree-sha1 = "2445008f1f3061f7685bb2c1dd6b556261efd4b9" uuid = "7f7a1694-90dd-40f0-9382-eb1efda571ba" -version = "3.12.0" +version = "3.12.1" [[deps.OptimizationOptimJL]] deps = ["Optim", "Optimization", "Reexport", "SparseArrays"] @@ -705,9 +711,9 @@ version = "0.12.3" [[deps.Parsers]] deps = ["Dates", "SnoopPrecompile"] -git-tree-sha1 = "6f4fbcd1ad45905a5dee3f4256fabb49aa2110c6" +git-tree-sha1 = "478ac6c952fddd4399e71d4779797c538d0ff2bf" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.5.7" +version = "2.5.8" [[deps.PhysicalConstants]] deps = ["Measurements", "Roots", "Unitful"] @@ -816,9 +822,9 @@ version = "1.3.0" [[deps.Roots]] deps = ["ChainRulesCore", "CommonSolve", "Printf", "Setfield"] -git-tree-sha1 = "9c2f5d3768804ed465f0c51540c6074ae9f63900" +git-tree-sha1 = "b45deea4566988994ebb8fb80aa438a295995a6e" uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" -version = "2.0.9" +version = "2.0.10" [[deps.RuntimeGeneratedFunctions]] deps = ["ExprTools", "SHA", "Serialization"] @@ -832,15 +838,15 @@ version = "0.7.0" [[deps.SciMLBase]] deps = ["ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Preferences", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SnoopPrecompile", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"] -git-tree-sha1 = "fe55d9f9d73fec26f64881ba8d120607c22a54b0" +git-tree-sha1 = "c5876dce653513953e145316f1406e8507ec5765" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "1.88.0" +version = "1.90.0" [[deps.SciMLOperators]] deps = ["ArrayInterface", "DocStringExtensions", "Lazy", "LinearAlgebra", "Setfield", "SparseArrays", "StaticArraysCore", "Tricks"] -git-tree-sha1 = "8419114acbba861ac49e1ab2750bae5c5eda35c4" +git-tree-sha1 = "e61e48ef909375203092a6e83508c8416df55a83" uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" -version = "0.1.22" +version = "0.2.0" [[deps.SentinelArrays]] deps = ["Dates", "Random"] @@ -956,7 +962,7 @@ version = "1.10.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" -version = "1.10.0" +version = "1.10.1" [[deps.TerminalLoggers]] deps = ["LeftChildRightSiblingTrees", "Logging", "Markdown", "Printf", "ProgressLogging", "UUIDs"] @@ -980,10 +986,10 @@ uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" version = "0.1.6" [[deps.TruncatedStacktraces]] -deps = ["InteractiveUtils"] -git-tree-sha1 = "47b1c66a0a4f98312e667992fb9cf7611eaf1c97" +deps = ["InteractiveUtils", "MacroTools"] +git-tree-sha1 = "f7057ba94e63b269125c0db75dcdef913d956351" uuid = "781d530d-4396-4725-bb49-402e4bee1e77" -version = "1.0.1" +version = "1.1.0" [[deps.UUIDs]] deps = ["Random", "SHA"] @@ -1032,10 +1038,10 @@ uuid = "83775a58-1f1d-513f-b197-d71354ab007a" version = "1.2.12+3" [[deps.Zygote]] -deps = ["AbstractFFTs", "ChainRules", "ChainRulesCore", "DiffRules", "Distributed", "FillArrays", "ForwardDiff", "GPUArrays", "GPUArraysCore", "IRTools", "InteractiveUtils", "LinearAlgebra", "LogExpFunctions", "MacroTools", "NaNMath", "Random", "Requires", "SparseArrays", "SpecialFunctions", "Statistics", "ZygoteRules"] -git-tree-sha1 = "e1af683167eea952684188f5e1e29b9cabc2e5f9" +deps = ["AbstractFFTs", "ChainRules", "ChainRulesCore", "DiffRules", "Distributed", "FillArrays", "ForwardDiff", "GPUArrays", "GPUArraysCore", "IRTools", "InteractiveUtils", "LinearAlgebra", "LogExpFunctions", "MacroTools", "NaNMath", "Random", "Requires", "SnoopPrecompile", "SparseArrays", "SpecialFunctions", "Statistics", "ZygoteRules"] +git-tree-sha1 = "5eb05dfdc66e6e7eeb5f390b3a3e7eb6e10c6b62" uuid = "e88e6eb3-aa80-5325-afca-941959d7151f" -version = "0.6.55" +version = "0.6.56" [[deps.ZygoteRules]] deps = ["MacroTools"] diff --git a/Project.toml b/Project.toml index 337cd19..cec535e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RMLImaging" uuid = "4d23c25a-f84e-4dc0-9513-4942a305df7e" authors = ["Kazunori Akiyama"] -version = "0.1.1" +version = "0.1.2" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -10,6 +10,7 @@ DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0" EHTImages = "a1be09f2-4a9d-4f8b-a1e3-812015e25e30" EHTModels = "aba06f68-8285-4329-b7bf-b3157c6bc00b" EHTNCDBase = "0d1a6071-c6ae-40ce-b68e-43bf1c0beb66" +EHTUVData = "56783127-7e15-4e7d-9691-d34b50bc826a" EHTUtils = "9d0fa6a6-ae25-4c2e-8152-6c4b7f2016aa" FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" FLoops = "cc61a311-1640-44b5-9fba-1b764f453329" @@ -18,6 +19,7 @@ NFFT = "efe261a4-0d2b-5849-be55-fc731d526b0d" Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba" OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] diff --git a/src/RMLImaging.jl b/src/RMLImaging.jl index 4e3d5f6..7b0e761 100644 --- a/src/RMLImaging.jl +++ b/src/RMLImaging.jl @@ -7,13 +7,18 @@ using DimensionalData using EHTImages using EHTModels using EHTUtils +using EHTUVData using FLoops using NFFT using Optimization using OptimizationOptimJL using OrderedCollections +using Statistics using Zygote +# common +include("./common.jl") + # data model include("./datamodels/abstract.jl") include("./datamodels/visibility.jl") diff --git a/src/common.jl b/src/common.jl new file mode 100644 index 0000000..0153256 --- /dev/null +++ b/src/common.jl @@ -0,0 +1,22 @@ +function sum_floop(x::AbstractArray; ex=ThreadedEx()) + value = 0.0 + @floop ex for i in 1:length(x) + @reduce value += x[i] + end + return value +end + +function sum_floop_grad(x::AbstractArray) + return ones(size(x)...) +end + +function ChainRulesCore.rrule(::typeof(sum_floop), x::AbstractArray; ex=ThreadedEx()) + y = sum_floop(x; ex=ex) + function pullback(Δy) + f̄bar = NoTangent() + xbar = @thunk(sum_floop_grad(x) .* Δy) + exbar = NoTangent() + return f̄bar, xbar, exbar + end + return y, pullback +end \ No newline at end of file diff --git a/src/datamodels/visibility.jl b/src/datamodels/visibility.jl index bdf2024..4bc8c3a 100644 --- a/src/datamodels/visibility.jl +++ b/src/datamodels/visibility.jl @@ -33,7 +33,7 @@ end function chisquare(datamodel::VisibilityDataModel, V::Vector{ComplexF64}; keywords...) model = evaluate(datamodel, V) @inbounds sqresid = abs.(model .- datamodel.data) .^ 2 ./ datamodel.variance - return sum(sqresid) / datamodel.Ndata + return mean(sqresid) end function get_stokesI(visds::DimStack; keywords...)