Skip to content

Commit

Permalink
Add wrapper for structure function
Browse files Browse the repository at this point in the history
Signed-off-by: cgalelli <[email protected]>
  • Loading branch information
cgalelli committed May 6, 2024
1 parent 22c365a commit 747d490
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gammapy/estimators/points/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from gammapy.modeling.models import TemplateSpectralModel
from gammapy.modeling.models.spectral import scale_plot_flux
from gammapy.modeling.scipy import stat_profile_ul_scipy
from gammapy.stats import structure_function
from gammapy.utils.interpolation import interpolate_profile
from gammapy.utils.scripts import make_path
from gammapy.utils.table import table_standardise_units_copy
Expand Down Expand Up @@ -951,3 +952,11 @@ def fpp(self, flux_quantity="flux"):

def doubling_time(self, flux_quantity="flux"):
return compute_lightcurve_doublingtime(self, flux_quantity)

def structure_function(self, flux_quantity="flux", tdelta_precision=5):

flux = getattr(self, flux_quantity)
flux_err = getattr(self, flux_quantity + "_err")
coords = self.geom.axes["time"].center

return structure_function(flux.data, flux_err.data, coords, tdelta_precision)

0 comments on commit 747d490

Please sign in to comment.