diff --git a/.gitignore b/.gitignore index 3447ee4803ef2a4c796a273793300b3e7c39021d..f3ad40e46e8fad8810d3ba0d9c8c9217a80c00b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ +# rust target/ arpist build + +# python .cache/ +.ipynb_checkpoints/ +__pycache__/ +tools/dist diff --git a/tools/.python-version b/tools/.python-version new file mode 100644 index 0000000000000000000000000000000000000000..8531a3b7ee7e007afb605e6ff0089d0ed1fc5af3 --- /dev/null +++ b/tools/.python-version @@ -0,0 +1 @@ +3.12.2 diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7fb9a671d16c958f37987f94e5d6c65abf28af51 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,3 @@ +# tools + +Describe your project here. \ No newline at end of file diff --git a/tools/pyproject.toml b/tools/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..17583c11471af3bcfe9c9291a7c1a9a56baee577 --- /dev/null +++ b/tools/pyproject.toml @@ -0,0 +1,34 @@ +[project] +name = "tools" +version = "0.1.0" +description = "Add your description here" +authors = [{ name = "Federico Lolli", email = "federico.lolli@skywarder.eu" }] +dependencies = [ + "fire==0.6.0", + "numpy==1.26.4", + "pandas==2.2.1", + "python-dateutil==2.9.0.post0", + "pytz==2024.1", + "six==1.16.0", + "termcolor==2.4.0", + "tzdata==2024.1", +] +readme = "README.md" +requires-python = ">= 3.8" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project.scripts] +tools = "tools:main" + +[tool.rye] +managed = true +dev-dependencies = [] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/tools"] diff --git a/tools/requirements-dev.lock b/tools/requirements-dev.lock new file mode 100644 index 0000000000000000000000000000000000000000..cacd42dac761858ef49d33350d6b7c226d5bce4f --- /dev/null +++ b/tools/requirements-dev.lock @@ -0,0 +1,33 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. +fire==0.6.0 + # via tools +numpy==1.26.4 + # via pandas + # via tools +pandas==2.2.1 + # via tools +python-dateutil==2.9.0.post0 + # via pandas + # via tools +pytz==2024.1 + # via pandas + # via tools +six==1.16.0 + # via fire + # via python-dateutil + # via tools +termcolor==2.4.0 + # via fire + # via tools +tzdata==2024.1 + # via pandas + # via tools diff --git a/tools/requirements.lock b/tools/requirements.lock new file mode 100644 index 0000000000000000000000000000000000000000..cacd42dac761858ef49d33350d6b7c226d5bce4f --- /dev/null +++ b/tools/requirements.lock @@ -0,0 +1,33 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. +fire==0.6.0 + # via tools +numpy==1.26.4 + # via pandas + # via tools +pandas==2.2.1 + # via tools +python-dateutil==2.9.0.post0 + # via pandas + # via tools +pytz==2024.1 + # via pandas + # via tools +six==1.16.0 + # via fire + # via python-dateutil + # via tools +termcolor==2.4.0 + # via fire + # via tools +tzdata==2024.1 + # via pandas + # via tools diff --git a/tools/src/tools/__init__.py b/tools/src/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d4fdfb8a2bdcc291a1d83b9c92db4b1a7eeff695 --- /dev/null +++ b/tools/src/tools/__init__.py @@ -0,0 +1,40 @@ +import fire +import pandas as pd +from pathlib import Path + + +def convert(file: Path): + # read csv + pdf = pd.read_csv(file) + + # columns to delete + to_del = ["left_servo_angle", "right_servo_angle", "wes_n", "wes_e", "wes_state"] + + # new columns + new_c = [ + "pressure_ada", + "pressure_dpl", + "ada_vert_speed", + "mea_mass", + "abk_angle", + "pin_quick_connector", + "ada_state", + "dpl_state", + "abk_state", + "mea_state", + "pin_launch", + "pin_expulsion", + ] + + # drop columns + df = pdf.drop(columns=to_del) + # add new columns (all 0) + for c in new_c: + df[c] = 0 + + # save to new file + df.to_csv("gemini_rocket.csv", index=False) + + +def main(): + fire.Fire(convert)