Files
Lugovtsov/solid-magnetic-gisteresis/plots.ipynb
T
2024-11-09 11:25:28 +03:00

3.1 KiB

In [2]:
# %load /home/glebi/git/experiment-automation/processing_tools.py
import numpy as np
from scipy.optimize import curve_fit
import pandas as pd

import matplotlib.pyplot as plt
import matplotlib as mpl
import scienceplots

plt.style.use(['science', 'russian-font'])

mpl.rcParams.update({
    'figure.figsize': [6, 4],
    'savefig.facecolor': 'white',
    'figure.dpi': 150.0,
    'font.size': 12.0,
})

U_1 = 12V -- первые данные Lugovcov

U = 25V -- остальные данные

Формат: t[us], U[V], U[V]

In [15]:
from random import random, randint, choice
def plot_data(filename):
    t, x, y = np.loadtxt(f"data//{filename}", skiprows=1, delimiter=",").T
    r = 1 / (2**.5)
    a = 150 # Э/А
    B = -x / r * a
    H = y / r * a
    with mpl.rc_context({
        'figure.figsize': [7, randint(3,5)],
        'font.size': randint(10, 16),  
        'axes.grid' : random() > .5,
        'axes.facecolor': f"'{1-random()*.07}'",
        'axes.grid.axis': choice(['both']),
        'axes.grid.which': choice(['both', 'minor', 'major'])
    }):
        fig, ax = plt.subplots()
        ax.plot(B, H, lw=random()*.3, color=f"C{randint(0, 7)}", linestyle=choice(['-', '--', ':']))
        ax.set_xlabel("Величина поля B, Э")
        ax.set_ylabel("Величина поля H, Э")
        fig.savefig(f"output//{filename.split('.')[0]}.png")
In [16]:
filenames = ["Lugovcov.csv", "Kazikov.csv", "Smirnov.csv", "Zakharov.csv"]

for f in filenames:
    plot_data(f)
In [ ]: