scope-cli
Control Layer Interface for parallel microscopy system.
Introduction
- What is Trappy-Scopes?
- How to use it?
- Why you should use it?
Installation
-
Install through conda or pip #todo
pip install trappyscopes conda install trappyscopes -
You can install directly from the source and install the environment using the inbuilt installer that uses
pip.git clone -r <repo_link> cd <scope-cli> python main.py --install
Configure the Scope
Get to know Trappy-Scope
-
Basic information about application startup
python main.py -h
-
A little introduction can be summoned by calling
intro().
Start-up and usage
-
Use
./trappyscope, a typical startup would look like:./trappyscope -su UserName experiment_script.py
-
Start control layer utility with
python -i main.pyin the interactive mode. -
Scripts are an important part of running experimental procedures:
python main.py <script1> <script2> <script3> trappyscope <script1> <script2> <script3> python main.py --iterate 3 <script1> ## Run Script1 three times
-
The scripts are executed in sequence and can be used to load pre-defined experimental protocols.
-
Alternatively, to load a script/execute a script from the interactive session:
ScriptEngine.now(globals(), "scriptfile.py")
Start an experiment
-
All data-collection should be done within the context of an
Experiment:exp = Experiment("test")
You should get the following output:
────────────────────────────── Experiment open ───────────────────────────────────────── [17:21:08] INFO Loading Experiment: test experiment.py:267 Working directory changed to: /Users/byatharth/experiments/test . ├── .experiment ├── analysis ├── converted ├── experiment.yaml ├── postprocess └── sessions.yaml 3 directories, 3 files user:ghost || ‹‹M1›› Experiment: test >>>
The experiment features are described in the expframework submodule.
Describing one scope
A scope is described as a tree of devices. It is a combination of Processors (ProcessorGroup), Sensors , and Actuators. A scope configuration is defined in the deviceid.yaml configuration file. An example is given below:
name: MDev
uuid: null
type: microscope
frame:
- pico
- topplate
- lit
- diffuser
- lenses.asphere
- sample
- samplestage
- midplate
- zoomlens
- zoomlensholdplate
- camera
- baseplate
optics:
lenses:
- 120deg plastic asphere
- ACL2520U
- zoomlens
hardware:
pico:
- nullpico
- pico1
- nullpico
camera: nullcamera
illumination: CA_PWM_RGB_LED_5mm
git_sync: false
write_server: ssd1
file_server: smb://files1.igc.gulbenkian.pt/igc/folders/LP/yatharth
auto_fsync: false
auto_pico_fsync: true
Describing N-scopes
Multiple scopes are defined by defining each of the configuration files on each of the scopes. After this is done, the network layer allows the scopes to be connected to the laboratory hive, where all scopes can be accessed on the fly.
How to do Science on the scopes?
An Experiment
The data and metadata collection for any experiment is handled through the Experiment class. It's primary role is to manage storage for every different experiments. Creation of the class, immediately changes the working directory to the experiment one.
Unique ID
Each experiment is also assigned a 10-digit hex unique id. Example: e8423b83d2.
File Structure
Each experiment has the following directory structure:
Experiment_name
|- .experiment (identifier)
|- experiment.yaml (event logs)
|- data1, data2, data3, ... (data - in the repository)
|- postprocess (postprocessed data)
|- converted (online conversion - eg. between video formats)
|- analysis (analysis results)
Flow of Control - TODO check with the current version
flowchart
subgraph Setup
Create-ID-files --> Create-folders --> Copy-Payload
end
subgraph Loading
load(load events) --> CWD(Change working directory)
end
subgraph Deletion
del -.calls.- close("exp.close()") --> Logs(Write event logs to yaml) --> CWDB(Change working <br>dir to original)
end
Setup --> Loading --> Deletion
LoadScript utility TODO
Configuration Files
camconfig.yaml: Contains the camera configuration file for the default mode.deviceid.yaml: Contains the unique identity constants for the device.common.py: Contains common constants for all devices.
TODO: Obsolete Current Sequence
flowchart LR
print-flugg.header --> load-device_id --> complete-all-imports --> connect-pico --> Free-REPL
Hardware
The hardware is modelled as a device-tree or a hierarchical collection of devices. All nodes that are not end-nodes are turing complete computational devices.
assembly:
| rpi: null
| cam: camera
| pico:
| | lit: light
| | beacon: beacon
| | tandh: t&h sensor
|
*
Hardware firmware
The hardware firmware is synched to the pico device in parts.
Pico Connection and FS Sync:
graph TD
pico(Pico)
open --mode--> pico
sync --mode--> pico
---
title: "Pico Open Protocol"
---
graph TD
Open-Pico --> connect-to-board -.-> Sync
Sync --up--> pico_firmware[[pico_firmware]]
Sync --up--> lights[[lights]]
logs[[logs]] --down--> Sync
Device ID
Examplar Device ID file:
The default mode for parsing a device ID structure is to first cast each field to a container/collection type and enforce the first value as the unique name and the 2nd value, if present, as a Universal unique identifier.
Experiments
- The
Experimentclass manages the saving of data in specific folders and logs experiement events. - A folder qualifies as an Experiemnt if it contains the
.experimentfile with the UUID of the experiment. - The file
<Experiment_name>.yamlcontains the event logs of the experiments.
Metadata
Release files for trappyscopes 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trappyscopes-0.1.1.tar.gz | 4.4 kB | With provenance | Details for trappyscopes-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trappyscopes-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for trappyscopes-0.1.1-py3-none-any.whl |
Total release size: 8.9 kB
Release files / trappyscopes-0.1.1.tar.gz
| Download URL | trappyscopes-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c517c1c0302b90013c35ab8415d5a1a2db71681ad1d3f9ae3fb17e9a9e8e854a
|
|
BLAKE2b-256 checksum How to use checksums |
3449d54d0e89954beb07101438d1e82854076e32ffaaace25fd94d7693baff3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency logRelease files / trappyscopes-0.1.1-py3-none-any.whl
| Download URL | trappyscopes-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
509cc63826d48bd8e1c0c245c405b84f5a77df440999d27ee80b58d5233ac176
|
|
BLAKE2b-256 checksum How to use checksums |
aa4f1668946100769217ef141cdc3c17893bf55d6a10e93c58a5e51e649ab716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency logSecurity for trappyscopes 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for trappyscopes-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.