Giter VIP home page Giter VIP logo

adjson.jl's Introduction

Run tests License: MIT

ADjson.jl

ADjson.jl provides ADerrors.jl with input and output routines for the json.gz file format used within pyerrors. The specifications of the json.gz format can be found in the documentation of pyerrors.

Installation

The package depends on ADerrors.jl which depends on bdio.jl. All three packages are not registered in the official Julia registry. They can be installed by running the following commands:

julia -e 'using Pkg; Pkg.add(url="https://gitlab.ift.uam-csic.es/alberto/bdio.jl")'
julia -e 'using Pkg; Pkg.add(url="https://gitlab.ift.uam-csic.es/alberto/ADerrors.jl")'
julia -e 'using Pkg; Pkg.add(url="https://github.com/fjosw/ADjson.jl")'

Features

At the moment ADjson.jl supports only a subset of the full json.gz-pyerrors specification.

Obs List Array Corr
read ✔️ ✔️ ✔️ ✔️
write ✔️ ✔️ ✖️ ✖️

Notes

  • ADerrors.jl always assumes that replica are labeled as r0, r1, etc. Custom replica names in json.gz files get lost in the conversion.
  • Per replicum means, labelled $\bar{a}_{\alpha}^{r}$ in hep-lat/0306017, get lost in the conversion as they are not stored within ADerrors.jl data types.
  • ADerrors.jl does not support array valued constants with cross correlations. If such a constant is found in a json.gz file ADjson.jl throws an error.
  • Reading files with multiple replica and gaps in the Monte Carlo history is not yet supported as not all cases supported by pyerrors can be correctly initialized in ADerrors.jl. For now ADjson.jl throws an error in case such an observable is encountered.
  • Writing files with gaps in the Monte Carlo history is not supported as ADerrors.jl rescales gapped data and this rescaling can be ambiguous.

Examples

A single observable can be written to a file as described in the following example

using ADerrors
using ADjson

# Create a test observable
test_obs = uwreal(rand(100), "Test ensemble")

# Write the observable to a file with a description
dump_to_json(test_obs, "test_file", "This file contains a test observable.")

# Read the observable from disk
check = load_json("test_file")

# Check that the observable was corretly reconstructed
iamzero = test - check
uwerr(iamzero)
println(iamzero)
>>> 0.0 +/- 0.0

ADjson.jl can also directly write a vector of uwreal objects to disc

test_obs = uwreal(rand(100), "Test ensemble") + uwreal(rand(20), "Second shorter test ensemble")
test_obs *= uwreal([1.02, 0.01], "Renormalization")

dump_to_json([test_obs, test_obs, test_obs],
             "vector_file",
             "File contains three times a test observable which is defined on two ensembles and a constant.")

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.