def test_MH_no_validate(qi: float, Di: float, Dterm: float) -> None: assume( dca.MH.nominal_from_secant(Di, 1.0) >= dca.MH.nominal_from_tangent( Dterm)) with pytest.raises(ValueError) as e: mh = dca.MH(qi, Di, 2.5, Dterm) mh = dca.MH(qi, Di, 2.5, Dterm, validate_params=[True, True, False, True])
def test_MH(qi: float, Di: float, bi: float, Dterm: float) -> None: assume( dca.MH.nominal_from_secant(Di, bi) >= dca.MH.nominal_from_tangent( Dterm)) mh = dca.MH(qi, Di, bi, Dterm) check_model(mh, qi) mh = dca.MH(qi, 0.0, bi, 0.0) check_model(mh, qi)
def test_terminal_exceeds() -> None: with pytest.raises(ValueError) as e: # Dinf > Di ple = dca.PLE(1000, 0.8, 0.9, 0.5) with pytest.raises(ValueError) as e: # Dterm > Di mh = dca.MH(1000, 0.5, 1.0, 0.9) with pytest.raises(ValueError) as e: # bf > bi thm = dca.THM(1000, 0.8, 1.5, 1.6, 30.0) with pytest.raises(ValueError) as e: # tterm < telf thm = dca.THM(1000, 0.8, 2.0, 1.0, 200.0, 0.3, 100.0 / dca.DAYS_PER_YEAR)
def test_MH_harmonic(qi: float, Di: float, Dterm: float) -> None: assume( dca.MH.nominal_from_secant(Di, 1.0) >= dca.MH.nominal_from_tangent( Dterm)) mh = dca.MH(qi, Di, 1.0, Dterm) check_model(mh, qi)
thm = dca.THM(qi=750, Di=.8, bi=2, bf=.5, telf=28) q_trans = thm.transient_rate(ftime) N_trans = thm.transient_cum(ftime) D_trans = thm.transient_D(ftime) b_trans = thm.transient_b(ftime) beta_trans = thm.transient_beta(ftime) # q_thm = thm.rate(ftime) N_thm = thm.cum(ftime) D_thm = thm.D(ftime) b_thm = thm.b(ftime) beta_thm = thm.beta(ftime) # mh = dca.MH(qi=725, Di=0.85, bi=0.6, Dterm=0.2) q_mh = mh.rate(ftime) N_mh = mh.cum(ftime) N_mh = mh.monthly_vol(ftime) N_mh = mh.interval_vol(ftime) D_mh = mh.D(ftime) b_mh = mh.b(ftime) beta_mh = mh.beta(ftime) # ple = dca.PLE(qi=750, Di=.1, Dinf=.00001, n=.5) q_ple = ple.rate(ftime) N_ple = ple.cum(ftime) N_ple = ple.monthly_vol(ftime) N_ple = ple.interval_vol(ftime) D_ple = ple.D(ftime)