ix-cli 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ix-hypothesis +11 -6
- data/bin/ix-xy +104 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 274579108c642bf99aee760136a22d4e7155f1f9de8da3f3a3cc6bd0be9586d6
|
4
|
+
data.tar.gz: 07a9faea67eb7857f430935c114dd234e86461836dec52657147e68f471cb515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c64015e5b8ff7a1182f252dbd2a45b7d81786e258447b486af89409cc3bb1bc614fc5fdccb4bad284170685474bcdcae127013bb62f5dc371ca75491ce689a76
|
7
|
+
data.tar.gz: 3d110e333880291c13048a796d2e35db3c8d0313399a3ee69d60832334ca690bfe70c77f9d4960fa6892670c171f84a1a39f0b48f7b86b8325d7e3bc96ce8c8c
|
data/bin/ix-hypothesis
CHANGED
@@ -135,6 +135,15 @@ class Array
|
|
135
135
|
|
136
136
|
def to_bell(text, standard_deviations_to_show = 3, base = :population, kazu_dev = 1, percentage_scale, hide)
|
137
137
|
|
138
|
+
if uniq.size == 1
|
139
|
+
the_variable = text.to_ansi.red.to_s
|
140
|
+
the_value = uniq.first.to_s.to_ansi.green.to_s
|
141
|
+
puts ''
|
142
|
+
puts "# All values of #{the_variable} where found to have the value of #{the_value}"
|
143
|
+
puts '-' * 80
|
144
|
+
return
|
145
|
+
end
|
146
|
+
|
138
147
|
if base == :population
|
139
148
|
sigma = population_standard_deviation
|
140
149
|
end
|
@@ -186,7 +195,7 @@ class Array
|
|
186
195
|
((groups[sigma] ? groups[sigma].size : 0.0) / total.to_f) * 100
|
187
196
|
end.max
|
188
197
|
|
189
|
-
puts [the_min, the_max].inspect
|
198
|
+
# puts [the_min, the_max].inspect
|
190
199
|
|
191
200
|
sigmas_copy.each_with_index do |sigma, index|
|
192
201
|
|
@@ -218,8 +227,6 @@ class Array
|
|
218
227
|
|
219
228
|
bell_line << ("%6.2f%% " % [(size.to_f / total.to_f) * 100]).to_s
|
220
229
|
|
221
|
-
# puts groups[sigma].inspect
|
222
|
-
|
223
230
|
bn = [
|
224
231
|
the_min,
|
225
232
|
(size.to_f / total.to_f) * 100,
|
@@ -231,11 +238,9 @@ class Array
|
|
231
238
|
percentage_scale
|
232
239
|
)
|
233
240
|
|
234
|
-
# bell_line << Percentage.new(total, size, percentage_scale).to_bar
|
235
|
-
|
236
241
|
case (std_dev_ruler).to_f
|
237
242
|
when 0.000
|
238
|
-
|
243
|
+
bell_line << '|' + ('|' * an[1]).to_s.to_ansi.pink.to_s
|
239
244
|
when 0..1
|
240
245
|
bell_line << '|' + ('|' * an[1]).to_s.to_ansi.green.to_s
|
241
246
|
when -1..0
|
data/bin/ix-xy
CHANGED
@@ -1,54 +1,122 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'tmpdir'
|
4
|
+
require 'isna'
|
4
5
|
require 'optparse'
|
5
6
|
|
6
7
|
options = {}
|
8
|
+
options[:title] = 'title'
|
9
|
+
options[:x_label] = 'x'
|
10
|
+
options[:y_label] = 'y'
|
11
|
+
options[:graph_width] = 800
|
12
|
+
options[:graph_height] = 600
|
13
|
+
options[:output] = 'output'
|
14
|
+
|
15
|
+
# option[title] = 'default value'
|
16
|
+
# option[y_label] = 'default value'
|
17
|
+
# option[x_label] = 'default value'
|
18
|
+
# options[:x_max] = 0
|
19
|
+
# options[:x_min] = 0
|
20
|
+
# options[:y_max] = 0
|
21
|
+
# options[:y_min] = 0
|
22
|
+
# option[graph_width] = 'default value'
|
23
|
+
# option[graph_height] = 'default value'
|
24
|
+
# option[output] = 'default value'
|
7
25
|
|
8
26
|
OptionParser.new do |opts|
|
9
27
|
|
10
|
-
|
11
|
-
|
28
|
+
basename = File.basename($0).to_ansi.green.to_s
|
29
|
+
options_hint = "[OPTIONS]".to_ansi.blink.red.to_s
|
30
|
+
opts.banner = "Usage: #{basename} #{options_hint}"
|
12
31
|
|
13
|
-
|
14
|
-
|
32
|
+
opts.on('-t', '--title [TITLE]', 'Title.') do |value|
|
33
|
+
options[:title] = value
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on('-y', '--y-label [TEXT]', 'Y label.') do |value|
|
37
|
+
options[:y_label] = value
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on('-x', '--x-label [TEXT]', 'X label.') do |value|
|
41
|
+
options[:x_label] = value
|
42
|
+
end
|
15
43
|
|
16
|
-
|
17
|
-
|
44
|
+
opts.on('-m', '--x-max [NUMBER]', 'X max.') do |value|
|
45
|
+
options[:x_max] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on('-i', '--x-min [NUMBER]', 'X min.') do |value|
|
49
|
+
options[:x_min] = value
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on('-a', '--y-max [NUMBER]', 'Y max.') do |value|
|
53
|
+
options[:y_max] = value
|
54
|
+
end
|
18
55
|
|
19
|
-
opts.on(
|
20
|
-
options[:
|
56
|
+
opts.on('-n', '--y-min [NUMBER]', 'Y min.') do |value|
|
57
|
+
options[:y_min] = value
|
21
58
|
end
|
22
59
|
|
23
|
-
opts.on(
|
24
|
-
options[:
|
60
|
+
opts.on('-g', '--graph-width [NUMBER]', 'Graph width.') do |value|
|
61
|
+
options[:graph_width] = value
|
25
62
|
end
|
26
63
|
|
27
|
-
opts.on(
|
28
|
-
options[:
|
64
|
+
opts.on('-r', '--graph-height [NUMBER]', 'Graph height.') do |value|
|
65
|
+
options[:graph_height] = value
|
29
66
|
end
|
30
67
|
|
31
|
-
opts.on(
|
32
|
-
options[:output] =
|
68
|
+
opts.on('-o', '--output [SNAKE]', 'Output.') do |value|
|
69
|
+
options[:output] = value
|
70
|
+
end
|
71
|
+
|
72
|
+
opts.on('-s', '--stats', 'Stats.') do |value|
|
73
|
+
options[:stats] = value
|
33
74
|
end
|
34
75
|
|
35
76
|
end.parse!
|
36
77
|
|
37
|
-
|
38
|
-
|
78
|
+
required_options = [
|
79
|
+
:title,
|
80
|
+
:y_label,
|
81
|
+
:x_label,
|
82
|
+
:graph_width,
|
83
|
+
:graph_height,
|
84
|
+
:output,
|
85
|
+
]
|
86
|
+
|
87
|
+
ranges = [
|
88
|
+
:x_max,
|
89
|
+
:x_min,
|
90
|
+
:y_max,
|
91
|
+
:y_min,
|
92
|
+
]
|
93
|
+
|
94
|
+
need_ranges = ranges.any? { |k| options[k] }
|
95
|
+
|
96
|
+
if need_ranges
|
97
|
+
ranges.each do |r|
|
98
|
+
required_options.push(r)
|
99
|
+
end
|
39
100
|
end
|
40
101
|
|
41
|
-
|
42
|
-
options[
|
102
|
+
required_options.each do |option|
|
103
|
+
unless options[option]
|
104
|
+
$stderr.puts "Can not run #{option.to_s.to_ansi.red.to_s} was not given."
|
105
|
+
exit 1
|
106
|
+
end
|
43
107
|
end
|
44
108
|
|
45
|
-
|
46
|
-
|
109
|
+
def pretty_options(hash, width = 20)
|
110
|
+
r = ''
|
111
|
+
hash.keys.sort.each do |key|
|
112
|
+
k = key.to_s.ljust(width, '.')
|
113
|
+
v = hash[key].to_s.rjust(width, '.')
|
114
|
+
r << [k, v] * ' ' + "\n"
|
115
|
+
end
|
116
|
+
r
|
47
117
|
end
|
118
|
+
puts pretty_options(options)
|
48
119
|
|
49
|
-
unless options[:output]
|
50
|
-
options[:output] = 'output'
|
51
|
-
end
|
52
120
|
|
53
121
|
Dir.mktmpdir do |dir|
|
54
122
|
|
@@ -62,20 +130,26 @@ Dir.mktmpdir do |dir|
|
|
62
130
|
end
|
63
131
|
|
64
132
|
File.open(script_path, 'w+') do |script|
|
65
|
-
script.puts "set term png size
|
133
|
+
script.puts "set term png size #{options[:graph_width]},#{options[:graph_height]}"
|
66
134
|
script.puts "set output \"#{options[:output]}.png\""
|
67
135
|
script.puts "set title \"#{options[:title]}\""
|
68
136
|
script.puts "set xlabel \"#{options[:x_label]}\""
|
69
137
|
script.puts "set ylabel \"#{options[:y_label]}\""
|
70
|
-
script.puts
|
71
|
-
script.puts
|
72
|
-
|
73
|
-
|
74
|
-
|
138
|
+
script.puts 'set grid'
|
139
|
+
script.puts 'set timestamp'
|
140
|
+
if options[:stats]
|
141
|
+
script.puts "stats '#{data_path}'"
|
142
|
+
end
|
143
|
+
if need_ranges
|
144
|
+
script.puts "plot [#{options[:x_min]}:#{options[:x_max]}][#{options[:y_min]}:#{options[:y_max]}] '#{data_path}' notitle with points linecolor rgb '#FF0000'"
|
145
|
+
else
|
146
|
+
script.puts "plot '#{data_path}' notitle with points linecolor rgb '#FF0000'"
|
147
|
+
end
|
148
|
+
script.puts 'quit'
|
75
149
|
end
|
76
150
|
|
77
151
|
system "gnuplot #{script_path}"
|
78
152
|
puts "open #{options[:output]}.png"
|
79
|
-
|
153
|
+
|
80
154
|
end
|
81
155
|
|