Skip to content

resample! is slow on NodalData #107

@stepholinger

Description

@stepholinger

At the moment, resample! is about two orders of magnitude slower when applied to NodalData than to CorrData. The two result in very sightly different but essentially identical outputs. The example below should demonstrate the issue.

# choose original fs and new fs
fs = 100.
resample_fs = 10.

# generate some 'data'
sz = 500
data = rand(Float32,sz,sz)

# resample CorrData with same underlying data
C = CorrData(corr=data,fs=fs)
corr_time = @elapsed SeisNoise.resample!(C,resample_fs)

# resample  NodalData with same underlying data
S = SeisNoise.NodalData()
S.data=data
S.fs=ones(sz).*fs
nodal_time = @elapsed SeisNoise.resample!(S,resample_fs)

# print results
print("CorrData time: ", corr_time, " s\n")
print("NodalData time: ", nodal_time, " s\n")

# verify the results are almost identical
print("Total difference: ",sum(C.corr-S.data))

CorrData time: 0.032703704 s
NodalData time: 3.133497156 s
Total difference: 7.137656e-6

At the moment, it seems to be faster to load data into a CorrData object, resample, and then put the data back into a NodalData object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions