Usage
Installation
SDynPy can be installed with pip
pip install sdynpy
SDynPy Overview
With SDynPy installed, you can then import it into your python code to perform analyes.
import sdynpy as sdpy
SDynPy Core Data Objects
SDynPy provides five core data objects:
sdpy.CoordinateArray
- An array of degrees of freedom (node and direction) e.g. ‘101X+’ or ‘23RZ-’sdpy.NDDataArray
- An array of data functions. Subclasses of this class provide functionality for specific types of data, e.g.time histories
,frequency response functions
, etc.sdpy.ShapeArray
- An array of shapes which define deformations at degrees of freedom.sdpy.Geometry
- A class containingnodes
,elements
,lines
, andcoordinate systems
that define the geometry of a test.sdpy.System
- A class containing mass, stiffness, and damping matrices, as well as a transformation from the inner state to physical degrees of freedom (e.g. a mode shape matrix to transform from modal coordinates defined by a modal mass, stiffness, and damping matrix to physical coordinates), which is useful for time integration and substructuring.
SDynPy objects are generally built using subclasses of Numpy’s ndarray class, which means SDynPy objects can generally use all the nice features of that object, including broadcasting, as well as many of the Numpy functions operating on ndarrays such as intersect1d.
Loading Test Data
SDynPy can read and write data to the Universal File Format
using the sdpy.unv
module. SDynPy can
currently read the following datasets
:
55
- Data at Nodes (sdpy.ShapeArray
)58
- Function at Nodal DOF (sdpy.NDDataArray
)82
- Tracelines (sdpy.TracelineArray
)151
- Header (not currently used in any SDynPy objects)164
- Units (not currently used in any SDynPy objects)1858
- Qualifiers for Dataset 58 (not currently used in any SDynPy objects)2400
- Model Header (not currently used in any SDynPy objects)2411
- Nodes (sdpy.NodeArray
)2412
- Elements (sdpy.ElementArray
)2420
- Coordinate Systems (sdpy.CoordinateSystemArray
)
SDynPy will generally read in data using the sdpy.unv.readunv
function.
This will output data into a dictionary where the key is the dataset number and
the value is the information inside the dataset. Many SDynPy objects have a
from_uff
function that when passed the universal file format dictionary
will automatically construct a SDynPy object from the data within.
# Read in the data from the UFF file
uff_dict = sdpy.uff.readuff('path/to/uff/file.uff')
# Parse the data in the dictionary into a SDynPy Geometry
geometry = sdpy.Geometry.from_uff(uff_dict)
SDynPy can also read time data from Rattlesnake’s
netCDF output using the sdpy.rattlesnake.read_rattlesnake_output
function. This function will return a sdpy.TimeHistoryArray
object,
as well as a pandas DataFrame object representing
the channel table.
Finally, SDynPy can also read data from Correlated Solutions’ VIC3D Digital Image Correlation software. It assumes the data has
been exported to .mat files from the VIC3D software. The sdpy.vic.read_vic3D_mat_files
function can be given the list of .mat files from VIC3D, and it will automatically generate a test geometry and time history from those results.
from glob import glob
# Get files
files = glob(r'*.mat')
# Read in time and displacement data
geometry,time_data = sdpy.vic.read_vic3D_mat_files(files)
Finite Element Models
SDynPy also has capabilities to work with finite element models and data.
SDynPy can read or write to the Exodus
file format. It has two representations for Exodus models; the first is
sdpy.Exodus
, which keeps the file on disk and only reads and writes
what is requested to it. This is most suitable for large files. A second
way to interact with Exodus models is through the sdpy.ExodusInMemory
class, which, as the name suggests, reads the entire model into memory.
Similarly to the universal file format readers, the output sdpy.Exodus
or
sdpy.ExodusInMemory
objects
can be transformed into SDynPy objects through various from_exodus
functions
in the SDynPy objects.
# Read in the data from the UFF file
exo = sdpy.Exodus('path/to/exodus/file.exo')
# Parse the data in the dictionary into a SDynPy Geometry
geometry = sdpy.Geometry.from_exodus(exo)
SDynPy can create small beam finite element models using the sdpy.beam
module. Using the function sdpy.beam.beamkm
or its helper function for
2D beams sdpy.beam.beamkm_2d
will produce
beam mass and stiffness matrices which can be used for finite element analysis.
SDynPy also has functionality for producing system matrices for
electro-mechanical modeling of shakers in sdpy.shaker
.
These are expected to be substructured to another finite element model in order
to predict the voltage, current, and force required for a given test.
Degree of freedom optimization routines can be found in sdpy.dof
.
These include Effective Independence and Condition Number optimization routines.
Experimental Modal Analysis
SDynPy has the ability to fit modes to structures using the Synthesize Modes and
Correlate sdpy.SMAC
or PolyPy
sdpy.PolyPy
routines.
Both SMAC and PolyPy have graphical user interfaces available to make the curve
fitting process easier (sdpy.SMAC_GUI
,
sdpy.PolyPy_GUI
). These can be
run from an IPython console.
Included in SDynPy is interactive plotting capabilities where mode shapes can be animated or several data sets can be plotted.
Documentation
SDynPy has the ability to automatically document portions of analysis by
exporting to a Microsoft PowerPoint presentation or LaTeX source code. A
PowerPoint presentation can be created using the
sdpy.doc.create_summary_pptx
function, or a LaTeX file can be created using the
sdpy.doc.create_latex_summary
function.
Signal Processing
SDynPy has several general purpose signal processing tools as well. These include:
sdpy.frf
- Functions for computing and working with Frequency Response Functionssdpy.cpsd
- Functions for computing and working with Cross-Power Spectral Density matricessdpy.integration
- Functions for performing integration of equations of motionsdpy.correlation
- Functions for comparing datasdpy.complex
- Functions for working with complex numberssdpy.rotation
- Functions for computing and working with rotation matricessdpy.generator
- Functions for generating standard signal types such as sine or pseudorandomsdpy.camera
- Functions for working with camera projections and projectionssdpy.harmonic
- Functions for working with harmonic signalssdpy.geometry_fitting
- Functions for fitting geometry to datasdpy.frf_inverse
- Functions for inverting frequency response functions for inverse problemssdpy.srs
- Functions for computing shock response spectra and generating sum-decayed-sines signals