def setUp(self): self.hop1 = centennial self.hop2 = cascade self.addition_kwargs = [ { u"boil_time": 60.0, u"weight": 0.57, u"utilization_cls_kwargs": { u"units": IMPERIAL_UNITS }, }, { u"boil_time": 5.0, u"weight": 0.76, u"utilization_cls_kwargs": { u"units": IMPERIAL_UNITS }, }, ] # Additions self.hop_addition1 = HopAddition(self.hop1, **self.addition_kwargs[0]) self.hop_addition2 = HopAddition(self.hop2, **self.addition_kwargs[1]) # Define Hops self.plato = 14.0 self.sg = plato_to_sg(self.plato) self.target_ibu = 40.0 self.final_volume = 5.0
def setUp(self): self.hop1 = centennial self.hop2 = cascade self.addition_kwargs = [ { u'boil_time': 60.0, u'weight': 0.57, u'utilization_cls_kwargs': {u'units': IMPERIAL_UNITS}, }, { u'boil_time': 5.0, u'weight': 0.76, u'utilization_cls_kwargs': {u'units': IMPERIAL_UNITS}, }, ] # Additions self.hop_addition1 = HopAddition(self.hop1, **self.addition_kwargs[0]) self.hop_addition2 = HopAddition(self.hop2, **self.addition_kwargs[1]) # Define Hops self.plato = 14.0 self.sg = plato_to_sg(self.plato) self.target_ibu = 40.0 self.final_volume = 5.0
def setUp(self): self.utilization_cls = HopsUtilizationJackieRager self.hop = centennial self.addition_kwargs = [{u"boil_time": 60.0, u"weight": 0.57}] # Additions self.plato = 14.0 self.sg = plato_to_sg(self.plato) self.final_volume = 5.0 self.boil_time = 60.0 self.hop_addition = HopAddition( self.hop, boil_time=self.boil_time, weight=0.57, utilization_cls=self.utilization_cls )
def setUp(self): self.utilization_cls = HopsUtilization self.hop = centennial self.addition_kwargs = [{u"boil_time": 60.0, u"weight": 0.57}] # Additions self.plato = 14.0 self.sg = plato_to_sg(self.plato) self.final_volume = 5.0 self.boil_time = 60.0 self.hop_addition = HopAddition( self.hop, boil_time=self.boil_time, weight=0.57, utilization_cls=self.utilization_cls, )
def setUp(self): self.utilization_cls = HopsUtilizationGlennTinseth self.hop = centennial self.addition_kwargs = [ { u'boil_time': 60.0, u'weight': 0.57, } ] # Additions self.plato = 14.0 self.sg = plato_to_sg(self.plato) self.final_volume = 5.0 self.boil_time = 60.0 self.hop_addition = HopAddition(self.hop, boil_time=self.boil_time, weight=0.57, utilization_cls=self.utilization_cls)
def get_sugar_conversion(brix_in, plato_in, sg_in, sugar_out): """ Convert one sugar unit to another or print all. brix_in - Degrees Brix Input plato_in - Degrees Plato Input sg_in - Specific Gravity Input sugar_out - Type of conversion ('b', 'p', 's', or None) """ brix, plato, sg = 0.0, 0.0, 0.0 if brix_in: brix = brix_in plato = brix_to_plato(brix_in) sg = brix_to_sg(brix_in) elif plato_in: brix = plato_to_brix(plato_in) plato = plato_in sg = plato_to_sg(plato_in) elif sg_in: brix = sg_to_brix(sg_in) plato = sg_to_plato(sg_in) sg = sg_in brix = round(brix, 1) plato = round(plato, 1) sg = round(sg, 3) if sugar_out and sugar_out in [u"b", u"p", u"s"]: if sugar_out == u"b": return brix elif sugar_out == u"p": return plato elif sugar_out == u"s": return sg else: out = textwrap.dedent( u"""\ SG\tPlato\tBrix {:0.3f}\t{:0.1f}\t{:0.1f}""".format( sg, plato, brix ) ) return out
def get_sugar_conversion(brix_in, plato_in, sg_in, sugar_out): """ Convert one sugar unit to another or print all. brix_in - Degrees Brix Input plato_in - Degrees Plato Input sg_in - Specific Gravity Input sugar_out - Type of conversion ('b', 'p', 's', or None) """ brix, plato, sg = 0.0, 0.0, 0.0 if brix_in: brix = brix_in plato = brix_to_plato(brix_in) sg = brix_to_sg(brix_in) elif plato_in: brix = plato_to_brix(plato_in) plato = plato_in sg = plato_to_sg(plato_in) elif sg_in: brix = sg_to_brix(sg_in) plato = sg_to_plato(sg_in) sg = sg_in brix = round(brix, 1) plato = round(plato, 1) sg = round(sg, 3) if sugar_out and sugar_out in [u'b', u'p', u's']: if sugar_out == u'b': return brix elif sugar_out == u'p': return plato elif sugar_out == u's': return sg else: out = textwrap.dedent(u"""\ SG\tPlato\tBrix {:0.3f}\t{:0.1f}\t{:0.1f}""".format(sg, plato, brix)) return out
def test_plato_to_sg(self): sg = plato_to_sg(14.0) self.assertEquals(round(sg, 3), 1.057)