-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f272c0e
commit 7c95b8b
Showing
24 changed files
with
1,338 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
__pycache__ | ||
.ipynb_checkpoints | ||
build | ||
*.egg-info | ||
dist | ||
htmlcov | ||
.coverage | ||
.mypy* |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
TESTS_DIR=tests | ||
|
||
format: | ||
yapf -irp . | ||
|
||
dead-code-check: | ||
vulture src --min-confidence 70 | ||
|
||
test: | ||
python -m unittest discover ${TESTS_DIR} | ||
|
||
type-check: | ||
mypy src --ignore-missing-imports | ||
|
||
coverage: | ||
coverage run --source=src -m unittest discover ${TESTS_DIR} | ||
coverage report -m | ||
coverage html | ||
|
||
build: | ||
rm -rf dist | ||
python -m pip install --upgrade build | ||
python -m build | ||
twine check dist/* | ||
|
||
push: | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "2a5d14b3-49cd-4ab3-990b-4e1951566381", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from datetime import datetime" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "a2a441d6-4985-482e-9a6e-e402cee100e8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import gorillacompression as gc" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "744bd485-b1b8-4b66-adfd-f765ed145e43", | ||
"metadata": {}, | ||
"source": [ | ||
"# Figure 2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "f6906a26-530e-441e-a183-13e0359904f5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"timestamps_str = ['March 24, 2015 02:01:02', 'March 24, 2015 02:02:02', 'March 24, 2015 02:03:02']\n", | ||
"timestamps_dt = list(map(lambda x: datetime.strptime(x, '%B %d, %Y %X'), timestamps_str))\n", | ||
"timestamps_int = [int(ts.timestamp()) for ts in timestamps_dt]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "fa8c693a-bca0-4ec8-82ae-9ee60dc9cc11", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"[1427158862, 1427158922, 1427158982]" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"timestamps_int" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "a81347f0-6828-40ab-a554-9bb7fdbd764d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"values = [12.0, 12.0, 24.0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "512ef064-d587-4d41-a1ef-14f60443690c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"[12.0, 12.0, 24.0]" | ||
] | ||
}, | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"values" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "c7a301c3-e967-42a6-8da1-429b7548fcc6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# content = gc.PairsEncoder.encode_all(list(zip(timestamps_int, values)))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "7b05b2cb-e4b3-4641-afdf-0425d472b33c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"pairs_encoder = gc.PairsEncoder()\n", | ||
"\n", | ||
"for ts, v in zip(timestamps_int, values):\n", | ||
" pairs_encoder.encode_next(ts, v)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"id": "e74710f7-82a5-4756-b6e8-b1de18f3523d", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"bitarray('1010101000100001011011101001110010000000010100000000000000000000000000000000000000000000000000000011010110000011')" | ||
] | ||
}, | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"pairs_encoder.bit_array" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"id": "7d304e17-4a18-43df-ac46-1683e081b7ae", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"content = pairs_encoder.get_encoded()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"id": "1cbb6a03-b147-4244-b236-d187dadde534", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"{'encoded': b'\\xaa!n\\x9c\\x80P\\x00\\x00\\x00\\x00\\x00\\x005\\x83',\n", | ||
" 'nb_pairs': 3,\n", | ||
" 'float_format': 'f64'}" | ||
] | ||
}, | ||
"execution_count": 11, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"content" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "506398d0-73d1-4360-84f2-823b7711a47e", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"14" | ||
] | ||
}, | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"len(content['encoded'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "966396b9-4b7f-4c91-9dea-eb2aa47a2a74", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"[(1427158862, 12.0), (1427158922, 12.0), (1427158982, 24.0)]" | ||
] | ||
}, | ||
"execution_count": 13, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"gc.PairsDecoder.decode_all(content)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c374aef9-4bdc-43f6-877e-9fcdb567d106", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.