Skip to content

Commit

Permalink
All no-good data options were already accounted for
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobachetti committed Sep 15, 2023
1 parent 83a4b9b commit 6406b5b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 44 deletions.
52 changes: 23 additions & 29 deletions stingray/crossspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
"""
Expand Down
25 changes: 10 additions & 15 deletions stingray/powerspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
"""
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6406b5b

Please sign in to comment.