def test_DS1_DS2(self): print 'test 18' pos = damage_allocator.damage_state_position([1,2,3], [[0.5,1,4],[1.5,1.8,4]]) self.assertTrue(numpy.allclose(pos,[[1,0,0,0],[0,1,0,0]]))
def test_DS2(self): pos = damage_allocator.damage_state_position([1,2,3], [[1.5,2.5,2.8],[1.5,2.5,4]]) self.assertTrue(numpy.allclose(pos,[[0,0,1,0],[0,0,0,1]]))
data.append(es_ls3) data.append(betas) # print data collapse_type = capacity_calculations.compute_collapse_type(data) collapse_type = 'Beam Sway' #Compute capacity displacement capacityDisp = capacity_calculations.compute_disps(data,collapse_type) ductilities = capacity_calculations.compute_ductility(capacityDisp) periods = capacity_calculations.compute_periods(data,ductilities) elasticPeriods.append(periods[0]) #Compute demand displacement demandDisp = demand_calculations.compute_demand_displacement(data,periods,spectraDisp,spectraPeriods,damping,ACCELEROGRAMS,ductilities) DSpositions = damage_allocator.damage_state_position(capacityDisp, demandDisp) damageStates=damageStates+DSpositions print capacityDisp # print demandDisp # print ductilities # print periods # Compute the imls for each accelerogram imlDamageStates = demand_calculations.compute_imls_damage_states(elasticPeriods,ACCELEROGRAMS,IMTs,IMTVALUES) # Compute the best logarithmic mean and standard deviation for each curve fit_curve.compute_best_curves(imlDamageStates,damageStates,IMTs) # Compute statistics for each fragility curve setIMLs,LS1PEs,LS2PEs,LS3PEs = fit_curve.generate_synthetic_datasets(imlDamageStates,damageStates,5) statistics = fit_curve.compute_statistics(setIMLs,LS1PEs,LS2PEs,LS3PEs)