示例#1
0
    amperr = pi[0].error
    sigma = pi[2].value
    sigmaerr = pi[2].error
    integral = amp * (2*np.pi)**0.5 *(sigma)
    int_error = (((amperr/amp)**2 + (sigmaerr/sigma)**2)*integral**2)**0.5

    return amp, amperr, sigma*FWHM, sigmaerr*FWHM, integral, int_error, pi[1].value, pi[1].error

def integral_ml(pi):
    return tbl_vals_gaussian(pi)[4:6]

F = False
T = True

sp6e8,spK6e8,_,_ = goddi_nh3_fits.load_spectrum(6, object='w51e8', headerfile='/Users/adam/work/w51/goddi/W51-25GHzcont.map.image.fits')
sp6e8.specfit.Registry.add_fitter('hfonly',hfonly_fitter(),7)
sp7e8,spK7e8,_,_ = goddi_nh3_fits.load_spectrum(7, object='w51e8', headerfile='/Users/adam/work/w51/goddi/W51-25GHzcont.map.image.fits')
sp7e8.specfit.Registry.add_fitter('hfonly',hfonly_fitter(),7)
sp9e8,spK9e8,_,_ = goddi_nh3_fits.load_spectrum(9, object='w51e8', headerfile='/Users/adam/work/w51/goddi/W51-27GHzcont.map.image.fits')
sp9e8.specfit.Registry.add_fitter('hfonly',hfonly_fitter(),7)
sp10e8,spK10e8,_,_ = goddi_nh3_fits.load_spectrum(10, object='w51e8', headerfile='/Users/adam/work/w51/goddi/W51-29GHzcont.map.image.fits')
sp10e8.specfit.Registry.add_fitter('hfonly',hfonly_fitter(),7)
sp13e8,spK13e8,_,_ = goddi_nh3_fits.load_spectrum(13, object='w51e8', headerfile='/Users/adam/work/w51/goddi/W51-33GHzcont.map.image.fits')
sp13e8.specfit.Registry.add_fitter('hfonly',hfonly_fitter(),7)

sp6e8.plotter()
sp7e8.plotter()
sp9e8.plotter()
sp10e8.plotter()
sp13e8.plotter()
limits = [(50, 65), (25,30), (0, 1), (0.1, 6), (30, 35), (0, 1), (0.1, 6)]
import os
from hf_only_model import hfonly_66_fixed_fitter, hfonly_fitter, sixsix_movinghf_fitter
from spectral_cube import SpectralCube
from astropy import units as u
import numpy as np
import pyspeckit

pyspeckit.fitters.default_Registry.add_fitter('hfonly', hfonly_fitter(), 7)
pyspeckit.fitters.default_Registry.add_fitter('hfonly66',
                                              hfonly_66_fixed_fitter(), 4)
pyspeckit.fitters.default_Registry.add_fitter('sixsix_movinghf',
                                              sixsix_movinghf_fitter(), 5)

cube = SpectralCube.read(
    '/Volumes/passport/W51-GODDI/W51e2_66_baselined-sc-pb.cube.image.fits')
scube = cube[:, 230:307, 205:270]
errmap = scube.spectral_slab(-20 * u.km / u.s, 10 * u.km / u.s).std(axis=0)
mn = scube.min(axis=0).value

guesses = np.empty((7, scube.shape[1], scube.shape[2]))
guesses[0, :, :] = 58
guesses[1, :, :] = 26.9
guesses[2, :, :] = 0.010
guesses[3, :, :] = 1.5
guesses[4, :, :] = 31.4
guesses[5, :, :] = 0.010
guesses[6, :, :] = 1.5

negmask = mn < -0.005
guesses[2, negmask] = -0.1
guesses[5, negmask] = -0.1
import os
from hf_only_model import hfonly_66_fixed_fitter, hfonly_fitter, sixsix_movinghf_fitter
from spectral_cube import SpectralCube
from astropy import units as u
import numpy as np
import pyspeckit

pyspeckit.fitters.default_Registry.add_fitter('hfonly', hfonly_fitter(), 7)
pyspeckit.fitters.default_Registry.add_fitter('hfonly66', hfonly_66_fixed_fitter(), 4)
pyspeckit.fitters.default_Registry.add_fitter('sixsix_movinghf', sixsix_movinghf_fitter(), 5)

cube = SpectralCube.read('/Volumes/passport/W51-GODDI/W51e2_66_baselined-sc-pb.cube.image.fits')
scube = cube[:, 230:307, 205:270]
errmap = scube.spectral_slab(-20*u.km/u.s, 10*u.km/u.s).std(axis=0)
mn = scube.min(axis=0).value


guesses = np.empty((7, scube.shape[1], scube.shape[2]))
guesses[0,:,:] = 58
guesses[1,:,:] = 26.9
guesses[2,:,:] = 0.010
guesses[3,:,:] = 1.5
guesses[4,:,:] = 31.4
guesses[5,:,:] = 0.010
guesses[6,:,:] = 1.5

negmask = mn<-0.005
guesses[2, negmask] = -0.1
guesses[5, negmask] = -0.1