-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_model.py
More file actions
64 lines (35 loc) · 1.13 KB
/
load_model.py
File metadata and controls
64 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import glob, os
# def load_R(parent_directory):
# array_lst = []
# glob_list = list(glob.glob(parent_directory + "/*.csv"))
# glob_list.sort()
# for file in glob_list:
# array = np.loadtxt(file, delimiter = ',')
# array_lst.append(array)
# return np.hstack(tuple(array_lst))
# #return array_lst
def load_R(file_path):
array = np.loadtxt(file_path, delimiter = ",")
return array
def load_I(file_path):
df = pd.read_csv(file_path)
return np.array(df['brightness'])
def load_D(file_path):
df = pd.read_csv(file_path)
return np.array(df['flux']), np.array(df['wavelength'])
if __name__ == '__main__':
I_file_path = './I/I_vector.csv'
R_file_path = './R/R_matrix.csv'
D_file_path = './D/flux_vs_wavelength_data.csv'
R = load_R(R_file_path)
D, wavelengths = load_D(D_file_path)
I = load_I(I_file_path)
plt.imshow(R)
plt.show()
print(R.shape)
print(D.shape)
print(wavelengths.shape)
print(I.shape)