Skip to content

Commit

Permalink
version 0.6.3
Browse files Browse the repository at this point in the history
* Finalised NSES example
  • Loading branch information
millen1m committed Oct 31, 2019
1 parent 295c0f8 commit 55e0b63
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 48 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
History
=======

0.6.3 (2019-10-X)
0.6.3 (2019-10-31)
--------------------
* Added missing `import eqsig` at top of lq.element.assess.py file - used in `calc_stored_energy_abs_incs_fd_peaks_and_indices` function
* Finalised NSES example

0.6.2 (2019-10-30)
--------------------
Expand Down
12 changes: 6 additions & 6 deletions examples/estimate_strain_energy_w_depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ def create(save=0, show=0):

# Perform linear site response analysis
odepths, cake, case = calc_case_and_cake_from_lin_analysis(sp, m)
sps[0].plot(case / in_cake, odepths, ls="-", label="Linear $\\xi={0:.0f}$%".format(damp * 100), c=cbox(0), lw=1)
sps[1].plot(cake / in_cake, odepths, ls="-", ms=2, label="Linear $\\xi={0:.0f}$%".format(damp * 100), c=cbox(0))
sps[0].plot(case / in_cake, odepths, ls="-", label="Linear analysis $\\xi={0:.0f}$%".format(damp * 100), c=cbox(0), lw=1)
sps[1].plot(cake / in_cake, odepths, ls="-", ms=2, label="Linear analysis $\\xi={0:.0f}$%".format(damp * 100), c=cbox(0))

# Estimate CASE and CAKE using the input motion with method from Millen et al. (2019)

pred_case = lq.trigger.nses.est_case_1d_millen_et_al_2019(sp, in_signal, odepths, xi=damp)[:, -1]
pred_cake = lq.trigger.nses.est_case_1d_millen_et_al_2019(sp, in_signal, odepths, xi=damp, nodal=False)[:, -1]
sps[0].plot(pred_case / in_cake, odepths, 's', label="NSES (base)", c=cbox(1), ms=3, alpha=0.6)
sps[1].plot(pred_cake / in_cake, odepths, 's', label="ASES (base)", c=cbox(1), ms=3, alpha=0.6)
sps[0].plot(pred_case / in_cake, odepths, 's', label="NSES Estimate (base)", c=cbox(1), ms=3, alpha=0.6)
sps[1].plot(pred_cake / in_cake, odepths, 's', label="ASES Estimate (base)", c=cbox(1), ms=3, alpha=0.6)

# get surface motion
oseries, profile, calc = run_sra(sp, m, [0])
Expand All @@ -169,8 +169,8 @@ def create(save=0, show=0):

pred_cake = lq.trigger.nses.est_case_1d_millen_et_al_2019(sp, surf_sig, odepths, xi=damp, in_loc=0,
nodal=False)[:, -1]
sps[0].plot(pred_case / in_cake, odepths, "x", ms=3, label="NSES (surf)", c=cbox(3))
sps[1].plot(pred_cake / in_cake, odepths, "x", ms=3, label="ASES (surf)", c=cbox(3))
sps[0].plot(pred_case / in_cake, odepths, "x", ms=3, label="NSES Estimate (surf)", c=cbox(3))
sps[1].plot(pred_cake / in_cake, odepths, "x", ms=3, label="ASES Estimate (surf)", c=cbox(3))

# Clean plot
sps[0].set_ylabel("Depth [m]")
Expand Down
280 changes: 250 additions & 30 deletions examples/example2_estimate_cumulative_strain_energy_w_depth.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion liquepy/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.6.2"
__version__ = "0.6.3"
__project__ = "liquepy"
__author__ = "Maxim Millen and Julieth Quintero"
__license__ = "MIT"
15 changes: 5 additions & 10 deletions liquepy/trigger/nses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def calc_energy_ratio_w_time(xi, total_time, time, av_period):


def est_case_1d_millen_et_al_2019(sp, asig, depth, xi, g_mod_red=1.0, trim=False, start=False, period=0.5, exact=False,
in_loc=1, g_scale_limit=10, nodal=True):
in_loc=1, g_scale_limit=1e3, nodal=True):
"""
Calculates the Cumulative absolute change in strain energy according to Millen et al. (2019)
Expand Down Expand Up @@ -78,10 +78,7 @@ def est_case_1d_millen_et_al_2019(sp, asig, depth, xi, g_mod_red=1.0, trim=False
stt = 0.0
else:
soil_in = sp.get_soil_at_depth(sp.height)
if start:
stt = total_time
else:
stt = 0.0
stt = total_time
down_red = np.exp(-xi * time_at_depth * 2 * np.pi / period) ** 2 * surf_reduction
spectra_series = eqsig.surface.calc_cum_abs_surface_energy(asig, time_at_depth, up_red=up_red,
down_red=down_red, trim=trim, nodal=nodal, stt=stt)
Expand All @@ -95,11 +92,9 @@ def est_case_1d_millen_et_al_2019(sp, asig, depth, xi, g_mod_red=1.0, trim=False
else:
soil_in = sp.get_soil_at_depth(sp.height)
red_ratio = red_at_surf + (1 - red_at_surf) / 2 * time_at_depth / total_time
if start:
stt = total_time
else:
stt = 0.0
spectra_series = eqsig.surface.calc_cum_abs_surface_energy(asig, time_at_depth, trim=trim, nodal=nodal, stt=stt)
stt = total_time
spectra_series = eqsig.surface.calc_cum_abs_surface_energy(asig, time_at_depth, trim=trim, nodal=nodal, stt=stt,
start=start)
spectra_series = red_ratio[:, np.newaxis] * np.asarray(spectra_series)
rho_in = soil_in.unit_dry_weight / 9.8
g_in = np.interp(in_depth, split_depths, split_g_mod)
Expand Down

0 comments on commit 55e0b63

Please sign in to comment.