Skip to content

error when loading output and plotting - python 3 vs python 2

Apologies if I'm doing something daft... Say I want to load tupak output and then plot the result. I can load the output by doing:

results = tupak.result.read_in_result(outdir, label)

which works fine. But I get an error when I try to do:

results.plot_corner()

the error is:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-21-227af86140ec> in <module>()
----> 1 results.plot_corner()

/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tupak/result.py in plot_corner(self, save, **kwargs)
    109             # If no truth argument given, set these to the injection params
    110             injection_parameters = [self.injection_parameters[key]
--> 111                                     for key in self.search_parameter_keys]
    112             kwargs['truth'] = kwargs.get('truth', injection_parameters)
    113 

/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tupak/result.py in <listcomp>(.0)
    109             # If no truth argument given, set these to the injection params
    110             injection_parameters = [self.injection_parameters[key]
--> 111                                     for key in self.search_parameter_keys]
    112             kwargs['truth'] = kwargs.get('truth', injection_parameters)
    113 

KeyError: b'luminosity_distance'

From what I can tell, the 'b' in front of luminosity_distance tells me this is the wrong type of string for python 3. Does anyone know how to fix this either at a data output stage, or when reading in the data?