Applying math.log10() function to a trace

I have a Raspberry Shake and Boom and I want to produce a plot of Infrasound (Sound) Pressure Level in dB.

The calculation for dB from Pascals, Pa, is dB = 20*math.log10(Pa/2e-5).

While simple operations can be done to a trace (e.g. like multiplication, etc) the math.log10() function is not allowed.

Does anyone have some example code to say export trace data to an array, say, apply the math.log10() function and then recreate the/a trace again from the array?

ATM that’s the only way I can think of the get around the problem, but happy to go another way if it works.

The only examples I have found so far on the net have been incorrect (i.e. incorrect conversion formula).

Thanks,

Al.

Hi, that is relatively straightforward:

import numpy as np
trace.data = np.log10(trace.data)