Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[arviz_example_data]
git-tree-sha1 = "10dfbe816ce1628f5ae460225e082e0eabbe064b"
git-tree-sha1 = "cb5639396962742e4eab4a5bd561126f19b9e6e3"

[[arviz_example_data.download]]
sha256 = "5184099a8b8167e990852f21090dd11592fad79ae400ef04e3710b386a5857aa"
url = "https://github.com/arviz-devs/arviz_example_data/archive/refs/tags/v0.3.0.tar.gz"
sha256 = "04b55abaf6398da33f52543b00f9eb39dc0f55f9278faad9f5425f856caeb2de"
url = "https://github.com/arviz-devs/arviz_example_data/archive/refs/tags/v0.4.3.tar.gz"
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ArviZExampleData"
uuid = "2f96bb34-afd9-46ae-bcd0-9b2d4372fe3c"
authors = ["Seth Axen <seth.axen@gmail.com> and contributors"]
version = "0.2.0"
version = "0.3.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
1 change: 0 additions & 1 deletion src/ArviZExampleData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const EXAMPLE_DATA_DIR = only(readdir(artifact"arviz_example_data"; join=true))
const LOCAL_DATA_DIR = joinpath(EXAMPLE_DATA_DIR, "data")
const LOCAL_DATA_FILE = joinpath(EXAMPLE_DATA_DIR, "data_local.json")
const REMOTE_DATA_FILE = joinpath(EXAMPLE_DATA_DIR, "data_remote.json")
const DATA_HTTP_PROTOCOL = "https"

include("metadata.jl")

Expand Down
2 changes: 1 addition & 1 deletion src/describe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This example uses an EPA study of radon levels in houses in Minnesota to constru

See Gelman and Hill (2006) for details on the example, or https://docs.pymc.io/notebooks/multilevel_modeling.html by Chris Fonnesbeck for details on this implementation.

remote: http://ndownloader.figshare.com/files/24067472
remote: https://ndownloader.figshare.com/files/24067472
```
"""
function describe_example_data end
Expand Down
14 changes: 9 additions & 5 deletions src/load.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ A file is downloaded only when it is requested and then cached for future use.

```jldoctest
julia> keys(load_example_data())
KeySet for a OrderedCollections.OrderedDict{String, ArviZExampleData.AbstractFileMetadata} with 10 entries. Keys:
KeySet for a OrderedCollections.OrderedDict{String, ArviZExampleData.AbstractFileMetadata} with 14 entries. Keys:
"centered_eight"
"non_centered_eight"
"radon"
"rugby"
"rugby_field"
"regression1d"
"regression10d"
"classification1d"
"classification10d"
"glycan_torsion_angles"
"crabs_poisson"
"crabs_hurdle_nb"
"sbc"
"anes"
"periwinkles"
"censored_cats"
"roaches_nb"
"roaches_zinb"

julia> load_example_data("centered_eight")
InferenceData with groups:
Expand Down
3 changes: 1 addition & 2 deletions src/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ function register_data(md::LocalFileMetadata)
return DataDeps.register(DataDeps.ManualDataDep(md.name, md.description))
end
function register_data(md::RemoteFileMetadata)
url = replace(md.url, "http" => DATA_HTTP_PROTOCOL)
return DataDeps.register(DataDeps.DataDep(md.name, md.description, url, md.checksum))
return DataDeps.register(DataDeps.DataDep(md.name, md.description, md.url, md.checksum))
end

register_all_data() = map(register_data, values(REMOTE_EXAMPLE_DATA))
19 changes: 13 additions & 6 deletions test/load.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@ using Test
@testset "data loading" begin
@testset "load_example_data" begin
names = [
"anes",
"censored_cats",
"centered_eight",
"classification10d",
"classification1d",
"crabs_hurdle_nb",
"crabs_poisson",
"glycan_torsion_angles",
"non_centered_eight",
"periwinkles",
"radon",
"regression10d",
"regression1d",
"roaches_nb",
"roaches_zinb",
"rugby",
"rugby_field",
"sbc",
]
datasets = load_example_data()
@test datasets isa AbstractDict{String,ArviZExampleData.AbstractFileMetadata}
@test issubset(names, keys(datasets))
for name in keys(datasets)
@testset for name in keys(datasets)
idata = load_example_data(name)
@test idata isa InferenceData
@test InferenceObjects.hasgroup(idata, :posterior)
if name != "sbc"
@test InferenceObjects.hasgroup(idata, :posterior)
end
end
@test_throws ArgumentError load_example_data("test_absent_dataset")
end
Expand Down
Loading