[mnseg] improve load option
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from pywavan import powspec, nb_scale
|
from pywavan import powspec, fan_trans, nb_scale
|
||||||
from astropy.io import fits
|
from astropy.io import fits
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
@@ -236,7 +236,7 @@ def load_results(label):
|
|||||||
return wav_k, S1a, wt, S11a, q
|
return wav_k, S1a, wt, S11a, q
|
||||||
|
|
||||||
|
|
||||||
def analyse_sim(im):
|
def analyse_sim(im, load=False):
|
||||||
""" Do the MnGseg analysis """
|
""" Do the MnGseg analysis """
|
||||||
meanim = np.mean(im)
|
meanim = np.mean(im)
|
||||||
imzm = im - meanim
|
imzm = im - meanim
|
||||||
@@ -247,15 +247,18 @@ def analyse_sim(im):
|
|||||||
label = "final" # label to identify parameter setup
|
label = "final" # label to identify parameter setup
|
||||||
|
|
||||||
# after a lot of trials I found a fixed q=2 is a good value
|
# after a lot of trials I found a fixed q=2 is a good value
|
||||||
|
if not load:
|
||||||
q = [2.0] * nb_scale(imzm.shape)
|
q = [2.0] * nb_scale(imzm.shape)
|
||||||
# wt, S11a, wav_k, S1a, q = fan_trans(imzm, reso=1, q=q, qdyn=False)
|
wt, S11a, wav_k, S1a, q = fan_trans(imzm, reso=1, q=q, qdyn=False)
|
||||||
# alternatively you can let pywavan determine it automatically by setting skewl
|
# alternatively you can let pywavan determine it automatically by setting skewl
|
||||||
# q=[3.0]*nb_scale(imzm.shape)
|
q = [3.0] * nb_scale(imzm.shape)
|
||||||
# wt, S11a, wav_k, S1a, q = fan_trans(imzm, reso=1, q=q, qdyn=True, skewl=0.4)
|
wt, S11a, wav_k, S1a, q = fan_trans(imzm, reso=1, q=q, qdyn=True, skewl=0.4)
|
||||||
# print(q)
|
print(q)
|
||||||
|
|
||||||
# save results because it can be long to calculate (especially if qdyn=True). Remark that wt and S11a are quite big
|
# save results because it can be long to calculate (especially if qdyn=True).
|
||||||
# save_results(wt, S11a, wav_k, S1a, q, label)
|
# Remark that wt and S11a are quite big
|
||||||
|
save_results(wt, S11a, wav_k, S1a, q, label)
|
||||||
|
if load:
|
||||||
wav_k, S1a, wt, S11a, q = load_results(label)
|
wav_k, S1a, wt, S11a, q = load_results(label)
|
||||||
|
|
||||||
# make images of the Gaussian and coherent part
|
# make images of the Gaussian and coherent part
|
||||||
|
|||||||
Reference in New Issue
Block a user