Skip to content
Snippets Groups Projects

Plot horizon distance from ranking statistics

Merged ChiWai Chan requested to merge plot_psd_horizon into master
1 unresolved thread
1 file
+ 24
0
Compare changes
  • Side-by-side
  • Inline
@@ -57,6 +57,8 @@ class HorizonDistance:
Returns:
An instance of HorizionDistance.
"""
self._min = None
self._max = None
self.verbose = verbose
self.horizon_history_dict = horizon_history_dict
@@ -133,6 +135,28 @@ class HorizonDistance:
raise UnknownExtensionError("Cannot determine the extension of the input data sources, please prepare files with the following extension: ('.gz' or '.cache').")
@property
def min(self):
"""Return the global minimum of the horizon distance."""
if self._min:
return self._min
gminh = 1e32
for ifo, history in self.horizon_history_dict.items():
gminh = min(gminh, min(history.values()))
self._min = gminh
return gminh
@property
def max(self):
"""Return the global minimum of the horizon distance."""
if self._max:
return self._max
gmaxh = -1e32
for ifo, history in self.horizon_history_dict.items():
gmaxh = max(gmaxh, max(history.values()))
self._max = gmaxh
return gmaxh
def savefig(self, output, figsize=(12,4), limits=None, title=None):
"""Save the horizon distance plot to disk.
Loading