diff --git a/mngseg.py b/mngseg.py index b19270f..b870017 100644 --- a/mngseg.py +++ b/mngseg.py @@ -158,7 +158,7 @@ def plot_components_power_spectrum( ): # plot power spectra - plt.figure(figsize=(5, 5)) + plt.figure(1, figsize=(5, 5)) plt.plot(tab_k, spec_k, color="black", label="Fourier PS", linewidth=1.5) plt.plot(wav_k, S1a[0, :], "s", color="black", label="Wavelet PS", markersize=6) plt.plot(wav_k, S1a[1, :], "D", color="blue", label="Coherent PS", markersize=4) @@ -236,7 +236,7 @@ def load_results(label): return wav_k, S1a, wt, S11a, q -def analyse_sim(im, load=False): +def analyse_sim(im, load=False, scale_image=False): """ Do the MnGseg analysis """ meanim = np.mean(im) imzm = im - meanim @@ -264,12 +264,13 @@ def analyse_sim(im, load=False): # make images of the Gaussian and coherent part make_images(im, wt, M, meanim, label) - # (optional) make the image for each scale - for s in range(fit_min, fit_max + 1): - scale_images(wt, M, label, scale=s) - - # (optional) plot the histogram for each scale - plot_each_scale(S11a, wav_k, q, label, coherent=True) + + if scale_image: + # (optional) make the image for each scale + for s in range(fit_min, fit_max + 1): + scale_images(wt, M, label, scale=s) + # (optional) plot the histogram for each scale + plot_each_scale(S11a, wav_k, q, label, coherent=True) # calc Fourier power spectrum for comparison tab_k, spec_k = powspec(imzm, reso=1)