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 containing nodes, elements, lines, and coordinate 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:

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 Functions

  • sdpy.cpsd - Functions for computing and working with Cross-Power Spectral Density matrices

  • sdpy.integration - Functions for performing integration of equations of motion

  • sdpy.correlation - Functions for comparing data

  • sdpy.complex - Functions for working with complex numbers

  • sdpy.rotation - Functions for computing and working with rotation matrices

  • sdpy.generator - Functions for generating standard signal types such as sine or pseudorandom

  • sdpy.camera - Functions for working with camera projections and projections

  • sdpy.harmonic - Functions for working with harmonic signals

  • sdpy.geometry_fitting - Functions for fitting geometry to data

  • sdpy.frf_inverse - Functions for inverting frequency response functions for inverse problems

  • sdpy.srs - Functions for computing shock response spectra and generating sum-decayed-sines signals