diff --git a/pesummary/gw/inputs.py b/pesummary/gw/inputs.py index 54c558d368556ac3b02357b64ac71ef1eb21709b..5fd2ed50d8e81e1a1c9d9209e9418830488b599e 100644 --- a/pesummary/gw/inputs.py +++ b/pesummary/gw/inputs.py @@ -98,45 +98,35 @@ class _GWInput(_Input): else: resume_file = [None] * len(self.labels) - try: - for num, label in enumerate(self.labels): - kwargs[label].update(dict( - evolve_spins=self.evolve_spins, f_low=self.f_low[num], - approximant=approx[num], f_ref=self.f_ref[num], - NRSur_fits=self.NRSur_fits, return_kwargs=True, - waveform_fits=self.waveform_fits, - multi_process=self.opts.multi_process, - redshift_method=self.redshift_method, - cosmology=self.cosmology, - no_conversion=self.no_conversion, - add_zero_spin=True, disable_remnant=self.disable_remnant, - force_BBH_remnant_computation=self.force_BBH_remnant_computation, - resume_file=resume_file[num] - )) - return kwargs - except IndexError: - logger.warning( - "Unable to find an f_ref, f_low and approximant for each " - "label. Using and f_ref={}, f_low={} and approximant={} " - "for all result files".format( - self.f_ref[0], self.f_low[0], approx[0] + _arrays = [] + _strings = ["f_low", "approximant", "f_ref"] + for num, _p in enumerate([self.f_low, approx, self.f_ref]): + if len(_p) != len(self.labels): + logger.warn( + "Unable to find an {} for each label. Using {}={} " + "for all result files".format( + _strings[num], _strings[num], _p[0] + ) ) - ) - for num, label in enumerate(self.labels): - kwargs[label].update(dict( - evolve_spins=self.evolve_spins, f_low=self.f_low[0], - approximant=approx[0], f_ref=self.f_ref[0], - NRSur_fits=self.NRSur_fits, return_kwargs=True, - waveform_fits=self.waveform_fits, - multi_process=self.opts.multi_process, - redshift_method=self.redshift_method, - cosmology=self.cosmology, - no_conversion=self.no_conversion, - add_zero_spin=True, - force_BBH_remnant_computation=self.force_BBH_remnant_computation, - resume_file=resume_file[num] - )) - return kwargs + _arrays.append([_p[0]] * len(self.labels)) + else: + _arrays.append(_p) + for num, label in enumerate(self.labels): + _f_low, _approx, _f_ref, = _arrays + kwargs[label].update(dict( + evolve_spins=self.evolve_spins, f_low=_f_low[num], + approximant=_approx[num], f_ref=_f_ref[num], + NRSur_fits=self.NRSur_fits, return_kwargs=True, + waveform_fits=self.waveform_fits, + multi_process=self.opts.multi_process, + redshift_method=self.redshift_method, + cosmology=self.cosmology, + no_conversion=self.no_conversion, + add_zero_spin=True, disable_remnant=self.disable_remnant, + force_BBH_remnant_computation=self.force_BBH_remnant_computation, + resume_file=resume_file[num] + )) + return kwargs @staticmethod def grab_data_from_file(