Skip to content

Commit ffc95b6

Browse files
committed
Add function
1 parent cd59916 commit ffc95b6

10 files changed

Lines changed: 218 additions & 47 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
aiohappyeyeballs==2.6.1
2+
aiohttp==3.13.3
3+
aiohttp-session==2.12.1
4+
aiosignal==1.4.0
5+
anyio==4.12.1
6+
appnope==0.1.4
7+
argon2-cffi==25.1.0
8+
argon2-cffi-bindings==25.1.0
9+
arrow==1.4.0
10+
asttokens==3.0.1
11+
attrs==25.4.0
12+
beautifulsoup4==4.14.3
13+
bleach==6.3.0
14+
certifi==2026.1.4
15+
cffi==2.0.0
16+
charset-normalizer==3.4.4
17+
comm==0.2.3
18+
cryptography==46.0.5
19+
debugpy==1.8.20
20+
decorator==5.2.1
21+
defusedxml==0.7.1
22+
executing==2.2.1
23+
fastjsonschema==2.21.2
24+
fqdn==1.5.1
25+
frozenlist==1.8.0
26+
idna==3.11
27+
ipykernel==7.2.0
28+
ipython==9.10.0
29+
ipython-pygments-lexers==1.1.1
30+
isoduration==20.11.0
31+
jedi==0.19.2
32+
jinja2==3.1.6
33+
jsonpointer==3.0.0
34+
jsonschema==4.26.0
35+
jsonschema-specifications==2025.9.1
36+
jupyter-client==8.8.0
37+
jupyter-core==5.9.1
38+
jupyter-events==0.12.0
39+
jupyter-matlab-proxy==0.18.0
40+
jupyter-server==2.17.0
41+
jupyter-server-proxy==4.4.0
42+
jupyter-server-terminals==0.5.4
43+
jupyterlab-pygments==0.3.0
44+
lark==1.3.1
45+
markdown-it-py==4.0.0
46+
markupsafe==3.0.3
47+
matlab-proxy==0.30.1
48+
matplotlib-inline==0.2.1
49+
mdurl==0.1.2
50+
mistune==3.2.0
51+
multidict==6.7.1
52+
nbclient==0.10.4
53+
nbconvert==7.17.0
54+
nbformat==5.10.4
55+
nest-asyncio==1.6.0
56+
packaging==26.0
57+
pandocfilters==1.5.1
58+
parso==0.8.6
59+
pexpect==4.9.0
60+
platformdirs==4.7.0
61+
prometheus-client==0.24.1
62+
prompt-toolkit==3.0.52
63+
propcache==0.4.1
64+
psutil==7.2.2
65+
ptyprocess==0.7.0
66+
pure-eval==0.2.3
67+
pycparser==3.0
68+
pygments==2.19.2
69+
python-dateutil==2.9.0.post0
70+
python-json-logger==4.0.0
71+
pyyaml==6.0.3
72+
pyzmq==27.1.0
73+
referencing==0.37.0
74+
requests==2.32.5
75+
rfc3339-validator==0.1.4
76+
rfc3986-validator==0.1.1
77+
rfc3987-syntax==1.1.0
78+
rich==14.3.2
79+
rpds-py==0.30.0
80+
send2trash==2.1.0
81+
simpervisor==1.0.0
82+
six==1.17.0
83+
soupsieve==2.8.3
84+
stack-data==0.6.3
85+
terminado==0.18.1
86+
tinycss2==1.4.0
87+
tornado==6.5.4
88+
traitlets==5.14.3
89+
typing-extensions==4.15.0
90+
tzdata==2025.3
91+
uri-template==1.3.0
92+
urllib3==2.6.3
93+
watchdog==6.0.0
94+
wcwidth==0.6.0
95+
webcolors==25.10.0
96+
webencodings==0.5.1
97+
websocket-client==1.9.0
98+
yarl==1.22.0

