def test_copy(): maps_file = remote_data_file('manga-8138-12704-MAPS-{0}.fits.gz'.format(dap_test_daptype)) kin = manga.MaNGAGasKinematics(maps_file) _kin = kin.copy() assert kin.vel is not _kin.vel, 'Velocity array points to the same object' assert numpy.array_equal(kin.vel, _kin.vel), 'Velocity data should be identical' assert kin.nbin == _kin.nbin, 'Number of bins is not the same'
def test_sbholes(): maps_file = remote_data_file('manga-8138-12704-MAPS-{0}.fits.gz'.format(dap_test_daptype)) kin = manga.MaNGAGasKinematics(maps_file, flux_bound=(0, 100)) sb = kin.remap('sb') _sb = util.gaussian_fill(sb) assert numpy.sum(_sb - sb.filled(0.0) > 0) > 250, 'Number of fixed spaxels changed.'
def test_inv_covar(): maps_file = remote_data_file('manga-8078-12703-MAPS-{0}.fits.gz'.format(dap_test_daptype)) kin = manga.MaNGAGasKinematics(maps_file, covar=True) # Force the covariance matrix to be positive definite cov = util.impose_positive_definite(kin.vel_covar) # Invert it icov = util.cinv(cov.toarray()) # Check that you get back the identity matrix assert numpy.std(numpy.diag(numpy.dot(icov, cov.toarray())) - 1.) < 1e-4, \ 'Multiplication by inverse matrix does not accurately produce identity matrix'
def test_manga_gas_kinematics(): maps_file = remote_data_file('manga-8138-12704-MAPS-{0}.fits.gz'.format(dap_test_daptype)) cube_file = remote_data_file('manga-8138-12704-LOGCUBE.fits.gz') kin = manga.MaNGAGasKinematics(maps_file, cube_file=cube_file) _vel = kin.remap('vel', masked=False) with fits.open(maps_file) as hdu: eml = manga.channel_dictionary(hdu, 'EMLINE_GVEL') assert numpy.array_equal(_vel, hdu['EMLINE_GVEL'].data[eml['Ha-6564']]), 'Bad read' # Check that the binning works. NOTE: This doesn't use # numpy.array_equal because the matrix multiplication used by bin() # leads to differences that are of order the numerical precision. assert numpy.allclose(kin.bin(_vel), kin.vel), 'Rebinning is bad'