Skip to content

Commit 9ddca85

Browse files
authored
gif fixes (#157)
* fix for svgs * fixes for action to prevent windows IO Errors * comments in example.yml * Typo fixes
1 parent 65b6ccf commit 9ddca85

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/Example.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,21 @@ jobs:
4141
run: pip install jupyter nbconvert
4242

4343
- name: "Execute notebook"
44+
env:
45+
FILE: examples/jupyter-src/${{ matrix.file-name }}.ipynb
46+
run: jupyter nbconvert --ExecutePreprocessor.kernel_name="julia-${{ matrix.julia-version }}" --to notebook --inplace --execute ${{ env.FILE }}
47+
48+
- name: "Fix SVGs" # on notebook (json) level: removes all cells, that have the tag "text/html" AND have "<?xml " within their content
49+
run: julia -e 'using Pkg; Pkg.add("JSON"); using JSON; data = JSON.parsefile(joinpath("examples", "jupyter-src", "${{ matrix.file-name }}.ipynb"); use_mmap=false); function search_and_remove!(json, tag, content=""); if typeof(json) == Vector{Any}; for e in json; search_and_remove!(e, tag, content); end; elseif typeof(json) == Dict{String, Any}; for (t, c) in json; if contains(t, tag) && (content == "" || any([contains(line, content) for line in c])); pop!(json, t); else; search_and_remove!(c, tag, content); end; end; end; end; search_and_remove!(data, "text/html", "<?xml "); open(joinpath("examples", "jupyter-src", "tmp_${{ matrix.file-name }}.ipynb"),"w") do f; JSON.print(f, data, 1); end; mv(joinpath("examples", "jupyter-src", "tmp_${{ matrix.file-name }}.ipynb"), joinpath("examples", "jupyter-src", "${{ matrix.file-name }}.ipynb"); force=true);'
50+
51+
- name: "Export notebook to jl and md"
4452
env:
4553
FILE: examples/jupyter-src/${{ matrix.file-name }}.ipynb
4654
run: |
47-
jupyter nbconvert --ExecutePreprocessor.kernel_name="julia-${{ matrix.julia-version }}" --to notebook --inplace --execute ${{ env.FILE }}
4855
jupyter nbconvert --to script ${{ env.FILE }}
4956
jupyter nbconvert --to markdown ${{ env.FILE }}
5057
51-
- name: "Fix GIFs"
58+
- name: "Fix GIFs" # on md level, requires .gif to be exportet prior during execution and follow naming convention of gifs: gif_1.gif, gif_2.gif, ...
5259
run: |
5360
echo "starting gif fixing"
5461
mv examples/jupyter-src/gif_*.gif examples/jupyter-src/${{ matrix.file-name }}_files

docs/src/examples/overview.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The examples show how to combine FMUs with machine learning ("NeuralFMU") and il
1616
- [__Modelica Conference 2021: NeuralFMUs__](https://thummeto.github.io/FMIFlux.jl/dev/examples/modelica_conference_2021/): Showing basics on how to train a NeuralFMU (Contribution for the *Modelica Conference 2021*).
1717

1818
## Workshops
19-
[__Pluto workshops__](https://thummeto.github.io/FMI.jl/dev/examples/workshops/): [Pluto](https://plutojl.org/) based notebooks, that can easily be executed on your own Pluto-Setup.
20-
- [__Scientific Machine Learning using Functional Mock-up Units__](https://thummeto.github.io/FMI.jl/dev/examples/pluto-src/SciMLUsingFMUs/SciMLUsingFMUs.html): Workshop at JuliaCon 2024 (Eindhoven University, Netherlands)
19+
[__Pluto workshops__](https://thummeto.github.io/FMIFlux.jl/dev/examples/workshops/): [Pluto](https://plutojl.org/) based notebooks, that can easily be executed on your own Pluto-Setup.
20+
- [__Scientific Machine Learning using Functional Mock-up Units__](https://thummeto.github.io/FMIFlux.jl/dev/examples/pluto-src/SciMLUsingFMUs/SciMLUsingFMUs.html): Workshop at JuliaCon 2024 (Eindhoven University, Netherlands)
2121

2222
## Archived
2323
- [__MDPI 2022: Physics-enhanced NeuralODEs in real-world applications__](https://thummeto.github.io/FMIFlux.jl/dev/examples/mdpi_2022/): An example for a NeuralODE in a real world modeling scenario (Contribution in *MDPI Electronics 2022*).
2424
- [__Growing Horizon ME-NeuralFMU__](https://thummeto.github.io/FMIFlux.jl/dev/examples/growing_horizon_ME/): Growing horizon training technique for a ME-NeuralFMU.
25-
- [__Hands-on: Hybrid Modeling using FMI__](https://thummeto.github.io/FMI.jl/dev/examples/pluto-src/HybridModelingUsingFMI/HybridModelingUsingFMI.html): Workshop at MODPROD 2024 (Linköping University, Sweden)
25+
- [__Hands-on: Hybrid Modeling using FMI__](https://thummeto.github.io/FMIFlux.jl/dev/examples/pluto-src/HybridModelingUsingFMI/HybridModelingUsingFMI.html): Workshop at MODPROD 2024 (Linköping University, Sweden)

0 commit comments

Comments
 (0)