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_eq_coc_inventory(u, phi, Y_v, pi, r, expected_val): test_val = cf.eq_coc_inventory(u, phi, Y_v, pi, r) assert(np.allclose(test_val, expected_val))
def test_eq_coc_inventory(u, phi, Y_v, pi, r, expected_val): test_val = cf.eq_coc_inventory(u, phi, Y_v, pi, r) assert (np.allclose(test_val, expected_val))