Skip to content

Commit 54b0c87

Browse files
new experiment profile docs
1 parent 2139691 commit 54b0c87

File tree

2 files changed

+56
-51
lines changed

2 files changed

+56
-51
lines changed

user-guide/03-Extending your Pioreactor/04-Experiment Profiles/02-create-edit-experiment-profiles.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ common:
2929
stirring:
3030
actions:
3131
- type: start
32-
hours_elapsed: 0
32+
t: 0
3333
options:
3434
target_rpm: 600
3535

@@ -39,9 +39,9 @@ pioreactors:
3939
od_reading:
4040
actions:
4141
- type: start
42-
hours_elapsed: 0
42+
t: 0
4343
- type: stop
44-
hours_elapsed: 1
44+
t: 1h
4545
```
4646
4747
4. Click **Search jobs and automations** if you want to insert additional sample actions—results paste directly into the editor.
@@ -51,9 +51,9 @@ pioreactors:
5151
5252
### How the example works
5353
54-
- `common` tasks run for **every** worker in the experiment. Here we start the stirring job everywhere at `0` hours elapsed.
54+
- `common` tasks run for **every** worker in the experiment. Here we start the stirring job everywhere at `0` time elapsed.
5555
- `pioreactors` lets you target individual workers. Swap `pio001` for your unit name (the UI autocompletes known workers) to start and stop OD readings only on that Pioreactor.
56-
- `hours_elapsed` is relative to when the profile starts. Setting `1` means "one hour after I launch this profile".
56+
- `t` is relative to when the profile starts. Use hours by default (`1` means "one hour after launch") or add units like `30s`, `2m`, `1h`, or `2d`.
5757
- You can add as many jobs as you like. Keep related actions in chronological order so they are easy to read later.
5858

5959
## Edit and iterate on a profile

user-guide/03-Extending your Pioreactor/04-Experiment Profiles/10-experiment-profiles-schema.md

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ common:
2828
stirring:
2929
actions:
3030
- type: start
31-
hours_elapsed: 0
31+
t: 0
3232
3333
pioreactors:
3434
pio001:
3535
jobs:
3636
temperature_automation:
3737
actions:
3838
- type: start
39-
hours_elapsed: 0.0
39+
t: 0.0
4040
options:
4141
automation_name: thermostat
4242
target_temperature: 35
@@ -45,21 +45,21 @@ pioreactors:
4545
temperature_automation:
4646
actions:
4747
- type: start
48-
hours_elapsed: 0.0
48+
t: 0.0
4949
options:
5050
automation_name: thermostat
5151
target_temperature: 32
5252
```
5353

54-
### `hours_elapsed` refers to the profile start time
54+
### Times refer to the profile start time
5555

56-
When writing a profile, note that the `hours_elapsed` field refers to when the experiment profile started, and not when the experiment started.
56+
When writing a profile, note that any `t` field refers to when the experiment profile started, and not when the experiment started. Use either a bare number (interpreted in hours) or a string with a unit suffix (`s`, `m`, `h`, or `d`, such as `30s`, `0.5h`, or `2d`); negative values are rejected.
5757

5858
## Conditionals and expressions
5959

6060
### How the `if` directive works
6161

62-
The `if` directive can be included in any action to conditionally execute it or not. The expression is evaluated _when the action is scheduled_ (that is, after `hours_elapsed` hours have passed since the profile started).
62+
The `if` directive can be included in any action to conditionally execute it or not. The expression is evaluated _when the action is scheduled_ (that is, after `t` time has passed since the profile started).
6363

6464
The `if` directive supports the boolean operators `and`, `or`, and `not`, parentheses, the literals `True` and `False`, comparisons (`==`, `>=`, `<=`, `>`, `<`), and basic arithmetic on floats (`+`, `-`, `*`, `/`). Strings must be bare words without spaces.
6565

