Skip to content

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
Submitting first publication
  • Loading branch information
mattia-lecci authored Mar 1, 2022
1 parent 63c2734 commit 20677f1
Show file tree
Hide file tree
Showing 3,148 changed files with 47,802 additions and 1 deletion.
The diff you're trying to view is too large. We only load the first 3000 changed files.
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2.1

orbs:
# The python orb contains a set of prepackaged circleci configuration you can use repeatedly in your configurations files
# Orb commands and jobs help you with common scripting around a language/tool
# so you dont have to copy and paste it everywhere.
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
python: circleci/[email protected]

workflows:
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
jobs:
- build-and-test


jobs:
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
# These next lines defines a docker executors: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from dockerhub or use one of the convenience images from CircleCI's Developer Hub
# A list of available CircleCI docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
# Change the version below to your required version of python
docker:
- image: cimg/python:3.8
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
environment:
PYTHONPATH: /home/circleci/project
steps:
- checkout
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
pip-dependency-file: requirements.txt
- run:
name: Run tests
# This assumes pytest is installed via the install-package step above
command: pytest --cov --cov-report=html
- store_artifacts: # store html coverage report as an artifact
path: htmlcov

7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[report]
exclude_lines =
pragma: no cover
if __name__ == .__main__.:
pass
\.\.\.
raise NotImplementedError
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rt-blocakge-manager
[![CircleCI](https://circleci.com/gh/signetlabdei/rt-blocakge-manager.svg?style=shield&circle-token=<154c2fd537a19d280b41d416abd54feb3ef6962e>)](https://circleci.com/gh/signetlabdei/rt-blocakge-manager)

24 changes: 24 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Examples might need to import modules from other packages, e.g., `src/`.

One possibility to run examples is to append the root folder of the repository to the `PYTHONPATH` environment variable.
For example:
1. `cd` your terminal to the root folder of the repository
1. Run the desired example as follows
```bash
PYTHONPATH=$PYTHONPATH:. python examples/your-example.py
```

A similar result can be obtained by exporting the updated `PYTHONPATH` to each newly opened terminal:
1. `cd` your terminal to the root folder of the repository
1. Add the current folder to the `PYTHONPATH`
```bash
export PYTHONPATH=$PYTHONPATH:.
```
1. Run the desired example as follows
```bash
python examples/your-example.py
```

A further possibility is to setup your IDE to automatically export the root folder to the `PYTHONPATH`.
For example, in VS Code it suffices to add `"env": {"PYTHONPATH": "${PYTHONPATH}:${workspaceFolder}"}` in the configuration contained in `.vscode/launch.json`.
In some VS Code releases, it is also necessary to set `"terminal.integrated.env.<platform>": {"PYTHONPATH": "${workspaceFolder}"}` (where `<platform>` might be `windows`,`linux` or `osx`) in the settings file contained in `.vscode/settings.json`.
57 changes: 57 additions & 0 deletions examples/environment_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import functools
import math
from os import path

import src.utils as utils
from src.diffraction_models import empirical_itu
from src.environment import Environment, ObstacleInteraction
from src.geometry import Point, Vector
from src.mobility_model import ConstantVelocityMobilityModel as cvmm
from src.obstacle import OrthoScreenObstacle
from src.scenario import QdRealizationScenario


def main():
## Scenario params
scenario_folder = "scenarios/HumanPresence"
scenario_out = path.join(scenario_folder, "BlockageOut")
obstacle_interactions = ObstacleInteraction.DIFFRACTION

scenario = QdRealizationScenario(scenario_folder)

## Obstacle params
start_pos = Point(5, 0, 0)
speed = 1.2 # [m/s]
vel = Vector(0, speed, 0)

width = 0.4 # shoulder span [m]
height = 1.7 # average human height [m]

distance_threshold = math.inf # [m]
wavelength = utils.get_wavelength(scenario.get_frequency())

# Setting up a diffraction loss model. The wavelength parameter is statically set to provide a function with the right signature to the obstacle
diffraction_loss_model = functools.partial(
empirical_itu, wavelength=wavelength)

mm = cvmm(start_pos=start_pos, vel=vel)
obs = OrthoScreenObstacle(mm=mm,
width=width,
height=height,
diffraction_loss_model=diffraction_loss_model,
distance_threshold=distance_threshold)

## Setup and process
env = Environment(scenario=scenario,
obstacles=[obs],
obstacle_interactions=obstacle_interactions)
env.process()

out_scenario = env._scenario
out_scenario.export(scenario_out, do_copy_unnecessary_files=True)

print(f"Processed scenario exported to '{path.abspath(scenario_out)}'")


if __name__ == "__main__":
main()
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Tested with Python 3.8, 3.9
numpy~=1.21.4
pytest~=6.2.1
pytest-cov~=2.11.1
scipy~=1.5.3
Loading

0 comments on commit 20677f1

Please sign in to comment.