Skip to content

Commit d07d2bd

Browse files
Initial commit
0 parents  commit d07d2bd

36 files changed

Lines changed: 2234 additions & 0 deletions

.github/workflows/pages.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
7+
name: Deploy Jekyll site to Pages
8+
9+
on:
10+
push:
11+
branches: ["main"]
12+
paths: ["docs/**"]
13+
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
24+
# Allow one concurrent deployment
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: true
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
defaults:
34+
run:
35+
working-directory: docs
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v5
39+
- name: Setup Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: '3.3' # Not needed with a .ruby-version file
43+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44+
cache-version: 0 # Increment this number if you need to re-download cached gems
45+
working-directory: '${{ github.workspace }}/docs'
46+
- name: Setup Pages
47+
id: pages
48+
uses: actions/configure-pages@v5
49+
- name: Build with Jekyll
50+
# Outputs to the './_site' directory by default
51+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
52+
env:
53+
JEKYLL_ENV: production
54+
- name: Upload artifact
55+
# Automatically uploads an artifact from the './_site' directory by default
56+
uses: actions/upload-pages-artifact@v4
57+
with:
58+
path: docs/_site/
59+
60+
# Deployment job
61+
deploy:
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
runs-on: ubuntu-latest
66+
needs: build
67+
steps:
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v4
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function out = columnize_structure(s)
2+
% Function ensures structure fields are columns
3+
4+
field_names = fieldnames(s);
5+
for i=1:numel(field_names)
6+
s_fn = size(s.(field_names{i}));
7+
if (s_fn(1) < s_fn(2))
8+
s.(field_names{i}) = (s.(field_names{i}))';
9+
end
10+
end
11+
12+
out = s;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
function jitter_data = table_to_jitter_format( ...
2+
t, data_label, f1_label, options)
3+
4+
arguments
5+
t (:,:) table
6+
data_label (1,1) string
7+
f1_label (1,1) string
8+
options.f2_label (1,1) string = ""
9+
options.f1_values (1,:) string = ""
10+
options.f2_values (1,:) string = ""
11+
options.grouping_label (1,1) string
12+
end
13+
14+
% Code
15+
16+
% Initialise output structure
17+
jitter_data = [];
18+
19+
% Do some conversions
20+
% Useful for == operator later
21+
if (iscell(t.(f1_label)(1)))
22+
t.(f1_label) = string(t.(f1_label));
23+
end
24+
if (((options.f2_label ~= "") && iscell(t.(options.f2_label)(1))))
25+
t.(options.f2_label) = string(t.(options.f2_label));
26+
end
27+
if ( (options.grouping_label ~= "") && ...
28+
(iscell(t.(options.grouping_label)(1))))
29+
t.(options.grouping_label) = string(t.(options.grouping_label));
30+
end
31+
32+
% Work out the unique values
33+
if (~isempty(options.f1_values))
34+
options.f1_values = unique(t.(f1_label));
35+
jitter_data.f1_values = options.f1_values;
36+
end
37+
38+
if (options.f2_label ~= "")
39+
if (~isempty(options.f2_values))
40+
options.f2_values = unique(t.(options.f2_label));
41+
jitter_data.f2_values = options.f2_values;
42+
end
43+
else
44+
options.f2_values = [];
45+
end
46+
47+
% Loop through combinations
48+
for f1_i = 1 : numel(options.f1_values)
49+
50+
if (isempty(options.f2_values))
51+
% One factor only
52+
vi = find(t.(f1_label) == options.f1_values(f1_i));
53+
jitter_data(1).points{f1_i} = t.(data_label)(vi);
54+
if (~isempty(options.grouping_label))
55+
jitter_data(1).group{f1_i} = t.(options.grouping_label)(vi);
56+
end
57+
else
58+
% Two factors
59+
for f2_i = 1 : numel(options.f2_values)
60+
vi = find((t.(f1_label) == options.f1_values(f1_i)) & ...
61+
(t.(options.f2_label) == options.f2_values(f2_i)));
62+
jitter_data(f2_i).points{f1_i} = t.(data_label)(vi);
63+
if (options.grouping_label ~= "")
64+
jitter_data(f2_i).group{f1_i} = t.(options.grouping_label)(vi);
65+
end
66+
end
67+
end
68+
end
69+
70+
71+
72+
73+
74+
75+
76+

0 commit comments

Comments
 (0)