<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Visualization for OpenFOAM actuatorLine simulation.
"""
from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd


def loadperf():
    df = pd.read_csv("postProcessing/actuatorLines/0/foil.csv")
    df = df.drop_duplicates("time", take_last=True)
    df["alpha_rad"] = df.alpha_deg/180.0*np.pi
    df["cn"] =  df.cl*np.cos(df.alpha_rad) - df.cd*np.sin(df.alpha_rad)
    df["cc"] = df.cl*np.sin(df.alpha_rad) - df.cd*np.cos(df.alpha_rad)
    return df


def plot_alpha():
    df = loadperf()
    plt.figure()
    plt.plot(df.time, df.alpha_geom_deg, label="Geometric")
    plt.plot(df.time, df.alpha_deg, label="Actual")
    plt.xlabel("Time (s)")
    plt.ylabel("Angle of attack (deg)")
    plt.legend(loc="best")
    plt.tight_layout()


def plot_cn(t0=0.5):
    df = loadperf()
    plt.figure()
    ind = df.time >= t0
    plt.plot(df.alpha_geom_deg[ind], df.cn[ind])
    plt.xlabel(r"$\alpha$ (geometric, degrees)")
    plt.ylabel(r"$C_N$")
    plt.xlim((0, None))
    plt.ylim((0, None))
    plt.tight_layout()


def plot_cc(t0=0.5):
    df = loadperf()
    plt.figure()
    ind = df.time >= t0
    plt.plot(df.alpha_geom_deg[ind], df.cc[ind])
    plt.xlabel(r"$\alpha$ (geometric, degrees)")
    plt.ylabel(r"$C_C$")
    plt.tight_layout()


if __name__ == "__main__":
    import seaborn as sns
    sns.set(context="paper", style="white", font_scale=1.5,
            rc={"axes.grid": True, "legend.frameon": True})
    
    plot_alpha()
    plot_cn()
    plot_cc()
    plt.show()
<commit_msg>Clean up plotting script<commit_after>#!/usr/bin/env python
"""
Plotting for pitching actuator line simulation.
"""

from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd


def loadperf():
    df = pd.read_csv("postProcessing/actuatorLines/0/foil.csv")
    df = df.drop_duplicates("time", take_last=True)
    df["alpha_rad"] = df.alpha_deg/180.0*np.pi
    df["cn"] =  df.cl*np.cos(df.alpha_rad) - df.cd*np.sin(df.alpha_rad)
    df["cc"] = df.cl*np.sin(df.alpha_rad) - df.cd*np.cos(df.alpha_rad)
    return df


def plot_alpha():
    df = loadperf()
    plt.figure()
    plt.plot(df.time, df.alpha_geom_deg, label="Geometric")
    plt.plot(df.time, df.alpha_deg, label="Actual")
    plt.xlabel("Time (s)")
    plt.ylabel("Angle of attack (deg)")
    plt.legend(loc="best")
    plt.tight_layout()


def plot_cn(t0=0.5):
    df = loadperf()
    plt.figure()
    ind = df.time >= t0
    plt.plot(df.alpha_geom_deg[ind], df.cn[ind])
    plt.xlabel(r"$\alpha$ (geometric, degrees)")
    plt.ylabel(r"$C_N$")
    plt.xlim((0, None))
    plt.ylim((0, None))
    plt.tight_layout()


def plot_cc(t0=0.5):
    df = loadperf()
    plt.figure()
    ind = df.time >= t0
    plt.plot(df.alpha_geom_deg[ind], df.cc[ind])
    plt.xlabel(r"$\alpha$ (geometric, degrees)")
    plt.ylabel(r"$C_C$")
    plt.tight_layout()


if __name__ == "__main__":
    import seaborn as sns
    sns.set(context="paper", style="white", font_scale=1.5,
            rc={"axes.grid": True, "legend.frameon": True})

    plot_alpha()
    plot_cn()
    plot_cc()
    plt.show()

{'fraction_non_alphanumeric': 0.17627013630731103, 'fraction_numerical': 0.01084262701363073, 'mean_word_length': 3.3168449197860963, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 7, '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': '7256889', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1281, 'n_words': 230}