Skip to content

Commit

Permalink
move tests and fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlujan91 committed Mar 5, 2024
1 parent b37bc96 commit 0407be6
Show file tree
Hide file tree
Showing 61 changed files with 57 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"
pull_request:
branches:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Run Sphinx
run: >
sphinx-build
-M html Documentation HARK-docs
-M html docs HARK-docs
-T
-W
-j 1
Expand Down Expand Up @@ -91,8 +91,8 @@ jobs:
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint
--ignore Documentation/example_notebooks/GenIncProcessModel.py
--ignore docs/example_notebooks/GenIncProcessModel.py
--enable all
--max-line-length 85
README.md
Documentation/
docs/
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"
pull_request:
branches:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"
schedule:
- cron: 0 0 * * *

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"
pull_request:
branches:
- master
paths-ignore:
- ".github/workflows/documentation.yml"
- "Documentation/**"
- "docs/**"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: Documentation/example_notebooks/
exclude: docs/example_notebooks/
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
Expand Down
48 changes: 24 additions & 24 deletions docs/NARK/NARK.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
by using names consistent with our guidelines.
\end{abstract}

\centerline{html version at \url{https://econ-ark.github.io/HARK/Documentation/NARK}}
\centerline{html version at \url{https://econ-ark.github.io/HARK/docs/NARK}}

% \thanks{The \texttt{NARK} repo that generates this document also contains \LaTeX~configuration files that permit you to use the same name for an object in your writing (your \texttt{paper.tex} file) and in your code (helping to minimize confusion in translating between paper and code).}

Expand All @@ -42,11 +42,11 @@
\section{Principles}
Our aim has been to balance:
\begin{itemize}
\item Brevity
\item Mnemonic quality
\item Uniqueness (enabling global search-and-replace)
\item Ubiquity (definitions useful for many projects)
\item Combinatoriality (which encourages mashups)
\item Brevity
\item Mnemonic quality
\item Uniqueness (enabling global search-and-replace)
\item Ubiquity (definitions useful for many projects)
\item Combinatoriality (which encourages mashups)
\end{itemize}


Expand Down Expand Up @@ -74,9 +74,9 @@ \subsection{Single-Letter}
\begin{table}[ht]
\centering
\begin{tabular}{|lcl|} \hline
Letter & & Meaning
Letter & & Meaning
\\ \hline
\ALev & & \textit{A}ssets \textit{A}fter \textit{A}ll \textit{A}ctions \textit{A}re \textit{A}ccomplished (end of period)
\ALev & & \textit{A}ssets \textit{A}fter \textit{A}ll \textit{A}ctions \textit{A}re \textit{A}ccomplished (end of period)
\\ \BLev & & \textit{B}eginning \textit{B}ank \textit{B}alances \textit{B}efore any \textit{B}ehavior (\textit{b}eginning-of-period)
\\ \CLev & & \textit{C}onsumption \textit{C}hoice \textit{C}onnects $B$ to $A$
\\ \DLev & & \textit{D}ebt
Expand Down Expand Up @@ -125,9 +125,9 @@ \subsection{Standard Variable Names}
\centering
\begin{tabular}{|rcl|}
\hline
Name & - & Description
Name & - & Description
\\ \hline
\texttt{CND} & - & Consumption of Nondurable Good
\texttt{CND} & - & Consumption of Nondurable Good
\\ \texttt{CNS} & - & Consumption of Nondurables and Services
\\ \texttt{Cst} & - & Cost of something
\\ \texttt{Dgd} & - & Stock of durable good
Expand Down Expand Up @@ -165,9 +165,9 @@ \section{Factors and Rates}
\centering
\begin{tabular}{|ccc|}
\hline
Code & Output & Description
Code & Output & Description
\\ \hline
\verb|\Rfree| & $\Rfree$ & Riskfree interest factor
\verb|\Rfree| & $\Rfree$ & Riskfree interest factor
\\ \verb|\rfree| & $\rfree$ & Riskfree interest rate
\\ \verb|\Risky| & $\Risky$ & The return factor on a risky asset
\\ \verb|\risky| & $\risky$ & The return rate on a risky asset
Expand All @@ -191,9 +191,9 @@ \section{Factors and Rates}
\centering
\begin{tabular}{|>{\ttfamily}cccl|}
\hline
Code & \LaTeX & Description & \\
Code & \LaTeX & Description & \\
\hline
\verb|\DiePrb| & $\DiePrb$ & Probabilty of death &
\verb|\DiePrb| & $\DiePrb$ & Probabilty of death &
\\ \verb|\LivPrb| & $\LivPrb$ & Probability to not die $=(1-\DiePrb)$ &
\\ \hline
\end{tabular}
Expand All @@ -217,9 +217,9 @@ \section{Parameters}
\centering
\begin{tabular}{|>{\ttfamily}rcll|}
\hline
Name & \LaTeX & Description & Illustration
Name & \LaTeX & Description & Illustration
\\ \hline
\verb|\CARA| & $\CARA$ & Coefficient of Absolute Risk Aversion &$\uFunc(\bullet)=-\CARA^{-1} e^{-\CARA \bullet}$
\verb|\CARA| & $\CARA$ & Coefficient of Absolute Risk Aversion & $\uFunc(\bullet)=-\CARA^{-1} e^{-\CARA \bullet}$
\\ \verb|\CRRA| & $\CRRA$ & Coefficient of Relative Risk Aversion & $\uFunc(\bullet)=(1-\CRRA)^{-1}\bullet^{1-\CRRA}$
\\ \verb|\DiscFac| & $\DiscFac$ & Time Discount Factor & $\uFunc^{\prime}(\cLev_{t}) = \Rfree \DiscFac \uFunc^{\prime}(\cLev_{t+1})$
\\ \verb|\discRte| & $\discRte$ & Time Discount rate & $\discRte=\DiscFac^{-1}-1$
Expand Down Expand Up @@ -250,10 +250,10 @@ \section{Parameters}

Mnemonics:
\begin{itemize}
\item Hebrew \texttt{daleth} is the fourth letter of the Hebrew alphabet (as d and $\delta$ are of the Roman and Greek) and is an etymological and linguistic cousin of those letters
\item $\discRte$ is the lower case Greek letter \texttt{omega}, because people say ``OMG, I've got to think about the future.''
\item You are invited to scrutinize $\Xi$ yourself to imagine reasons it could represent something to do with population growth.
\item The glorious letter $\Pat$ (pronounced `\href{https://en.wikipedia.org/wiki/Thorn_(letter)}{thorn}') enriched Old English, Gothic, and some other defunct alphabets; sadly, it remains in use today only in Iceland. It is useful because having to type the many symbols in the object $(\Rfree \DiscFac)^{1/\CRRA}$ over and over again is a \textit{thorn} in the side of economists working with dynamic models! (It is the `absolute patience factor' because if it is less than one the consumer wants to bring resources from the future to the present and is therefore absolutely impatient; for a fuller discussion of this terminology, see \cite{carrollTractable}.)
\item Hebrew \texttt{daleth} is the fourth letter of the Hebrew alphabet (as d and $\delta$ are of the Roman and Greek) and is an etymological and linguistic cousin of those letters
\item $\discRte$ is the lower case Greek letter \texttt{omega}, because people say ``OMG, I've got to think about the future.''
\item You are invited to scrutinize $\Xi$ yourself to imagine reasons it could represent something to do with population growth.
\item The glorious letter $\Pat$ (pronounced `\href{https://en.wikipedia.org/wiki/Thorn_(letter)}{thorn}') enriched Old English, Gothic, and some other defunct alphabets; sadly, it remains in use today only in Iceland. It is useful because having to type the many symbols in the object $(\Rfree \DiscFac)^{1/\CRRA}$ over and over again is a \textit{thorn} in the side of economists working with dynamic models! (It is the `absolute patience factor' because if it is less than one the consumer wants to bring resources from the future to the present and is therefore absolutely impatient; for a fuller discussion of this terminology, see \cite{carrollTractable}.)
\end{itemize}


Expand All @@ -265,9 +265,9 @@ \section{Operators}
\centering
\begin{tabular}{|>{\ttfamily}rccll|}
\hline
Name & \LaTeX & Code & Description & Illustration
Name & \LaTeX & Code & Description & Illustration
\\ \hline
\verb|\Ex| & $\Ex$ & \texttt{Ex\_} & The expectation as of date $t$ & $\Ex_{t}[\uFunc^{\prime}(\cRat_{t+1})]$
\verb|\Ex| & $\Ex$ & \texttt{Ex\_} & The expectation as of date $t$ & $\Ex_{t}[\uFunc^{\prime}(\cRat_{t+1})]$
\\ \verb|\PDV| & $\PDV$ & \texttt{PDV\_} & Present Discounted Value & $\PDV_{t}^{T}(y)$ is human wealth
\\ \hline
\end{tabular}
Expand All @@ -283,8 +283,8 @@ \section{Modifiers}
\centering
\begin{tabular}{|>{\ttfamily}lcl|}
\hline
\textit{[object]}\texttt{P} & - & ``Prime'' means derivative, e.g.\ \texttt{vPP} is the second derivative of value: $\vFunc^{\prime\prime}$
\\ \hline
\textit{[object]}\texttt{P} & - & ``Prime'' means derivative, e.g.\ \texttt{vPP} is the second derivative of value: $\vFunc^{\prime\prime}$
\\ \hline
\textit{[object]}\texttt{Agg} & - & Value of something at the aggregate level (as opposed to \texttt{Ind})
\\ \textit{[object]}\texttt{Ind} & - & Value of something at the level of an individual (as opposed to \texttt{Agg})
\\ \textit{[object]}\texttt{Lvl} & - & Level
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"github_user": "econ-ark",
"github_repo": "HARK",
"github_version": "master",
"doc_path": "Documentation/",
"doc_path": "docs/",
}

# Use Econ-ARK URL to host the website
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Object naming conventions in HARK are fairly different than existing standards,

- Class names should use no underscores and capitalize the first letter of each word; moreover, a class name _must include a noun_. E.g. **_ConsPerfForesightSolver_**.

When naming variables in model modules, the HARK team strongly discourages using single letter names, like **_c_** for consumption. Instead, we encourage contributors to use longer, more descriptive variable names using additional words and common abbreviations to specify the variable more precisely. In [NARK](https://github.com/econ-ark/HARK/blob/master/Documentation/NARK/NARK.pdf), we list standard single letter variable ''bases'' and an array of prefixes and suffixes to adjust them. Economic variables in model modules should (usually) not use underscores, instead using camel case to the greatest extent possible. For ''non-economic'' variables that are only used temporarily, underscores are permissible. The development team prefers this standard so that users can translate between Python code and LaTeX script with minimal work.
When naming variables in model modules, the HARK team strongly discourages using single letter names, like **_c_** for consumption. Instead, we encourage contributors to use longer, more descriptive variable names using additional words and common abbreviations to specify the variable more precisely. In [NARK](https://github.com/econ-ark/HARK/blob/master/docs/NARK/NARK.pdf), we list standard single letter variable ''bases'' and an array of prefixes and suffixes to adjust them. Economic variables in model modules should (usually) not use underscores, instead using camel case to the greatest extent possible. For ''non-economic'' variables that are only used temporarily, underscores are permissible. The development team prefers this standard so that users can translate between Python code and LaTeX script with minimal work.

Conventions for naming variables in HARK's tool modules are significantly closer to more commonly used standards. Variable names should be in all lower case, with underscores between words, e.g. **_data_to_match_**. The functions and classes in these modules are more general and almost surely do not have any inherent ''economic content''; they are numerical or algorithmic objects, not variables that might appear in an equation in an article for a (non-computational) economics journal. Variable names in application modules (e.g. the files that execute the **_cstwMPC_** estimations) are a mix of the conventions for tool and model files, as appropriate for each variable. That is, variables that are directly related to ''economic variables'' in model modules should follow those conventions, while objects created solely for data manipulation or reporting should use the style of tool modules.

Expand Down Expand Up @@ -272,7 +272,7 @@ multiple entries. If no output, this is just "None".

- Provide ample comments within a function or method so that a relatively intelligent reader can follow along with your algorithm. Short comments can follow at the end of a line, longer comments (or descriptions of the step or task about to be performed) should precede a block of code on the line(s) above it.

Finally, if you write a new model module, the HARK team asks that you also provide a short mathematical writeup of the model as a PDF. This document does not need to go into great detail about the solution method for the model or the functions and classes included in the module, merely specify the economic model and provide a summary of how it is solved. See [ConsumptionSavingModels.pdf](https://github.com/econ-ark/HARK/blob/master/Documentation/ConsumptionSavingModels.pdf) for an example of this.
Finally, if you write a new model module, the HARK team asks that you also provide a short mathematical writeup of the model as a PDF. This document does not need to go into great detail about the solution method for the model or the functions and classes included in the module, merely specify the economic model and provide a summary of how it is solved. See [ConsumptionSavingModels.pdf](https://github.com/econ-ark/HARK/blob/master/docs/ConsumptionSavingModels.pdf) for an example of this.

### Testing

Expand Down
Empty file.
Empty file.
Empty file removed src/HARK/Calibration/__init__.py
Empty file.
10 changes: 0 additions & 10 deletions src/HARK/ConsumptionSaving/__init__.py

This file was deleted.

Empty file.
Empty file.
Empty file removed src/HARK/datasets/SCF/__init__.py
Empty file.
Empty file removed src/HARK/datasets/cpi/__init__.py
Empty file.
Empty file.
Empty file.
Empty file.
Empty file removed src/HARK/models/__init__.py
Empty file.
Empty file removed src/HARK/simulation/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
KrusellSmithType,
)
from HARK.distribution import Uniform
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testAggShockConsumerType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
IndShockExplicitPermIncConsumerType,
PersistentShockConsumerType,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION

GenIncDictionary = {
"CRRA": 2.0, # Coefficient of relative risk aversion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PerfForesightLabeledType,
PortfolioLabeledType,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class test_PerfForesightLabeledType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import HARK.ConsumptionSaving.ConsPortfolioModel as cpm
from HARK import make_one_period_oo_solver
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class PortfolioConsumerTypeTestCase(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
KinkyPrefConsumerType,
PrefShockConsumerType,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testPrefShockConsumerType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RepAgentConsumerType,
RepAgentMarkovConsumerType,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testRepAgentConsumerType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
RiskyContribConsumerType,
init_risky_contrib,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class test_(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
init_idiosyncratic_shocks,
init_lifecycle,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testIndShockConsumerType(unittest.TestCase):
Expand Down Expand Up @@ -169,9 +169,9 @@ def test_GICRawFails(self):
GICRaw_fail_dictionary = dict(self.base_params)
GICRaw_fail_dictionary["Rfree"] = 1.08
GICRaw_fail_dictionary["PermGroFac"] = [1.00]
GICRaw_fail_dictionary[
"cycles"
] = 0 # cycles=0 makes this an infinite horizon consumer
GICRaw_fail_dictionary["cycles"] = (
0 # cycles=0 makes this an infinite horizon consumer
)

GICRawFailExample = IndShockConsumerType(**GICRaw_fail_dictionary)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
init_lifecycle,
)
from HARK.ConsumptionSaving.ConsIndShockModelFast import IndShockConsumerTypeFast
from HARK.ConsumptionSaving.tests.test_IndShockConsumerType import (
from HARK.ConsumptionSavingtest_HARK.test_IndShockConsumerType import (
CyclicalDict,
IdiosyncDict,
LifecycleDict,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testIndShockConsumerTypeFast(unittest.TestCase):
Expand Down Expand Up @@ -127,9 +127,9 @@ def test_GICRawFails(self):
GICRaw_fail_dictionary = dict(self.base_params)
GICRaw_fail_dictionary["Rfree"] = 1.08
GICRaw_fail_dictionary["PermGroFac"] = [1.00]
GICRaw_fail_dictionary[
"cycles"
] = 0 # cycles=0 makes this an infinite horizon consumer
GICRaw_fail_dictionary["cycles"] = (
0 # cycles=0 makes this an infinite horizon consumer
)

GICRawFailExample = IndShockConsumerTypeFast(**GICRaw_fail_dictionary)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from HARK.ConsumptionSaving.ConsIndShockModel import KinkedRconsumerType
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testKinkedRConsumerType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np

from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class testPerfForesightConsumerType(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
from HARK.ConsumptionSaving.ConsIndShockModelFast import PerfForesightConsumerTypeFast
from HARK.ConsumptionSaving.tests.test_PerfForesightConsumerType import (
from HARK.ConsumptionSavingtest_HARK.test_PerfForesightConsumerType import (
testPerfForesightConsumerType,
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
distr_of_function,
expected,
)
from HARK.tests import HARK_PRECISION
from tests import HARK_PRECISION


class DiscreteDistributionTests(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0407be6

Please sign in to comment.