Python pycrayon.CrayonClient() Examples

The following are 30 code examples of pycrayon.CrayonClient(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pycrayon , or try the search function .
Example #1
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_wrong_variable(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25]}
        self.assertRaises(ValueError, foo.add_histogram_value,
                          "", data) 
Example #2
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_values_wrong_variable(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 0)
        self.assertRaises(ValueError, foo.get_scalar_values, "") 
Example #3
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_names(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("fizz", 0, wall_time=0)
        foo.add_scalar_value("buzz", 0, wall_time=0)
        self.assertEqual(sorted(foo.get_scalar_names()),
                         sorted(["fizz", "buzz"]))

    # Histograms 
Example #4
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25]}
        foo.add_histogram_value("bar", data, wall_time=0, step=0)
        foo.add_histogram_value("bar", data) 
Example #5
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_with_sum(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25],
                "sum": 75}
        foo.add_histogram_value("bar", data) 
Example #6
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_with_sumsq(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25],
                "sum_squares": 5625}
        foo.add_histogram_value("bar", data) 
Example #7
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_with_sum_sumsq(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25],
                "sum": 75,
                "sum_squares": 2675}
        foo.add_histogram_value("bar", data) 
Example #8
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_less_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"some data": 0}
        self.assertRaises(ValueError, foo.add_histogram_value,
                          "bar", data)

    # TODO These should really be tested singularly... 
Example #9
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_histogram_value_wrong_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = ["lolz", "lulz", "lelz"]
        self.assertRaises(ValueError, foo.add_histogram_value,
                          "bar", data, tobuild=True) 
Example #10
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_values_auto_step(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 0, wall_time=0)
        foo.add_scalar_value("bar", 1, wall_time=1)
        foo.add_scalar_value("bar", 2, wall_time=2, step=10)
        foo.add_scalar_value("bar", 3, wall_time=3)
        self.assertEqual(foo.get_scalar_values("bar"),
                         [[0.0, 0, 0.0], [1.0, 1, 1.0],
                          [2.0, 10, 2.0], [3.0, 11, 3.0]]) 
Example #11
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_histogram_values_no_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        self.assertRaises(ValueError, foo.get_histogram_values, "bar") 
Example #12
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_histogram_values_one_datum(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25]}
        foo.add_histogram_value("bar", data, wall_time=0, step=0)
        self.assertEqual(foo.get_histogram_values("bar"),
                         [[0.0, 0,
                           [0.0, 100.0, 3.0, 0.0, 0.0,
                            [10.0, 50.0, 30.0],
                            [5.0, 45.0, 25.0]]]]) 
Example #13
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_histogram_values_wrong_variable(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25]}
        foo.add_histogram_value("bar", data, wall_time=0, step=0)
        self.assertRaises(ValueError, foo.get_histogram_values, "") 
Example #14
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_histogram_names(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"min": 0,
                "max": 100,
                "num": 3,
                "bucket_limit": [10, 50, 30],
                "bucket": [5, 45, 25]}
        foo.add_histogram_value("fizz", data, wall_time=0, step=0)
        foo.add_histogram_value("buzz", data, wall_time=1, step=1)
        self.assertEqual(sorted(foo.get_histogram_names()),
                         sorted(["fizz", "buzz"]))

    # Only checks that we get a zip file.
    # TODO open and match data to recorded 
Example #15
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_to_zip(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 2, wall_time=time.time(), step=1)
        filename = foo.to_zip()
        os.remove(filename)

    # Only checks that we set a zip file. 
Example #16
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_init_from_file(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 2, wall_time=time.time(), step=1)
        filename = foo.to_zip()
        new = cc.create_experiment("new", filename)
        os.remove(filename) 
Example #17
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_set_data_wrong_file(self):
        cc = CrayonClient(port=self.test_server_port)
        self.assertRaises(IOError, cc.create_experiment, "foo",
                          "random_noise") 
Example #18
Source File: remove_experiment.py    From atis with MIT License 5 votes vote down vote up
def main():
    """ Opens the crayon client and removes the specified experiment."""
    crayon_client = CrayonClient("localhost")
    crayon_client.remove_experiment(sys.argv[1]) 
Example #19
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_values_two_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 0, wall_time=0, step=0)
        foo.add_scalar_value("bar", 1, wall_time=1, step=1)
        self.assertEqual(foo.get_scalar_values("bar"),
                         [[0.0, 0, 0.0], [1.0, 1, 1.0]]) 
Example #20
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_values_one_datum(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 0, wall_time=0, step=0)
        self.assertEqual(foo.get_scalar_values("bar"), [[0.0, 0, 0.0]]) 
Example #21
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_get_scalar_values_no_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        self.assertRaises(ValueError, foo.get_scalar_values, "bar") 
Example #22
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_scalar_dict(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        data = {"fizz": 3, "buzz": 5}
        foo.add_scalar_dict(data, wall_time=0, step=5)
        data = {"fizz": 6, "buzz": 10}
        foo.add_scalar_dict(data) 
Example #23
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_scalar_wrong_variable(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        self.assertRaises(ValueError, foo.add_scalar_value,
                          "", 2) 
Example #24
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_scalar_wrong_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        self.assertRaises(ValueError, foo.add_scalar_value,
                          "bar", "lol") 
Example #25
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_scalar_less_data(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 2)

    # TODO These should really be tested singularly... 
Example #26
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_add_scalar_value(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 2, wall_time=time.clock(), step=1) 
Example #27
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_open_experiment(self):
        cc = CrayonClient(port=self.test_server_port)
        foo = cc.create_experiment("foo")
        foo.add_scalar_value("bar", 1, step=2, wall_time=0)
        foo = cc.open_experiment("foo")
        foo.add_scalar_value("bar", 3, wall_time=1)
        self.assertEqual(foo.get_scalar_values("bar"),
                         [[0.0, 2, 1.0], [1.0, 3, 3.0]]) 
Example #28
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_init_xp_empty(self):
        cc = CrayonClient(port=self.test_server_port)
        self.assertRaises(ValueError, cc.create_experiment, "") 
Example #29
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_init_wrong_port(self):
        self.assertRaises(ValueError, CrayonClient, "localhost", 123412341234) 
Example #30
Source File: test_crayon.py    From crayon with MIT License 5 votes vote down vote up
def test_init_wrong_localhost(self):
        self.assertRaises(ValueError, CrayonClient, "not_open",
                          self.test_server_port)