add test for adding a mask for the fit LC estimation
@@ -239,6 +239,31 @@ def test_lightcurve_estimator_spectrum_datasets():
rtol=1e-5,
)
+@requires_data()
+@requires_dependency("iminuit")
+def test_lightcurve_estimator_spectrum_datasets_withmaskfit():
+ # Doing a LC on one hour bin
+ datasets = get_spectrum_datasets()
+ time_intervals = [
+ Time(["2010-01-01T00:00:00", "2010-01-01T01:00:00"]),
+ Time(["2010-01-01T01:00:00", "2010-01-01T02:00:00"]),
+ ]
+
+ e_min_fit = 1 * u.TeV
+ e_max_fit = 3 * u.TeV
+ for dataset in datasets:
+ mask_fit = dataset.counts.energy_mask(emin=e_min_fit, emax=e_max_fit)
+ dataset.mask_fit = mask_fit
+
+ steps = ["err", "counts", "ts", "norm-scan"]
+ estimator = LightCurveEstimator(
+ datasets, norm_n_values=3, time_intervals=time_intervals)
+ lightcurve = estimator.run(e_ref=10 * u.TeV, e_min=1 * u.TeV, e_max=100 * u.TeV, steps=steps)
+ assert_allclose(lightcurve.table["time_min"], [55197.0, 55197.041667])
+ assert_allclose(lightcurve.table["time_max"], [55197.041667, 55197.083333])
+ assert_allclose(lightcurve.table["stat"], [6.60304 , 0.421047], rtol=1e-5)
+ assert_allclose(lightcurve.table["norm"], [0.885082, 0.967022], rtol=1e-5)
+
@requires_data()
@requires_dependency("iminuit")
