bayesian_blocks¶
- astropy.stats.bayesian_blocks(t, x=None, sigma=None, fitness='events', **kwargs)[ソース]¶
スカゲルベイズブロックを用いてデータの最適分割を計算する
これはScargle 2012で記述されたベイジアンブロックアルゴリズムの柔軟な実現である. [1].
- パラメータ
- tアレイ式.
データ回数(1次元,長さN)
- x同様のアレイはオプションです
データ値.
- sigmaクラス配列または浮動小数点型、オプション
データエラー
- fitness文字列またはオブジェクト
モデルの適応度関数に用いる.文字列である場合は、以下のオプションをサポートします。
“事件” : binned or unbinned event data. Arguments are
gamma, which gives the slope of the prior on the number of bins, orncp_prior, which is \(-\ln({{\tt gamma}})\) それがそうです。'regular_events' : non-overlapping events measured at multiples of a fundamental tick rate,
dt, which must be specified as an additional argument. Extra arguments arep0, which gives the false alarm probability to compute the prior, orgamma, which gives the slope of the prior on the number of bins, orncp_prior, which is \(-\ln({{\tt gamma}})\) それがそうです。“措置” : fitness for a measured sequence with Gaussian errors. Extra arguments are
p0, which gives the false alarm probability to compute the prior, orgamma, which gives the slope of the prior on the number of bins, orncp_prior, which is \(-\ln({{\tt gamma}})\) それがそうです。
In all three cases, if more than one of
p0,gamma, andncp_prioris chosen,ncp_priortakes precedence overgammawhich takes precedence overp0.あるいは、適応度パラメータは
FitnessFuncあるいはそのサブクラスです- **kwargs :
他のキーワードパラメータは指定されたものに渡されます
FitnessFunc派生類。
- 返品
- edgesNdarray
N個の柱を定義する(N+1)条辺を含む配列
参考
astropy.stats.histogramベイジアンブロックを用いてヒストグラムを計算する
参考文献
- 1
スカガーJらです(2012)https://ui.adsab.atherard.edu/abs/2013 ApJ...764..167 S
実例.
活動データ:
>>> t = np.random.normal(size=100) >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)
繰り返しのイベントデータ:
>>> t = np.random.normal(size=100) >>> t[80:] = t[:20] >>> edges = bayesian_blocks(t, fitness='events', p0=0.01)
通常のイベントデータ:
>>> dt = 0.05 >>> t = dt * np.arange(1000) >>> x = np.zeros(len(t)) >>> x[np.random.randint(0, len(t), len(t) // 10)] = 1 >>> edges = bayesian_blocks(t, x, fitness='regular_events', dt=dt)
間違った測定点データ:
>>> t = 100 * np.random.random(100) >>> x = np.exp(-0.5 * (t - 50) ** 2) >>> sigma = 0.1 >>> x_obs = np.random.normal(x, sigma) >>> edges = bayesian_blocks(t, x_obs, sigma, fitness='measures')