toji 2.8.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/calendar.ipynb +42 -51
- data/example/calendar.yaml +6 -6
- data/example/calendar_file.ipynb +36 -36
- data/example/example_core.rb +877 -205
- data/example/kake_ingredient.rb +21 -15
- data/example/koji_ingredient.rb +31 -21
- data/example/{koji_making.ipynb → koji_progress.ipynb} +14 -14
- data/example/{koji_making.rb → koji_progress.rb} +3 -2
- data/example/{koji_making.yaml → koji_progress.yaml} +8 -9
- data/example/{koji_making_multi.ipynb → koji_progress_multi.ipynb} +21 -22
- data/example/{moromi.ipynb → moromi_progress.ipynb} +22 -22
- data/example/{moromi.rb → moromi_progress.rb} +3 -2
- data/example/{moromi.yaml → moromi_progress.yaml} +0 -0
- data/example/moto_progress.ipynb +121 -0
- data/example/{moto.rb → moto_progress.rb} +3 -2
- data/example/{moto.yaml → moto_progress.yaml} +14 -15
- data/example/recipe.rb +44 -32
- data/lib/toji.rb +4 -1
- data/lib/toji/calendar.rb +18 -18
- data/lib/toji/calendar/date_column.rb +7 -22
- data/lib/toji/calendar/date_row.rb +6 -6
- data/lib/toji/ingredient.rb +6 -2
- data/lib/toji/ingredient/alcohol.rb +14 -0
- data/lib/toji/ingredient/base.rb +11 -0
- data/lib/toji/ingredient/kake.rb +3 -9
- data/lib/toji/ingredient/koji.rb +19 -10
- data/lib/toji/ingredient/lactic_acid.rb +14 -0
- data/lib/toji/ingredient/rice.rb +50 -4
- data/lib/toji/ingredient/tanekoji.rb +29 -0
- data/lib/toji/ingredient/water.rb +18 -0
- data/lib/toji/ingredient/yeast.rb +20 -0
- data/lib/toji/processing.rb +18 -0
- data/lib/toji/processing/base.rb +7 -0
- data/lib/toji/processing/cooled_rice.rb +22 -0
- data/lib/toji/processing/cooled_rice_element.rb +8 -0
- data/lib/toji/processing/dekoji.rb +22 -0
- data/lib/toji/processing/dekoji_element.rb +8 -0
- data/lib/toji/processing/kake_processing.rb +7 -0
- data/lib/toji/processing/koji_processing.rb +10 -0
- data/lib/toji/processing/rice_processing.rb +19 -0
- data/lib/toji/processing/soaked_rice.rb +49 -0
- data/lib/toji/processing/soaked_rice_element.rb +18 -0
- data/lib/toji/processing/steamed_rice.rb +22 -0
- data/lib/toji/processing/steamed_rice_element.rb +8 -0
- data/lib/toji/product.rb +11 -83
- data/lib/toji/product/schedule_factory.rb +74 -0
- data/lib/toji/progress.rb +23 -0
- data/lib/toji/progress/base_progress.rb +37 -0
- data/lib/toji/progress/base_state.rb +39 -0
- data/lib/toji/progress/builder.rb +53 -0
- data/lib/toji/progress/graph.rb +11 -0
- data/lib/toji/{brew → progress}/graph/ab.rb +4 -4
- data/lib/toji/{brew → progress}/graph/bmd.rb +2 -2
- data/lib/toji/{brew/graph/multi_progress.rb → progress/graph/multi_progress_note.rb} +11 -11
- data/lib/toji/{brew/graph/progress.rb → progress/graph/progress_note.rb} +20 -18
- data/lib/toji/progress/koji_progress.rb +15 -0
- data/lib/toji/progress/koji_state.rb +23 -0
- data/lib/toji/{brew/moromi.rb → progress/moromi_progress.rb} +9 -5
- data/lib/toji/progress/moromi_state.rb +77 -0
- data/lib/toji/progress/moto_progress.rb +15 -0
- data/lib/toji/progress/moto_state.rb +31 -0
- data/lib/toji/progress/progress.rb +15 -0
- data/lib/toji/progress/state.rb +9 -0
- data/lib/toji/progress/state/baume_to_nihonshudo.rb +21 -0
- data/lib/toji/progress/state/nihonshudo_to_baume.rb +21 -0
- data/lib/toji/recipe.rb +54 -39
- data/lib/toji/recipe/ab_expect.rb +2 -2
- data/lib/toji/recipe/action.rb +8 -0
- data/lib/toji/recipe/step.rb +97 -71
- data/lib/toji/schedule.rb +5 -0
- data/lib/toji/schedule/action_schedule.rb +9 -0
- data/lib/toji/schedule/base.rb +9 -0
- data/lib/toji/schedule/kake_schedule.rb +11 -0
- data/lib/toji/schedule/koji_schedule.rb +11 -0
- data/lib/toji/schedule/rice_schedule.rb +16 -0
- data/lib/toji/utils.rb +43 -0
- data/lib/toji/version.rb +1 -1
- metadata +59 -40
- data/lib/toji/brew.rb +0 -18
- data/lib/toji/brew/base.rb +0 -55
- data/lib/toji/brew/builder.rb +0 -98
- data/lib/toji/brew/graph.rb +0 -11
- data/lib/toji/brew/koji.rb +0 -11
- data/lib/toji/brew/moto.rb +0 -11
- data/lib/toji/brew/state.rb +0 -122
- data/lib/toji/brew/wrapped_state.rb +0 -109
- data/lib/toji/ingredient/kake/actual.rb +0 -26
- data/lib/toji/ingredient/kake/base.rb +0 -18
- data/lib/toji/ingredient/kake/expected.rb +0 -40
- data/lib/toji/ingredient/koji/actual.rb +0 -29
- data/lib/toji/ingredient/koji/actual_fermentable.rb +0 -15
- data/lib/toji/ingredient/koji/base.rb +0 -35
- data/lib/toji/ingredient/koji/expected.rb +0 -45
- data/lib/toji/ingredient/koji/expected_fermentable.rb +0 -15
- data/lib/toji/ingredient/koji_rate.rb +0 -16
- data/lib/toji/ingredient/rice/actual_steamable.rb +0 -27
- data/lib/toji/ingredient/rice/base.rb +0 -40
- data/lib/toji/ingredient/rice/expected_steamable.rb +0 -27
- data/lib/toji/ingredient/rice_rate.rb +0 -23
- data/lib/toji/product/event.rb +0 -13
- data/lib/toji/product/rice_event.rb +0 -28
- data/lib/toji/product/rice_event_group.rb +0 -19
@@ -1,5 +1,5 @@
|
|
1
1
|
module Toji
|
2
|
-
module
|
2
|
+
module Progress
|
3
3
|
module Graph
|
4
4
|
class Ab
|
5
5
|
def initialize
|
@@ -34,7 +34,7 @@ module Toji
|
|
34
34
|
result = []
|
35
35
|
|
36
36
|
@actuals.each {|moromi, name|
|
37
|
-
states = moromi.
|
37
|
+
states = moromi.states.select{|s| s.alcohol && s.baume}
|
38
38
|
|
39
39
|
xs = states.map(&:alcohol)
|
40
40
|
ys = states.map(&:baume)
|
@@ -57,13 +57,13 @@ module Toji
|
|
57
57
|
|
58
58
|
def min_baume
|
59
59
|
@actuals.map {|moromi, name|
|
60
|
-
moromi.
|
60
|
+
moromi.states.map(&:baume).compact.min
|
61
61
|
}.compact.min || 0
|
62
62
|
end
|
63
63
|
|
64
64
|
def max_baume
|
65
65
|
@actuals.map {|moromi, name|
|
66
|
-
moromi.
|
66
|
+
moromi.states.map(&:baume).compact.max
|
67
67
|
}.compact.max || 0
|
68
68
|
end
|
69
69
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Toji
|
2
|
-
module
|
2
|
+
module Progress
|
3
3
|
module Graph
|
4
4
|
class Bmd
|
5
5
|
|
@@ -16,7 +16,7 @@ module Toji
|
|
16
16
|
result = []
|
17
17
|
|
18
18
|
@actuals.each {|moromi, name|
|
19
|
-
states = moromi.
|
19
|
+
states = moromi.states.select{|s| s.moromi_day && s.bmd}
|
20
20
|
|
21
21
|
xs = states.map(&:moromi_day).map{|d| d*DAY}
|
22
22
|
ys = states.map(&:bmd)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Toji
|
2
|
-
module
|
2
|
+
module Progress
|
3
3
|
module Graph
|
4
|
-
class
|
4
|
+
class MultiProgressNote
|
5
5
|
|
6
6
|
LINE_DASHES = [
|
7
7
|
:solid,
|
@@ -23,15 +23,15 @@ module Toji
|
|
23
23
|
end
|
24
24
|
|
25
25
|
case source
|
26
|
-
when
|
26
|
+
when ProgressNote
|
27
27
|
progress = source.dup
|
28
28
|
progress.name = name
|
29
29
|
progress.dash = dash
|
30
30
|
progress.enable_annotations = enable_annotations
|
31
|
-
when
|
32
|
-
progress = source.
|
31
|
+
when Progress
|
32
|
+
progress = source.progress_note(name: name, dash: dash, enable_annotations: enable_annotations)
|
33
33
|
else
|
34
|
-
raise Error, "ArgumentError: Progress or
|
34
|
+
raise Error, "ArgumentError: Toji::Progress::Graph::ProgressNote or Toji::Progress::Progress required"
|
35
35
|
end
|
36
36
|
|
37
37
|
@progresses << progress
|
@@ -52,17 +52,17 @@ module Toji
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def plot(keys=nil)
|
55
|
-
|
56
|
-
|
57
|
-
index =
|
58
|
-
day_labels =
|
55
|
+
progresses = @progresses.map(&:progress)
|
56
|
+
max_days = progresses.map(&:days).max
|
57
|
+
index = progresses.index{|progress| progress.days==max_days}
|
58
|
+
day_labels = progresses[index].day_labels
|
59
59
|
|
60
60
|
Plotly::Plot.new(
|
61
61
|
data: plot_data(keys),
|
62
62
|
layout: {
|
63
63
|
xaxis: {
|
64
64
|
dtick: DAY,
|
65
|
-
tickvals:
|
65
|
+
tickvals: max_days.times.map{|d| d*DAY},
|
66
66
|
ticktext: day_labels
|
67
67
|
},
|
68
68
|
annotations: annotations,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Toji
|
2
|
-
module
|
2
|
+
module Progress
|
3
3
|
module Graph
|
4
|
-
class
|
4
|
+
class ProgressNote
|
5
5
|
|
6
6
|
PLOT_KEYS = [:temps, :preset_temp, :room_temp, :room_psychrometry, :baume, :acid, :amino_acid, :alcohol, :bmd].freeze
|
7
7
|
|
@@ -26,13 +26,13 @@ module Toji
|
|
26
26
|
:dashdot,
|
27
27
|
].freeze
|
28
28
|
|
29
|
-
attr_reader :
|
29
|
+
attr_reader :progress
|
30
30
|
attr_accessor :name
|
31
31
|
attr_accessor :dash
|
32
32
|
attr_accessor :enable_annotations
|
33
33
|
|
34
|
-
def initialize(
|
35
|
-
@
|
34
|
+
def initialize(progress, name: nil, dash: :solid, enable_annotations: true)
|
35
|
+
@progress = progress
|
36
36
|
@name = name
|
37
37
|
@dash = dash
|
38
38
|
@enable_annotations = enable_annotations
|
@@ -40,7 +40,7 @@ module Toji
|
|
40
40
|
|
41
41
|
def plot_data(keys=nil, use_name=false)
|
42
42
|
if !keys
|
43
|
-
keys = @
|
43
|
+
keys = @progress.has_keys
|
44
44
|
end
|
45
45
|
|
46
46
|
name = ""
|
@@ -56,7 +56,7 @@ module Toji
|
|
56
56
|
xs = []
|
57
57
|
ys = []
|
58
58
|
text = []
|
59
|
-
@
|
59
|
+
@progress.states.each {|s|
|
60
60
|
val = s.send(key)
|
61
61
|
if val
|
62
62
|
[val].flatten.each_with_index {|v,i|
|
@@ -75,7 +75,7 @@ module Toji
|
|
75
75
|
result << {x: xs, y: ys, text: text, name: "#{name}#{key}", line: {dash: @dash, shape: line_shape}, marker: {color: PLOT_COLORS[key]}}
|
76
76
|
}
|
77
77
|
|
78
|
-
if 0<@
|
78
|
+
if 0<@progress.states.length && 0<@progress.day_offset
|
79
79
|
result = result.map{|h|
|
80
80
|
h[:x].unshift(0)
|
81
81
|
h[:y].unshift(nil)
|
@@ -84,8 +84,8 @@ module Toji
|
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
87
|
-
#if 0<@
|
88
|
-
# t = @
|
87
|
+
#if 0<@progress.states.length && @progress.states.last.time.strftime("%T")!="00:00:00"
|
88
|
+
# t = @progress.states.last.elapsed_time_with_offset
|
89
89
|
# t -= (t % DAY) - DAY
|
90
90
|
#
|
91
91
|
# result = result.map{|h|
|
@@ -102,7 +102,7 @@ module Toji
|
|
102
102
|
def annotations
|
103
103
|
return [] if !@enable_annotations
|
104
104
|
|
105
|
-
@
|
105
|
+
@progress.states.select{|s| s.mark}.map {|s|
|
106
106
|
{
|
107
107
|
x: s.elapsed_time_with_offset,
|
108
108
|
y: s.temps.first || 0,
|
@@ -119,19 +119,21 @@ module Toji
|
|
119
119
|
|
120
120
|
def table_data(keys=nil)
|
121
121
|
if !keys
|
122
|
-
keys = @
|
122
|
+
keys = @progress.has_keys
|
123
123
|
keys.delete(:elapsed_time)
|
124
124
|
keys.delete(:time)
|
125
125
|
keys.delete(:day)
|
126
126
|
keys.delete(:moromi_day)
|
127
|
-
keys.
|
128
|
-
|
127
|
+
if keys.include?(:display_baume)
|
128
|
+
keys.delete(:baume)
|
129
|
+
keys.delete(:nihonshudo)
|
130
|
+
end
|
129
131
|
else
|
130
|
-
keys &= @
|
132
|
+
keys &= @progress.has_keys
|
131
133
|
end
|
132
134
|
|
133
135
|
rows = []
|
134
|
-
@
|
136
|
+
@progress.states.each {|state|
|
135
137
|
rows << keys.map {|k|
|
136
138
|
v = state&.send(k)
|
137
139
|
if Array===v
|
@@ -155,8 +157,8 @@ module Toji
|
|
155
157
|
layout: {
|
156
158
|
xaxis: {
|
157
159
|
dtick: DAY,
|
158
|
-
tickvals: @
|
159
|
-
ticktext: @
|
160
|
+
tickvals: @progress.days.times.map{|d| d*DAY},
|
161
|
+
ticktext: @progress.day_labels
|
160
162
|
},
|
161
163
|
annotations: annotations,
|
162
164
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module KojiProgress
|
4
|
+
include BaseProgress
|
5
|
+
|
6
|
+
def all_keys
|
7
|
+
KojiState::REQUIRED_KEYS + KojiState::OPTIONAL_KEYS
|
8
|
+
end
|
9
|
+
|
10
|
+
def progress_note(name: nil, dash: :solid, enable_annotations: true)
|
11
|
+
Graph::ProgressNote.new(self, name: name, dash: dash, enable_annotations: enable_annotations)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module KojiState
|
4
|
+
include BaseState
|
5
|
+
|
6
|
+
OPTIONAL_KEYS = [
|
7
|
+
:temps,
|
8
|
+
:preset_temp,
|
9
|
+
:room_temp,
|
10
|
+
:room_psychrometry,
|
11
|
+
|
12
|
+
:note,
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
attr_accessor :temps
|
16
|
+
attr_accessor :preset_temp
|
17
|
+
attr_accessor :room_temp
|
18
|
+
attr_accessor :room_psychrometry
|
19
|
+
|
20
|
+
attr_accessor :note
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Toji
|
2
|
-
module
|
3
|
-
module
|
4
|
-
include
|
2
|
+
module Progress
|
3
|
+
module MoromiProgress
|
4
|
+
include BaseProgress
|
5
5
|
|
6
6
|
attr_accessor :prefix_day_labels
|
7
7
|
|
@@ -28,8 +28,12 @@ module Toji
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
|
31
|
+
def all_keys
|
32
|
+
MoromiState::REQUIRED_KEYS + MoromiState::OPTIONAL_KEYS
|
33
|
+
end
|
34
|
+
|
35
|
+
def progress_note(name: nil, dash: :solid, enable_annotations: true)
|
36
|
+
Graph::ProgressNote.new(self, name: name, dash: dash, enable_annotations: enable_annotations)
|
33
37
|
end
|
34
38
|
|
35
39
|
def bmd
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module MoromiState
|
4
|
+
include BaseState
|
5
|
+
|
6
|
+
OPTIONAL_KEYS = [
|
7
|
+
:moromi_day,
|
8
|
+
:temps,
|
9
|
+
:preset_temp,
|
10
|
+
:room_temp,
|
11
|
+
:room_psychrometry,
|
12
|
+
|
13
|
+
:baume,
|
14
|
+
:nihonshudo,
|
15
|
+
:display_baume,
|
16
|
+
:acid,
|
17
|
+
:amino_acid,
|
18
|
+
:alcohol,
|
19
|
+
:bmd,
|
20
|
+
|
21
|
+
:warmings,
|
22
|
+
:note,
|
23
|
+
].freeze
|
24
|
+
|
25
|
+
attr_accessor :temps
|
26
|
+
attr_accessor :preset_temp
|
27
|
+
attr_accessor :room_temp
|
28
|
+
attr_accessor :room_psychrometry
|
29
|
+
|
30
|
+
attr_accessor :baume
|
31
|
+
attr_accessor :nihonshudo
|
32
|
+
attr_accessor :acid
|
33
|
+
attr_accessor :amino_acid
|
34
|
+
attr_accessor :alcohol
|
35
|
+
|
36
|
+
attr_accessor :warmings
|
37
|
+
attr_accessor :note
|
38
|
+
|
39
|
+
def moromi_day
|
40
|
+
_tome_day = progress.moromi_tome_day
|
41
|
+
_now_day = day
|
42
|
+
|
43
|
+
if _tome_day && _tome_day < _now_day
|
44
|
+
_now_day - _tome_day + 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def display_baume
|
49
|
+
_baume = baume
|
50
|
+
if _baume
|
51
|
+
if _baume<3.0
|
52
|
+
nihonshudo
|
53
|
+
else
|
54
|
+
_baume
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def bmd
|
60
|
+
_moromi_day = moromi_day
|
61
|
+
_baume = baume
|
62
|
+
|
63
|
+
if _moromi_day && _baume
|
64
|
+
_moromi_day * _baume
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def expected_alcohol(target_alc, target_nihonshudo, coef)
|
69
|
+
_baume = baume
|
70
|
+
|
71
|
+
if _baume
|
72
|
+
target_alc - (_baume - target_nihonshudo * -0.1) * coef
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module MotoProgress
|
4
|
+
include BaseProgress
|
5
|
+
|
6
|
+
def all_keys
|
7
|
+
MotoState::REQUIRED_KEYS + MotoState::OPTIONAL_KEYS
|
8
|
+
end
|
9
|
+
|
10
|
+
def progress_note(name: nil, dash: :solid, enable_annotations: true)
|
11
|
+
Graph::ProgressNote.new(self, name: name, dash: dash, enable_annotations: enable_annotations)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module MotoState
|
4
|
+
include BaseState
|
5
|
+
|
6
|
+
OPTIONAL_KEYS = [
|
7
|
+
:temps,
|
8
|
+
:preset_temp,
|
9
|
+
:room_temp,
|
10
|
+
:room_psychrometry,
|
11
|
+
|
12
|
+
:baume,
|
13
|
+
:acid,
|
14
|
+
|
15
|
+
:warmings,
|
16
|
+
:note,
|
17
|
+
].freeze
|
18
|
+
|
19
|
+
attr_accessor :temps
|
20
|
+
attr_accessor :preset_temp
|
21
|
+
attr_accessor :room_temp
|
22
|
+
attr_accessor :room_psychrometry
|
23
|
+
|
24
|
+
attr_accessor :baume
|
25
|
+
attr_accessor :acid
|
26
|
+
|
27
|
+
attr_accessor :warmings
|
28
|
+
attr_accessor :note
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Toji
|
2
|
+
module Progress
|
3
|
+
module State
|
4
|
+
module BaumeToNihonshudo
|
5
|
+
def nihonshudo
|
6
|
+
if self.baume
|
7
|
+
self.baume * -10
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def nihonshudo=(val)
|
12
|
+
if val
|
13
|
+
self.baume = val.to_f / -10.0
|
14
|
+
else
|
15
|
+
self.baume = nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|