Пример #1
0

##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/')

plt.show()
Пример #2
0
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'])

Пример #3
0
## A for toy model
Aprior = pf.open('Simu_nottoosimple/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 = 25      #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)

## Writting results
hdus = pf.PrimaryHDU(S)
lists = pf.HDUList([hdus])
lists.writeto('Simu_nottoosimple/Sources_'+str(n)+'.fits', clobber=True)

hdus = pf.PrimaryHDU(A)
lists = pf.HDUList([hdus])
lists.writeto('Simu_nottoosimple/Estimated_A.fits', clobber=True)

## Plot residuals
cs.make_colour_sub('Simu_nottoosimple/Sources_'+str(n)+'.fits',
                   'Simu_nottoosimple/Estimated_A.fits',
                   './Simu_nottoosimple/Cube.fits',
                   'nottosimple_'+str(n), prefix = './Simu_nottoosimple/')


Пример #4
0
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
##                     An optional prefix for file names
##                     Cuts: optional, these are the lower and upper cuts for Red, Green, Blue bands and for the sources to be displayed
## This command will show in DS9 the sources as extrated by MuSCADeT, the original images in RGB, the subtraction of blue (or red) component from the original data, the subtraction of red (or bleu) component from the original data and finally the residuals. If the separation is successful, the residuals should present only nonise.
cs.make_colour_sub('Simu_For_User/Sources_'+str(n)+'.fits',
                   'Simu_For_User/Estimated_A.fits',
                   './Simu_For_User/Cube.fits',
                   prefix = './Simu_For_User/',
                   cuts = ['-0.1','0.6','-0.05','0.3','-0.02','0.1', '0','0.5'])
Пример #5
0
## 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),
                       prefix = './Simu_Refsdal_big/',
                       cuts = ['0','0.1','-0.002','0.06','-0.002','0.03'])