@@ -77,7 +77,7 @@ fetches the `target_rpm` from `pio1`'s stirring job at execution time, compares
7777
stirring:
7878
actions:
7979
- type: update
80-
hours_elapsed: 6.0
80+
t: 6.0
8181
if: pio1:stirring:target_rpm >= 500
8282
options:
8383
target_rpm: 400
@@ -89,7 +89,7 @@ You can also compare against strings. For example, to stop a job if the temperat
8989
temperature_automation:
9090
actions:
9191
- type: stop
92-
hours_elapsed: 6.0
92+
t: 6.0
9393
if: pio1:temperature_automation:automation_name == thermostat
9494
```
9595

@@ -99,7 +99,7 @@ Many published settings are nested JSON blobs. Use `.` to index into them:
9999
temperature_automation:
100100
actions:
101101
- type: update
102-
hours_elapsed: 6.0
102+
t: 6.0
103103
if: pio1:temperature_automation:temperature.temperature <= 30
104104
options:
105105
target_temperature: 32
@@ -116,11 +116,11 @@ pioreactors:
116116
stirring:
117117
actions:
118118
- type: start
119-
hours_elapsed: 0
119+
t: 0
120120
options:
121121
target_rpm: 500
122122
- type: update
123-
hours_elapsed: 12
123+
t: 12
124124
options:
125125
target_rpm: ${{ worker1:stirring:target_rpm + 50 }}
126126
```
@@ -129,7 +129,7 @@ You can reference other jobs, too. The example below adjusts stirring based on o
129129

130130
```yaml
131131
- type: update
132-
hours_elapsed: 12
132+
t: 12
133133
options:
134134
target_rpm: ${{ worker1:stirring:target_rpm + worker1:od_reading:od2.od * 10 }}
135135
```
@@ -150,7 +150,7 @@ common:
150150
stirring:
151151
actions:
152152
- type: update
153-
hours_elapsed: 6
153+
t: 6
154154
if: ${{ ::stirring:target_rpm <= 500 }}
155155
options:
156156
target_rpm: 500
@@ -164,7 +164,7 @@ common:
164164
stirring:
165165
actions:
166166
- type: update
167-
hours_elapsed: 6
167+
t: 6
168168
if: ${{ ::stirring:target_rpm <= 500 }}
169169
options:
170170
target_rpm: ${{ ::stirring:target_rpm + 10 * ::od_reading:od2.od }}
@@ -203,7 +203,7 @@ There are a few helper functions you can call inside `${{ ... }}`:
203203

204204
### `log`
205205

206-
`log` writes a message to the event log. `options.message` is required, and `options.level` defaults to `info`.
206+
`log` writes a message to the event log. `options.message` is required, and `options.level` defaults to `notice`.
207207

208208
```yaml
209209
actions:
@@ -226,42 +226,42 @@ common:
226226
dosing_automation:
227227
actions:
228228
- type: when
229-
condition: ${{ ::od_reading:od2.od > 2.0 }}
230-
hours_elapsed: 0
229+
wait_until: ${{ ::od_reading:od2.od > 2.0 }}
230+
t: 0
231231
actions:
232232
- type: start
233-
hours_elapsed: 0
233+
t: 0
234234
options:
235235
automation_name: chemostat
236236
volume: 0.6
237237
duration: 10
238238
```
239239

240-
`hours_elapsed` delays evaluation until the specified time. Once the condition fires, the `when` action is exhausted and will not run again.
240+
`t` delays evaluation until the specified time. Once the condition fires, the `when` action is exhausted and will not run again.
241241

242242
### `repeat`
243243

244244
`repeat` loops a block of actions. It requires two fields:
245245

246-
- `actions`: the actions to perform each iteration. Their `hours_elapsed` values are relative to the start of the loop.
247-
- `repeat_every_hours`: how long, in hours, between iterations.
246+
- `actions`: the actions to perform each iteration. Their `t` values are relative to the start of the loop.
247+
- `every`: how long between iterations.
248248

249249
```yaml
250250
- type: repeat
251-
hours_elapsed: 6.0 # start looping after 6 hours
252-
repeat_every_hours: 0.5 # run every 30 minutes
251+
t: 6.0 # start looping after 6 hours
252+
every: 0.5h # run every 30 minutes
253253
actions:
254254
- type: update
255-
hours_elapsed: 0.0
255+
t: 0.0
256256
...
257257
- type: update
258-
hours_elapsed: 0.1
258+
t: 0.1h
259259
...
260260
```
261261

262262
Optional fields provide stricter control:
263263

264-
- `max_hours`: total runtime of the loop. With `repeat_every_hours: 0.5` and `max_hours: 6`, the loop runs 12 times.
264+
- `max_time`: total runtime of the loop. With `every: 0.5h` and `max_time: 6h`, the loop runs 12 times.
265265
- `while`: an expression evaluated at the start of each iteration. If it returns `False`, the loop exits.
266266
- `if`: skip the entire `repeat` block when the expression is `False`.
267267

