Skip to content

Commit

Permalink
add example vibrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahmish committed Jan 4, 2024
1 parent e85e789 commit 0e536e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions notebooks/data/vibrations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
COD_ELEMENT,signal_id,timestamp,xvalues,yvalues
0,S1,2022-01-02 13:21:01,"[2022-01-02 13:21:01, 2022-01-02 13:41:01, 2022-01-02 14:01:01]","[0.5, 0.4, 0.2]"
0,S2,2022-03-08 11:00:00,"[2022-03-08 11:00:00, 2022-03-08 11:10:00, 2022-03-08 11:20:00]","[10, 10, 9]"
1,S1,2022-01-02 13:21:01,"[2022-01-02 13:21:01, 2022-01-02 13:41:01, 2022-01-02 14:01:01]","[0.9, 0.95, 0.8]"
1,S2,2022-03-08 11:00:00,"[2022-03-08 11:00:00, 2022-03-08 11:10:00, 2022-03-08 11:20:00]","[15, 11, 9]"
10 changes: 8 additions & 2 deletions zephyr_ml/entityset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from itertools import chain

import featuretools as ft

from zephyr_ml.metadata import get_mapped_kwargs
Expand Down Expand Up @@ -85,7 +87,7 @@ def create_vibrations_entityset(dfs, new_kwargs_mapping=None):
**get_mapped_kwargs('pidata', new_kwargs_mapping),
**get_mapped_kwargs('vibrations', new_kwargs_mapping),
}
_validate_data(dfs, 'vibrations', entity_kwargs)
_validate_data(dfs, ['pidata', 'vibrations'], entity_kwargs)

es = _create_entityset(dfs, 'vibrations', entity_kwargs)
es.id = 'Vibrations data'
Expand All @@ -96,7 +98,11 @@ def create_vibrations_entityset(dfs, new_kwargs_mapping=None):
def _validate_data(dfs, es_type, es_kwargs):
'''Validate data by checking for required columns in each entity
'''
entities = set(['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', es_type])
if not isinstance(es_type, list):
es_type = [es_type]

entities = set(chain(['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', *es_type]))

if set(dfs.keys()) != entities:
missing = entities.difference(set(dfs.keys()))
extra = set(dfs.keys()).difference(entities)
Expand Down

0 comments on commit 0e536e1

Please sign in to comment.