# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.9.5 64-bit (''poissonprocess'': conda)'
#     name: python3
# ---

import numpy as np
import pandas as pd


def load_data(fp, meter_id='A'):

    data = np.loadtxt(fp + '/Meter{}.txt'.format(meter_id))
    print(data.shape)

    if meter_id == 'A':
        columns =  ['flatness_ratio', 'symmetry', 'crossflow']
        columns += ['flow_velocity_{}'.format(i+1) for i in range(8)]
        columns += ['sound_speed_{}'.format(i+1) for i in range(8)]
        columns += ['average_speed']
        columns += ['gain_{}'.format(i+1) for i in range(16)]
        columns += ['health_state']

    if meter_id == 'B':
        columns =  ['profile_factor', 'symmetry', 'crossflow', 'swirl_angle']
        columns += ['flow_velocity_{}'.format(i+1) for i in range(4)]
        columns += ['average_flow']
        columns += ['sound_speed_{}'.format(i+1) for i in range(4)]
        columns += ['average_speed']
        columns += ['signal_strength_{}'.format(i+1) for i in range(8)]
        columns += ['turbulence_{}'.format(i+1) for i in range(4)]
        columns += ['meter_performance']
        columns += ['signal_quality_{}'.format(i+1) for i in range(8)]
        columns += ['gain_{}'.format(i+1) for i in range(8)]
        columns += ['transit_time_{}'.format(i+1) for i in range(8)]
        columns += ['health_state']

    if meter_id == 'C' or meter_id == 'D':
        columns =  ['profile_factor', 'symmetry', 'crossflow']
        columns += ['flow_velocity_{}'.format(i+1) for i in range(4)]
        columns += ['sound_speed_{}'.format(i+1) for i in range(4)]
        columns += ['signal_strength_{}'.format(i+1) for i in range(8)]
        columns += ['signal_quality_{}'.format(i+1) for i in range(8)]
        columns += ['gain_{}'.format(i+1) for i in range(8)]
        columns += ['transit_time_{}'.format(i+1) for i in range(8)]
        columns += ['health_state']

    return pd.DataFrame(data, columns=columns)


# data = load_data('../data/ufd/', meter_id='A')
# data = load_data('../data/ufd/', meter_id='B')
# data = load_data('../data/ufd/', meter_id='C')
data = load_data('../data/ufd/', meter_id='D')
data

data.health_state.plot()



StarcoderdataJupyterScriptsDedupFiltered