Skip to content

Commit

Permalink
0.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Samreay committed Sep 22, 2016
1 parent ca3c161 commit 3ae18ab
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ features requests thought up.

### Update History

##### 0.11.2
* Improving text labels again

##### 0.11.1
* Improving text labels for high value data.

Expand Down
4 changes: 3 additions & 1 deletion chainconsumer/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ChainConsumer(object):
""" A class for consuming chains produced by an MCMC walk
"""
__version__ = "0.11.1"
__version__ = "0.11.2"

def __init__(self):
logging.basicConfig()
Expand Down Expand Up @@ -537,6 +537,8 @@ def get_parameter_text(self, lower, maximum, upper, wrap=False):
fmt = "%0.0f"
factor = -1
r = 0
if resolution == 1:
fmt = "%0.0f"
if resolution == -1:
fmt = "%0.2f"
r = 2
Expand Down
48 changes: 48 additions & 0 deletions test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,54 @@ def test_output_format10(self):
text = consumer.get_parameter_text(*p1)
assert text == r"\left( 123.5\pm 1.2 \right) \times 10^{3}"

def test_output_format11(self):
x = 222.222
d = 111.111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"220\pm 110"

def test_output_format12(self):
x = 222.222
d = 11.111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"222\pm 11"

def test_output_format13(self):
x = 2222.222
d = 11.111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"2222\pm 11"

def test_output_format14(self):
x = 222.222
d = 1.111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"222.2\pm 1.1"

def test_output_format15(self):
x = 222.222
d = 0.111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"222.22\pm 0.11"

def test_output_format16(self):
x = 222.2222222
d = 0.0111
p1 = [x - d, x, x + d]
consumer = ChainConsumer()
text = consumer.get_parameter_text(*p1)
assert text == r"222.222\pm 0.011"

def test_file_loading1(self):
data = self.data[:1000]
directory = tempfile._get_default_tempdir()
Expand Down

0 comments on commit 3ae18ab

Please sign in to comment.