Skip to content

Commit 87ceb53

Browse files
authored
Merge pull request #83 from emotional-cities/package-structure
Update build system to use uv
2 parents 0852b45 + 07babbd commit 87ceb53

File tree

17 files changed

+94
-64
lines changed

17 files changed

+94
-64
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Builds the python environment; linter and formatting via ruff
2+
3+
name: build
4+
on:
5+
push:
6+
branches: ['*']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build_run_tests:
12+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
if: github.event.pull_request.draft == false
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
python-version: [3.9, 3.11]
19+
fail-fast: false
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: 'pip'
28+
- name: Install dependencies
29+
run: pip install -e .[dev]
30+
31+
- name: ruff
32+
run: ruff check .

.gitignore

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
.vscode
2-
3-
# Python temp files
4-
__pycache__
5-
*.pyc
6-
*.egg-info
7-
dist
8-
.idea/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
4+
# Distribution / packaging
5+
dist/
6+
_version.py
7+
*.egg-info/
8+
*.egg
9+
10+
# IDE
11+
.vscode/*
12+
13+
# Test
14+
.coverage
15+
16+
# Environment
17+
.venv/
18+
uv.lock

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 NeuroGEARS Ltd
3+
Copyright (c) 2022-2025 NeuroGEARS Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# pluma-analysis
22

3+
![build](https://github.com/emotional-cities/pluma-analysis/actions/workflows/build.yml/badge.svg?branch=main)
4+
35
A low-level interface to data collected with the [pluma](https://github.com/emotional-cities/pluma) urban data acquisition system. Data used in the notebooks has been made publicly available in Amazon Simple Storage Service (S3) buckets.
46

57
More information about sample data sharing can be found in the [eMOTIONAL Cities data-share repository](https://github.com/emotional-cities/data-share).
68

7-
## Compatible Environments
9+
## Set-up Instructions
10+
11+
We recommend [uv](https://docs.astral.sh/uv/) for python version, environment, and package dependency management. However, any other tool compatible with the `pyproject.toml` standard should work.
12+
13+
### Install from PyPI
814

9-
[Visual Studio Code](https://code.visualstudio.com/): All notebooks have been tested in Visual Studio Code on a Windows platform. Tests in other platforms and environments are forthcoming and will be added here.
15+
```
16+
uv pip install pluma-analysis
17+
```
1018

11-
## How to build
19+
### Install from source
1220

13-
1. Open project folder in VS Code
14-
2. Install [miniconda](https://docs.conda.io/en/latest/miniconda.html) (Python 3.9)
15-
3. Install [Python Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
16-
4. Create environment from VS Code:
17-
- `Ctrl+Shift+P` > `Create Environment`
18-
- Select `.conda` environment
19-
5. Make sure correct environment is selected in the notebook
21+
```
22+
git clone https://github.com/emotional-cities/pluma-analysis.git
23+
cd pluma-analysis
24+
uv sync --all-extras
25+
```
2026

21-
The current notebook requires Python 3.9+ to run successfully. The file `environment.yml` contains the list of minimal package dependencies required.
27+
This package was developed for the eMOTIONAL CITIES Project, which received funding from European Union’s Horizon 2020 research and innovation programme, under the grant agreement No 945307. The eMOTIONAL CITIES Project is a consortium of 12 partners co-coordinated by IGOT and FMUL, taking place between 2021 and 2025. More information at https://emotionalcities-h2020.eu/

pluma/export/streams.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def export_stream_to_csv(
4444
resampling_function_kws=resampling_function_kws,
4545
)
4646
else:
47-
raise NotImplementedError(f"Export of stream type\
48-
{type(stream)} is not yet supported.")
47+
raise NotImplementedError(f"Export of stream type {type(stream)} is not yet supported.")
4948

5049

5150
def export_uniform_table_stream(

pluma/io/eeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_eeg_file(root: Union[str, ComplexPath] = "", if_multiple_load_index: int
2828
ret = None
2929
elif len(expected_files) > 1:
3030
warnings.warn(
31-
f"Multiple *.nedf files found in {root}. " f"Loading {expected_files[if_multiple_load_index]}."
31+
f"Multiple *.nedf files found in {root}. Loading {expected_files[if_multiple_load_index]}."
3232
)
3333
ret = expected_files[if_multiple_load_index]
3434
else:

pluma/io/harp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ def read_harp_bin(file: Union[str, ComplexPath], time_offset: float = 0) -> pd.D
8484
with path.open("rb") as stream:
8585
data = np.frombuffer(stream.read(), dtype=np.uint8)
8686
except FileNotFoundError:
87-
warnings.warn(f"Harp stream file\
88-
{path} could not be found.")
87+
warnings.warn(f"Harp stream file {path} could not be found.")
8988
return pd.DataFrame()
9089
except FileExistsError:
91-
warnings.warn(f"Harp stream file\
92-
{path} could not be found.")
90+
warnings.warn(f"Harp stream file {path} could not be found.")
9391
return pd.DataFrame()
9492
if len(data) == 0:
9593
return None

pluma/io/microphone.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def load_microphone(
3232
micdata = np.frombuffer(stream.read(), dtype=dtype)
3333
micdata = micdata.reshape((-1, channels))
3434
except FileNotFoundError:
35-
warnings.warn(f"Microphone stream file\
36-
{path} could not be found.")
35+
warnings.warn(f"Microphone stream file {path} could not be found.")
3736
except FileExistsError:
38-
warnings.warn(f"Microphone stream file\
39-
{path} could not be found.")
37+
warnings.warn(f"Microphone stream file {path} could not be found.")
4038
return micdata

pluma/io/ubx.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ def read_ubx_file(path: Union[str, ComplexPath]) -> pd.DataFrame:
6262
with path.open("rb") as fstream:
6363
out = read(fstream)
6464
except FileNotFoundError:
65-
warnings.warn(f"UBX file\
66-
{path} could not be found.")
65+
warnings.warn(f"UBX file {path} could not be found.")
6766
return pd.DataFrame()
6867
except FileExistsError:
69-
warnings.warn(f"UBX file\
70-
{path} could not be found.")
68+
warnings.warn(f"UBX file {path} could not be found.")
7169
return pd.DataFrame()
7270

7371
df = pd.DataFrame({"Message": out})

pluma/io/zeromq.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ def load_zeromq(
2525

2626
data_frames.append(pd.DataFrame(np.fromfile(path.path, dtype=np.dtype(dtypes[i]))))
2727
except FileNotFoundError:
28-
warnings.warn(f"Stream file\
29-
{path} could not be found.")
28+
warnings.warn(f"Stream file {path} could not be found.")
3029
except FileExistsError:
31-
warnings.warn(f"Stream file\
32-
{path} could not be found.")
30+
warnings.warn(f"Stream file {path} could not be found.")
3331

3432
return pd.concat(data_frames, axis=1)

0 commit comments

Comments
 (0)