Skip to content

Commit 365ffea

Browse files
authored
DEP: remove BILBY_INCLUDE_GLOBAL_META_DATA (#1084)
* DEP: remove `BILBY_INCLUDE_GLOBAL_META_DATA` * DOC: remove global metadata FAQ
1 parent ced8cf5 commit 365ffea

4 files changed

Lines changed: 5 additions & 62 deletions

File tree

bilby/core/result.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
recursively_decode_bilby_json,
2727
safe_file_dump,
2828
random,
29-
string_to_boolean,
3029
)
3130
from .prior import Prior, PriorDict, DeltaFunction, ConditionalDeltaFunction
3231

@@ -538,18 +537,6 @@ def __init__(self, label='no_label', outdir='.', sampler=None,
538537
self.prior_values = None
539538
self._kde = None
540539

541-
if not string_to_boolean(os.getenv("BILBY_INCLUDE_GLOBAL_META_DATA", "False")):
542-
gmd = self.meta_data.pop("global_meta_data", None)
543-
if gmd is not None:
544-
logger.info(
545-
"Global meta data was removed from the result object for compatibility. "
546-
"Use the `BILBY_INCLUDE_GLOBAL_METADATA` environment variable to include it. "
547-
"This behaviour will be removed in a future release. "
548-
"For more details see: https://bilby-dev.github.io/bilby/faq.html#global-meta-data"
549-
)
550-
else:
551-
logger.debug("Including global meta data in the result object.")
552-
553540
_load_doctstring = """ Read in a saved .{format} data file
554541
555542
Parameters

bilby/gw/result.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ def cosmology(self):
140140
"""The global cosmology used in the analysis.
141141
142142
Will return None if the result does not include global meta data.
143-
Inclusion of the the global meta is controlled by the
144-
:code:`BILBY_INCLUDE_GLOBAL_META_DATA` environment variable.
145143
146144
.. versionadded:: 2.5.0
147145
"""

docs/faq.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,3 @@ Plotting questions
1111
which can set up the rcParams and we use environment variables to allow
1212
configuration of this. See the docstring of this :code:`bilby.core.utils.latex_plot_format`
1313
for the allowed configuration options.
14-
15-
16-
Global meta data
17-
----------------
18-
19-
**Q:** I'm seeing a message about global meta data, what does this mean?
20-
21-
**A:** In :code:`bilby` 2.5.0, the global meta data dictionary was added to the result object
22-
under :code:`result.meta_data["global_meta_data]`. This includes information such as the
23-
global cosmology and random number generator. To ensure backwards compatibility,
24-
by default, this dictionary is removed from the result object when it is instantiated.
25-
In a future release, this will be changed.
26-
In the meantime, you can include the global meta data by setting the
27-
global variable :code:`BILBY_INCLUDE_GLOBAL_META_DATA=1`
28-
(:code:`BILBY_INCLUDE_GLOBAL_META_DATA=0` excludes it).
29-
This can be either be done in the command line using
30-
:code:`export BILBY_INCLUDE_GLOBAL_META_DATA=1` or within
31-
python (e.g. using :code:`os`,
32-
:code:`os.environ["BILBY_INCLUDE_GLOBAL_META_DATA"] = "1"`)

test/gw/result_test.py

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import logging
32
import unittest
43

54
import pandas as pd
@@ -212,43 +211,21 @@ def test_detector_injection_properties_no_injection(self):
212211
)
213212

214213

215-
@parameterized_class(
216-
["include_global_meta_data"], [["True"], ["False"]]
217-
)
218214
class CBCResultsGlobalMetaDataTest(BaseCBCResultTest):
219215

220216
@pytest.fixture(autouse=True)
221217
def set_caplog(self, caplog):
222218
self._caplog = caplog
223219

224-
def setUp(self):
225-
# Current default is False
226-
self.meta_data_env_var = os.getenv("BILBY_INCLUDE_GLOBAL_META_DATA") or "False"
227-
os.environ["BILBY_INCLUDE_GLOBAL_META_DATA"] = self.include_global_meta_data
228-
super().setUp()
229-
230-
def tearDown(self):
231-
super().tearDown()
232-
os.environ["BILBY_INCLUDE_GLOBAL_META_DATA"] = self.meta_data_env_var
233-
234220
def test_global_meta_data(self):
235-
if self.include_global_meta_data == "True":
236-
assert "global_meta_data" in self.result.meta_data
237-
else:
238-
assert "global_meta_data" not in self.result.meta_data
221+
assert "global_meta_data" in self.result.meta_data
239222

240223
def test_cosmology(self):
241224
bilby.core.utils.meta_data.logger.propagate = True
242-
with self._caplog.at_level(logging.DEBUG, logger="bilby"):
243-
cosmology = self.result.cosmology
244-
if self.include_global_meta_data == "True":
245-
self.assertEqual(
246-
self.result.cosmology,
247-
self.meta_data["global_meta_data"]["cosmology"],
248-
)
249-
else:
250-
self.assertEqual(cosmology, None)
251-
assert "not containing global meta data" in str(self._caplog.text)
225+
self.assertEqual(
226+
self.result.cosmology,
227+
self.meta_data["global_meta_data"]["cosmology"],
228+
)
252229

253230

254231
@parameterized_class(

0 commit comments

Comments
 (0)