<commit_before># -*- coding: utf-8 -*-
"""
This module contains classes and functions for processing data.

"""
from __future__ import division, print_function
import numpy as np
from pxl import timeseries as ts
import matplotlib.pyplot as plt
from scipy.io import loadmat
import multiprocessing as mp
import scipy.stats
from scipy.stats import nanmean, nanstd
from pxl import fdiff
import progressbar
import json
import os
import sys
import pandas as pd

if sys.version_info[0] == 3:
    from urllib.request import urlretrieve
else:
    from urllib import urlretrieve

# Dict for runs corresponding to each height
wakeruns = {0.0 : np.arange(0, 45),
            0.125 : np.arange(45, 90),
            0.25 : np.arange(90, 135),
            0.375 : np.arange(135, 180),
            0.5 : np.arange(180, 225),
            0.625 : np.arange(225, 270)}
           
# Constants
H = 1.0
D = 1.0
A = D*H
R = D/2
rho = 1000.0
nu = 1e-6

# Directory constants
raw_data_dir = os.path.join("Data", "Raw")
processed_data_dir = os.path.join("Data", "Processed")

def calc_b_vec(vel):
    """Calculates the systematic error of a Vectrino measurement (in m/s)
    from their published specs. Returns half the +/- value as b."""
    return 0.5*(0.005*np.abs(vel) + 0.001)
    
def calc_uncertainty(quantity, b):
    return np.sqrt(nanstd(quantity)**2 + b**2)
             
def calc_tare_torque(rpm):
    """Returns tare torque array given RPM array."""<commit_msg>Read turbine properties from config file<commit_after># -*- coding: utf-8 -*-
"""
This module contains classes and functions for processing data.

"""
from __future__ import division, print_function
import numpy as np
from pxl import timeseries as ts
import matplotlib.pyplot as plt
from scipy.io import loadmat
import multiprocessing as mp
import scipy.stats
from scipy.stats import nanmean, nanstd
from pxl import fdiff
import progressbar
import json
import os
import sys
import pandas as pd

if sys.version_info[0] == 3:
    from urllib.request import urlretrieve
else:
    from urllib import urlretrieve

# Dict for runs corresponding to each height
wakeruns = {0.0 : np.arange(0, 45),
            0.125 : np.arange(45, 90),
            0.25 : np.arange(90, 135),
            0.375 : np.arange(135, 180),
            0.5 : np.arange(180, 225),
            0.625 : np.arange(225, 270)}
           
# Read constants from turbine properties
with open("Config/turbine_properties.json") as f:
    turbine_properties = json.load(f)
H = turbine_properties["height"]
D = turbine_properties["diameter"]
A = D*H
R = D/2
rho = 1000.0
nu = 1e-6

# Directory constants
raw_data_dir = os.path.join("Data", "Raw")
processed_data_dir = os.path.join("Data", "Processed")

def calc_b_vec(vel):
    """Calculates the systematic error of a Vectrino measurement (in m/s)
    from their published specs. Returns half the +/- value as b."""
    return 0.5*(0.005*np.abs(vel) + 0.001)
    
def calc_uncertainty(quantity, b):
    return np.sqrt(nanstd(quantity)**2 + b**2)
             
def calc_tare_torque(rpm):
    """Returns tare torque array given RPM array."""
{'fraction_non_alphanumeric': 0.11150614091790563, 'fraction_numerical': 0.04783451842275371, 'mean_word_length': 3.23972602739726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4699424', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1024, 'n_words': 336}