Skip to content

Commit d2a388c

Browse files
authored
Docker container (#13)
* Fixed .csv header with correct information. Updated version number. Added docker container for linux.
1 parent 3a4424c commit d2a388c

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:jammy-20240911.1
2+
3+
# Install dependencies for pycairo, pyobject and pydbus
4+
RUN apt update
5+
RUN apt install -y python3.10
6+
RUN apt install -y python3-pip
7+
RUN apt install -y wget
8+
RUN apt install -y libcairo2-dev libxt-dev libgirepository1.0-dev
9+
RUN apt install -y build-essential libdbus-glib-1-dev libgirepository1.0-dev
10+
RUN apt install -y ninja-build patchelf bluez dbus bluetooth
11+
12+
# Start bluetooth services
13+
RUN service dbus start
14+
RUN service bluetooth start
15+
16+
# Copy requirements file and install python requirements
17+
COPY requirements.txt ./
18+
RUN pip3 install meson
19+
RUN pip3 install --no-cache-dir -r requirements.txt
20+
21+
# Copy all files to container
22+
COPY . .

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,34 @@ Install them using `pip`:
2222
pip install -r requirements.txt
2323
```
2424

25+
## Using Docker in Linux
26+
27+
When running the API on Linux, if issues arise, it is recommended to try using it inside a docker container.
28+
29+
First, install [docker](https://docs.docker.com/engine/install/).
30+
31+
Then, clone the repository and navigate to the directory:
32+
```sh
33+
# Getting this repository
34+
git clone https://github.com/scientisst/scientisst-sense-api-python.git
35+
cd scientisst-sense-api-python
36+
```
37+
38+
Then, build the docker container with:
39+
```sh
40+
sudo docker build -t sense_docker .
41+
```
42+
43+
It is required to build the container only once. Finally, run the container with:
44+
```sh
45+
sudo docker run -v /var/run/dbus/:/var/run/dbus/:z --privileged -it sense_docker
46+
```
47+
48+
This will open a terminal inside the container with access to bluetooth and Wi-Fi. To exit the container run:
49+
```sh
50+
exit
51+
```
52+
2553
## Running
2654

2755
### Automatic

scientisst/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from scientisst.scientisst import *
22

3-
__version__ = "1.1.0"
3+
__version__ = "1.2.0"

sense_src/file_writer.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ def __get_metadata(self, address, fs, channels, api_version, firmware_version, a
5656
"Timestamp": timestamp.timestamp(),
5757
"ISO 8601": timestamp.isoformat(),
5858
}
59+
if API_MODE_DICT[api_com_version] == API_MODE_SCIENTISST:
60+
metadata = {
61+
"API version": api_version,
62+
"Channels": channels,
63+
"Channels labels": get_channel_labels(channels, self.mv),
64+
"Device": address,
65+
"Firmware version": firmware_version,
66+
"Header": get_header(channels, self.mv, api_com_version),
67+
"Resolution (bits)": [12, 1, 1, 1, 1] + self.__get_channel_resolutions(),
68+
"Sampling rate (Hz)": fs,
69+
"Timestamp": timestamp.timestamp(),
70+
"ISO 8601": timestamp.isoformat(),
71+
}
5972
else:
6073
metadata = {
6174
"API version": api_version,

0 commit comments

Comments
 (0)