import numpy as np
import matplotlib.pyplot as plt

k=0.9
l=154 #nm

with open('XRD_krystalinsk.txt','r') as file:
    line = file.readline()
    line= file.readline() #første linje er navnet på aksene
    y_max = 0
    max_2t = 0
    while line:
        [to_theta, y] = [float(x.replace(',', '.')) for x in line.split()]
        if y > y_max:
            y_max = y
            max_2t = to_theta
        line = file.readline()

print(y_max,max_2t)

with open('XRD_krystalinsk.txt','r') as file:
    fileList = file.readlines()[1:]

    ylist = [float(x.split()[1].replace(',','.')) for x in fileList]
    tlist = [float(x.split()[0].replace(',','.')) for x in fileList]

print(y_max,max_2t)