Source code for the spectral matching algorithm, along with input data for the IN718 dataset. The spectral matching algorithm was developed to rapidly generate statistically equivalent melt pool geometry fluctuations for studying stochastic lack-of-fusion defects. Input data - 1) melt pool measurments as a time-series, e.g. from optical microscopy of line scans; 2) the resolution/spacing between the measurements in length or time.
The spectral matching algorithm requires numpy, scipy, and matplotlib (for test case plotting) installed in the local python environment.
To run the test cases, call /path/to/local/python test.py (making sure the above libraries are installed). The three cases are
- Simple superposition of 3 cosines.
- Superposition of 50 cosines parametrized by random amplitude, period, and phase. Note that a seed is set so the output will be consistent.
- Width and depth data for IN718 melt pool variations. For each case, the input data is plotted in red, and the output data is plotted in royal blue. The PSD plots follow the same convention.
To use the class for your own melt pool fluctuation generation, you need
- Evenly spaced melt pool fluctuation data (say, from a high fidelity simulation, or optical microscopy of single tracks)
- The resolution of the fluctuation data, either in distance or time units (microns were used for development) In general, the worflow would be to
- Import the spectral matching class from
spectral_matcher.py - Instantiate the
SpectralMatcherclass with the experimental data sequence and resolution as inputs - Call the
gen_equivalent_fluctuationmethod to get an output sequence Note thatreturn_all=Truecan be used to get information on the spectral densities of the input and output to verify that they are equivalent. This can be seen intest.py.