Skip to content

Commit

Permalink
pass labels argument through when reading chains (#232)
Browse files Browse the repository at this point in the history
* labels kwarg passed through correctly like params/columns

* consistent use of "columns" instead of "params"

* change to single quotes

* updated getdist to match

* one more set of double quotes

Co-authored-by: Lukas Hergt <[email protected]>
Co-authored-by: Will Handley <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2023
1 parent fffa42e commit 9f57446
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions anesthetic/read/cobaya.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def read_cobaya(root, *args, **kwargs):
if not chains_files:
raise FileNotFoundError(dirname + '/' + regex + " not found.")

params, labels = read_paramnames(root)
columns = kwargs.pop('columns', params)
columns, labels = read_paramnames(root)
columns = kwargs.pop('columns', columns)
labels = kwargs.pop('labels', labels)
kwargs['label'] = kwargs.get('label', os.path.basename(root))

samples = []
Expand Down
5 changes: 3 additions & 2 deletions anesthetic/read/getdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def read_getdist(root, *args, **kwargs):
if not chains_files:
raise FileNotFoundError(dirname + '/' + regex + " not found.")

params, labels = read_paramnames(root)
columns = kwargs.pop('columns', params)
columns, labels = read_paramnames(root)
columns = kwargs.pop('columns', columns)
labels = kwargs.pop('labels', labels)
kwargs['label'] = kwargs.get('label', os.path.basename(root))

samples = []
Expand Down
2 changes: 2 additions & 0 deletions anesthetic/read/multinest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def read_multinest(root, *args, **kwargs):

kwargs['label'] = kwargs.get('label', os.path.basename(root))
columns, labels = read_paramnames(root)
columns = kwargs.pop('columns', columns)
labels = kwargs.pop('labels', labels)
data = samples

return NestedSamples(data=data, logL=logL, logL_birth=logL_birth,
Expand Down
5 changes: 3 additions & 2 deletions anesthetic/read/polychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def read_polychord(root, *args, **kwargs):
except IOError:
pass
data, logL, logL_birth = np.split(data, [-2, -1], axis=1)
params, labels = read_paramnames(root)
columns, labels = read_paramnames(root)

columns = kwargs.pop('columns', params)
columns = kwargs.pop('columns', columns)
labels = kwargs.pop('labels', labels)
kwargs['label'] = kwargs.get('label', os.path.basename(root))

return NestedSamples(data=data, columns=columns,
Expand Down

0 comments on commit 9f57446

Please sign in to comment.