.github/workflows/calkit-run.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Run Calkit pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
12+
# Make sure we only ever run one per branch so we don't have issues pushing
13+
# after running the pipeline
14+
concurrency:
15+
group: calkit-run-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
main:
20+
name: Run
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
# For PRs, checkout the head ref to avoid detached HEAD
26+
ref: ${{ github.head_ref || github.ref_name }}
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
submodules: true
29+
- name: Configure Git credentials
30+
run: |
31+
git config user.name github-actions[bot]
32+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
33+
- name: Setup uv
34+
uses: astral-sh/setup-uv@v5
35+
- name: Install Calkit
36+
run: uv tool install calkit-python
37+
- name: Setup matlab
38+
uses: matlab-actions/setup-matlab@v2
39+
with:
40+
cache: true
41+
release: R2024b
42+
products: >
43+
Parallel_Computing_Toolbox
44+
Global_Optimization_Toolbox
45+
Optimization_Toolbox
46+
Statistics_and_Machine_Learning_Toolbox
47+
MATLAB_Report_Generator
48+
Simulink
49+
Simscape
50+
Simscape_Multibody
51+
- name: Run Calkit
52+
uses: calkit/run-action@378d217f814687b57b1b71fd710c43e8c75dfdef
53+
with:
54+
dvc_token: ${{ secrets.CALKIT_DVC_TOKEN }}
55+
matlab: true

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
scratch.m
22
.DS_Store
3-
43
.env

calkit.yaml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,41 @@ title: MATLAB example
22
description: >
33
This project shows how to incorporate MATLAB into a reproducible
44
research project.
5-
environments:
6-
matlab:
7-
kind: matlab
8-
version: R2024b
9-
products:
10-
- Statistics_and_Machine_Learning_Toolbox
11-
- Parallel_Computing_Toolbox
5+
# environments:
6+
# matlab:
7+
# kind: matlab
8+
# version: R2024b
9+
# products:
10+
# - Statistics_and_Machine_Learning_Toolbox
11+
# - Parallel_Computing_Toolbox
12+
1213
pipeline:
1314
stages:
1415
collect-data:
1516
kind: matlab-script
16-
environment: matlab
1717
script_path: scripts/collect_data.m
18+
environment: _system
19+
inputs:
20+
- src/myfunction.m
1821
outputs:
19-
- data/raw/data.parquet
22+
- path: data/raw/data.parquet
23+
storage: dvc
2024
plot-data:
2125
kind: matlab-script
22-
environment: matlab
2326
script_path: scripts/plot_data.m
24-
outputs:
25-
- figures/plot.png
27+
environment: _system
2628
inputs:
2729
- data/raw/data.parquet
30+
outputs:
31+
- path: figures/plot.png
32+
storage: dvc
33+
2834
datasets:
2935
- path: data/raw/data.parquet
3036
title: Raw data
3137
description: The raw data from the experiment.
3238
stage: collect-data
39+
3340
figures:
3441
- path: figures/plot.png
3542
title: The plot

