Skip to content

Commit

Permalink
Merge pull request #99 from petrobras/other_improvements
Browse files Browse the repository at this point in the history
Other improvements
  • Loading branch information
ricardoevvargas authored May 23, 2024
2 parents 922d8ba + d71b891 commit 65c520e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 207 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ $ conda env create -f environment.yml
```
* To activate the created virtual environment:
```
$ conda activate 3w
$ conda activate 3W
```
* To use the 3W toolkit resources interactively:
```
Expand Down
218 changes: 16 additions & 202 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,205 +3,19 @@ channels:
- conda-forge
- defaults
dependencies:
- argon2-cffi=21.3.0=pyhd8ed1ab_0
- argon2-cffi-bindings=21.2.0=py310he2412df_2
- asttokens=2.0.8=pyhd8ed1ab_0
- attrs=22.1.0=pyh71513ae_1
- backcall=0.2.0=pyh9f0ad1d_0
- backports=1.0=py_2
- backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
- beautifulsoup4=4.11.1=pyha770c72_0
- bleach=5.0.1=pyhd8ed1ab_0
- brotli=1.0.9=h8ffe710_7
- brotli-bin=1.0.9=h8ffe710_7
- bzip2=1.0.8=h8ffe710_4
- ca-certificates=2022.12.7=h5b45459_0
- certifi=2022.12.7=pyhd8ed1ab_0
- cffi=1.15.1=py310hcbf9ad4_0
- colorama=0.4.5=pyhd8ed1ab_0
- contourpy=1.0.5=py310h232114e_0
- cycler=0.11.0=pyhd8ed1ab_0
- debugpy=1.6.3=py310h8a704f9_0
- decorator=5.1.1=pyhd8ed1ab_0
- defusedxml=0.7.1=pyhd8ed1ab_0
- entrypoints=0.4=pyhd8ed1ab_0
- executing=1.1.0=pyhd8ed1ab_0
- flit-core=3.7.1=pyhd8ed1ab_0
- fonttools=4.37.3=py310h8d17308_0
- freetype=2.12.1=h546665d_0
- gettext=0.19.8.1=h5728263_1009
- glib=2.74.0=h12be248_0
- glib-tools=2.74.0=h12be248_0
- gst-plugins-base=1.20.3=h001b923_2
- gstreamer=1.20.3=h6b5321d_2
- icu=70.1=h0e60522_0
- importlib-metadata=4.11.4=py310h5588dad_0
- importlib_resources=5.9.0=pyhd8ed1ab_0
- intel-openmp=2022.1.0=h57928b3_3787
- ipykernel=6.16.0=pyh025b116_0
- ipython=8.12.0=pyh08f2357_0
- ipython_genutils=0.2.0=py_1
- ipywidgets=8.0.2=pyhd8ed1ab_1
- jedi=0.18.1=pyhd8ed1ab_2
- jinja2=3.1.2=pyhd8ed1ab_1
- joblib=1.2.0=pyhd8ed1ab_0
- jpeg=9e=h8ffe710_2
- jsonschema=4.16.0=pyhd8ed1ab_0
- jupyter=1.0.0=py310h5588dad_7
- jupyter_client=7.3.5=pyhd8ed1ab_0
- jupyter_console=6.4.4=pyhd8ed1ab_0
- jupyterlab_pygments=0.2.2=pyhd8ed1ab_0
- jupyterlab_widgets=3.0.3=pyhd8ed1ab_0
- kiwisolver=1.4.4=py310h476a331_0
- krb5=1.19.3=h1176d77_0
- lcms2=2.12=h2a16943_0
- lerc=4.0.0=h63175ca_0
- libblas=3.9.0=16_win64_mkl
- libbrotlicommon=1.0.9=h8ffe710_7
- libbrotlidec=1.0.9=h8ffe710_7
- libbrotlienc=1.0.9=h8ffe710_7
- libcblas=3.9.0=16_win64_mkl
- libclang=14.0.6=default_hf4acfee_0
- libclang13=14.0.6=default_h8992b79_0
- libdeflate=1.14=hcfcfb64_0
- libffi=3.4.2=h8ffe710_5
- libglib=2.74.0=h79619a9_0
- libiconv=1.17=h8ffe710_0
- liblapack=3.9.0=16_win64_mkl
- libogg=1.3.4=h8ffe710_1
- libpng=1.6.38=h19919ed_0
- libsodium=1.0.18=h8d14728_1
- libsqlite=3.39.3=hcfcfb64_0
- libtiff=4.4.0=h8e97e67_4
- libvorbis=1.3.7=h0e60522_0
- libwebp=1.2.4=hcfcfb64_1
- libwebp-base=1.2.4=h8ffe710_0
- libxcb=1.13=hcd874cb_1004
- libxml2=2.10.2=h99b13fb_1
- libxslt=1.1.35=h34f844d_0
- libzlib=1.2.12=hcfcfb64_3
- llvmlite=0.39.1=py310hb84602e_0
- lxml=4.9.1=py310he2412df_0
- m2w64-gcc-libgfortran=5.3.0=6
- m2w64-gcc-libs=5.3.0=7
- m2w64-gcc-libs-core=5.3.0=7
- m2w64-gmp=6.1.0=2
- m2w64-libwinpthread-git=5.0.0.4634.697f757=2
- markupsafe=2.1.1=py310he2412df_1
- matplotlib-base=3.6.0=py310h51140c5_0
- matplotlib-inline=0.1.6=pyhd8ed1ab_0
- mistune=2.0.4=pyhd8ed1ab_0
- mkl=2022.1.0=h6a75c08_874
- msys2-conda-epoch=20160418=1
- munkres=1.1.4=pyh9f0ad1d_0
- natsort=8.2.0=pyhd8ed1ab_0
- nbclient=0.6.8=pyhd8ed1ab_0
- nbconvert=7.0.0=pyhd8ed1ab_0
- nbconvert-core=7.0.0=pyhd8ed1ab_0
- nbconvert-pandoc=7.0.0=pyhd8ed1ab_0
- nbformat=5.6.1=pyhd8ed1ab_0
- nest-asyncio=1.5.5=pyhd8ed1ab_0
- notebook=6.4.12=pyha770c72_0
- numba=0.56.4=py310h19bcfe9_0
- numpy=1.23.3=py310h4a8f9c9_0
- openjpeg=2.5.0=hc9384bd_1
- openssl=1.1.1t=hcfcfb64_0
- packaging=21.3=pyhd8ed1ab_0
- pandas=1.5.0=py310h1c4a608_0
- pandoc=2.19.2=h57928b3_0
- pandocfilters=1.5.0=pyhd8ed1ab_0
- parso=0.8.3=pyhd8ed1ab_0
- patsy=0.5.2=pyhd8ed1ab_0
- pcre2=10.37=hdfff0fc_1
- pickleshare=0.7.5=py_1003
- pip=22.2.2=pyhd8ed1ab_0
- pkgutil-resolve-name=1.3.10=pyhd8ed1ab_0
- platformdirs=2.5.2=pyhd8ed1ab_1
- plotly=5.13.0=pyhd8ed1ab_0
- ply=3.11=py_1
- prometheus_client=0.14.1=pyhd8ed1ab_0
- prompt-toolkit=3.0.31=pyha770c72_0
- prompt_toolkit=3.0.31=hd8ed1ab_0
- psutil=5.9.2=py310h8d17308_0
- pthread-stubs=0.4=hcd874cb_1001
- pure_eval=0.2.2=pyhd8ed1ab_0
- pycparser=2.21=pyhd8ed1ab_0
- pygments=2.13.0=pyhd8ed1ab_0
- pyparsing=3.0.9=pyhd8ed1ab_0
- pyqt=5.15.7=py310hbabf5d4_0
- pyqt5-sip=12.11.0=py310h8a704f9_0
- pyrsistent=0.18.1=py310he2412df_1
- python=3.10.6=h9a09f29_0_cpython
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python-fastjsonschema=2.16.2=pyhd8ed1ab_0
- python_abi=3.10=2_cp310
- pytz=2022.2.1=pyhd8ed1ab_0
- pywin32=303=py310he2412df_0
- pywinpty=2.0.8=py310h00ffb61_0
- pyzmq=24.0.1=py310hcd737a0_0
- qt-main=5.15.6=hf0cf448_0
- qtconsole=5.3.2=pyhd8ed1ab_0
- qtconsole-base=5.3.2=pyha770c72_0
- qtpy=2.2.0=pyhd8ed1ab_0
- scikit-learn=1.1.2=py310h3a564e9_0
- scipy=1.9.1=py310h578b7cb_0
- seaborn=0.12.0=hd8ed1ab_0
- seaborn-base=0.12.0=pyhd8ed1ab_0
- send2trash=1.8.0=pyhd8ed1ab_0
- setuptools=65.4.0=pyhd8ed1ab_0
- sip=6.6.2=py310h8a704f9_0
- six=1.16.0=pyh6c4a22f_0
- soupsieve=2.3.2.post1=pyhd8ed1ab_0
- stack_data=0.5.1=pyhd8ed1ab_0
- statsmodels=0.13.2=py310h2873277_0
- tbb=2021.6.0=h91493d7_0
- tenacity=8.1.0=pyhd8ed1ab_0
- terminado=0.15.0=py310h5588dad_0
- threadpoolctl=3.1.0=pyh8a188c0_0
- tinycss2=1.1.1=pyhd8ed1ab_0
- tk=8.6.12=h8ffe710_0
- toml=0.10.2=pyhd8ed1ab_0
- tornado=6.2=py310he2412df_0
- traitlets=5.4.0=pyhd8ed1ab_0
- tslearn=0.5.3.2=py310h9b08ddd_0
- typing_extensions=4.3.0=pyha770c72_0
- tzdata=2022d=h191b570_0
- ucrt=10.0.20348.0=h57928b3_0
- unicodedata2=14.0.0=py310he2412df_1
- vc=14.2=hb210afc_7
- vs2015_runtime=14.29.30139=h890b9b1_7
- wcwidth=0.2.5=pyh9f0ad1d_2
- webencodings=0.5.1=py_1
- wheel=0.37.1=pyhd8ed1ab_0
- widgetsnbextension=4.0.3=pyhd8ed1ab_0
- winpty=0.4.3=4
- xorg-libxau=1.0.9=hcd874cb_0
- xorg-libxdmcp=1.1.3=hcd874cb_0
- xz=5.2.6=h8d14728_0
- zeromq=4.3.4=h0e60522_1
- zipp=3.8.1=pyhd8ed1ab_0
- zlib=1.2.12=hcfcfb64_3
- zstd=1.5.2=h7755175_4
- pip:
- about-time==3.1.1
- alive-progress==2.4.1
- charset-normalizer==3.0.1
- grapheme==0.6.0
- htmlmin==0.1.12
- idna==3.4
- imagehash==4.3.1
- jupyter-core==4.11.2
- multimethod==1.9.1
- networkx==3.0
- pandas-profiling==3.6.3
- phik==0.12.3
- pillow==9.3.0
- pydantic==1.10.4
- pywavelets==1.4.1
- pyyaml==6.0
- requests==2.28.2
- tangled-up-in-unicode==0.2.0
- tqdm==4.64.1
- typeguard==2.13.3
- urllib3==1.26.14
- visions==0.7.5
- python=3.10.6
- notebook=6.4.12
- alive-progress=2.4.1
- h5py=3.11.0
- matplotlib=3.6.0
- natsort=8.2.0
- pandas=1.5.0
- plotly=5.13.0
- pydantic=1.10.4
- scikit-learn=1.1.2
- seaborn=0.12.0
- tslearn=0.5.3.2
- pandas-profiling=3.6.3
- numba=0.56.4
- missingno=0.5.2

