Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts used in survey and conference paper #30

Merged
merged 5 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
output/

.vscode/



# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/







# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
16 changes: 15 additions & 1 deletion datasets/trace1_Rutgers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@
TRACE_PATH = path.dirname(path.abspath(__file__))
DATA_PATH = path.join(TRACE_PATH, 'data')

TRANSFORM_OUTPUT_PATH = path.join(BASE_TRANSFORM_OUTPUT_PATH, 'dataset-2-rutgers_wifi')
TRANSFORM_OUTPUT_PATH = path.join(
BASE_TRANSFORM_OUTPUT_PATH,
'dataset-1-rutgers_wifi'
)


NOISE_SOURCES = (
# Coordinates are a mess. Rutgers declare coordinates as Node(row, column)
# where column are x axis and rows are y axis. They also use invert y axis.

(2, 1.5), # between (2,1) & (2,2)
(2, 7.5), # between (2,7) & (2,8)
(7, 1.5), # between (7,1) & (7,2)
(7, 7.5), # between (7,7) & (7,8)
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 10 additions & 8 deletions datasets/trace1_Rutgers/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def get_filenames() -> Iterator[str]:
def parser(filename: str) -> pd.DataFrame:
"""Returns Pandas DataFrame produced from reading and parsing specified Rutgers link trace."""
# datasets/trace1_Rutgers/data/dbm-5/Results_node1-4_DailyTest_Sat-Oct-15-03_54_00-2005/sdec1-2
# node1-4 is Tx node, while sdec1-2 is Rx node in our case

noise = np.int8(filename.split('/')[-3][len('dbm'):])
src = filename.split('/')[-2].split('_')[1]
dst = 'node' + filename.split('/')[-1][len('sdec'):]
tx = filename.split('/')[-2].split('_')[1]
rx = 'node' + filename.split('/')[-1][len('sdec'):]

rssi = np.full(shape=300, fill_value=0, dtype=np.uint8)
received = np.full(shape=300, fill_value=False, dtype=np.bool)
Expand All @@ -51,12 +53,12 @@ def parser(filename: str) -> pd.DataFrame:

assert len(row) == 2, 'Expected row length 2, got {}'.format(len(row))

seq, _rssi_ = int(row[0]), np.uint8(row[1])
seq, value = int(row[0]), np.uint8(row[1])

if seq < 300:
# Keep information about received packet
if _rssi_ < 128 and _rssi_ >= 0:
rssi[seq] = _rssi_
# Keep information about received packet
if value < 128 and value >= 0:
rssi[seq] = value
received[seq] = True

else:
Expand All @@ -74,8 +76,8 @@ def parser(filename: str) -> pd.DataFrame:

df['seq'] = df.index + 1
df['noise'] = noise
df['src'] = src
df['dst'] = dst
df['src'] = tx
df['dst'] = rx

# Convert to appropriate types
df = df.astype(dtypes)
Expand Down
631 changes: 631 additions & 0 deletions notebooks/Rutgers/rutgers-analysis.ipynb

Large diffs are not rendered by default.

Loading