dvc.lock

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,36 @@ stages:
1313
md5: 0b2be6aa89192942ea0e1263f9f7e55c
1414
size: 384
1515
plot-data:
16-
cmd: calkit xenv -n matlab --no-check -- "run('scripts/plot_data.m');"
16+
cmd: matlab -batch "restoredefaultpath; run('scripts/plot_data.m');"
1717
deps:
18-
- path: .calkit/env-locks/matlab.json
19-
hash: md5
20-
md5: 074a6771582255a621b5fda8cb2cc2d3
21-
size: 5082
2218
- path: data/raw/data.parquet
2319
hash: md5
24-
md5: 7d4fadae29fbf5fdf9eedc81a9f0cc9e
20+
md5: 69f8e2d950d29dc34ce8b1ce944c637c
2521
size: 9853
2622
- path: scripts/plot_data.m
2723
hash: md5
28-
md5: dd5ffb54107b06b64d0f3fb5be4429f9
29-
size: 144
24+
md5: ba7e2fcc376bc1f4b17fca546082cf7b
25+
size: 148
3026
outs:
3127
- path: figures/plot.png
3228
hash: md5
33-
md5: 0459648a57a7fd45c8264e4902a15494
34-
size: 79715
29+
md5: beee9043fe29cb7f49f6c4343e06a615
30+
size: 58503
3531
collect-data:
36-
cmd: calkit xenv -n matlab --no-check -- "run('scripts/collect_data.m');"
32+
cmd: matlab -batch "restoredefaultpath; run('scripts/collect_data.m');"
3733
deps:
38-
- path: .calkit/env-locks/matlab.json
39-
hash: md5
40-
md5: 074a6771582255a621b5fda8cb2cc2d3
41-
size: 5082
4234
- path: scripts/collect_data.m
4335
hash: md5
44-
md5: e9f0c4b4277e253b9034dbc7e5495058
45-
size: 142
36+
md5: 698569e0ca9128c52f0dec553a9badd1
37+
size: 210
38+
- path: src/myfunction.m
39+
hash: md5
40+
md5: 84a5dc7525d6297428329a1a79c8ac87
41+
size: 53
4642
outs:
4743
- path: data/raw/data.parquet
4844
hash: md5
49-
md5: 7d4fadae29fbf5fdf9eedc81a9f0cc9e
45+
md5: 69f8e2d950d29dc34ce8b1ce944c637c
5046
size: 9853
5147
_check_env_matlab:
5248
cmd: calkit check matlab-env --name matlab --output .calkit/env-locks/matlab.json

dvc.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
stages:
2-
_check-env-matlab:
3-
cmd: calkit check matlab-env --name matlab --output .calkit/env-locks/matlab.json
4-
deps: []
5-
outs:
6-
- .calkit/env-locks/matlab.json:
7-
cache: false
8-
persist: true
9-
always_changed: true
102
collect-data:
11-
cmd: calkit xenv -n matlab --no-check -- "run('scripts/collect_data.m');"
3+
cmd: matlab -batch "restoredefaultpath; run('scripts/collect_data.m');"
124
deps:
135
- scripts/collect_data.m
14-
- .calkit/env-locks/matlab.json
6+
- src/myfunction.m
157
outs:
16-
- data/raw/data.parquet
8+
- data/raw/data.parquet:
9+
cache: true
10+
persist: false
11+
desc: Automatically generated from the 'collect-data' stage in calkit.yaml.
12+
Changes made here will be overwritten.
1713
plot-data:
18-
cmd: calkit xenv -n matlab --no-check -- "run('scripts/plot_data.m');"
14+
cmd: matlab -batch "restoredefaultpath; run('scripts/plot_data.m');"
1915
deps:
2016
- scripts/plot_data.m
2117
- data/raw/data.parquet
22-
- .calkit/env-locks/matlab.json
2318
outs:
24-
- figures/plot.png
19+
- figures/plot.png:
20+
cache: true
21+
persist: false
22+
desc: Automatically generated from the 'plot-data' stage in calkit.yaml.
23+
Changes made here will be overwritten.

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jupyter-matlab-proxy

scripts/collect_data.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
disp("Processing data");
2+
3+
addpath("../src");
4+
5+
myfunction();
6+
7+
% Set random seed
8+
rng(432);
9+
210
voltage = rand(1000, 1);
311
data = table(voltage);
12+
413
mkdir("../data/raw");
5-
parquetwrite("../data/raw/data.parquet", data);
14+
15+
parquetwrite("../data/raw/data.parquet", data);

scripts/plot_data.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
disp("Plotting");
2+
23
data = parquetread("../data/raw/data.parquet");
4+
35
plot(data, "voltage");
6+
47
mkdir("../figures");
5-
saveas(gcf, "../figures/plot.png")
8+
saveas(gcf, "../figures/plot.png")

src/myfunction.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function myfunction()
2+
disp('Hello, World!');
3+
end

0 commit comments

Comments
 (0)