LightcurveSNREvaluator#
- class jinwu.lightcurve.LightcurveSNREvaluator(time: ndarray, counts: ndarray, dt: float, background: _BackgroundPrior | _BackgroundCountsPosterior, off_exposure_ref: float | None = None)[source]#
Bases:
objectEvaluate whether a binned lightcurve can reach a target SNR after T0.
T0 is detected via Bayesian Blocks with per-block Li & Ma SNR ≥ 3. Supports a fast expected-value mode and an MC mode with Poisson fluctuations for ON and OFF counts.
Typical usage#
>>> bg = BackgroundPrior(n_off_prior=1200, t_off=100000.0, area_ratio=1/12) >>> ev = LightcurveSNREvaluator.from_counts( ... time=np.arange(0, 2000.0, 0.5), ... counts=np.random.poisson(0.1, 4000), ... dt=0.5, ... background=bg, ... ) >>> ok, stats = ev.reaches_snr(target=7.0, window=1200.0, mode="fast")
Methods Summary
from_counts(time, counts[, dt, background, ...])from_npz(npz_path, background, *[, ...])reaches_snr([target, window, mode, n_mc, ...])Methods Documentation
- classmethod from_counts(time: ndarray, counts: ndarray, dt: float | None = None, background: _BackgroundPrior | _BackgroundCountsPosterior | None = None, off_exposure_ref: float | None = None) LightcurveSNREvaluator[source]#
- classmethod from_npz(npz_path: str, background: _BackgroundPrior | _BackgroundCountsPosterior, *, time_key_primary: str = 'time_series', time_key_fallback: str = 'raw_time_series', counts_key_preferred: str = 'corrected_counts_src', net_key: str = 'corrected_counts', off_key: str = 'corrected_counts_back', raw_counts_key_fallback: str = 'raw_corrected_counts', dt: float | None = None, off_exposure_ref: float | None = None, verbose: bool = True) LightcurveSNREvaluator[source]#