def calc_base(self): """ Call functions for the current_year. This involves updating depreciation methods, computing the npv of depreciation (z), and computing the cost of capital (rho) and then calling the calc_all() function to do computations that dependon rho and z. """ # conducts static analysis of Calculator object for current_year self.__assets.df = update_depr_methods(self.__assets.df, self.__p) dfs = {'c': self.__assets.df[ self.__assets.df['tax_treat'] == 'corporate'].copy(), 'nc': self.__assets.df[ self.__assets.df['tax_treat'] == 'non-corporate'].copy()} # separate into corp and non-corp dataframe here for t in self.__p.entity_list: for f in self.__p.financing_list: dfs[t]['z_' + str(f)] = npv_tax_depr( dfs[t], self.__p.r[t][f], self.__p.inflation_rate, self.__p.land_expensing) dfs[t]['rho_' + str(f)] = eq_coc( dfs[t]['delta'], dfs[t]['z_' + str(f)], self.__p.property_tax, self.__p.u[t], self.__p.inv_tax_credit, self.__p.inflation_rate, self.__p.r[t][f]) if not self.__p.inventory_expensing: idx = dfs[t]['asset_name'] == 'Inventories' dfs[t].loc[idx, 'rho_' + str(f)] = eq_coc_inventory( self.__p.u[t], self.__p.phi, self.__p.Y_v, self.__p.inflation_rate, self.__p.r[t][f]) self.__assets.df = pd.concat(dfs, ignore_index=True, copy=True, sort=True)
def test_npv_tax_depr(df, r, pi, land_expensing, expected_df): test_df = cf.npv_tax_depr(df, r, pi, land_expensing) print('Types = ', type(test_df), type(expected_df)) assert_series_equal(test_df, expected_df)