tsa_saxs/plotting/plot_error.py

24 lines
501 B
Python
Raw Permalink Normal View History

2024-03-13 11:13:52 +01:00
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
def plot_error(dir):
# q | I_data | err | I_fit
data = np.genfromtxt(os.path.join(dir, "POPC-test.fit"))
plt.loglog(data[:,0], data[:, 1], ".", label="I_data")
plt.loglog(data[:,0], data[:, 3], label="I_fit")
plt.legend()
plt.show()
if __name__ == "__main__":
if len(sys.argv) > 1 and os.path.isdir(sys.argv[1]):
dir = sys.argv[1]
else:
dir = "POPC-test"
plot_error(dir)