Permalink
Browse files

BF: Moved setting of the sampling rate to the __init__, instead of sp…

…ectrum.

This makes sure that the results don't depend on the order of running the
'spectrum' and 'coherence'/'coherency' methods.
  • Loading branch information...
1 parent 3ff40c7 commit 19e9d24496475d3c8821711b0a97fa90503feffb @arokem committed May 2, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 nitime/analysis/coherence.py
View
3 nitime/analysis/coherence.py
@@ -447,6 +447,8 @@ def __init__(self, time_series=None, ij=(0, 0), method=None, lb=0, ub=None,
e_s += "spectral estimation method must be welch"
raise ValueError(e_s)
+ self.method['Fs'] = self.method.get('Fs', self.input.sampling_rate)
+
#Additional parameters for the coherency estimation:
self.lb = lb
self.ub = ub
@@ -488,7 +490,6 @@ def cache(self):
def spectrum(self):
"""get the spectrum for the collection of time-series in this analyzer
"""
- self.method['Fs'] = self.method.get('Fs', self.input.sampling_rate)
spectrum = tsa.cache_to_psd(self.cache, self.ij)
return spectrum

0 comments on commit 19e9d24

Please sign in to comment.