<jupyter_start><jupyter_text>Field Distribution<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
import os, sys
import numpy as np
import pickle
sys.path.append("/Users/maxime/IndividualProject/code/Data_Assimilation/src/VarDACAE")
sys.path.append("/Users/maxime/IndividualProject/code/fluidity/")
from fluidity import vtktools
os.getcwd()
ug8 = vtktools.vtu("../../../../../data/subdomain_8/LSBU_0_8.vtu")
locations8 = ug8.GetLocations()
scalars8 = ug8.GetScalarField('TracerGeorge')
print(len(scalars8))

ug6 = vtktools.vtu("../../../../../data/subdomain_6/LSBU_0_6.vtu")
locations6 = ug6.GetLocations()
scalars6 = ug6.GetScalarField('TracerGeorge')

def normaliseScalar(scalar):
    """ Normalise a scalar field between 0 and 1 """
    normalisedScalar = []
    maxValue = np.amax(scalar)
    minValue = np.amin(scalar)
    for value in scalar:
        normalisedValue = (value - minValue) / (maxValue - minValue)
        normalisedScalar.append(normalisedValue)

    return normalisedScalar

normScalar8 = normaliseScalar(scalars8)
print(np.max(normScalar8), np.min(normScalar8))
print(np.max(scalars8), np.min(scalars8))

x = np.linspace(0, len(scalars8), 1)
plt.plot(x, scalars8, facecolor='g')
plt.xlabel('Scalars')
plt.ylabel('Counts')
plt.title('Histogram of TracerGeorge Scalar for Subdomain 8')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1462160176340926, 'fraction_numerical': 0.02204261572373255, 'mean_word_length': 4.973684210526316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '525109', 'license': 'MIT', 'n_tokens_mistral': 507, 'n_tokens_neox': 483, 'n_words': 88, 'path': 'Notebooks/.ipynb_checkpoints/Field Distribution-checkpoint.ipynb', 'repo_name': 'MaximeRedstone/UnstructuredCAE-DA', 'size': '1361'}