2 changes: 1 addition & 1 deletion overviews/AndreMachado/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63528,7 +63528,7 @@
"source": [
"class_number = 2\n",
"resample_factor = 100\n",
"df_all_instances_class = pd.concat([tk.resample(pd.read_csv(f, sep=',',header=0),resample_factor,class_number)for f in glob.glob(tk.PATH_DATASET + '\\\\'+str(class_number)+'\\\\*.csv')],ignore_index=True)"
"df_all_instances_class = pd.concat([tk.resample(pd.read_csv(f, sep=',',header=0),resample_factor,class_number)for f in glob.glob(os.path.join(tk.PATH_DATASET, str(class_number), \"*.csv\"))],ignore_index=True)"
]
},
{
Expand Down
9 changes: 6 additions & 3 deletions toolkit/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.colors as mcolors
import os

from matplotlib.patches import Patch
from pathlib import Path
Expand Down Expand Up @@ -538,7 +539,7 @@ def resample(data, n, class_number):
# Back with transient label value
resampleClass.replace(0.5, class_number + 100, inplace=True)
# Non overlap group and get the average value from the data
dfResample = data.groupby(data.index // n).mean()
dfResample = data.groupby(data.index // n).mean(numeric_only=True)
# Drop class column
dfResample.drop(["class"], axis=1, inplace=True)
# Insert new class label values group by non overlap
Expand All @@ -557,7 +558,7 @@ def plot_instance(class_number, instance_index, resample_factor):
class_number (integer): integer that represents the event class [0-8]
instance_index (integer): input the instance file index
"""
instances_path = PATH_DATASET + "\\" + str(class_number) + "\\*.csv"
instances_path = os.path.join(PATH_DATASET, str(class_number), "*.csv")
instances_path_list = glob.glob(instances_path)
if class_number > 8 or class_number < 0:
print(
Expand All @@ -571,7 +572,9 @@ def plot_instance(class_number, instance_index, resample_factor):
df_instance = pd.read_csv(
instances_path_list[instance_index], sep=",", header=0
)

df_instance_resampled = resample(df_instance, resample_factor, class_number)

df_drop_resampled = df_instance_resampled.drop(["timestamp", "class"], axis=1)
df_drop_resampled.interpolate(
method="linear", limit_direction="both", axis=0, inplace=True
Expand Down Expand Up @@ -708,7 +711,7 @@ def plot_instance(class_number, instance_index, resample_factor):
line_color=colors_traces[8],
)
),
fileName = instances_path_list[instance_index].split("\\")
fileName = instances_path_list[instance_index].split(os.sep)
fig.update_layout(
title=EVENT_NAMES[class_number] + " - " + fileName[-1],
xaxis_title="Time(s)",
Expand Down

0 comments on commit 65c520e

Please sign in to comment.