Skip to content

Commit

Permalink
Merge pull request #33 from scipp/varargs
Browse files Browse the repository at this point in the history
Add support for parameter tables
  • Loading branch information
SimonHeybrock authored Aug 11, 2023
2 parents cd0c2c7 + cc98092 commit a4cec89
Show file tree
Hide file tree
Showing 16 changed files with 1,778 additions and 63 deletions.
2 changes: 2 additions & 0 deletions docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
:template: class-template.rst
:recursive:
ParamTable
Pipeline
Scope
Series
scheduler.Scheduler
scheduler.DaskScheduler
scheduler.NaiveScheduler
Expand Down
10 changes: 7 additions & 3 deletions docs/user-guide/getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
"from typing import NewType\n",
"import sciline\n",
"\n",
"_fake_filesytem = {'data.txt': [1, 2, float('nan'), 3]}\n",
"\n",
"\n",
"# 1. Define domain types\n",
"\n",
"Filename = NewType('Filename', str)\n",
Expand All @@ -115,19 +118,20 @@
"\n",
"def load(filename: Filename) -> RawData:\n",
" \"\"\"Load the data from the filename.\"\"\"\n",
" return {'data': [1, 2, float('nan'), 3], 'meta': {'filename': filename}}\n",
" data = _fake_filesytem[filename]\n",
" return RawData({'data': data, 'meta': {'filename': filename}})\n",
"\n",
"\n",
"def clean(raw_data: RawData) -> CleanedData:\n",
" \"\"\"Clean the data, removing NaNs.\"\"\"\n",
" import math\n",
"\n",
" return [x for x in raw_data['data'] if not math.isnan(x)]\n",
" return CleanedData([x for x in raw_data['data'] if not math.isnan(x)])\n",
"\n",
"\n",
"def process(data: CleanedData, param: ScaleFactor) -> Result:\n",
" \"\"\"Process the data, multiplying the sum by the scale factor.\"\"\"\n",
" return sum(data) * param\n",
" return Result(sum(data) * param)\n",
"\n",
"\n",
"# 3. Create pipeline\n",
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ maxdepth: 2
---
getting-started
parameter-tables
```
Loading

0 comments on commit a4cec89

Please sign in to comment.