Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug related to backbone curve #29

Open
VahedCivil opened this issue Jul 31, 2023 · 5 comments
Open

Bug related to backbone curve #29

VahedCivil opened this issue Jul 31, 2023 · 5 comments

Comments

@VahedCivil
Copy link

VahedCivil commented Jul 31, 2023

Hello
I had a number of hysteresis charts that I drew the bone curve with the hysteresis library. In one of the hysteresis curves, there was a mistake in the bone drawing, which is probably related to the bug. I will upload the necessary data, please guide me if possible.

Download hystersis data -> hystersis data.csv

Download loading protocol -> SAC Loading protocol.csv

hystersis and backbone curve

@cslotboom
Copy link
Owner

Hey Vahed, interesting. Yeah that last data point is very suspicious. Are you comfortable sharing any of your code so I can see if I can replicate the issue?

@VahedCivil
Copy link
Author

VahedCivil commented Jul 31, 2023

Hi Mr. @cslotboom
Yes of course.

Source code

import numpy as np
import matplotlib.pyplot as plt
import hysteresis as hys

hystFileName = r"hystersis data.csv"
data = np.loadtxt(hystFileName, delimiter=',', skiprows=1)
myHys = hys.Hysteresis(data)
LPsteps = [6,6,6,4,2,2,2,2]
bavg, _, _ = hys.getAvgBackbone(myHys, LPsteps, returnPeaks=True)
myEEEP = hys.fitEEEP(bavg)

fig, ax = plt.subplots()
line1 = myHys.plot(linewidth = 0.7, label = 'Hysteresis curve')
line2 = bavg.plot(linestyle = '-.', label =  'Avg. Backbone')
line3 = myEEEP.plot(color = 'black', label = 'EEEP Curve')
plt.minorticks_on()
ax.grid(which='major', color='grey', linewidth=0.5, alpha = 0.8)
ax.grid(which='minor', linewidth=0.5, alpha = 0.4)
# ax.legend(loc='lower right')
ax.legend()
ax.set_xlabel('Displacement (mm)')
ax.set_ylabel('Force (kN)')

In the above code, two more steps should be defined in the LPsteps variable, which causes an error. The correct value of LPsteps is as follows:

LPsteps = [6, 6, 6, 4, 2, 2, 2, 2, 2]

Loading scheme according to SAC loading protocol

Loading scheme according to SAC loading protocol

Also, myHys.cycles does not return a complete cycle of the hysteresis loop:

fig, ax = plt.subplots()
cycle = myHys.cycles[-1]
curvexy = cycle.xy
ax.plot(curvexy[:, 0] , curvexy[:, 1])

fig, ax = plt.subplots()
for cycle in myHys.cycles[0:3]:
    curvexy = cycle.xy
    ax.plot(curvexy[:, 0] , curvexy[:, 1])

fig, ax = plt.subplots()
for cycle in myHys.cycles[4:6]:
    curvexy = cycle.xy
    ax.plot(curvexy[:, 0] , curvexy[:, 1])

@cslotboom
Copy link
Owner

So, I'm looking into this. On my end I was able to get this plot:

image

Try to upgrade to the latest version, which is 2.0.1, and see if you get a plot similar to mine. You can upgrade in your console with:

pip install hysteresis --upgrade

Regarding the LPsteps, there does seem to be something slightly off with getAvgBackbone, I'm reviewing it, but for now I would use your temporary fix.

Regrading the cycles - right now this is expected behavior. What we're plotting is probably more accurately defined as a "half-cycle". I'm realizing calling them cycles is confusing.

I'm going to consider changing the name, but I need to be careful because many parts of the package reference this attribute.

@VahedCivil
Copy link
Author

VahedCivil commented Aug 4, 2023

Hello Mr. @cslotboom
Thank you for solving the bugs. I'm upgraded the package and I get this:

hystersis and backbone curve-new_version

I am busy now, but in the coming months I will try to help you in adding new features to the package.
It is suggested to add ASCE/SEI 41-17 code to convert skeleton curve to ideal bilinear.

@cslotboom
Copy link
Owner

Glad this is working for you now. I'd love to add a additional function for ASCE/SEI 41-17 to convert to ideal bilinear.

I discovered a "off by one" error with the backbone function on LP steps, that why you have to add less cycle than the correct amount. This has been fixed but I'm leaving the issue open until next time I update the package.

@cslotboom cslotboom reopened this Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants