Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwhite committed Feb 7, 2025
1 parent 901dd7c commit 8a43c0d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions HARK/Calibration/Income/IncomeProcesses.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, sigma, n_approx, neutral_measure=False, seed=0):
logn_approx = lognormal_dstn.discretize(
n_approx if sigma > 0.0 else 1, method="equiprobable", tail_N=0
)

limit = {
"dist": lognormal_dstn,
"method": "equiprobable",
Expand All @@ -87,7 +87,7 @@ def __init__(self, sigma, n_approx, neutral_measure=False, seed=0):
"infimum": logn_approx.limit["infimum"],
"supremum": logn_approx.limit["supremum"],
}

# Change the pmv if necessary
if neutral_measure:
logn_approx.pmv = (logn_approx.atoms * logn_approx.pmv).flatten()
Expand Down Expand Up @@ -127,7 +127,7 @@ def __init__(self, sigma, UnempPrb, IncUnemp, n_approx, seed=0):
dstn_approx = dstn_orig.discretize(
n_approx if sigma > 0.0 else 1, method="equiprobable", tail_N=0
)

if UnempPrb > 0.0:
dstn_approx = add_discrete_outcome_constant_mean(
dstn_approx, p=UnempPrb, x=IncUnemp
Expand Down
2 changes: 1 addition & 1 deletion HARK/distributions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, seed: Optional[int] = 0) -> None:

self._seed: int = _seed
self._rng: random.Generator = random.default_rng(self._seed)

# Bounds of distribution support should be overwritten by subclasses
self.infimum = np.array([])
self.supremum = np.array([])
Expand Down
2 changes: 1 addition & 1 deletion HARK/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class Weibull(ContinuousFrozenDistribution):
def __init__(self, scale=1.0, shape=1.0, seed=0):
self.scale = np.asarray(scale)
self.shape = np.asarray(shape)

# Set up the RNG
super().__init__(stats.weibull_min, c=shape, scale=scale, seed=seed)
self.infimum = np.array([0.0])
Expand Down
6 changes: 3 additions & 3 deletions HARK/distributions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
)
from HARK.distributions.continuous import Normal


# TODO: This function does not generate the limit attribute
def approx_lognormal_gauss_hermite(N, mu=0.0, sigma=1.0, seed=0):
d = Normal(mu, sigma).discretize(N, method="hermite")
Expand Down Expand Up @@ -258,7 +259,7 @@ def add_discrete_outcome_constant_mean(distribution, x, p, sort=False):
],
seed=distribution.seed,
)

else:
atoms = np.append(x, distribution.atoms * (1 - p * x) / (1 - p))
pmv = np.append(p, distribution.pmv * (1 - p))
Expand Down Expand Up @@ -301,7 +302,6 @@ def add_discrete_outcome_constant_mean(distribution, x, p, sort=False):
return DiscreteDistribution(pmv, atoms, seed=distribution.seed, limit=limit)



def add_discrete_outcome(distribution, x, p, sort=False):
"""
Adds a discrete outcome of x with probability p to an existing distribution,
Expand Down Expand Up @@ -426,7 +426,7 @@ def combine_indep_dstns(*distributions, seed=0):
P_out = np.prod(P_temp, axis=0)

assert np.isclose(np.sum(P_out), 1), "Probabilities do not sum to 1!"

# Make the limit dictionary
infimum = np.concatenate(
[distributions[i].limit["infimum"] for i in range(dstn_count)]
Expand Down

0 comments on commit 8a43c0d

Please sign in to comment.