Skip to content

Commit

Permalink
Merge pull request #550 from LinkedEarth/corr_fix
Browse files Browse the repository at this point in the history
coerced signif to boolean and removed extraneous print() statement
  • Loading branch information
jordanplanders authored May 28, 2024
2 parents a0660aa + 5671bf0 commit 934ffa8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyleoclim/core/corr.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, r, p, signif, alpha, p_fmt_td=0.01, p_fmt_style='exp'):
self.p = p
self.p_fmt_td = p_fmt_td
self.p_fmt_style = p_fmt_style
self.signif = signif
self.signif = bool(signif) # coerce as Boolean
self.alpha = alpha

def copy(self):
Expand Down
9 changes: 6 additions & 3 deletions pyleoclim/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ def summary_plot(self, psd, scalogram, figsize=[8, 10], title=None,
import pyleoclim as pyleo
series = pyleo.utils.load_dataset('SOI')
psd = series.spectral(freq_method = 'welch')
psd = series.spectral(freq = 'welch')
scalogram = series.wavelet(freq_method = 'welch')
fig, ax = series.summary_plot(psd = psd,scalogram = scalogram)
Expand All @@ -1819,10 +1819,10 @@ def summary_plot(self, psd, scalogram, figsize=[8, 10], title=None,
import pyleoclim as pyleo
series = pyleo.utils.load_dataset('SOI')
psd = series.spectral(freq_method = 'welch')
psd = series.spectral(freq = 'welch').signif_test(number=20)
scalogram = series.wavelet(freq_method = 'welch')
fig, ax = series.summary_plot(psd = psd,scalogram = scalogram, period_lim = [5,0], ts_plot_kwargs = {'color':'red','linewidth':.5}, psd_plot_kwargs = {'color':'red','linewidth':.5})
fig, ax = series.summary_plot(psd = psd,scalogram = scalogram, period_lim = [0,5], ts_plot_kwargs = {'color':'Purple','linewidth':.5}, psd_plot_kwargs = {'color':'Purple','linewidth':1.5})
'''

Expand Down Expand Up @@ -3142,7 +3142,10 @@ def wavelet(self, method='cwt', settings=None, freq_method='log', freq_kwargs=No
# Process options
settings = {} if settings is None else settings.copy()
freq_kwargs = {} if freq_kwargs is None else freq_kwargs.copy()

freq = specutils.make_freq_vector(self.time, method=freq_method, **freq_kwargs)


args = {}
args['wwz'] = {'freq': freq}
args['cwt'] = {'freq': freq}
Expand Down
7 changes: 7 additions & 0 deletions pyleoclim/tests/test_core_Series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,13 @@ def test_wave_t3(self,mother):
'''
ts = gen_ts(model='colored_noise',nt=200)
_ = ts.wavelet(method='cwt',settings={'mother':mother})

@pytest.mark.parametrize('freq_meth', ['log', 'scale', 'nfft', 'welch'])
def test_wave_t4(self,freq_meth):
''' Test Series.wavelet() with different mother wavelets
'''
ts = gen_ts(model='colored_noise',nt=200)
_ = ts.wavelet(method='cwt',freq_method=freq_meth)

class TestUISeriesSsa():
''' Test the SSA functionalities
Expand Down
1 change: 0 additions & 1 deletion pyleoclim/utils/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@ def association(y1, y2, statistic='pearsonr',settings=None):
acceptable_methods = ['linregress','pearsonr','spearmanr','pointbiserialr','kendalltau','weightedtau']
if statistic in acceptable_methods:
func = getattr(stats, statistic)
print(args)
res = func(y1,y2,**args)
else:
raise ValueError(f'Wrong statistic: {statistic}; acceptable choices are {acceptable_methods}')
Expand Down

0 comments on commit 934ffa8

Please sign in to comment.