Skip to content

Commit c48ad74

Browse files
[arellano] refactor: PEP8 class rename + None checks (#301)
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
1 parent 21051be commit c48ad74

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

lectures/arellano.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ We define a class that will store parameters, grids and transition
339339
probabilities.
340340

341341
```{code-cell} python
342-
class Arellano_Economy:
342+
class ArellanoEconomy:
343343
" Stores data and creates primitives for the Arellano economy. "
344344
345345
def __init__(self,
@@ -496,20 +496,20 @@ def update_values_and_prices(v_c, v_d, # Current guess of value functions
496496
return new_v_c, new_v_d
497497
```
498498

499-
We can now write a function that will use the `Arellano_Economy` class and the
499+
We can now write a function that will use the `ArellanoEconomy` class and the
500500
functions defined above to compute the solution to our model.
501501

502502
We do not need to JIT compile this function since it only consists of outer
503503
loops (and JIT compiling makes almost zero difference).
504504

505505
In fact, one of the jobs of this function is to take an instance of
506-
`Arellano_Economy`, which is hard for the JIT compiler to handle, and strip it
506+
`ArellanoEconomy`, which is hard for the JIT compiler to handle, and strip it
507507
down to more basic objects, which are then passed out to jitted functions.
508508

509509
```{code-cell} python
510510
def solve(model, tol=1e-8, max_iter=10_000):
511511
"""
512-
Given an instance of Arellano_Economy, this function computes the optimal
512+
Given an instance of ArellanoEconomy, this function computes the optimal
513513
policy and value functions.
514514
"""
515515
# Unpack
@@ -551,7 +551,7 @@ def simulate(model, T, v_c, v_d, q, B_star, y_idx=None, B_idx=None):
551551
"""
552552
Simulates the Arellano 2008 model of sovereign debt
553553
554-
Here `model` is an instance of `Arellano_Economy` and `T` is the length of
554+
Here `model` is an instance of `ArellanoEconomy` and `T` is the length of
555555
the simulation. Endogenous objects `v_c`, `v_d`, `q` and `B_star` are
556556
assumed to come from a solution to `model`.
557557
@@ -562,9 +562,9 @@ def simulate(model, T, v_c, v_d, q, B_star, y_idx=None, B_idx=None):
562562
B_grid, y_grid, P = model.B_grid, model.y_grid, model.P
563563
564564
# Set initial conditions to middle of grids
565-
if y_idx == None:
565+
if y_idx is None:
566566
y_idx = np.searchsorted(y_grid, y_grid.mean())
567-
if B_idx == None:
567+
if B_idx is None:
568568
B_idx = B0_idx
569569
in_default = False
570570
@@ -616,7 +616,7 @@ Let's start by trying to replicate the results obtained in
616616

617617
In what follows, all results are computed using Arellano's parameter values.
618618

619-
The values can be seen in the `__init__` method of the `Arellano_Economy`
619+
The values can be seen in the `__init__` method of the `ArellanoEconomy`
620620
shown above.
621621

622622
For example, `r=0.017` matches the average quarterly rate on a 5 year US treasury over the period 1983--2001.
@@ -686,7 +686,7 @@ Periods of relative stability are followed by sharp spikes in the discount rate
686686

687687
To the extent that you can, replicate the figures shown above
688688

689-
* Use the parameter values listed as defaults in `Arellano_Economy`.
689+
* Use the parameter values listed as defaults in `ArellanoEconomy`.
690690
* The time series will of course vary depending on the shock draws.
691691

692692
```{exercise-end}
@@ -699,7 +699,7 @@ To the extent that you can, replicate the figures shown above
699699
Compute the value function, policy and equilibrium prices
700700

701701
```{code-cell} python
702-
ae = Arellano_Economy()
702+
ae = ArellanoEconomy()
703703
```
704704

705705
```{code-cell} python

0 commit comments

Comments
 (0)