def test_parse_portfolio(self): lines = portfolio_builder.parse_input(self.exposure_path) parameters = portfolio_builder.buildings_counter(lines) number_categories = parameters[0] number_assets = parameters[1] self.assertEqual(number_categories, 2) self.assertEqual(number_assets, [7, 4])
import damage_allocator import fit_curve # COMPUTE THE SPECTRA BASED ON A SET OF ACCELEROGRAMS minPeriod = 0.05 maxPeriod = 10.0 step = 0.04 damping = 0.05 spectraPeriods = demand_calculations.compute_spectra_periods(minPeriod,maxPeriod,step) spectraDisp = demand_calculations.compute_spectra(minPeriod,maxPeriod,step,damping,ACCELEROGRAMS,SPECTRA) numberAccs = len(spectraDisp) print 'Spectra produced' # READ THE PORFOLIO OF BUILDINGS lines = portfolio_builder.parse_input(EXPOSURE) assets_count = portfolio_builder.buildings_counter(lines) number_categories = int(assets_count[0]) number_assets = assets_count[1] # CREATE THE VECTOR FOR THE DAMAGE STATES AND BETA FOR INFILLED FRAMES damageStates= numarray.zeros(4) IMTs=['PGA','PGV','Sa03','Saelastic'] elasticPeriods = [] betas = [0.52, 0.46, 0.28] # COMPUTE THE DISPLACAMENT FOR EACH BUILDING for asset_category in range(number_categories): for asset in range(number_assets[asset_category]): data = portfolio_builder.create_asset(lines[asset_category]) code=data[1]