Author: Msc. Ing. Carlos Andrés Celi Sánchez.
This Python function processes AT2 seismic record files to extract the acceleration signal, compute the Fast Fourier Transform (FFT) to identify the dominant frequency and peak ground acceleration (PGA), and generate visualizations in both the time and frequency domains. The computed results, along with the plots, are saved in a dedicated folder.
at2_files(list of str): List of file paths for the AT2 seismic record files.select_record(int): Number of files to process from the provided list.record(str): Identifier for the seismic record used for labeling plots and saving the results.
REC(DataFrame): DataFrame containing two columns, 'Time' and 'Acceleration', extracted from the seismic record.time(numpy array): Array of time values corresponding to the seismic record.accel(list): List of acceleration values extracted from the AT2 file.RESULT(DataFrame): DataFrame containing the frequency spectrum, with columns for frequencies and their corresponding FFT amplitudes.
- Data Extraction and Preprocessing:
- Reads the provided AT2 files and extracts the acceleration data along with the time increment (DT) from the file header.
- Constructs the time vector based on the DT value and combines it with the acceleration data into a structured DataFrame.
- FFT Computation:
- Computes the Fast Fourier Transform (FFT) of the acceleration signal.
- Sorts the frequency components, isolates the positive frequencies, and identifies the dominant frequency (i.e., the frequency with the maximum amplitude).
- Visualization and Annotation:
- Time Domain Plot: Plots the seismic record, highlighting the peak ground acceleration (PGA) with an annotated marker and a dashed vertical line at the occurrence time.
- Frequency Domain Plot: Displays a semilog plot of the FFT amplitude spectrum with a marker indicating the dominant frequency.
- Results Saving:
- Creates a results folder (named as
Results_FFT_<record>.file) if it does not exist. - Saves the generated time-domain and frequency-domain plots as PNG images within this folder.
- Creates a results folder (named as
- Figure 1 - Time Domain:
Illustrates the seismic record over time, marking the point of maximum acceleration (PGA) with annotations for clarity. - Figure 2 - Frequency Domain:
Shows the FFT amplitude spectrum on a semilog scale, emphasizing the dominant frequency component with a distinct marker and label.
This function is particularly useful for researchers, engineers, and students in seismic engineering and signal processing. By combining both time-domain and frequency-domain analyses, it provides a comprehensive overview of the seismic data, facilitating the identification of key signal characteristics such as the dominant frequency and peak acceleration.