@@ -271,8 +271,8 @@ A coarse turbidostat example:
271271
add_media:
272272
actions:
273273
- type: repeat
274-
hours_elapsed: 6.0
275-
repeat_every_hours: 0.0025 # every 9 seconds
274+
t: 6.0
275+
every: 9s
276276
while: ${{ worker1:od_reading:od2.od > 3.0 }}
277277
actions:
278278
- type: start
@@ -281,8 +281,8 @@ add_media:
281281
remove_waste:
282282
actions:
283283
- type: repeat
284-
hours_elapsed: 6.0
285-
repeat_every_hours: 0.0025
284+
t: 6.0
285+
every: 9s
286286
while: ${{ worker1:od_reading:od2.od > 3.0 }}
287287
actions:
288288
- type: start
@@ -305,12 +305,12 @@ common:
305305
temperature_automation:
306306
actions:
307307
- type: update
308-
hours_elapsed: 12.0
308+
t: 12.0
309309
if: ${{ ::od_reading:od2.od < od_threshold }}
310310
options:
311311
target_temperature: ${{ stationary_phase_temp }}
312312
- type: update
313-
hours_elapsed: 12.0
313+
t: 12.0
314314
if: ${{ ::od_reading:od2.od >= od_threshold }}
315315
options:
316316
target_temperature: ${{ growth_phase_temp }}
@@ -328,7 +328,7 @@ common:
328328
temperature_automation:
329329
actions:
330330
- type: start
331-
hours_elapsed: 0.0
331+
t: 0.0
332332
options:
333333
automation_name: thermostat
334334
target_temperature: 30
@@ -341,7 +341,7 @@ common:
341341
temperature_automation:
342342
actions:
343343
- type: start
344-
hours_elapsed: 0.0
344+
t: 0.0
345345
options:
346346
automation_name: thermostat
347347
target_temperature: 30
@@ -408,49 +408,49 @@ pioreactors:
408408
409409
# Action definitions
410410
- type: log
411-
hours_elapsed: <float>
411+
t: <time_string_or_float>
412412
if: <bool_or_expression>
413413
options:
414414
message: <string>
415415
level: DEBUG|debug|WARNING|warning|INFO|info|NOTICE|notice|ERROR|error (default: notice)
416416
417417
- type: start
418-
hours_elapsed: <float>
418+
t: <time_string_or_float>
419419
if: <bool_or_expression>
420420
options: {<option_name>: <value>} # expressions allowed via ${{ }}
421421
args: [<string>, ...]
422422
config_overrides: {<config_name>: <value>}
423423
424424
- type: update
425-
hours_elapsed: <float>
425+
t: <time_string_or_float>
426426
if: <bool_or_expression>
427427
options: {<option_name>: <value>} # expressions allowed via ${{ }}
428428
429429
- type: pause
430-
hours_elapsed: <float>
430+
t: <time_string_or_float>
431431
if: <bool_or_expression>
432432
433433
- type: resume
434-
hours_elapsed: <float>
434+
t: <time_string_or_float>
435435
if: <bool_or_expression>
436436
437437
- type: stop
438-
hours_elapsed: <float>
438+
t: <time_string_or_float>
439439
if: <bool_or_expression>
440440
441441
- type: repeat
442-
hours_elapsed: <float>
442+
t: <time_string_or_float>
443443
if: <bool_or_expression>
444-
repeat_every_hours: <float> # default: 1.0
445-
while: <bool_or_expression> # optional stop condition
446-
max_hours: <float> # optional cap on total hours
444+
every: <time_string_or_float>
445+
while: <bool_or_expression> # optional stop condition
446+
max_time: <time_string_or_float> # optional cap on total time loops run for
447447
actions:
448448
- # basic action only (log, start, pause, resume, stop, update)
449449
450450
- type: when
451-
hours_elapsed: <float>
451+
t: <time_string_or_float>
452452
if: <bool_or_expression>
453-
condition: <bool_or_expression>
453+
wait_until: <bool_or_expression>
454454
actions:
455455
- # any action (including repeat/when)
456456
@@ -483,6 +483,11 @@ pioreactors:
483483
#
484484
# Conversion rules
485485
# - Numeric strings become floats; "true"/"false" become booleans; otherwise strings stay strings.
486+
#
487+
# Time strings
488+
# Accepted formats are either a number (float/int) meaning hours, or a string that is a number immediately followed by a unit:
489+
# s, m, h, or d (case-insensitive). Examples: 0.5 (30min), "30s", "2m", "1.5h", "2d". Whitespace or extra text is rejected, and
490+
# negative values are disallowed
486491
487492
```
488493

0 commit comments

Comments
 (0)