I’ve written three perl scripts that provide the ability to collect infrasound levels and report them on an hourly averaged basis. There’s one script that collects the samples from the Infra20 and two that analyze that collected data.
Collection
The data collection script collects the 50 samples/sec from the Infra20, buffers them up and writes them out to a file. Each hour the file is closed and a new one is started. The file names reflect the date and hour of the collection. Once started the script runs “forever” with no further intervention needed, even if the Infra20 is disconnected. By default the files reside in the same directory as the script is running. Above is a screenshot of what it looks like as it is running. Note that it runs in a DOS window, in this case under XP. I use a simple bat file to start it up, as I don’t like to type any more than I have to. Also note that the top part of the screen shows me stopping the script (with a ctrl-c) and then starting it up again.
Analysis Scripts
The analysis scripts read through the samples in a file and calculate the number of records (typically around 175,000), their average value (in both the native Pascals and the equivalent dB), and finds the largest value for that hour.
The first of these is for individual files, where you have to manually enter the filename to be analysed. Below is a screenshot of how the script runs. Note that it, like the collector script, runs in a DOS window, and can be run at the same time as the collector’s DOS window. Also note how the file is named, although the “test1” prefix will likely change before I ship the software to anyone else (current just an “a”).
The second of these is a batch analysis script. First it finds all the sample files in its folder (presumably c:\perl\site\bin\). Then it analyzes each one in turn (except the one currently being created), creating a csv output file with: file name, average in Pa, average in dB, max sample and # of samples in that order. It then copies the files to an archive (presently in folder c:\infra-archive\). Finally it deletes the files from the original folder. The csv file can be easily imported into a spreadsheet. I’ve set it up as a scheduled task that runs after midnight and thus gathers up the previous day’s numbers.