Aprior = pf.open('./Simu_2744/Estimated_A.fits')[0].data ##param mom = 'mom' positivity =False reweighting ='none' pca = 'PCA' wmode = 'add' soft = False npca = 32 n = 800 #[145,255] S,A = MC.mMCA(cube, Aprior, 5,n,threshmode = mom, PCA=[2,11], harder =0, alpha = [142,256], npca = npca, pos = positivity,mode=pca) pen = reweighting hdus = pf.PrimaryHDU(S) lists = pf.HDUList([hdus]) lists.writeto('Simu_2744/Sources_'+str(n)+'_'+pen+'.fits', clobber=True) hdus = pf.PrimaryHDU(A) lists = pf.HDUList([hdus]) lists.writeto('Simu_2744/Estimated_A.fits', clobber=True) cs.make_colour_sub('Simu_2744/Sources_'+str(n)+'_'+pen+'.fits', 'Simu_2744/Estimated_A.fits', './Simu_2744/All_real.fits','big_'+str(n)+'_'+pen, cuts = ['0','0.25','0','0.15','0','0.02','0','0.1','0','0.1'], prefix = './Simu_2744/')
num,n,n = np.shape(cube) ## If A is unknown, set it to zero. Aprior = 0 #pf.open('Simu_simple/Simu_A.fits')[0].data ## Input parameters pca = 'PCA' #Estimation of the mixing coefficients from PCA. If different from PCA it will use the array provided in Aprior n = 100 #Number of iterations: increase if the separation is not good enough! nsig = 5 #Threshold in units of noise standard deviation: Can be lowered down to 3 but 5 should be fine. ns = 2 #Number of sources: angle = 10 #Resolution angle for the PCA colour estimation (start with 15 then adjust empirically) alpha = [0,0] #If automated estimation of PCA coefficients fails, chose adequate alphas. See readme for more details plot = False #option to plot the PCA coefficients of the SEDs in the image. This option is usefull if one wants to make sure that SEDs have been correctly estimated. In automated mode, keep this option at False. In case the SEDs have to be refined, set plot to True, identify the features (alignements) on the plot that stand for different SEDs and use this to give values for alpha. (see readme.) ## Running MuSCADeT S,A = MCA.mMCA(cube, Aprior, nsig,n, PCA=[ns,angle], mode=pca, alpha = [0,0]) ## MuSCADeT estimates ns source, which means, variable S contains ns images ## Saves the sources in a fits file hdus = pf.PrimaryHDU(S) lists = pf.HDUList([hdus]) lists.writeto('Simu_For_User/Sources_'+str(n)+'.fits', clobber=True) ## Saves the estimated mixing matrix, A, in a fits file hdus = pf.PrimaryHDU(A) lists = pf.HDUList([hdus]) lists.writeto('Simu_For_User/Estimated_A.fits', clobber=True) ## This command shows the result of the separation in various formats: ## The command needs : A fits file with the extracted source and mixing coefficients (MuSCADeT's outputs) ## A fits file with the original data
## Openning data cube cube = pf.open('Simu_big/Cube.fits')[0].data num,n1,n2 = np.shape(cube) ## A for toy model Aprior = pf.open('Simu_simple/Simu_A.fits')[0].data ## Input parameters pca = 'PCA' #Estimation of the mixing coefficients from PCA. If different from PCA it will use the array provided in Aprior n = 100 #Number of iterations nsig = 5 #Threshold in units of noise standard deviation ns = 2 #Number of sources angle = 5 #Resolution angle for the PCA colour estimation (start with 15 then adjust empirically) ## Running MuSCADeT S,A = MCA.mMCA(cube, Aprior.T, nsig,n, PCA=[ns,angle], mode=pca) hdus = pf.PrimaryHDU(S) lists = pf.HDUList([hdus]) lists.writeto('Simu_big/Sources_'+str(n)+'.fits', clobber=True) hdus = pf.PrimaryHDU(A) lists = pf.HDUList([hdus]) lists.writeto('Simu_big/Estimated_A.fits', clobber=True) cs.make_colour_sub('Simu_big/Sources_'+str(n)+'.fits', 'Simu_big/Estimated_A.fits', './Simu_big/Cube.fits', 'big_'+str(n), prefix = './Simu_big/', cuts = ['-0.1','0.6','-0.05','0.3','-0.02','0.1'])
## Openning data cube cube = pf.open('./Simu_Refsdal_big/Cube.fits')[0].data num,n,n = np.shape(cube) ## A for toy model Aprior =pf.open('Simu_Refsdal_big/Estimated_A_PCA.fits')[0].data ## Input parameters pca = 'noPCA' #Estimation of the mixing coefficients from PCA. If different from PCA it will use the array provided in Aprior n = 2000 #Number of iterations nsig = 5 #Threshold in units of noise standard deviation ns = 2 #Number of sources angle = 50 #Resolution angle for the PCA colour estimation (start with 15 then adjust empirically) ## Running MuSCADeT S,A = MCA.mMCA(cube, Aprior, nsig,n, PCA=[ns,angle], mode=pca, harder = 1) for i in [1]: hdus = pf.PrimaryHDU(S) lists = pf.HDUList([hdus]) lists.writeto('Simu_Refsdal_big/Sources_'+str(n)+'.fits', clobber=True) hdus = pf.PrimaryHDU(A) lists = pf.HDUList([hdus]) lists.writeto('Simu_Refsdal_big/Estimated_A.fits', clobber=True) cs.make_colour_sub('Simu_Refsdal_big/Sources_'+str(n)+'.fits', 'Simu_Refsdal_big/Estimated_A.fits', './Simu_Refsdal_big/Cube.fits', 'Refsdal_big_'+str(n),