-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput_lib.py
More file actions
executable file
·152 lines (145 loc) · 5.82 KB
/
Copy pathinput_lib.py
File metadata and controls
executable file
·152 lines (145 loc) · 5.82 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/python3
'''
Abstract:
This is a program for reading and loading input files.
Usage:
print_input_lib.py
Editor:
Jacob975
##################################
# Python3 #
# This code is made in python3 #
##################################
20181113
####################################
update log
20181113 version alpha 1
1. The code works.
'''
import numpy as np
import time
class option_test():
def __init__(self):
self.opts = None
def create(self):
s = [ '# mask code:',
'# \t[mask code should] be a 8 digit binary number.',
'# Example: 00000000 represent no masked; 11111111 represent all masked',
'00000000',
'# consider error:',
'# \t[consider error] means considering error or not during the convertion.',
'# Available options: yes, no',
'yes']
np.savetxt('option_test.txt', s, fmt = '%s')
def load(self, file_name):
self.opts = np.loadtxt(file_name, dtype = str)
self.opts = list(self.opts)
return self.opts
class option_ccdiag():
def __init__(self):
self.opts = None
def create(self):
s = [ '# Please indicate the band you like below',
'# Available bands: J, H, K in UKIDSS, and IR1, IR2, IR3, IR4, MP1 in spitzer',
'# Put "N" indicate skip that band when ploting, and that color would be magnitude.',
'# Mag 3 - Mag 4 vs. Mag 1 - Mag 2',
'#--------------------------------',
'# Mag 1',
'IR3',
'# Mag 2',
'IR4',
'# Mag 3',
'IR4',
'# Mag 4',
'MP1']
np.savetxt('option_ccdiag.txt', s, fmt = '%s')
def load(self, file_name):
self.opts = np.loadtxt(file_name, dtype = str)
self.opts = list(self.opts)
return self.opts
class option_train():
def __init__(self):
self.opts = None
def create(self):
s = [ '# mask code:',
'# \t[mask code] should be a 8 digit binary number.',
'# Example: 00000000 represent no masked; 11111111 represent all masked',
'00000000',
'# consider error:',
'# \t[consider error] means considering error or not during the convertion.',
'# Available options: yes, no',
'yes',
'# batch format:',
'# \t[batch format] means how to get the next batch of sources.',
'# Available options: equal, random',
'equal',
'# iterations upperlimits:',
'# \t[iterations upperlimits] means the training process will end if the model is train by this times.',
'# It should be an integer',
'50000',
'# validation function:',
'# \t[validation function] means the function we used to judge the model.',
'# Available options: GT_score, GT_score_newn, cross_entropy',
'GT_score']
np.savetxt('option_train.txt', s, fmt = '%s')
def load(self, file_name):
self.opts = np.loadtxt(file_name, dtype = str)
self.opts = list(self.opts)
return self.opts
class option_dat2npy():
def __init__(self):
self.opts = None
def create(self):
s = [ '# mask code:',
'# \t[mask code should] be a 8 digit binary number.',
'# Example: 00000000 represent no masked; 11111111 represent all masked',
'00000000',
'# number of lost:',
'# \t[number of lost] represent the tolerance for data',
'# Example: 0 means only data without loss will be saved, [number of lost] should be a integer between 0 and 15',
'0',
'# do normalization:',
'# \t[do normalization] means normalize the SEDs or not during the convertion.',
'# Available options: yes, no',
'no',
'# consider error:',
'# \t[consider error] means considering error or not during the convertion.',
'# Available options: yes, no',
'yes',
'# High error-flux correlation:',
'# \t[error_flux_correlation] mean the program only select the source with high error-flux correlation.',
'# Available options: yes, no',
'no',
'# Upper limit of number of sources:',
'# \t[upper limit of the number of sources] mean the maximum number of the sources',
'# It can only be a integer.',
'0',
'# Trace the Av:',
'# If you do extinction correction before dat2npy_ensemble.py, you may like to keep the Av information.',
'# Available option: yes, no',
'no',
'# Trace the HL 2013 labels:',
'# Available option: yes, no',
'no']
np.savetxt('option_dat2npy.txt', s, fmt = '%s')
def load(self, file_name):
self.opts = np.loadtxt(file_name, dtype = str)
self.opts = list(self.opts)
return self.opts
class option_cm_reliable():
def __init__(self):
self.opts = None
def create(self):
s = [
'# How many true labels are given?',
'3',
'# How many pred label are given?',
'4',
'# The lower limit for the highest probability.',
'0.8',
]
np.savetxt('option_cm_reliable.txt', s, fmt = '%s')
def load(self, file_name):
self.opts = np.loadtxt(file_name, dtype = str)
self.opts = list(self.opts)
return self.opts