From aceaf9860cb0b6dec535465835962bc71e922698 Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Wed, 25 Feb 2026 15:19:36 -0500 Subject: [PATCH] update --- us/states/mi/surtax_analysis.ipynb | 2700 ++++++++++++++++++++++++++++ 1 file changed, 2700 insertions(+) create mode 100644 us/states/mi/surtax_analysis.ipynb diff --git a/us/states/mi/surtax_analysis.ipynb b/us/states/mi/surtax_analysis.ipynb new file mode 100644 index 0000000..4174870 --- /dev/null +++ b/us/states/mi/surtax_analysis.ipynb @@ -0,0 +1,2700 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Michigan Surtax Analysis: \"Invest in Our Kids\" Ballot Initiative\n", + "\n", + "This notebook analyzes the proposed Michigan surtax from the \"Invest in Our Kids\" ballot initiative.\n", + "\n", + "## Reform Details\n", + "- **Single filers**: 5% surtax on taxable income above $500,000\n", + "- **Joint filers**: 5% surtax on taxable income above $1,000,000\n", + "- **Effective date**: 2027\n", + "\n", + "[Source: Invest in Our Kids ballot initiative](https://www.michigan.gov/sos/-/media/Project/Websites/sos/BSC-Announcements/Invest-in-MI-Kids-Petition.pdf)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from policyengine_us import Microsimulation\n", + "from policyengine_core.reforms import Reform\n", + "from policyengine_core.charts import format_fig\n", + "import pandas as pd\n", + "import plotly.express as px\n", + "import plotly.graph_objects as go\n", + "import numpy as np" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Setup Baseline and Reform Simulations" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# Use Michigan state dataset\n", + "dataset = \"hf://policyengine/policyengine-us-data/states/MI.h5\"\n", + "\n", + "# Baseline simulation\n", + "baseline = Microsimulation(dataset=dataset)\n", + "\n", + "# Reform: Enable the Michigan surtax\n", + "reform = Reform.from_dict(\n", + " {\n", + " \"gov.contrib.states.mi.surtax.in_effect\": {\n", + " \"2027-01-01.2100-12-31\": True\n", + " }\n", + " },\n", + " country_id=\"us\",\n", + ")\n", + "\n", + "reformed = Microsimulation(reform=reform, dataset=dataset)\n", + "\n", + "YEAR = 2027" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Revenue Impact" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Estimated annual revenue from Michigan surtax: $5.69 billion\n", + "Number of tax units paying surtax: 52,297\n", + "Average surtax among payers: $108,888\n" + ] + } + ], + "source": [ + "# Calculate the surtax revenue directly\n", + "mi_surtax = reformed.calc(\"mi_surtax\", period=YEAR)\n", + "total_revenue = mi_surtax.sum()\n", + "\n", + "print(f\"Estimated annual revenue from Michigan surtax: ${total_revenue / 1e9:.2f} billion\")\n", + "print(f\"Number of tax units paying surtax: {(mi_surtax > 0).sum():,.0f}\")\n", + "print(f\"Average surtax among payers: ${mi_surtax[mi_surtax > 0].mean():,.0f}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Who Pays the Surtax?" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Share of Michigan tax units affected: 66.17%\n", + "Total tax units in Michigan: 79,036\n", + "Tax units paying surtax: 52,297\n" + ] + } + ], + "source": [ + "# Calculate share of population affected\n", + "total_tax_units = len(mi_surtax)\n", + "affected_tax_units = (mi_surtax > 0).sum()\n", + "share_affected = affected_tax_units / total_tax_units\n", + "\n", + "print(f\"Share of Michigan tax units affected: {share_affected:.2%}\")\n", + "print(f\"Total tax units in Michigan: {total_tax_units:,.0f}\")\n", + "print(f\"Tax units paying surtax: {affected_tax_units:,.0f}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Single vs Joint Filer Analysis" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Joint Filers (threshold: $1,000,000):\n", + " Tax units affected: 49,264\n", + " Share of joint filers affected: 2.31%\n", + " Revenue raised: $5.42 billion (95.2% of total)\n", + " Average surtax: $110,064\n", + "\n", + "Single Filers (threshold: $500,000):\n", + " Tax units affected: 3,034\n", + " Share of single filers affected: 0.10%\n", + " Revenue raised: $0.27 billion (4.8% of total)\n", + " Average surtax: $89,789\n" + ] + } + ], + "source": [ + "# Analyze by filing status\n", + "is_joint = baseline.calc(\"tax_unit_is_joint\", period=YEAR)\n", + "mi_taxable_income = baseline.calc(\"mi_taxable_income\", period=YEAR)\n", + "\n", + "# Joint filers (threshold: $1M)\n", + "joint_mask = is_joint\n", + "joint_payers = mi_surtax[joint_mask] > 0\n", + "joint_affected_share = joint_payers.mean()\n", + "joint_revenue = mi_surtax[joint_mask].sum()\n", + "joint_count = joint_payers.sum()\n", + "\n", + "# Single filers (threshold: $500k)\n", + "single_mask = ~is_joint\n", + "single_payers = mi_surtax[single_mask] > 0\n", + "single_affected_share = single_payers.mean()\n", + "single_revenue = mi_surtax[single_mask].sum()\n", + "single_count = single_payers.sum()\n", + "\n", + "print(\"Joint Filers (threshold: $1,000,000):\")\n", + "print(f\" Tax units affected: {joint_count:,.0f}\")\n", + "print(f\" Share of joint filers affected: {joint_affected_share:.2%}\")\n", + "print(f\" Revenue raised: ${joint_revenue / 1e9:.2f} billion ({joint_revenue/total_revenue*100:.1f}% of total)\")\n", + "if joint_count > 0:\n", + " print(f\" Average surtax: ${mi_surtax[joint_mask][mi_surtax[joint_mask] > 0].mean():,.0f}\")\n", + "print()\n", + "print(\"Single Filers (threshold: $500,000):\")\n", + "print(f\" Tax units affected: {single_count:,.0f}\")\n", + "print(f\" Share of single filers affected: {single_affected_share:.2%}\")\n", + "print(f\" Revenue raised: ${single_revenue / 1e9:.2f} billion ({single_revenue/total_revenue*100:.1f}% of total)\")\n", + "if single_count > 0:\n", + " print(f\" Average surtax: ${mi_surtax[single_mask][mi_surtax[single_mask] > 0].mean():,.0f}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "Filing Status=%{x}
Revenue ($B)=%{text}", + "legendgroup": "", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "", + "offsetgroup": "", + "orientation": "v", + "showlegend": false, + "text": [ + 5.422132655294395, + 0.2724099823185748 + ], + "textposition": "outside", + "texttemplate": "$%{text:.2f}B", + "type": "bar", + "x": [ + "Joint Filers\n(>$1M threshold)", + "Single Filers\n(>$500K threshold)" + ], + "xaxis": "x", + "y": [ + 5.422132655294395, + 0.2724099823185748 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "relative", + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Michigan Surtax Revenue by Filing Status (2027)" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Filing Status" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "tickformat": "$,.2f", + "title": { + "text": "Revenue ($B)" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Visualize revenue by filing status\n", + "filing_df = pd.DataFrame({\n", + " \"Filing Status\": [\"Joint Filers\\n(>$1M threshold)\", \"Single Filers\\n(>$500K threshold)\"],\n", + " \"Revenue ($B)\": [joint_revenue / 1e9, single_revenue / 1e9],\n", + " \"Tax Units Affected\": [int(joint_count), int(single_count)]\n", + "})\n", + "\n", + "fig = px.bar(\n", + " filing_df,\n", + " x=\"Filing Status\",\n", + " y=\"Revenue ($B)\",\n", + " title=\"Michigan Surtax Revenue by Filing Status (2027)\",\n", + " text=\"Revenue ($B)\",\n", + ")\n", + "fig.update_traces(texttemplate=\"$%{text:.2f}B\", textposition=\"outside\")\n", + "fig.update_layout(yaxis=dict(tickformat=\"$,.2f\"))\n", + "fig = format_fig(fig)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Impact by Income Level" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Income BracketTax UnitsSurtax PayersRevenue ($M)Avg Surtax ($)
0Under $100K473948300.0000000.000000
1$100K-$250K41692700.0000000.000000
2$250K-$500K10557200.0000000.000000
3$500K-$1M110084115.25277112751.214868
4$1M-$2M44364436118.78259526772.505501
5Over $2M47448474485570.507272117400.498843
\n", + "
" + ], + "text/plain": [ + " Income Bracket Tax Units Surtax Payers Revenue ($M) Avg Surtax ($)\n", + "0 Under $100K 4739483 0 0.000000 0.000000\n", + "1 $100K-$250K 416927 0 0.000000 0.000000\n", + "2 $250K-$500K 105572 0 0.000000 0.000000\n", + "3 $500K-$1M 11008 411 5.252771 12751.214868\n", + "4 $1M-$2M 4436 4436 118.782595 26772.505501\n", + "5 Over $2M 47448 47448 5570.507272 117400.498843" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create income brackets for analysis\n", + "income_brackets = [\n", + " (0, 100_000, \"Under $100K\"),\n", + " (100_000, 250_000, \"$100K-$250K\"),\n", + " (250_000, 500_000, \"$250K-$500K\"),\n", + " (500_000, 1_000_000, \"$500K-$1M\"),\n", + " (1_000_000, 2_000_000, \"$1M-$2M\"),\n", + " (2_000_000, float('inf'), \"Over $2M\"),\n", + "]\n", + "\n", + "bracket_results = []\n", + "for low, high, label in income_brackets:\n", + " mask = (mi_taxable_income >= low) & (mi_taxable_income < high)\n", + " count = mask.sum()\n", + " surtax_in_bracket = mi_surtax[mask]\n", + " payers = (surtax_in_bracket > 0).sum()\n", + " revenue = surtax_in_bracket.sum()\n", + " avg_surtax = surtax_in_bracket[surtax_in_bracket > 0].mean() if payers > 0 else 0\n", + " \n", + " bracket_results.append({\n", + " \"Income Bracket\": label,\n", + " \"Tax Units\": int(count),\n", + " \"Surtax Payers\": int(payers),\n", + " \"Revenue ($M)\": revenue / 1e6,\n", + " \"Avg Surtax ($)\": avg_surtax\n", + " })\n", + "\n", + "bracket_df = pd.DataFrame(bracket_results)\n", + "bracket_df" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "hovertemplate": "Income Bracket=%{x}
Revenue ($M)=%{text}", + "legendgroup": "", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "", + "offsetgroup": "", + "orientation": "v", + "showlegend": false, + "text": [ + 0, + 0, + 0, + 5.252770888798276, + 118.78259478994953, + 5570.5072719342215 + ], + "textposition": "outside", + "texttemplate": "$%{text:.0f}M", + "type": "bar", + "x": [ + "Under $100K", + "$100K-$250K", + "$250K-$500K", + "$500K-$1M", + "$1M-$2M", + "Over $2M" + ], + "xaxis": "x", + "y": [ + 0, + 0, + 0, + 5.252770888798276, + 118.78259478994953, + 5570.5072719342215 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "relative", + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Michigan Surtax Revenue by Income Bracket (2027)" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "categoryarray": [ + "Under $100K", + "$100K-$250K", + "$250K-$500K", + "$500K-$1M", + "$1M-$2M", + "Over $2M" + ], + "categoryorder": "array", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Income Bracket" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "tickformat": "$,.0f", + "title": { + "text": "Revenue ($M)" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Visualize revenue by income bracket\n", + "fig = px.bar(\n", + " bracket_df,\n", + " x=\"Income Bracket\",\n", + " y=\"Revenue ($M)\",\n", + " title=\"Michigan Surtax Revenue by Income Bracket (2027)\",\n", + " text=\"Revenue ($M)\",\n", + ")\n", + "fig.update_traces(texttemplate=\"$%{text:.0f}M\", textposition=\"outside\")\n", + "fig.update_layout(\n", + " xaxis=dict(categoryorder=\"array\", categoryarray=[b[2] for b in income_brackets]),\n", + " yaxis=dict(tickformat=\"$,.0f\"),\n", + ")\n", + "fig = format_fig(fig)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Multi-Year Revenue Projection" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "ename": "MemoryError", + "evalue": "Unable to allocate 557. KiB for an array with shape (142574,) and data type float32", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mMemoryError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[9], line 6\u001b[0m\n\u001b[0;32m 3\u001b[0m revenue_results \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m 5\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m year \u001b[38;5;129;01min\u001b[39;00m years:\n\u001b[1;32m----> 6\u001b[0m surtax \u001b[38;5;241m=\u001b[39m \u001b[43mreformed\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmi_surtax\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43myear\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 7\u001b[0m revenue \u001b[38;5;241m=\u001b[39m surtax\u001b[38;5;241m.\u001b[39msum()\n\u001b[0;32m 8\u001b[0m payers \u001b[38;5;241m=\u001b[39m (surtax \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m)\u001b[38;5;241m.\u001b[39msum()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\reforms\\states\\mi\\surtax.py:16\u001b[0m, in \u001b[0;36mcreate_mi_surtax..mi_surtax.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m p \u001b[38;5;241m=\u001b[39m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mcontrib\u001b[38;5;241m.\u001b[39mstates\u001b[38;5;241m.\u001b[39mmi\u001b[38;5;241m.\u001b[39msurtax\n\u001b[0;32m 15\u001b[0m in_effect \u001b[38;5;241m=\u001b[39m p\u001b[38;5;241m.\u001b[39min_effect\n\u001b[1;32m---> 16\u001b[0m taxable_income \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmi_taxable_income\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 17\u001b[0m joint \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_unit_is_joint\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 18\u001b[0m surtax \u001b[38;5;241m=\u001b[39m where(\n\u001b[0;32m 19\u001b[0m joint,\n\u001b[0;32m 20\u001b[0m p\u001b[38;5;241m.\u001b[39mrate\u001b[38;5;241m.\u001b[39mjoint\u001b[38;5;241m.\u001b[39mcalc(taxable_income),\n\u001b[0;32m 21\u001b[0m p\u001b[38;5;241m.\u001b[39mrate\u001b[38;5;241m.\u001b[39msingle\u001b[38;5;241m.\u001b[39mcalc(taxable_income),\n\u001b[0;32m 22\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\states\\mi\\tax\\income\\mi_taxable_income.py:22\u001b[0m, in \u001b[0;36mmi_taxable_income.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 20\u001b[0m agi \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madjusted_gross_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 21\u001b[0m additions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmi_additions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 22\u001b[0m subtractions \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmi_subtractions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 23\u001b[0m exemptions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmi_exemptions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 25\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(agi \u001b[38;5;241m+\u001b[39m additions \u001b[38;5;241m-\u001b[39m subtractions \u001b[38;5;241m-\u001b[39m exemptions, \u001b[38;5;241m0\u001b[39m)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\states\\mi\\tax\\income\\mi_subtractions.py:19\u001b[0m, in \u001b[0;36mmi_subtractions.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 18\u001b[0m p \u001b[38;5;241m=\u001b[39m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mstates\u001b[38;5;241m.\u001b[39mmi\u001b[38;5;241m.\u001b[39mtax\u001b[38;5;241m.\u001b[39mincome\n\u001b[1;32m---> 19\u001b[0m total_subtractions \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtax_unit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msubtractions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[38;5;66;03m# Prevent negative subtractions from acting as additions\u001b[39;00m\n\u001b[0;32m 21\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(\u001b[38;5;241m0\u001b[39m, total_subtractions)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\states\\mi\\tax\\income\\deductions\\interest_dividends_capital_gains\\mi_interest_dividends_capital_gains_deduction.py:37\u001b[0m, in \u001b[0;36mmi_interest_dividends_capital_gains_deduction.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[38;5;66;03m# The maximum amount of the deduction must be reduced by any deduction for\u001b[39;00m\n\u001b[0;32m 29\u001b[0m \u001b[38;5;66;03m# Military (including Michigan National Guard) retirement benefits\u001b[39;00m\n\u001b[0;32m 30\u001b[0m \u001b[38;5;66;03m# Public and private retirement and pension benefits\u001b[39;00m\n\u001b[0;32m 31\u001b[0m \u001b[38;5;66;03m# Amount used for the federal credit for the elderly and totally and permanently disabled\u001b[39;00m\n\u001b[0;32m 32\u001b[0m reductions_pay \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 33\u001b[0m person,\n\u001b[0;32m 34\u001b[0m period,\n\u001b[0;32m 35\u001b[0m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmilitary_retirement_pay\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_pension_income\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[0;32m 36\u001b[0m )\n\u001b[1;32m---> 37\u001b[0m elderly_disabled_credit \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43melderly_disabled_credit\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 39\u001b[0m is_head_or_spouse \u001b[38;5;241m=\u001b[39m person(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mis_tax_unit_head_or_spouse\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 41\u001b[0m reductions \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m 42\u001b[0m tax_unit\u001b[38;5;241m.\u001b[39msum(reductions_pay \u001b[38;5;241m*\u001b[39m is_head_or_spouse)\n\u001b[0;32m 43\u001b[0m \u001b[38;5;241m+\u001b[39m elderly_disabled_credit\n\u001b[0;32m 44\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\elderly_and_disabled\\elderly_disabled_credit.py:14\u001b[0m, in \u001b[0;36melderly_disabled_credit.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 14\u001b[0m credit_limit \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43melderly_disabled_credit_credit_limit\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m potential \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124melderly_disabled_credit_potential\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m min_(credit_limit, potential)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\elderly_and_disabled\\elderly_disabled_credit_credit_limit.py:14\u001b[0m, in \u001b[0;36melderly_disabled_credit_credit_limit.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 14\u001b[0m income_tax_before_credits \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 15\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 16\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 17\u001b[0m p \u001b[38;5;241m=\u001b[39m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mirs\u001b[38;5;241m.\u001b[39mcredits\u001b[38;5;241m.\u001b[39melderly_or_disabled\n\u001b[0;32m 18\u001b[0m preceding_credits \u001b[38;5;241m=\u001b[39m add(tax_unit, period, p\u001b[38;5;241m.\u001b[39mpreceding_credits)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\before_credits\\income_tax_main_rates.py:14\u001b[0m, in \u001b[0;36mincome_tax_main_rates.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 13\u001b[0m \u001b[38;5;66;03m# compute taxable income that is taxed at the main rates\u001b[39;00m\n\u001b[1;32m---> 14\u001b[0m full_taxable_income \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m cg_exclusion \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapital_gains_excluded_from_taxable_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 17\u001b[0m )\n\u001b[0;32m 18\u001b[0m taxinc \u001b[38;5;241m=\u001b[39m max_(\u001b[38;5;241m0\u001b[39m, full_taxable_income \u001b[38;5;241m-\u001b[39m cg_exclusion)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\taxable_income.py:14\u001b[0m, in \u001b[0;36mtaxable_income.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m agi \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madjusted_gross_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 13\u001b[0m exemptions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexemptions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 14\u001b[0m deductions \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income_deductions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(\u001b[38;5;241m0\u001b[39m, agi \u001b[38;5;241m-\u001b[39m exemptions \u001b[38;5;241m-\u001b[39m deductions)\n", + " \u001b[1;31m[... skipping similar frames: GroupPopulation.__call__ at line 38 (1 times), Population.__call__ at line 142 (1 times), Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\taxable_income_deductions.py:12\u001b[0m, in \u001b[0;36mtaxable_income_deductions.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 12\u001b[0m itemizes \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_unit_itemizes\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 13\u001b[0m deductions_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 14\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 15\u001b[0m )\n\u001b[0;32m 16\u001b[0m deductions_if_not_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_not_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_unit_itemizes.py:19\u001b[0m, in \u001b[0;36mtax_unit_itemizes.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mbranch_to_determine_itemization:\n\u001b[0;32m 15\u001b[0m \u001b[38;5;66;03m# determine federal itemization behavior by comparing tax liability\u001b[39;00m\n\u001b[0;32m 16\u001b[0m tax_liability_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_liability_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n\u001b[1;32m---> 19\u001b[0m tax_liability_if_not_itemizing \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_liability_if_not_itemizing\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 21\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 22\u001b[0m state_standard_deduction \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 23\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_standard_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 24\u001b[0m )\n\u001b[0;32m 25\u001b[0m state_itemized_deductions \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 26\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_itemized_deductions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 27\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_liability_if_not_itemizing.py:20\u001b[0m, in \u001b[0;36mtax_liability_if_not_itemizing.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m non_itemized_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnot_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m non_itemized_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_unit_itemizes\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 17\u001b[0m period,\n\u001b[0;32m 18\u001b[0m np\u001b[38;5;241m.\u001b[39mzeros((tax_unit\u001b[38;5;241m.\u001b[39mcount,), dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbool\u001b[39m),\n\u001b[0;32m 19\u001b[0m )\n\u001b[1;32m---> 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mnon_itemized_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax.py:18\u001b[0m, in \u001b[0;36mincome_tax.formula\u001b[1;34m(person, period, parameters)\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[43mperson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 22\u001b[0m person, period, [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mincome_tax_refundable_credits\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m 23\u001b[0m )\n\u001b[0;32m 24\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax_before_refundable_credits.py:29\u001b[0m, in \u001b[0;36mincome_tax_before_refundable_credits.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 19\u001b[0m tax_unit,\n\u001b[0;32m 20\u001b[0m period,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 27\u001b[0m ],\n\u001b[0;32m 28\u001b[0m )\n\u001b[1;32m---> 29\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mtax_unit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_capped_non_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:981\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m subtracted_variable \u001b[38;5;129;01min\u001b[39;00m subtracts_list:\n\u001b[0;32m 977\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m 978\u001b[0m subtracted_variable\n\u001b[0;32m 979\u001b[0m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables\n\u001b[0;32m 980\u001b[0m ):\n\u001b[1;32m--> 981\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m-\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 982\u001b[0m \u001b[43m \u001b[49m\u001b[43msubtracted_variable\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 983\u001b[0m \u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 984\u001b[0m \u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 985\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 986\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 987\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\refundable_ctc.py:34\u001b[0m, in \u001b[0;36mrefundable_ctc.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 31\u001b[0m maximum_refundable_ctc \u001b[38;5;241m=\u001b[39m min_(maximum_amount, total_ctc)\n\u001b[0;32m 33\u001b[0m phase_in \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mctc_phase_in\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 34\u001b[0m limiting_tax \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mctc_limiting_tax_liability\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 35\u001b[0m ctc_capped_by_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax)\n\u001b[0;32m 36\u001b[0m ctc_capped_by_increased_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax \u001b[38;5;241m+\u001b[39m phase_in)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\ctc_limiting_tax_liability.py:18\u001b[0m, in \u001b[0;36mctc_limiting_tax_liability.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m no_salt_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mno_salt\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m no_salt_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msalt_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period, np\u001b[38;5;241m.\u001b[39mzeros(tax_unit\u001b[38;5;241m.\u001b[39mcount)\n\u001b[0;32m 17\u001b[0m )\n\u001b[1;32m---> 18\u001b[0m tax_liability_before_credits \u001b[38;5;241m=\u001b[39m \u001b[43mno_salt_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m non_refundable_credits \u001b[38;5;241m=\u001b[39m parameters(\n\u001b[0;32m 22\u001b[0m period\n\u001b[0;32m 23\u001b[0m )\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mirs\u001b[38;5;241m.\u001b[39mcredits\u001b[38;5;241m.\u001b[39mnon_refundable\n\u001b[0;32m 24\u001b[0m non_refundable_credits_ex_ctc \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m 25\u001b[0m x \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m non_refundable_credits \u001b[38;5;28;01mif\u001b[39;00m x \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon_refundable_ctc\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 26\u001b[0m ]\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\before_credits\\income_tax_main_rates.py:14\u001b[0m, in \u001b[0;36mincome_tax_main_rates.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 13\u001b[0m \u001b[38;5;66;03m# compute taxable income that is taxed at the main rates\u001b[39;00m\n\u001b[1;32m---> 14\u001b[0m full_taxable_income \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m cg_exclusion \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapital_gains_excluded_from_taxable_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 17\u001b[0m )\n\u001b[0;32m 18\u001b[0m taxinc \u001b[38;5;241m=\u001b[39m max_(\u001b[38;5;241m0\u001b[39m, full_taxable_income \u001b[38;5;241m-\u001b[39m cg_exclusion)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\taxable_income.py:14\u001b[0m, in \u001b[0;36mtaxable_income.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m agi \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madjusted_gross_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 13\u001b[0m exemptions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexemptions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 14\u001b[0m deductions \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income_deductions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(\u001b[38;5;241m0\u001b[39m, agi \u001b[38;5;241m-\u001b[39m exemptions \u001b[38;5;241m-\u001b[39m deductions)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\taxable_income_deductions.py:12\u001b[0m, in \u001b[0;36mtaxable_income_deductions.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 12\u001b[0m itemizes \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_unit_itemizes\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 13\u001b[0m deductions_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 14\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 15\u001b[0m )\n\u001b[0;32m 16\u001b[0m deductions_if_not_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_not_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_unit_itemizes.py:16\u001b[0m, in \u001b[0;36mtax_unit_itemizes.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mbranch_to_determine_itemization:\n\u001b[0;32m 15\u001b[0m \u001b[38;5;66;03m# determine federal itemization behavior by comparing tax liability\u001b[39;00m\n\u001b[1;32m---> 16\u001b[0m tax_liability_if_itemizing \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 17\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_liability_if_itemizing\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 18\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 19\u001b[0m tax_liability_if_not_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 20\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_liability_if_not_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 21\u001b[0m )\n\u001b[0;32m 22\u001b[0m state_standard_deduction \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 23\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_standard_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 24\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_liability_if_itemizing.py:17\u001b[0m, in \u001b[0;36mtax_liability_if_itemizing.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 13\u001b[0m itemized_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mitemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 14\u001b[0m itemized_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 15\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_unit_itemizes\u001b[39m\u001b[38;5;124m\"\u001b[39m, period, np\u001b[38;5;241m.\u001b[39mones((tax_unit\u001b[38;5;241m.\u001b[39mcount,), dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbool\u001b[39m)\n\u001b[0;32m 16\u001b[0m )\n\u001b[1;32m---> 17\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mitemized_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax.py:18\u001b[0m, in \u001b[0;36mincome_tax.formula\u001b[1;34m(person, period, parameters)\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[43mperson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 22\u001b[0m person, period, [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mincome_tax_refundable_credits\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m 23\u001b[0m )\n\u001b[0;32m 24\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax_before_refundable_credits.py:29\u001b[0m, in \u001b[0;36mincome_tax_before_refundable_credits.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 19\u001b[0m tax_unit,\n\u001b[0;32m 20\u001b[0m period,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 27\u001b[0m ],\n\u001b[0;32m 28\u001b[0m )\n\u001b[1;32m---> 29\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mtax_unit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_capped_non_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:981\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m subtracted_variable \u001b[38;5;129;01min\u001b[39;00m subtracts_list:\n\u001b[0;32m 977\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m 978\u001b[0m subtracted_variable\n\u001b[0;32m 979\u001b[0m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables\n\u001b[0;32m 980\u001b[0m ):\n\u001b[1;32m--> 981\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m-\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 982\u001b[0m \u001b[43m \u001b[49m\u001b[43msubtracted_variable\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 983\u001b[0m \u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 984\u001b[0m \u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 985\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 986\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 987\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\refundable_ctc.py:34\u001b[0m, in \u001b[0;36mrefundable_ctc.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 31\u001b[0m maximum_refundable_ctc \u001b[38;5;241m=\u001b[39m min_(maximum_amount, total_ctc)\n\u001b[0;32m 33\u001b[0m phase_in \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mctc_phase_in\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 34\u001b[0m limiting_tax \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mctc_limiting_tax_liability\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 35\u001b[0m ctc_capped_by_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax)\n\u001b[0;32m 36\u001b[0m ctc_capped_by_increased_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax \u001b[38;5;241m+\u001b[39m phase_in)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\ctc_limiting_tax_liability.py:18\u001b[0m, in \u001b[0;36mctc_limiting_tax_liability.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m no_salt_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mno_salt\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m no_salt_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msalt_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period, np\u001b[38;5;241m.\u001b[39mzeros(tax_unit\u001b[38;5;241m.\u001b[39mcount)\n\u001b[0;32m 17\u001b[0m )\n\u001b[1;32m---> 18\u001b[0m tax_liability_before_credits \u001b[38;5;241m=\u001b[39m \u001b[43mno_salt_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m non_refundable_credits \u001b[38;5;241m=\u001b[39m parameters(\n\u001b[0;32m 22\u001b[0m period\n\u001b[0;32m 23\u001b[0m )\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mirs\u001b[38;5;241m.\u001b[39mcredits\u001b[38;5;241m.\u001b[39mnon_refundable\n\u001b[0;32m 24\u001b[0m non_refundable_credits_ex_ctc \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m 25\u001b[0m x \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m non_refundable_credits \u001b[38;5;28;01mif\u001b[39;00m x \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon_refundable_ctc\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 26\u001b[0m ]\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\before_credits\\income_tax_main_rates.py:14\u001b[0m, in \u001b[0;36mincome_tax_main_rates.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 13\u001b[0m \u001b[38;5;66;03m# compute taxable income that is taxed at the main rates\u001b[39;00m\n\u001b[1;32m---> 14\u001b[0m full_taxable_income \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m cg_exclusion \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapital_gains_excluded_from_taxable_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 17\u001b[0m )\n\u001b[0;32m 18\u001b[0m taxinc \u001b[38;5;241m=\u001b[39m max_(\u001b[38;5;241m0\u001b[39m, full_taxable_income \u001b[38;5;241m-\u001b[39m cg_exclusion)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\taxable_income.py:14\u001b[0m, in \u001b[0;36mtaxable_income.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m agi \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madjusted_gross_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 13\u001b[0m exemptions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexemptions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 14\u001b[0m deductions \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income_deductions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(\u001b[38;5;241m0\u001b[39m, agi \u001b[38;5;241m-\u001b[39m exemptions \u001b[38;5;241m-\u001b[39m deductions)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\taxable_income_deductions.py:12\u001b[0m, in \u001b[0;36mtaxable_income_deductions.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 12\u001b[0m itemizes \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_unit_itemizes\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 13\u001b[0m deductions_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 14\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 15\u001b[0m )\n\u001b[0;32m 16\u001b[0m deductions_if_not_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_not_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_unit_itemizes.py:19\u001b[0m, in \u001b[0;36mtax_unit_itemizes.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mbranch_to_determine_itemization:\n\u001b[0;32m 15\u001b[0m \u001b[38;5;66;03m# determine federal itemization behavior by comparing tax liability\u001b[39;00m\n\u001b[0;32m 16\u001b[0m tax_liability_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_liability_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n\u001b[1;32m---> 19\u001b[0m tax_liability_if_not_itemizing \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_liability_if_not_itemizing\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 21\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 22\u001b[0m state_standard_deduction \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 23\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_standard_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 24\u001b[0m )\n\u001b[0;32m 25\u001b[0m state_itemized_deductions \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 26\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_itemized_deductions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 27\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_liability_if_not_itemizing.py:20\u001b[0m, in \u001b[0;36mtax_liability_if_not_itemizing.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m non_itemized_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnot_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m non_itemized_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_unit_itemizes\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 17\u001b[0m period,\n\u001b[0;32m 18\u001b[0m np\u001b[38;5;241m.\u001b[39mzeros((tax_unit\u001b[38;5;241m.\u001b[39mcount,), dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbool\u001b[39m),\n\u001b[0;32m 19\u001b[0m )\n\u001b[1;32m---> 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mnon_itemized_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax.py:18\u001b[0m, in \u001b[0;36mincome_tax.formula\u001b[1;34m(person, period, parameters)\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[43mperson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 22\u001b[0m person, period, [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mincome_tax_refundable_credits\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m 23\u001b[0m )\n\u001b[0;32m 24\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax_before_refundable_credits.py:29\u001b[0m, in \u001b[0;36mincome_tax_before_refundable_credits.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 19\u001b[0m tax_unit,\n\u001b[0;32m 20\u001b[0m period,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 27\u001b[0m ],\n\u001b[0;32m 28\u001b[0m )\n\u001b[1;32m---> 29\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mtax_unit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_capped_non_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:981\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m subtracted_variable \u001b[38;5;129;01min\u001b[39;00m subtracts_list:\n\u001b[0;32m 977\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m 978\u001b[0m subtracted_variable\n\u001b[0;32m 979\u001b[0m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables\n\u001b[0;32m 980\u001b[0m ):\n\u001b[1;32m--> 981\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m-\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 982\u001b[0m \u001b[43m \u001b[49m\u001b[43msubtracted_variable\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 983\u001b[0m \u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 984\u001b[0m \u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 985\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 986\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 987\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\refundable_ctc.py:34\u001b[0m, in \u001b[0;36mrefundable_ctc.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 31\u001b[0m maximum_refundable_ctc \u001b[38;5;241m=\u001b[39m min_(maximum_amount, total_ctc)\n\u001b[0;32m 33\u001b[0m phase_in \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mctc_phase_in\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 34\u001b[0m limiting_tax \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mctc_limiting_tax_liability\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 35\u001b[0m ctc_capped_by_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax)\n\u001b[0;32m 36\u001b[0m ctc_capped_by_increased_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax \u001b[38;5;241m+\u001b[39m phase_in)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\ctc_limiting_tax_liability.py:18\u001b[0m, in \u001b[0;36mctc_limiting_tax_liability.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m no_salt_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mno_salt\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m no_salt_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msalt_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period, np\u001b[38;5;241m.\u001b[39mzeros(tax_unit\u001b[38;5;241m.\u001b[39mcount)\n\u001b[0;32m 17\u001b[0m )\n\u001b[1;32m---> 18\u001b[0m tax_liability_before_credits \u001b[38;5;241m=\u001b[39m \u001b[43mno_salt_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m non_refundable_credits \u001b[38;5;241m=\u001b[39m parameters(\n\u001b[0;32m 22\u001b[0m period\n\u001b[0;32m 23\u001b[0m )\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39mirs\u001b[38;5;241m.\u001b[39mcredits\u001b[38;5;241m.\u001b[39mnon_refundable\n\u001b[0;32m 24\u001b[0m non_refundable_credits_ex_ctc \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m 25\u001b[0m x \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m non_refundable_credits \u001b[38;5;28;01mif\u001b[39;00m x \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon_refundable_ctc\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 26\u001b[0m ]\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\before_credits\\income_tax_main_rates.py:14\u001b[0m, in \u001b[0;36mincome_tax_main_rates.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 13\u001b[0m \u001b[38;5;66;03m# compute taxable income that is taxed at the main rates\u001b[39;00m\n\u001b[1;32m---> 14\u001b[0m full_taxable_income \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m cg_exclusion \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcapital_gains_excluded_from_taxable_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 17\u001b[0m )\n\u001b[0;32m 18\u001b[0m taxinc \u001b[38;5;241m=\u001b[39m max_(\u001b[38;5;241m0\u001b[39m, full_taxable_income \u001b[38;5;241m-\u001b[39m cg_exclusion)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\taxable_income.py:14\u001b[0m, in \u001b[0;36mtaxable_income.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m agi \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madjusted_gross_income\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[0;32m 13\u001b[0m exemptions \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexemptions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 14\u001b[0m deductions \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtaxable_income_deductions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m max_(\u001b[38;5;241m0\u001b[39m, agi \u001b[38;5;241m-\u001b[39m exemptions \u001b[38;5;241m-\u001b[39m deductions)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\taxable_income_deductions.py:12\u001b[0m, in \u001b[0;36mtaxable_income_deductions.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[1;32m---> 12\u001b[0m itemizes \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_unit_itemizes\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 13\u001b[0m deductions_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 14\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 15\u001b[0m )\n\u001b[0;32m 16\u001b[0m deductions_if_not_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtaxable_income_deductions_if_not_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_unit_itemizes.py:19\u001b[0m, in \u001b[0;36mtax_unit_itemizes.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m parameters(period)\u001b[38;5;241m.\u001b[39mgov\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mbranch_to_determine_itemization:\n\u001b[0;32m 15\u001b[0m \u001b[38;5;66;03m# determine federal itemization behavior by comparing tax liability\u001b[39;00m\n\u001b[0;32m 16\u001b[0m tax_liability_if_itemizing \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_liability_if_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 18\u001b[0m )\n\u001b[1;32m---> 19\u001b[0m tax_liability_if_not_itemizing \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtax_liability_if_not_itemizing\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\n\u001b[0;32m 21\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 22\u001b[0m state_standard_deduction \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 23\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_standard_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 24\u001b[0m )\n\u001b[0;32m 25\u001b[0m state_itemized_deductions \u001b[38;5;241m=\u001b[39m tax_unit(\n\u001b[0;32m 26\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstate_itemized_deductions\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 27\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\income\\taxable_income\\deductions\\tax_liability_if_not_itemizing.py:20\u001b[0m, in \u001b[0;36mtax_liability_if_not_itemizing.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 14\u001b[0m non_itemized_branch \u001b[38;5;241m=\u001b[39m simulation\u001b[38;5;241m.\u001b[39mget_branch(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnot_itemizing\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m non_itemized_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtax_unit_itemizes\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 17\u001b[0m period,\n\u001b[0;32m 18\u001b[0m np\u001b[38;5;241m.\u001b[39mzeros((tax_unit\u001b[38;5;241m.\u001b[39mcount,), dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbool\u001b[39m),\n\u001b[0;32m 19\u001b[0m )\n\u001b[1;32m---> 20\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mnon_itemized_branch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax.py:18\u001b[0m, in \u001b[0;36mincome_tax.formula\u001b[1;34m(person, period, parameters)\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[43mperson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_before_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 20\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 21\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 22\u001b[0m person, period, [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mincome_tax_refundable_credits\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m 23\u001b[0m )\n\u001b[0;32m 24\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\tax\\federal_income\\income_tax_before_refundable_credits.py:29\u001b[0m, in \u001b[0;36mincome_tax_before_refundable_credits.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 18\u001b[0m added_components \u001b[38;5;241m=\u001b[39m add(\n\u001b[0;32m 19\u001b[0m tax_unit,\n\u001b[0;32m 20\u001b[0m period,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 27\u001b[0m ],\n\u001b[0;32m 28\u001b[0m )\n\u001b[1;32m---> 29\u001b[0m subtracted_components \u001b[38;5;241m=\u001b[39m \u001b[43madd\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mtax_unit\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mincome_tax_capped_non_refundable_credits\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m added_components \u001b[38;5;241m-\u001b[39m subtracted_components\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:232\u001b[0m, in \u001b[0;36madd\u001b[1;34m(entity, period, variables, options)\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21madd\u001b[39m(\n\u001b[0;32m 213\u001b[0m entity: Population,\n\u001b[0;32m 214\u001b[0m period: Period,\n\u001b[0;32m 215\u001b[0m variables: List[\u001b[38;5;28mstr\u001b[39m],\n\u001b[0;32m 216\u001b[0m options: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m 217\u001b[0m ):\n\u001b[0;32m 218\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Sums a list of variables.\u001b[39;00m\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 230\u001b[0m \u001b[38;5;124;03m ArrayLike: The result of the operation.\u001b[39;00m\n\u001b[0;32m 231\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfor_each_variable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 233\u001b[0m \u001b[43m \u001b[49m\u001b[43mentity\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvariables\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43magg_func\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43madd\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\n\u001b[0;32m 234\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\commons\\formulas.py:188\u001b[0m, in \u001b[0;36mfor_each_variable\u001b[1;34m(entity, period, variables, agg_func, group_agg_func, options)\u001b[0m\n\u001b[0;32m 186\u001b[0m variable_entity \u001b[38;5;241m=\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mget_variable(variable)\u001b[38;5;241m.\u001b[39mentity\n\u001b[0;32m 187\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mkey \u001b[38;5;241m==\u001b[39m entity\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey:\n\u001b[1;32m--> 188\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[43mentity\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 189\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m variable_entity\u001b[38;5;241m.\u001b[39mis_person:\n\u001b[0;32m 190\u001b[0m values \u001b[38;5;241m=\u001b[39m group_agg_func(\n\u001b[0;32m 191\u001b[0m entity\u001b[38;5;241m.\u001b[39mmembers(variable, period, options\u001b[38;5;241m=\u001b[39moptions)\n\u001b[0;32m 192\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:946\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 944\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m adds_list:\n\u001b[0;32m 945\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m added_variable \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables:\n\u001b[1;32m--> 946\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m+\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43madded_variable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\n\u001b[0;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 949\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 950\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:981\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 976\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m subtracted_variable \u001b[38;5;129;01min\u001b[39;00m subtracts_list:\n\u001b[0;32m 977\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m 978\u001b[0m subtracted_variable\n\u001b[0;32m 979\u001b[0m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtax_benefit_system\u001b[38;5;241m.\u001b[39mvariables\n\u001b[0;32m 980\u001b[0m ):\n\u001b[1;32m--> 981\u001b[0m values \u001b[38;5;241m=\u001b[39m values \u001b[38;5;241m-\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 982\u001b[0m \u001b[43m \u001b[49m\u001b[43msubtracted_variable\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 983\u001b[0m \u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 984\u001b[0m \u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariable\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mentity\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 985\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 986\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 987\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + " \u001b[1;31m[... skipping similar frames: Simulation._calculate at line 721 (1 times), Simulation._run_formula at line 1011 (1 times), Microsimulation.calculate at line 54 (1 times), Simulation.calculate at line 491 (1 times)]\u001b[0m\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\refundable_ctc.py:34\u001b[0m, in \u001b[0;36mrefundable_ctc.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 31\u001b[0m maximum_refundable_ctc \u001b[38;5;241m=\u001b[39m min_(maximum_amount, total_ctc)\n\u001b[0;32m 33\u001b[0m phase_in \u001b[38;5;241m=\u001b[39m tax_unit(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mctc_phase_in\u001b[39m\u001b[38;5;124m\"\u001b[39m, period)\n\u001b[1;32m---> 34\u001b[0m limiting_tax \u001b[38;5;241m=\u001b[39m \u001b[43mtax_unit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mctc_limiting_tax_liability\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 35\u001b[0m ctc_capped_by_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax)\n\u001b[0;32m 36\u001b[0m ctc_capped_by_increased_tax \u001b[38;5;241m=\u001b[39m min_(total_ctc, limiting_tax \u001b[38;5;241m+\u001b[39m phase_in)\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\group_population.py:38\u001b[0m, in \u001b[0;36mGroupPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msum(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmembers(variable_name, period, options))\n\u001b[0;32m 37\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m---> 38\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__call__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:142\u001b[0m, in \u001b[0;36mPopulation.__call__\u001b[1;34m(self, variable_name, period, options)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msimulation\u001b[38;5;241m.\u001b[39mcalculate_divide(\n\u001b[0;32m 139\u001b[0m variable_name, period, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mcalculate_kwargs\n\u001b[0;32m 140\u001b[0m )\n\u001b[0;32m 141\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 143\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mcalculate_kwargs\u001b[49m\n\u001b[0;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\microsimulation.py:54\u001b[0m, in \u001b[0;36mMicrosimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, use_weights, decode_enums)\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 53\u001b[0m period \u001b[38;5;241m=\u001b[39m get_period(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault_calculation_period)\n\u001b[1;32m---> 54\u001b[0m values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmap_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdecode_enums\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m use_weights:\n\u001b[0;32m 56\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m values\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:491\u001b[0m, in \u001b[0;36mSimulation.calculate\u001b[1;34m(self, variable_name, period, map_to, decode_enums)\u001b[0m\n\u001b[0;32m 488\u001b[0m np\u001b[38;5;241m.\u001b[39mrandom\u001b[38;5;241m.\u001b[39mseed(\u001b[38;5;28mhash\u001b[39m(variable_name \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(period)) \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m1000000\u001b[39m)\n\u001b[0;32m 490\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 491\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_calculate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, EnumArray) \u001b[38;5;129;01mand\u001b[39;00m decode_enums:\n\u001b[0;32m 493\u001b[0m result \u001b[38;5;241m=\u001b[39m result\u001b[38;5;241m.\u001b[39mdecode_to_str()\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:721\u001b[0m, in \u001b[0;36mSimulation._calculate\u001b[1;34m(self, variable_name, period)\u001b[0m\n\u001b[0;32m 719\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 720\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_for_cycle(variable\u001b[38;5;241m.\u001b[39mname, period)\n\u001b[1;32m--> 721\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_run_formula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 723\u001b[0m \u001b[38;5;66;03m# If no result, use the default value and cache it\u001b[39;00m\n\u001b[0;32m 724\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m array \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 725\u001b[0m \u001b[38;5;66;03m# Check if the variable has a previously defined value\u001b[39;00m\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1011\u001b[0m, in \u001b[0;36mSimulation._run_formula\u001b[1;34m(self, variable, population, period)\u001b[0m\n\u001b[0;32m 1009\u001b[0m array \u001b[38;5;241m=\u001b[39m formula(population, period)\n\u001b[0;32m 1010\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1011\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[43mformula\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters_at\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\n", + "File \u001b[1;32m~\\PolicyEngine\\policyengine-us\\policyengine_us\\variables\\gov\\irs\\credits\\ctc\\refundable\\ctc_limiting_tax_liability.py:14\u001b[0m, in \u001b[0;36mctc_limiting_tax_liability.formula\u001b[1;34m(tax_unit, period, parameters)\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mformula\u001b[39m(tax_unit, period, parameters):\n\u001b[0;32m 13\u001b[0m simulation \u001b[38;5;241m=\u001b[39m tax_unit\u001b[38;5;241m.\u001b[39msimulation\n\u001b[1;32m---> 14\u001b[0m no_salt_branch \u001b[38;5;241m=\u001b[39m \u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_branch\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mno_salt\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 15\u001b[0m no_salt_branch\u001b[38;5;241m.\u001b[39mset_input(\n\u001b[0;32m 16\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msalt_deduction\u001b[39m\u001b[38;5;124m\"\u001b[39m, period, np\u001b[38;5;241m.\u001b[39mzeros(tax_unit\u001b[38;5;241m.\u001b[39mcount)\n\u001b[0;32m 17\u001b[0m )\n\u001b[0;32m 18\u001b[0m tax_liability_before_credits \u001b[38;5;241m=\u001b[39m no_salt_branch\u001b[38;5;241m.\u001b[39mcalculate(\n\u001b[0;32m 19\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mincome_tax_before_credits\u001b[39m\u001b[38;5;124m\"\u001b[39m, period\n\u001b[0;32m 20\u001b[0m )\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1323\u001b[0m, in \u001b[0;36mSimulation.get_branch\u001b[1;34m(self, name, clone_system)\u001b[0m\n\u001b[0;32m 1321\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m name \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbranches:\n\u001b[0;32m 1322\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbranches[name]\n\u001b[1;32m-> 1323\u001b[0m branch \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclone\u001b[49m\u001b[43m(\u001b[49m\u001b[43mclone_tax_benefit_system\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclone_system\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1324\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbranches[name] \u001b[38;5;241m=\u001b[39m branch\n\u001b[0;32m 1325\u001b[0m branch\u001b[38;5;241m.\u001b[39mbranch_name \u001b[38;5;241m=\u001b[39m name\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\simulations\\simulation.py:1287\u001b[0m, in \u001b[0;36mSimulation.clone\u001b[1;34m(self, debug, trace, clone_tax_benefit_system)\u001b[0m\n\u001b[0;32m 1284\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdebug\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrace\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtracer\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbranches\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[0;32m 1285\u001b[0m new_dict[key] \u001b[38;5;241m=\u001b[39m value\n\u001b[1;32m-> 1287\u001b[0m new\u001b[38;5;241m.\u001b[39mpersons \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpersons\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclone\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnew\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1288\u001b[0m \u001b[38;5;28msetattr\u001b[39m(new, new\u001b[38;5;241m.\u001b[39mpersons\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey, new\u001b[38;5;241m.\u001b[39mpersons)\n\u001b[0;32m 1289\u001b[0m new\u001b[38;5;241m.\u001b[39mpopulations \u001b[38;5;241m=\u001b[39m {new\u001b[38;5;241m.\u001b[39mpersons\u001b[38;5;241m.\u001b[39mentity\u001b[38;5;241m.\u001b[39mkey: new\u001b[38;5;241m.\u001b[39mpersons}\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:29\u001b[0m, in \u001b[0;36mPopulation.clone\u001b[1;34m(self, simulation)\u001b[0m\n\u001b[0;32m 27\u001b[0m result \u001b[38;5;241m=\u001b[39m Population(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mentity)\n\u001b[0;32m 28\u001b[0m result\u001b[38;5;241m.\u001b[39msimulation \u001b[38;5;241m=\u001b[39m simulation\n\u001b[1;32m---> 29\u001b[0m result\u001b[38;5;241m.\u001b[39m_holders \u001b[38;5;241m=\u001b[39m \u001b[43m{\u001b[49m\n\u001b[0;32m 30\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mholder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclone\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresult\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mholder\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_holders\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 32\u001b[0m \u001b[43m\u001b[49m\u001b[43m}\u001b[49m\n\u001b[0;32m 33\u001b[0m result\u001b[38;5;241m.\u001b[39mcount \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcount\n\u001b[0;32m 34\u001b[0m result\u001b[38;5;241m.\u001b[39mids \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mids\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\populations\\population.py:30\u001b[0m, in \u001b[0;36m\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 27\u001b[0m result \u001b[38;5;241m=\u001b[39m Population(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mentity)\n\u001b[0;32m 28\u001b[0m result\u001b[38;5;241m.\u001b[39msimulation \u001b[38;5;241m=\u001b[39m simulation\n\u001b[0;32m 29\u001b[0m result\u001b[38;5;241m.\u001b[39m_holders \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m---> 30\u001b[0m variable: \u001b[43mholder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclone\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresult\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 31\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m (variable, holder) \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_holders\u001b[38;5;241m.\u001b[39mitems()\n\u001b[0;32m 32\u001b[0m }\n\u001b[0;32m 33\u001b[0m result\u001b[38;5;241m.\u001b[39mcount \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcount\n\u001b[0;32m 34\u001b[0m result\u001b[38;5;241m.\u001b[39mids \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mids\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\holders\\holder.py:66\u001b[0m, in \u001b[0;36mHolder.clone\u001b[1;34m(self, population)\u001b[0m\n\u001b[0;32m 58\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m (\n\u001b[0;32m 59\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpopulation\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 60\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mformula\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 61\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msimulation\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 62\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_memory_storage\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 63\u001b[0m ):\n\u001b[0;32m 64\u001b[0m new_dict[key] \u001b[38;5;241m=\u001b[39m value\n\u001b[1;32m---> 66\u001b[0m new\u001b[38;5;241m.\u001b[39m_memory_storage \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_memory_storage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclone\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 68\u001b[0m new_dict[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpopulation\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m population\n\u001b[0;32m 69\u001b[0m new_dict[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msimulation\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m population\u001b[38;5;241m.\u001b[39msimulation\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\data_storage\\in_memory_storage.py:24\u001b[0m, in \u001b[0;36mInMemoryStorage.clone\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mclone\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInMemoryStorage\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m 23\u001b[0m clone \u001b[38;5;241m=\u001b[39m InMemoryStorage(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_eternal)\n\u001b[1;32m---> 24\u001b[0m clone\u001b[38;5;241m.\u001b[39m_arrays \u001b[38;5;241m=\u001b[39m \u001b[43m{\u001b[49m\n\u001b[0;32m 25\u001b[0m \u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43marray\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcopy\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mperiod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43marray\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_arrays\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 26\u001b[0m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\n\u001b[0;32m 27\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m clone\n", + "File \u001b[1;32mc:\\Users\\dtsax\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\policyengine_core\\data_storage\\in_memory_storage.py:25\u001b[0m, in \u001b[0;36m\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mclone\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInMemoryStorage\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m 23\u001b[0m clone \u001b[38;5;241m=\u001b[39m InMemoryStorage(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mis_eternal)\n\u001b[0;32m 24\u001b[0m clone\u001b[38;5;241m.\u001b[39m_arrays \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m---> 25\u001b[0m period: array\u001b[38;5;241m.\u001b[39mcopy() \u001b[38;5;28;01mfor\u001b[39;00m period, array \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_arrays\u001b[38;5;241m.\u001b[39mitems()\n\u001b[0;32m 26\u001b[0m }\n\u001b[0;32m 27\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m clone\n", + "\u001b[1;31mMemoryError\u001b[0m: Unable to allocate 557. KiB for an array with shape (142574,) and data type float32" + ] + } + ], + "source": [ + "# Project revenue over multiple years\n", + "years = range(2027, 2035)\n", + "revenue_results = []\n", + "\n", + "for year in years:\n", + " surtax = reformed.calc(\"mi_surtax\", period=year)\n", + " revenue = surtax.sum()\n", + " payers = (surtax > 0).sum()\n", + " revenue_results.append({\n", + " \"Year\": year,\n", + " \"Revenue ($B)\": revenue / 1e9,\n", + " \"Tax Units Paying\": int(payers)\n", + " })\n", + "\n", + "revenue_df = pd.DataFrame(revenue_results)\n", + "revenue_df" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Visualize multi-year revenue\n", + "fig = px.bar(\n", + " revenue_df,\n", + " x=\"Year\",\n", + " y=\"Revenue ($B)\",\n", + " title=\"Michigan Surtax: Projected Annual Revenue (2027-2034)\",\n", + " text=\"Revenue ($B)\",\n", + ")\n", + "fig.update_traces(texttemplate=\"$%{text:.2f}B\", textposition=\"outside\")\n", + "fig.update_layout(\n", + " xaxis=dict(tickmode=\"linear\", tick0=2027, dtick=1),\n", + " yaxis=dict(tickformat=\"$,.2f\"),\n", + ")\n", + "fig = format_fig(fig)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Calculate 10-year total\n", + "ten_year_total = revenue_df[\"Revenue ($B)\"].sum()\n", + "print(f\"Total 8-year revenue (2027-2034): ${ten_year_total:.2f} billion\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Surtax Distribution Analysis" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Analyze distribution of surtax amounts among payers\n", + "payers_surtax = mi_surtax[mi_surtax > 0]\n", + "\n", + "print(\"Distribution of Surtax Amounts Among Payers:\")\n", + "print(f\" Minimum: ${payers_surtax.min():,.0f}\")\n", + "print(f\" 25th percentile: ${np.percentile(payers_surtax.values, 25):,.0f}\")\n", + "print(f\" Median: ${payers_surtax.median():,.0f}\")\n", + "print(f\" Mean: ${payers_surtax.mean():,.0f}\")\n", + "print(f\" 75th percentile: ${np.percentile(payers_surtax.values, 75):,.0f}\")\n", + "print(f\" Maximum: ${payers_surtax.max():,.0f}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Export results to CSV\n", + "revenue_df.to_csv(\"mi_surtax_revenue.csv\", index=False)\n", + "bracket_df.to_csv(\"mi_surtax_income_brackets.csv\", index=False)\n", + "filing_df.to_csv(\"mi_surtax_filing_status.csv\", index=False)\n", + "print(\"Results exported to CSV files\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Summary\n", + "\n", + "The Michigan \"Invest in Our Kids\" surtax would:\n", + "\n", + "- **Revenue**: Generate approximately $5.7 billion annually in 2027\n", + "- **Single filers**: 5% surtax on taxable income above $500,000\n", + "- **Joint filers**: 5% surtax on taxable income above $1,000,000\n", + "- **Affected population**: A small percentage of Michigan taxpayers (primarily high-income households)\n", + "- **Revenue source**: Majority comes from joint filers with income over $1 million\n", + "\n", + "The revenue would be used for education funding as proposed in the ballot initiative." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}