From 343ebd88f9624b95c50a9a0d2f3356b9a83eacf3 Mon Sep 17 00:00:00 2001
From: Jameson Graef Rollins <jrollins@finestructure.net>
Date: Wed, 5 Feb 2020 15:12:22 -0800
Subject: [PATCH] fix gwinc() to use Noise style labels in noises dictionary

This fixes a regression in the move to the new Budget structured. The keys
in the gwinc() noises output changed to be the name of the Noise class,
instead of the label, causing the matgwinc comparison test to fail.

This fixes the keys in the gwinc noises output to be the labels to maintain
consistency.
---
 gwinc/gwinc.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gwinc/gwinc.py b/gwinc/gwinc.py
index 3327db15..93b46d95 100644
--- a/gwinc/gwinc.py
+++ b/gwinc/gwinc.py
@@ -32,12 +32,15 @@ def gwinc(freq, ifoin, source=None, plot=False, PRfixed=True):
     Budget, ifo_, freq_, plot_style = load_ifo('aLIGO')
 
     # add some precomputed info to the ifo struct
-    #this implicitly deepcopies and the return value is the copy
+    # this implicitly deepcopies and the return value is the copy
     ifo = precompIFO(freq, ifoin, PRfixed)
 
     traces = Budget(freq, ifo=ifo).calc_trace()
 
-    noises = {n:d[0] for n, d in traces.items()}
+    # construct matgwinc-compatible noises structure
+    noises = {}
+    for name, (data, style) in traces.items():
+        noises[style.get('label', name)] = data
     noises['Freq'] = freq
 
     pbs      = ifo.gwinc.pbs
-- 
GitLab