toji 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/koji_making.ipynb +84 -0
- data/example/koji_making.rb +14 -0
- data/example/koji_making2.rb +69 -0
- data/example/moromi.ipynb +159 -0
- data/example/moromi.rb +15 -0
- data/example/shubo.ipynb +84 -0
- data/example/shubo.rb +14 -0
- data/example/three_step_mashing_recipe.rb +25 -25
- data/lib/toji/graph/ab.rb +23 -19
- data/lib/toji/graph/bmd.rb +56 -0
- data/lib/toji/graph/progress.rb +84 -0
- data/lib/toji/graph.rb +2 -0
- data/lib/toji/product/base.rb +74 -0
- data/lib/toji/{progress → product}/job.rb +32 -21
- data/lib/toji/{progress → product}/job_accessor.rb +1 -1
- data/lib/toji/{progress/make_koji.rb → product/koji_making.rb} +16 -22
- data/lib/toji/{progress → product}/moromi.rb +70 -110
- data/lib/toji/{progress → product}/shubo.rb +22 -50
- data/lib/toji/product.rb +11 -0
- data/lib/toji/recipe/rice_rate/cooked.rb +1 -25
- data/lib/toji/recipe/rice_rate/steamed.rb +0 -12
- data/lib/toji/version.rb +1 -1
- data/lib/toji.rb +1 -1
- metadata +18 -10
- data/example/make_koji.rb +0 -18
- data/lib/toji/progress/jobs.rb +0 -142
- data/lib/toji/progress.rb +0 -11
data/lib/toji/progress/jobs.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
module Toji
|
2
|
-
module Progress
|
3
|
-
class Jobs
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
attr_reader :day_offset
|
7
|
-
|
8
|
-
def initialize(arr)
|
9
|
-
@arr = []
|
10
|
-
@hash = {}
|
11
|
-
@day_offset = 0
|
12
|
-
|
13
|
-
arr.each {|j|
|
14
|
-
self << j
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
def [](id)
|
19
|
-
@hash[id]
|
20
|
-
end
|
21
|
-
|
22
|
-
def <<(job)
|
23
|
-
if job.id
|
24
|
-
if @hash[job.id]
|
25
|
-
@arr.delete(@hash[job.id])
|
26
|
-
end
|
27
|
-
@hash[job.id] = job
|
28
|
-
end
|
29
|
-
@arr << job
|
30
|
-
job.jobs = self
|
31
|
-
normalization
|
32
|
-
end
|
33
|
-
|
34
|
-
def normalization
|
35
|
-
min_time = @arr.select{|j| j.time}.map(&:time).sort.first
|
36
|
-
|
37
|
-
if min_time
|
38
|
-
@arr.each {|j|
|
39
|
-
if j.time
|
40
|
-
j.elapsed_time = (j.time - min_time).to_i
|
41
|
-
else
|
42
|
-
j.time = min_time + j.elapsed_time
|
43
|
-
end
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
@arr = @arr.sort{|a,b| a.elapsed_time<=>b.elapsed_time}
|
48
|
-
|
49
|
-
t = @arr.first&.time
|
50
|
-
if t
|
51
|
-
@day_offset = t - Time.mktime(t.year, t.month, t.day)
|
52
|
-
else
|
53
|
-
@day_offset = 0
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def each(&block)
|
58
|
-
normalization
|
59
|
-
@arr.each(&block)
|
60
|
-
end
|
61
|
-
|
62
|
-
def plot_data(keys=nil)
|
63
|
-
normalization
|
64
|
-
|
65
|
-
data = map(&:to_h).map(&:compact)
|
66
|
-
if !keys
|
67
|
-
keys = data.map(&:keys).flatten.uniq
|
68
|
-
end
|
69
|
-
|
70
|
-
result = []
|
71
|
-
|
72
|
-
if keys.include?(:temps)
|
73
|
-
temps = data.map{|h| h[:temps]}
|
74
|
-
if 0<temps.select{|a| a.present?}.size
|
75
|
-
temps_x = []
|
76
|
-
temps_y = []
|
77
|
-
temps.each_with_index {|ts,i|
|
78
|
-
ts.each_with_index {|t,j|
|
79
|
-
temps_x << data[i][:elapsed_time] + j + day_offset
|
80
|
-
temps_y << t
|
81
|
-
}
|
82
|
-
}
|
83
|
-
result << {x: temps_x, y: temps_y, name: :temps}
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
keys &= [:preset_temp, :room_temp, :room_psychrometry, :baume, :acid, :amino_acid, :alcohol]
|
88
|
-
|
89
|
-
keys.each {|key|
|
90
|
-
xs = []
|
91
|
-
ys = []
|
92
|
-
data.each {|h|
|
93
|
-
if h[key]
|
94
|
-
ys << h[key]
|
95
|
-
xs << h[:elapsed_time] + day_offset
|
96
|
-
end
|
97
|
-
}
|
98
|
-
|
99
|
-
line_shape = :linear
|
100
|
-
if key==:preset_temp
|
101
|
-
line_shape = :hv
|
102
|
-
end
|
103
|
-
|
104
|
-
result << {x: xs, y: ys, name: key, line: {shape: line_shape}}
|
105
|
-
}
|
106
|
-
|
107
|
-
if 0<day_offset
|
108
|
-
result = result.map{|h|
|
109
|
-
h[:x].unshift(0)
|
110
|
-
h[:y].unshift(nil)
|
111
|
-
h
|
112
|
-
}
|
113
|
-
end
|
114
|
-
|
115
|
-
result
|
116
|
-
end
|
117
|
-
|
118
|
-
def bmd_plot_data
|
119
|
-
normalization
|
120
|
-
|
121
|
-
data = map{|j| [j.time || j.elapsed_time + day_offset, j.moromi_time, j.moromi_day, j.baume, j.bmd]}.select{|a| a[1] && a[4]}
|
122
|
-
xs = data.map{|a| a[1]}
|
123
|
-
ys = data.map{|a| a[4]}
|
124
|
-
texts = data.map{|a| "%s<br />moromi day=%d, be=%s, bmd=%s" % [a[0], a[2], a[3], a[4]]}
|
125
|
-
|
126
|
-
{x: xs, y: ys, text: texts, name: :bmd}
|
127
|
-
end
|
128
|
-
|
129
|
-
def ab_plot_data
|
130
|
-
normalization
|
131
|
-
|
132
|
-
result = []
|
133
|
-
|
134
|
-
data = map{|j| [j.time || j.elapsed_time + day_offset, j.alcohol, j.baume]}.select{|a| a[1] && a[2]}
|
135
|
-
xs = data.map{|a| a[1]}
|
136
|
-
ys = data.map{|a| a[2]}
|
137
|
-
texts = data.map{|a| "%s<br />alc=%s, be=%s" % a}
|
138
|
-
{x: xs, y: ys, text: texts, name: :actual}
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
data/lib/toji/progress.rb
DELETED