Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion artemis/examples/drunkards_walk_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ def demo_drunkards_walk(n_steps=500, n_drunkards=5, homing_instinct = 0, n_dim=2
# Try
# run all
# compare all
# display 1
# show 1
3 changes: 3 additions & 0 deletions artemis/general/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ def __exit__(self, exc_type, exc_val, exc_tb):
sys.stderr = self.old_stderr
self.close()

def __getattr__(self, name):
return getattr(self.old_stdout, name)

def get_log_file_path(self):
assert self._log_file_path is not None, "You never specified a path when you created this logger, so don't come back and ask for one now"
return self._log_file_path
Expand Down
1 change: 1 addition & 0 deletions artemis/general/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_str_with_arrayopts():
a = np.arange(1, 6, 1./3)
assert str_with_arrayopts(a, float_format='.3g', threshold=None) == '[1 1.33 1.67 2 2.33 2.67 3 3.33 3.67 4 4.33 4.67 5 5.33 5.67]'
assert str_with_arrayopts(a, float_format='.3g', threshold=5) == '[1 1.33 1.67 ..., 5 5.33 5.67]' # Yeah there's a minimum of 3 on each end.
# Note that it seems different numpy versions may include or disclude the comma

b = a.reshape(3, 5)
assert str_with_arrayopts(b, float_format='.3g', threshold=5) == '[[1 1.33 1.67 2 2.33]\n [2.67 3 3.33 3.67 4]\n [4.33 4.67 5 5.33 5.67]]'
Expand Down