Skip to content

Commit

Permalink
fix equations and gifs in the mountain cair example
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Jun 2, 2023
1 parent 8273c0f commit f40d0cd
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 390 deletions.
354 changes: 205 additions & 149 deletions examples/Active Inference Mountain car.ipynb

Large diffs are not rendered by default.

255 changes: 28 additions & 227 deletions examples/Infinite Data Stream.ipynb

Large diffs are not rendered by default.

Binary file added examples/pics/infinite-data-stream-inference.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/pics/infinite-data-stream.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 5 additions & 14 deletions scripts/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,11 @@ function Base.run(examplesrunner::ExamplesRunner)
close(examplesrunner.jobschannel)
close(examplesrunner.resultschannel)

# `gifs` are a bit special in the `Plots.jl`, we need to fix paths manually
gifs = filter(d -> last(splitext(d)) == ".gif", readdir(joinpath(dfolder, "pics"), join = true))

foreach(gifs) do gifpath
mv(gifpath, joinpath(afolder, last(splitpath(gifpath))), force = true)
end

fixgifs = map(gifs) do gifpath
gif_filename = last(splitpath(gifpath))
return gif_filename => string("../assets/examples/pics/", gif_filename)
end

# Fix paths from the `pics/` folder located in the examples
fixpics = "![](pics/" => "![](../assets/examples/pics/"
fixpics = (
"![](pics/" => "![](../assets/examples/pics/",
"![](./pics/" => "![](../assets/examples/pics/",
)

if isnothing(examplesrunner.specific_example)

Expand Down Expand Up @@ -227,7 +218,7 @@ function Base.run(examplesrunner::ExamplesRunner)
open(mdpath, "w") do f
# In every examples we replace title with its `@id` equivalent, such that
# `# Super cool title` becomes `[# Super cool title](@id examples-super-cool-title)`
fixtext = replace(mdtext, "# $(title)" => "# [$(title)](@id $(id))", fixpics, fixgifs...)
fixtext = replace(mdtext, "# $(title)" => "# [$(title)](@id $(id))", fixpics...)
output = string("This example has been auto-generated from the [`examples/`](https://github.com/biaslab/RxInfer.jl/tree/main/examples) folder at GitHub repository.\n\n", fixtext)
write(f, output)
end
Expand Down

0 comments on commit f40d0cd

Please sign in to comment.