torrance / casacore.jl Goto Github PK
View Code? Open in Web Editor NEWA high level Julia interface to Casacore
License: MIT License
A high level Julia interface to Casacore
License: MIT License
Reported by Iniyan Natarajan:
I have a question about updating MSes using Casacore.jl and wasn't sure whether Github issues was the right place to ask: how do I write back the changes made to the disk? For instance, I can do something like this without errors:
tab = CCTable("[test.ms](http://test.ms/)", CCTables.Update)
deleteat!(tab, 100)
But how do I close/write the changes made back to the MS? I couldn't find it in the readme and I don't see the changes reflected in the MS.
While I can easily access the values of a Float64 array such as the DISH_DIAMETER in the ANTENNA subtable
table.ANTENNA[:DISH_DIAMETER][:]
,
trying to access a column with string values throws the following error:
table.ANTENNA[:MOUNT][:]
ERROR: MethodError: Cannot `convert` an object of type Ptr{Nothing} to an object of type Casacore.LibCasacore.String
Closest candidates are:
convert(::Type{Casacore.LibCasacore.String}, ::Casacore.LibCasacore.StringDereferenced) at ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:681
convert(::Type{Casacore.LibCasacore.String}, ::Casacore.LibCasacore.StringAllocated) at ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:680
convert(::Type{Casacore.LibCasacore.String}, ::T) where T<:Casacore.LibCasacore.String at ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:676
...
Stacktrace:
[1] cxxconvert(to_type::Type{CxxWrap.CxxWrapCore.CxxPtr{Casacore.LibCasacore.String}}, x::Ptr{Nothing}, #unused#::Type{CxxWrap.CxxWrapCore.IsCxxType})
@ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:581
[2] cconvert(to_type::Type{CxxWrap.CxxWrapCore.CxxPtr{Casacore.LibCasacore.String}}, x::Ptr{Nothing})
@ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:564
[3] Casacore.LibCasacore.Vector{Casacore.LibCasacore.String}(arg1::Casacore.LibCasacore.IPositionAllocated, arg2::Ptr{Nothing}, arg3::Casacore.LibCasacore.StorageInitPolicy)
@ Casacore.LibCasacore ~/.julia/packages/CxxWrap/IdOJa/src/CxxWrap.jl:618
[4] getindex(c::Casacore.Tables.Column{Casacore.LibCasacore.String, 1, Casacore.LibCasacore.ScalarColumnAllocated{Casacore.LibCasacore.String}}, i::Colon)
@ Casacore.Tables ~/.julia/packages/Casacore/pZFa6/src/Tables.jl:204
[5] top-level scope
@ REPL[14]:1
Am I missing something related to indexing in Julia here? Or is there something about Casacore's own String type I should be watching out for? Thanks!
Pkg.add("Casacore")
on Julia 1.10 fails due to both CxxWrap and libcasacorecxx_jll failing to build. This seems to be due at least to CxxWrap being restricted to version 0.12 in Project.toml. Independently, I can confirm that I can precompile CxxWrap version 0.14 on Julia 1.10 successfully, but not 0.12.
Would it be easy to release an updated version of Casacore that works with Julia 1.10?
Thanks!
I am using some casatools and casatasks with PythonCall for some functionality currently unavailable in Casacore.jl. Once I open an MS in Update mode and write some data into it, it seems like there is no way to close or free it for further manipulation by a different module. Is there a clean way to close an MS so that I can use casatools/casatasks on it?
For instance, I write some data into an MS using Casacore.jl and then want to use exportuvfits() on it. This is what I get when I call exportuvfits from my code:
[ Info: Creating test.uvfits from test.ms...
2023-08-02 17:51:06 SEVERE exportuvfits::ms::open Exception Reported: RegularFileIO: error in open or create of file /home/iniyan/software/dev/Anime.jl/examples/output/test.ms/table.f2: No such file or directory
2023-08-02 17:51:06 SEVERE exportuvfits::::casa Task exportuvfits raised an exception of class RuntimeError with the following message: RegularFileIO: error in open or create of file /home/iniyan/software/dev/Anime.jl/examples/output/test.ms/table.f2: No such file or directory
ERROR: LoadError: Python: RuntimeError: RegularFileIO: error in open or create of file /home/iniyan/software/dev/Anime.jl/examples/output/test.ms/table.f2: No such file or directory
Python stacktrace:
[1] open
@ casatools.__casac__.ms ~/software/dev/Anime.jl/.CondaPkg/env/lib/python3.8/site-packages/casatools/__casac__/ms.py:151
[2] open
@ casatools.ms ~/software/dev/Anime.jl/.CondaPkg/env/lib/python3.8/site-packages/casatools/ms.py:79
[3] exportuvfits
@ casatasks.private.task_exportuvfits ~/software/dev/Anime.jl/.CondaPkg/env/lib/python3.8/site-packages/casatasks/private/task_exportuvfits.py:15
[4] __call__
@ casatasks.exportuvfits ~/software/dev/Anime.jl/.CondaPkg/env/lib/python3.8/site-packages/casatasks/exportuvfits.py:182
Stacktrace:
[1] pythrow()
@ PythonCall ~/.julia/packages/PythonCall/1f5yE/src/err.jl:94
[2] errcheck
@ ~/.julia/packages/PythonCall/1f5yE/src/err.jl:10 [inlined]
[3] pycallargs
@ ~/.julia/packages/PythonCall/1f5yE/src/abstract/object.jl:211 [inlined]
[4] pycall(::PythonCall.Py; kwargs::Base.Pairs{Symbol, String, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:vis, :fitsfile, :datacolumn), Tuple{String, String, String}}})
@ PythonCall ~/.julia/packages/PythonCall/1f5yE/src/abstract/object.jl:222
[5] pycall
@ ~/.julia/packages/PythonCall/1f5yE/src/abstract/object.jl:218 [inlined]
[6] #_#11
@ ~/.julia/packages/PythonCall/1f5yE/src/Py.jl:341 [inlined]
[7] mstouvfits(msname::String, uvfits::String, datacolumn::String; field::String, spw::String, antenna::String, timerange::String, overwrite::Bool)
@ Main.Anime ~/software/dev/Anime.jl/src/storageutils/generatems.jl:165
[8] mstouvfits(msname::String, uvfits::String, datacolumn::String)
@ Main.Anime ~/software/dev/Anime.jl/src/storageutils/generatems.jl:156
[9] top-level scope
@ ~/software/dev/Anime.jl/examples/AnimeExample.jl:127
in expression starting at /home/iniyan/software/dev/Anime.jl/examples/AnimeExample.jl:127
But if I
then I do not get any errors. Any ideas? Thanks for your help!
I can ]add Casacore
(v 0.2.0) in Julia 1.8.3 , but when it tries to precompile it gives this error:
julia> import Pkg; Pkg.precompile()
Precompiling project...
✗ Casacore
0 dependencies successfully precompiled in 1 seconds. 381 already precompiled.
ERROR: The following 1 direct dependency failed to precompile:
Casacore [72bb1062-94f5-49fa-bb69-94b615203ad9]
Failed to precompile Casacore [72bb1062-94f5-49fa-bb69-94b615203ad9] to /Users/davidm/.julia/compiled/v1.8/Casacore/jl_pJbmQl.
ERROR: LoadError: UndefVarError: libcasacorecxx not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Casacore/Xzq3F/src/LibCasacore.jl:7
[2] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[3] include(x::String)
@ Casacore ~/.julia/packages/Casacore/Xzq3F/src/Casacore.jl:1
[4] top-level scope
@ ~/.julia/packages/Casacore/Xzq3F/src/Casacore.jl:3
[5] include
@ ./Base.jl:419 [inlined]
[6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[7] top-level scope
@ stdin:1
in expression starting at /Users/davidm/.julia/packages/Casacore/Xzq3F/src/LibCasacore.jl:1
in expression starting at /Users/davidm/.julia/packages/Casacore/Xzq3F/src/Casacore.jl:1
in expression starting at stdin:1
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
[2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1432
[3] precompile
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1063 [inlined]
[4] #precompile#225
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
[5] precompile (repeats 2 times)
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1062 [inlined]
[6] top-level scope
@ REPL[26]:1
Here is my version info:
julia> versioninfo()
Julia Version 1.8.3
Commit 0434deb161e (2022-11-14 20:14 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin21.3.0)
CPU: 8 × Apple M2
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
Threads: 1 on 4 virtual cores
Is this due to lack of M2 support in casacore itself? If it can't (yet) work, it would at least be nice to get a friendlier error message.
Indexing into a column to get all data currently requires using as many colons (or 1:N
UnitRanges) as there are dimensions. As a convenience, it would be nice if one could use empty indexing to get all data. This also avoids having to know the dimensionality of the data, which can aid exploration of the data format.
Instead of:
antpos = table.ANETNNA[:POSITION][:,:]
one could use:
antpos = table.ANETNNA[:POSITION][]
FWIW, HDF5.jl uses this convention to read data from HDF5 Datasets.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.