From e85b0885ac45e5773a2e9dfb2b91bc8a57de98e2 Mon Sep 17 00:00:00 2001 From: pepperpepperpepper Date: Sat, 5 Dec 2015 16:57:53 -0800 Subject: added normalization to params --- ricky/param/bool.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ricky/param/bool.py') diff --git a/ricky/param/bool.py b/ricky/param/bool.py index 961912e..2b25bbd 100644 --- a/ricky/param/bool.py +++ b/ricky/param/bool.py @@ -34,3 +34,10 @@ class Bool(Param): def randomize(self): self.value_set(random.choice([True, False])) + + def from_normalized(self, value): + value_as_int = int(round(value, 0)) + self.value = True if value_as_int else False + + def as_normalized(self): + return 1 if self.value else 0 -- cgit v1.2.3-70-g09d2