-
Notifications
You must be signed in to change notification settings - Fork 11
Working with Activities
"Activities" is a way to prepare many different tasks (for example for teaching, or doing experiments) and they allow you to easily switch between them.
Activities have several components:
- Python files with prepared analyses
- configuration file
- dataset
- optionally slides (for designing an experiment)
Features:
- automatic loading of predefined layers
- allows different reference raster and scanning parameters for different activities
- allows simple filtering of hands
- adding profiles, simple dashboard
- limiting time for each activity (for experiments)
- support logging and postprocessing (for experiments, needs to be scripted specifically based on the activity)
- slides with automatic progress (for experiments)
The Python files are described in Running analyses and developing workflows.
The following settings do not depend on the activities.
Specification of directory where to find Python files with activity workflow for all activities. This is required.
"taskDir": "/path/to/my/activities/",
Specification of directory where to write log files after each activity ends (useful for running experiments).
This postprocessing is done inside the Python files describing the activity workflow in Python function
starting with post_...
. This is optional.
"logDir": "/path/to/logs/",
Specifies whether HTML (specifically reveal.js) slides should be used during the activity (useful for running experiments). This has 2 items, one specifies directory where html slides are to be found, and the second determines the position where the window with slides will be opened. This is optional.
"slides":
{
"dir": "/home/tangible/Rogers_experiment/experiment_slides2/",
"position": [2000, 300]
},
Specifies whether to show a sign after completing each activity to indicate that users need to remove hands so that the scanner can capture final result (useful for experiments). Color, font size, position (within Map Display) and text can be specified. This is optional.
"handsoff": [
"d.text",
"at=6,45",
"size=20",
"color=red",
"text='HANDS OFF'"
],
Specifies how much time the sign stays displayed to ensure completing each activity. Color, font size, position and text can be specified. This is optional, if not specified it's 0 seconds, units are milliseconds.
"duration_handsoff": 6000,
"duration_handsoff_after": 5000,
Key bindings for specific actions. In wxPython, for example, wx.WXK_F5
is 344 and so on.
You can find a list of key event names here.
Available actions are stopTask
(user can stop activity this way, for example using a button),
and scanOnce
which is used in cases when we don't need to run analysis continuously during
the activity, but need to capture and analyze the scan just when the user needs it.
This is optional, you can specify one or both.
"keyboard_events": {"stopTask": 344, "scanOnce": 370},
This describes the activities (explained further below):
"tasks": [
{
"title": "Freeplay",
"layers": [
[
"d.rast",
"map=freeplay_scan"
],
[
"d.vect",
"map=freeplay_contours"
],
],
"layers_opacity": [1.0, 0.5],
"calibration": false,
"base": "cutfill1_dem1",
"time_limit": 300,
"scanning_params": {"smooth": 10, "numscans": 2, "zexag": 1},
"analyses": "experiment_freeplay.py",
"filter" : {"threshold": 200, "debug": true},
"slides": {"switch": [93, 174], "file": "freeplay.html"},
"profile": {"size": [400, 140], "position": [4272, 660],
"limitx": [0, 350], "limity": [90, 190], "ticks": 10, "raster": "freeplay_scan"}
}
]
Specifies title of the activity visible in the GUI, it's required:
"title": "Freeplay"
Specification of GIS layers which should be loaded when the activity starts. The display will automatically zoom to capture all these layers. The specification of the symbology is given using d.rast and d.vect GRASS GIS modules. Note that the specified raster or vector maps must be present when the activity starts, otherwise the loading will fail. This is required, however the layer list can be empty if needed.
"layers": [
[
"d.rast",
"map=freeplay_scan"
],
[
"d.vect",
"map=freeplay_contours"
],
],
This specifies the semitransparency of the layers (1 is opaque). The length of the list should be the same as the number of loaded layers. This is optional.
"layers_opacity": [1.0, 0.5],
Sometimes it's necessary to capture the topography shape before the start of the activity,
for example for detection of markers. Specifying true
will result in creating a 'Calibrate' button for the activity. When you press the Calibrate button, it will save the raster under name scan_saved
.
This is optional.
"calibration": false,
Specifies a raster map used for georeferencing. This is required.
"base": "cutfill1_dem1",
Specifies time limit for each activity (useful for experiments). After the specified time is up, the activity is ended, useful for experiments. This is optional, units are seconds.
"time_limit": 300,
Specifies scanning parameters, overwrites whatever is set in Scanning tab. This is optional, however the settings stay for next activities unless other settings are specified there:
"scanning_params": {"smooth": 10, "numscans": 2, "zexag": 1},
File with Python workflow file for the activity (and postprocessing if desired). The directory is specified in 'taskDir' above. This is required.
"analyses": "experiment_freeplay.py",
Specifies filtering of scans to avoid scans with captured hands based on the range of elevation values of each scan.
"debug": true
outputs the elevation range in normal case without hands and allows in this way to pick the right threshold.
"filter" : {"threshold": 200, "debug": true},
Allows to have activities which use continuous scanning (false) or just single scan. This is optional, by default it's continuous:
"single_scan": true,
Specifies details of the slides for each activity (when to switch slides and which html file to use). 'Switch' is a list of numbers telling the application when to switch to next slide, in this case next slide is switched after 93s and 174 s (from the beginning of the activity). When the last slide comes, the activity is started and the last slide stays on screen.
"slides": {"switch": [93, 174], "file": "freeplay.html"},
Specifies whether profile widget should be displayed, what is its size, position on the screen, limit on axes, and raster used for computing the profile:
"profile": {"size": [400, 140], "position": [4272, 660],
"limitx": [0, 350], "limity": [90, 190], "ticks": 10, "raster": "freeplay_scan"},
This is how the profile gets updated from a Python workflow file:
from activities import updateProfile
def run_freeplay(scanned_elev, eventHandler, env, **kwargs):
event = updateProfile(points=[(640026, 223986), (640334, 223986)])
eventHandler.postEvent(receiver=eventHandler.activities_panel, event=event)
Getting started
- Software installation
- Physical setup
- Preparing a simple sand model
- Calibration
- Putting it all together
Tangible Landscape plugin manual
- Tangible Landscape plugin: Scanning
- Tangible Landscape plugin: Output
- Tangible Landscape plugin: Analyses
Advanced features
Resources