Skip to content

Commit

Permalink
Minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskontrimas authored May 13, 2024
1 parent 9faacad commit 2c7ef38
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 22 deletions.
4 changes: 2 additions & 2 deletions skyllh/analyses/i3/publicdata_ps/detsigyield.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ def _create_hist(
E2=energy_bin_edges_upper)
h_phi *= to_internal_flux_unit_factor

# Sum over the enegry bins for each sin_dec row.
# Sum over the energy bins for each sin_dec row.
h = np.sum(aeff*h_phi, axis=1)

# make sure h is greater than 0 everywhere
# Make sure `h` is greater than 0 everywhere.
min_h = np.min(h[h>0])
return np.where(h==0, min_h*1e-10, h)

Expand Down
1 change: 0 additions & 1 deletion skyllh/analyses/i3/publicdata_ps/signal_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ def __init__(
f'Its current type is {classname(time_flux_profile)}!')

self.livetime = livetime
self._livetime = livetime
self._time_flux_profile = time_flux_profile

@property
Expand Down
9 changes: 5 additions & 4 deletions skyllh/analyses/i3/publicdata_ps/time_integrated_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from skyllh.core.minimizers.iminuit import (
IMinuitMinimizerImpl,
)

from skyllh.core.model import (
DetectorModel,
)
Expand Down Expand Up @@ -192,7 +191,7 @@ def create_analysis(
Minimizer implementation to be used. Supported options are ``"LBFGS"``
(L-BFG-S minimizer used from the :mod:`scipy.optimize` module),
``"minuit"`` (Minuit minimizer used by the :mod:`iminuit` module),
or "crs" (global CRS minimizer by nlopt, not gradient based).
or ``"crs"`` (global CRS minimizer by nlopt, not gradient based).
Default: "LBFGS".
minimizer_max_rep : int
In case the minimization process did not converge at the first time
Expand Down Expand Up @@ -245,7 +244,8 @@ def create_analysis(

# Create the minimizer instance.
if minimizer_impl == "LBFGS":
minimizer = Minimizer(LBFGSMinimizerImpl(cfg=cfg))
minimizer = Minimizer(LBFGSMinimizerImpl(cfg=cfg),
max_repetitions=minimizer_max_rep)
elif minimizer_impl == "minuit":
minimizer = Minimizer(IMinuitMinimizerImpl(cfg=cfg, ftol=1e-8),
max_repetitions=minimizer_max_rep)
Expand All @@ -255,7 +255,8 @@ def create_analysis(
CRSMinimizerImpl,
)

minimizer = Minimizer(CRSMinimizerImpl(cfg=cfg, ftol=1e-8))
minimizer = Minimizer(CRSMinimizerImpl(cfg=cfg, ftol=1e-8),
max_repetitions=minimizer_max_rep)
else:
raise NameError(
f"Minimizer implementation `{minimizer_impl}` is not supported "
Expand Down
11 changes: 0 additions & 11 deletions skyllh/core/flux_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ def get_integral(
return integral



class PowerLawEnergyFluxProfile(
EnergyFluxProfile,
):
Expand Down Expand Up @@ -980,7 +979,6 @@ def crit_log10_energy_upper(self, v):
class FunctionEnergyFluxProfile(
EnergyFluxProfile):
r"""Energy flux profile for a callable function with energy as argument.
"""
def __init__(
self,
Expand Down Expand Up @@ -1039,7 +1037,6 @@ class EpeakFunctionEnergyProfile(
r"""Energy flux profile for a callable function with energy as argument where
Epeak (assuming a peaked spectrum, this is the peak's energy) and the scaling
will be optimized.
"""
def __init__(
self,
Expand Down Expand Up @@ -1072,38 +1069,33 @@ def __init__(
# method.
self.param_names = ('e_peak')


@property
def e_peak(self):
"""The e_peak parameter of the function.
"""
return self._e_peak


@e_peak.setter
def e_peak(self, e):
e = float_cast(
e,
'Property e must be castable to type float!')
self._e_peak = e


@property
def e_peak_orig(self):
"""The original peak energy of the original distribution. The shift will
be relative to this energy
"""
return self._e_peak_orig


@e_peak_orig.setter
def e_peak_orig(self, e):
e = float_cast(
e,
'Property e must be castable to type float!')
self._e_peak_orig = e


def __call__(
self,
E,
Expand Down Expand Up @@ -1141,7 +1133,6 @@ def __call__(
# avoid really small values
return np.where(value >= max_flux*1e-100, value, max_flux*1e-100)


def get_integral(
self,
E1,
Expand Down Expand Up @@ -1199,10 +1190,8 @@ def get_integral(
# used to be an issue using the spline integrate self.function.integrate)
integral[i] = tmp_int if tmp_int >= 0. else 0.


return integral


@property
def math_function_str(self):
"""(read-only) The string representation of the mathematical function of
Expand Down
2 changes: 0 additions & 2 deletions skyllh/core/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def make_linear_parameter_grid_1d(
grid = np.arange(low, high+delta, delta)
return ParameterGrid(name, grid, delta)


def make_logarithmic_parameter_grid_1d(
name,
low,
Expand Down Expand Up @@ -307,7 +306,6 @@ def as_linear_grid(self, delta):

return grid


def as_logarithmic_grid(self, delta):
"""Creates a ParameterGrid instance with a linear grid with constant
grid value distances delta.
Expand Down
2 changes: 0 additions & 2 deletions skyllh/core/utils/coords.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

import numpy as np
from astropy.coordinates import SkyCoord

from astropy.coordinates import (
SkyCoord,
Expand Down Expand Up @@ -199,4 +198,3 @@ def angular_separation(ra1, dec1, ra2, dec2, psi_floor=None):
psi = np.where(psi < psi_floor, psi_floor, psi)

return psi

0 comments on commit 2c7ef38

Please sign in to comment.