diff --git a/stingray/crossspectrum.py b/stingray/crossspectrum.py index 1839aeff8..9a5681ea4 100644 --- a/stingray/crossspectrum.py +++ b/stingray/crossspectrum.py @@ -582,18 +582,16 @@ def __init__( if not good_input: return self._initialize_empty() - if data1 is not None and data2 is not None: - return self._initialize_from_any_input( - data1, - data2, - dt=dt, - norm=norm, - power_type=power_type, - fullspec=fullspec, - gti=gti, - save_all=save_all, - ) - raise ValueError("You need to specify two valid input datasets!") + return self._initialize_from_any_input( + data1, + data2, + dt=dt, + norm=norm, + power_type=power_type, + fullspec=fullspec, + gti=gti, + save_all=save_all, + ) def initial_checks( self, @@ -1715,23 +1713,19 @@ def __init__( data1 = list(data1) data2 = list(data2) - if data1 is not None and data2 is not None: - return self._initialize_from_any_input( - data1, - data2, - dt=dt, - segment_size=segment_size, - gti=gti, - norm=norm, - power_type=power_type, - silent=silent, - fullspec=fullspec, - use_common_mean=use_common_mean, - save_all=save_all, - ) - - else: - raise ValueError("You must specify two valid input datasets") + return self._initialize_from_any_input( + data1, + data2, + dt=dt, + segment_size=segment_size, + gti=gti, + norm=norm, + power_type=power_type, + silent=silent, + fullspec=fullspec, + use_common_mean=use_common_mean, + save_all=save_all, + ) def initial_checks(self, data1, segment_size=None, **kwargs): """ diff --git a/stingray/powerspectrum.py b/stingray/powerspectrum.py index 859e280c5..da79909ff 100755 --- a/stingray/powerspectrum.py +++ b/stingray/powerspectrum.py @@ -122,10 +122,7 @@ def __init__(self, data=None, norm="frac", gti=None, dt=None, lc=None, skip_chec if not good_input: return self._initialize_empty() - if data is not None: - return self._initialize_from_any_input(data, dt=dt, norm=norm) - - raise ValueError("No valid data provided!") + return self._initialize_from_any_input(data, dt=dt, norm=norm) def rebin(self, df=None, f=None, method="mean"): """ @@ -874,17 +871,15 @@ def __init__( ) data = list(data) - if data is not None: - return self._initialize_from_any_input( - data, - dt=dt, - segment_size=segment_size, - norm=norm, - silent=silent, - use_common_mean=use_common_mean, - save_all=save_all, - ) - raise ValueError("No valid input data!") + return self._initialize_from_any_input( + data, + dt=dt, + segment_size=segment_size, + norm=norm, + silent=silent, + use_common_mean=use_common_mean, + save_all=save_all, + ) def initial_checks(self, *args, **kwargs): return AveragedCrossspectrum.initial_checks(self, *args, **kwargs)