Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8c900bf
[ftio] add astft skeleton
josefinez Feb 3, 2025
b551463
[ftio/freq/_astft] oastft: add preliminary tfr
josefinez Feb 5, 2025
cd092e9
[ftio/freq] oastft: create binary image
josefinez Feb 5, 2025
6307010
[ftio/freq/_astft]: add sinusoidal test signal
josefinez Feb 11, 2025
856017e
[ftio/freq/_astft]: use scipy stft, compute ptfr fft n-times
josefinez Feb 11, 2025
20bcb2e
[ftio/freq/if_comp_sep]: use threshold to create binary image
josefinez Feb 11, 2025
3761dfb
[ftio/freq]: add component linking
josefinez Feb 11, 2025
950e68e
[ftio/freq/_astft]: fix regular rate
josefinez Feb 17, 2025
c47a856
[ftio/freq]: add some concentration measures (Pei & Huang)
josefinez Feb 17, 2025
4dd471a
[ftio/freq/_astft]: use conc measures for ptfr
josefinez Feb 17, 2025
2926aff
[ftio/freq/conc_meas]: make ptfr win selection more adaptive
josefinez Feb 19, 2025
906017e
[ftio/freq]: use zscore to clean up binary image (way too sparse)
josefinez Feb 19, 2025
9e003de
[ftio/freq/if_comp_sep]: store exracted components
josefinez Feb 19, 2025
65cbfab
[ftio/freq/conc_meas]: remove max win limitation, decrease win length…
josefinez Feb 19, 2025
8705bf9
[ftio/freq/_astft]: plot result simple astft
josefinez Feb 19, 2025
2ff844c
[ftio/freq/if_comp/sep]: binary image: use n most prominent peaks, ex…
josefinez Feb 27, 2025
b748d28
[ftio/freq]: add denoising: pseudo wigner ville distribution based ti…
josefinez Feb 27, 2025
a200d24
[ftio/freq/cons_meas]: fix zero padding
josefinez Mar 3, 2025
da7ac5a
[ftio/freq/if_comp_sep]: add some comments
josefinez Mar 3, 2025
812f7e7
[ftio/freq/_astft]: add rect test signal, noise
josefinez Mar 3, 2025
012c89d
[toml]: add cv2
josefinez Mar 3, 2025
457686e
[ftio/plot]: add tf plot
josefinez Mar 3, 2025
0354670
[ftio/freq/_astft]: ignore tfpf
josefinez Mar 3, 2025
5bce825
[ftio/plot/plot_tf]: add tf contour plot
josefinez Mar 4, 2025
c2f50f8
[ftio/freq/denoise]: fix tfpf
josefinez Mar 14, 2025
e68b58b
[ftio/plot/plot_tf]: tf normalize frequency plots
josefinez Mar 14, 2025
3c04c2f
[ftio/plot/plot_tf]: add tf plot args
josefinez Mar 19, 2025
d06c2bb
[ftio/freq/_astft]: fix pftr fs, allow filtered signal usage, impr te…
josefinez Mar 19, 2025
bbc47be
[ftio/freq/conc_meas]: min p, alt norm
josefinez Mar 27, 2025
4cd9af8
[ftio] add amd skeleton (adaptive mode decomposition)
josefinez Apr 9, 2025
7e03fe6
[ftio/freq/_amd]: add simple fixed vmd
josefinez Apr 9, 2025
76fe8d8
[ftio/freq/denoise]: compute ts once
josefinez Apr 24, 2025
39ba401
[ftio/freq/_amd]: separate imf plot
josefinez Apr 24, 2025
a827f0c
[ftio/freq/_amd]: add plot: imf amplitude envelope & if
josefinez Apr 24, 2025
9ea3b3b
[ftio/freq/_amd]: identify non-periodic imfs
josefinez Apr 24, 2025
3d73d26
[ftio/freq]: identify best matching imf
josefinez Apr 24, 2025
e0cf77b
[ftio/freq/denoise]: fix wvd plot
josefinez Apr 29, 2025
7c4f1f2
[ftio/freq]: add imf selection based on change point detection
josefinez Apr 29, 2025
5bd1a8f
[toml]: add vmdpy, ruptures
josefinez Apr 29, 2025
3881dc6
[ftio/freq/if_comp_sep]: store mean and median frq, use argpartition
josefinez Jun 10, 2025
2e68242
[ftio/freq/_astft]: add final astft
josefinez Jun 10, 2025
af14158
add time measurements
josefinez Jul 2, 2025
8fae96a
[ftio/freq/_astft]: rm oversampling, regular rate, oastft
josefinez Jul 10, 2025
b131934
[ftio/freq]: CM: use scipy stft
josefinez Jul 11, 2025
5fe6b64
[ftio/freq/_astft]: clean up
josefinez Jul 11, 2025
96077ed
[ftio/freq/_amd]: fix indices
josefinez Jun 9, 2025
f8dff86
[ftio/freq/_amd]: plot original signal in final plot
josefinez Jun 9, 2025
568994b
[ftio/freq/_amd]: add initial version of imf frequency determination
josefinez Jun 9, 2025
82a822a
[ftio/freq/_amd]: use 0.65 corr
josefinez Jun 9, 2025
b5c53da
[ftio/freq/_amd]: add windowed correlation test based selection
josefinez Jun 17, 2025
b5474b0
[ftio/freq/_amd]: rm change point detection
josefinez Jun 17, 2025
2e0ae4c
[ftio/freq/_amd]: return components
josefinez Jun 17, 2025
cf6e03e
[ftio/freq/_amd]: remove low amplitude segments
josefinez Jun 17, 2025
8fc979b
[ftio/freq/_amd]: merge overlapping correlation windows
josefinez Jun 17, 2025
00cf357
[ftio/freq/_amd]: add efd pysdkit
josefinez Jun 30, 2025
61e85ef
[ftio/freq/_amd]: vmd freq estimation update
josefinez Jul 10, 2025
ed75fdc
[ftio/freq/_amd]: efd window selection
josefinez Jul 13, 2025
4a752f6
[ftio/freq/_amd]: fix hilbert remove zero
josefinez Jul 13, 2025
91dbebf
[ftio/freq/conc_meas]: use 50 percent overlap
josefinez Jul 14, 2025
4cd9ad2
[ftio/freq/_amd]: use astft in vmd, update cases
josefinez Jul 14, 2025
985ed49
[ftio/freq/_astft]: skip pre processing merge, add post merge, select…
josefinez Jul 15, 2025
2211dfd
[ftio/freq/_amd]: clean up
josefinez Jul 15, 2025
22f277c
[ftio/freq]: rm debug output
josefinez Jul 15, 2025
0141ade
[ftio/freq/_amd]: add some comments
josefinez Jul 15, 2025
c57c28e
[toml]: rm ruptures, add pysdkit
josefinez Jul 16, 2025
d6539f7
[ftio/freq]: frequency refinement
josefinez Jul 18, 2025
c3813bb
[ftio/freq]: fix magnitude comparison secondary peak
josefinez Jul 18, 2025
e3c5ff5
merge development
josefinez Oct 16, 2025
648ae84
[ftio]: use z-score without plotting in astft and amd
josefinez Oct 16, 2025
e7f4ba0
[ftio/freq]: fix sampling call
josefinez Oct 16, 2025
856721c
[ftio/cli/ftio_core.py]: apply temporary fix: enforce termination aft…
josefinez Oct 16, 2025
b747f2a
[ftio]: separate cmd line args for efd and vmd
josefinez Oct 16, 2025
94e160a
[ftio]: add tfpf cmd line argument
josefinez Oct 16, 2025
77868e3
[ftio]: add cmd line argument for setting the window length of the AS…
josefinez Oct 16, 2025
df68b78
[toml]: specify tftb version
josefinez Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions ftio/analysis/anomaly_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,60 @@ def z_score(

return dominant_index, conf, text

# ?#################################
# ? Z-score
# ?#################################
def z_score_minimal(
amp: np.ndarray, freq_arr: np.ndarray, args
) -> tuple[list[float], np.ndarray, str]:
if args.psd:
amp = amp * amp / len(amp)

indices = np.arange(1, int(len(amp) / 2) + 1)
amp_tmp = np.array(2 * amp[indices])
# norm the data
amp_tmp = amp_tmp / amp_tmp.sum() if amp_tmp.sum() > 0 else amp_tmp

tol = args.tol
dominant_index = []
mean = np.mean(amp_tmp)
std = np.std(amp_tmp)
z_k = abs(amp_tmp - mean) / std if std > 0 else np.zeros(len(amp_tmp))
conf = np.zeros(len(z_k))
# find outliers
index = (
np.where((z_k / np.max(z_k) > tol) & (z_k > 3))
if len(z_k) > 0 and np.max(z_k) > 0
else (np.array([], dtype=np.int64),)
)
if len(index[0]) > 3:
counter = 0
for i in index[0]:
counter += 1

index, removed_index, msg = remove_harmonics(freq_arr, amp_tmp, indices[index[0]])

if len(index) > 0:
removed_index = [i - 1 for i in removed_index] # tmp starts at 1
# conf[index] = (z_k[index]/max_z + z_k[index]/np.sum(z_k[index]) + 1/np.sum(z_k > 3))/3
# calculate the confidence:
# 1) check z_k/max_zk > tol
tmp = z_k / np.max(z_k) > tol
tmp[removed_index] = False
conf[tmp] += z_k[tmp] / np.sum(z_k[tmp])

# 2) check z_k > 0
tmp = z_k > 3
tmp[removed_index] = False
conf[tmp] += z_k[tmp] / np.sum(z_k[tmp])
conf = conf / 2
conf = np.array(conf)

# get dominant index
dominant_index, msg = dominant(index, freq_arr, conf)

return dominant_index, conf


# ?#################################
# ? DB-Scan
Expand Down
20 changes: 20 additions & 0 deletions ftio/cli/ftio_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
from ftio.plot.freq_plot import convert_and_plot
from ftio.prediction.unify_predictions import merge_predictions
from ftio.processing.print_output import display_prediction
from ftio.freq.time_window import data_in_time_window
from ftio.freq._wavelet_cont_workflow import ftio_wavelet_cont
from ftio.freq._wavelet_disc_workflow import ftio_wavelet_disc
from ftio.freq._dft_workflow import ftio_dft
from ftio.freq._astft_workflow import ftio_astft
from ftio.freq._amd_workflow import ftio_amd


def main(
Expand Down Expand Up @@ -191,6 +197,20 @@ def freq_analysis(
args, bandwidth, time_b, ranks
)

elif "astft" in args.transformation:
prediction, analysis_figures, share = ftio_astft(
args, bandwidth, time_b, total_bytes, ranks, text
)
import sys
sys.exit()

elif "efd" in args.transformation or "vmd" in args.transformation:
prediction, analysis_figures, share = ftio_amd(
args, bandwidth, time_b, total_bytes, ranks, text
)
import sys
sys.exit()

else:
raise Exception("Unsupported decomposition specified")

Expand Down
Loading