MADRS — Modified Acceleration-Displacement Response Spectrum
A Python package implementing the MADRS method of FEMA 440 for seismic performance-point calculation using pushover curves and response spectra.
Installation
From PyPI (once published)
pip install madrs
Directly from GitHub
pip install git+https://github.com/YOUR_USERNAME/MADRS.git
Local development install (editable)
git clone https://github.com/YOUR_USERNAME/MADRS.git
cd MADRS
pip install -e .
Quick Start
import numpy as np
from madrs import MADRS_Method
# --- Pushover curve: columns = [displacement (m), base shear (kN)] ---
PO = np.loadtxt("pushover.csv", delimiter=",")
# --- Demand curve: columns = [period (s), Sa (g)] ---
DC = np.loadtxt("spectrum.csv", delimiter=",")
# --- Modal / structural parameters ---
pf1 = 1.30 # Modal participation factor (1st mode)
alpha1 = 0.85 # Modal mass coefficient (1st mode)
wt = 5000.0 # Seismic weight (kN)
phi_roof1 = 1.0 # 1st-mode shape at roof
tol = 1e-4 # Area-balance tolerance for bilinear fitting
CP1 = 0.5 # Lower ay search bound (fraction of api)
CP2 = 0.95 # Upper ay search bound (fraction of api)
CP3 = 0.5 # Controls initial stiffness of the bi-linear curve (ranges from 0 to 1, preferred 0.5)
results = MADRS_Method(PO, DC, pf1, alpha1, wt, phi_roof1, tol, CP1, CP2, CP3)
dpi, api, dy, ay, roof_disp, flag, *_ = results
if flag:
print(f"Performance point — Sd: {dpi:.4f} m | Sa: {api:.4f} g")
print(f"Roof displacement : {roof_disp:.4f} m")
else:
print("No performance point found — adjust CP1, CP2, or tol.")
API Reference
MADRS_Method
MADRS_Method(PO, DC, pf1, alpha1, wt, phi_roof1, tol, CP1, CP2,
show_intermediate_plots=True)
| Parameter | Type | Description |
|---|---|---|
PO |
ndarray (N, 2) |
Pushover curve — [displacement (m), base shear (kN)] |
DC |
ndarray (M, 2) |
Demand/response spectrum — [period (s), Sa (g)] |
pf1 |
float |
Modal participation factor (1st mode) |
alpha1 |
float |
Modal mass coefficient (1st mode) |
wt |
float |
Seismic weight (kN) |
phi_roof1 |
float |
1st-mode shape value at roof |
tol |
float |
Tolerance for bilinear area balance |
CP1 |
float |
Lower multiplier for ay search |
CP2 |
float |
Upper multiplier for ay search |
CP3 |
float |
Controls initial stiffness of the bi-linear curve (ranges from 0 to 1, preferred 0.5) |
show_intermediate_plots |
bool |
Show 6-panel diagnostic figure (default True) |
Returns (dpi, api, dy, ay, roof_disp, flag, Sd_spectra, Sa_Spectranew, Sd, Sa, x_bilinear, y_bilinear)
Helper functions
from madrs import curve_intersections, closest_point_on_curve, area_between_curves
curve_intersections(x1, y1, x2, y2)— find intersection points between two polylinesclosest_point_on_curve(P, x_curve, y_curve)— nearest point on a polyline to point Parea_between_curves(x, y1, y2)— signed area between two curves via Simpson's rule
Requirements
- Python ≥ 3.9
- numpy ≥ 1.24
- scipy ≥ 1.10
- matplotlib ≥ 3.7
License
MIT
Metadata
Release files for madrs 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| madrs-0.1.4.tar.gz | 6.4 kB | Without provenance | Details for madrs-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| madrs-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for madrs-0.1.4-py3-none-any.whl |
Total release size: 13.1 kB
Release files / madrs-0.1.4.tar.gz
| Download URL | madrs-0.1.4.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12542a677012278d5a8c93dc5e1132e0853411647168c9c14ac6acb86a516e4a
|
|
BLAKE2b-256 checksum How to use checksums |
a048e5660b7389471c4c01c9dddb035d9b16d407d58422de70d828e0c1b2b99f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / madrs-0.1.4-py3-none-any.whl
| Download URL | madrs-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9063d24eec547f49f7ee5e7d925f107305aab0a577cb7887abc38f01955a21de
|
|
BLAKE2b-256 checksum How to use checksums |
cdcae4f36dca15afe9ac62244786b1a428cbc5aa838c83f294758837e8c62850
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for madrs 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.