Skip to content

Commit

Permalink
remove rough script
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBuchananCompPhys committed Dec 23, 2024
1 parent 2913ff2 commit 94b37b1
Showing 1 changed file with 0 additions and 127 deletions.
127 changes: 0 additions & 127 deletions MDANSE/Src/MDANSE/Mathematics/Signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,130 +932,3 @@ def power_spectrum(

# Adjust to atom selection
return (output["romega"], output["pps_total"])

if __name__=="__main__":
filter_class = filter_map["ChebyshevTypeI"]
filter_class.set_defaults()

import os
os.chdir('..\\..\\..\\')

data = numpy.loadtxt("Tests\\UnitTests\\TrajectoryFilter\\methane_hydrogen_position.csv")
ps = ()
ps_raw = ()

N = 10000
fs = 200.0

pre_filter_freqs = {
"h": fftpack.fft(data),
"w": fftpack.fftfreq(N, d=1/fs)
}

pre_w = pre_filter_freqs["w"][:np.int32(N/2)]
dw = pre_w[1] - pre_w[0]
pre_amplitudes = (2 * (np.abs(pre_filter_freqs["h"])) / N)[:np.int32(N/2)]

import matplotlib.pyplot as plt

x_raw = np.linspace(0, 646, 160)
x = np.linspace(0, 646, 1000)

plt.figure(figsize=(10, 6))
plt.plot(x_raw, ps_raw, label="RAW POWER SPECTRUM")
plt.show()

f = filter_class(**{
"n_steps": 10000,
"time_step_ps": 0.005,
"order": 2,
"attenuation_type": "highpass",
"cutoff_freq": 25.0,
"max_ripple": 1.0
})

data1 = f.apply(data)

post_filter_freqs = {
"h": fftpack.fft(data1),
"w": fftpack.fftfreq(N, d=1/fs)
}

post_w = post_filter_freqs["w"][:np.int32(N/2)]
post_amplitudes = (2 * (np.abs(post_filter_freqs["h"])) / N)[:np.int32(N/2)]

plt.figure(figsize=(10, 6))
plt.plot(x, ps, label="UPSAMPLED POWER SPECTRUM")
plt.show()

# w0 = 2 * np.pi * 1.5
# a0 = 20.0
#
# w1 = 2 * np.pi * 60.0
# a1 = 5.0
#
# N = 10000
# t = np.linspace(0, 20, N)
# fs = (t[1] - t[0])**(-1)
# x0 = a0 * np.sin(w0*t) + a1 * np.sin(w1*t)
#
# pre_filter_freqs = {
# "h": fftpack.fft(x0),
# "w": fftpack.fftfreq(N, d=1/fs)
# }
#
# pre_w = pre_filter_freqs["w"][:np.int32(N/2)]
# dw = pre_w[1] - pre_w[0]
# pre_amplitudes = (2 * (np.abs(pre_filter_freqs["h"])) / N)[:np.int32(N/2)]

import matplotlib.pyplot as plt
plt.figure(figsize=(10, 6))
#plt.plot(pre_w, pre_amplitudes, label="pre-filter")
plt.show()

#import matplotlib.pyplot as plt
#plt.figure(figsize=(10, 6))
#plt.plot(t, x, label="pre-filter")
#plt.show()

#f = filter_class(**{
# "attenuation_type": "lowpass",
# "order": 1,
# "cutoff_freq": 60.0,
# "time_step_ps": 1/fs,
# "n_steps": N}
#)

#x1 = f.apply(x0)

#post_filter_freqs = {
# "h": fftpack.fft(x1),
# "w": fftpack.fftfreq(N, d=1/fs)
#}

# post_w = post_filter_freqs["w"][:np.int32(N/2)]
# post_amplitudes = (2 * (np.abs(post_filter_freqs["h"])) / N)[:np.int32(N/2)]

import matplotlib.pyplot as plt
plt.figure(figsize=(10, 6))
#plt.plot(post_w, post_amplitudes, label="post-filter")
plt.show()

#s = f.__str__()
#r = f.__repr__()



#plt.figure(figsize=(10, 6))
#plt.plot(t, f.apply(x), label="post-filter")
#plt.show()

#string_representation = [
# f"Trajectory filter of type {1.0} implemented with the following parameters:\n\n",
# f" # sample_freq\n Reciprocal of the molecular dynamics time step, in picohertz\n {2.0}\n\n",
# f" # Sample frequency\n Reciprocal of the molecular dynamics time step in picohertz\n {3.0}\n\n",
#]

#string_representation.append(f" # Cutoff frequency\n Reciprocal of the molecular dynamics time step in picohertz\n {4.0}\n\n")

#print("".join(string_representation))

0 comments on commit 94b37b1

Please sign in to comment.