Beispiel #1
0
def get_feed_ps(feed):
    my_map = map_cosmo.MapCosmo(mapname, feed=feed)

    my_ps = power_spectrum.PowerSpectrum(my_map)

    ps, k, nmodes = my_ps.calculate_ps()

    rms_mean, rms_sig = my_ps.run_noise_sims(10)
    my_ps.make_h5()
    return ps, k, rms_mean, rms_sig
Beispiel #2
0
import sys

import tools
import map_cosmo
import power_spectrum

try:
    mappath = sys.argv[1]
except IndexError:
    print('Missing filepath!')
    print('Usage: python ps_script.py mappath')
    sys.exit(1)

my_map = map_cosmo.MapCosmo(mappath)

my_ps = power_spectrum.PowerSpectrum(my_map)

ps, k, nmodes = my_ps.calculate_ps()

rms_mean, rms_sig = my_ps.run_noise_sims(10)

my_ps.make_h5()

fig = plt.figure()

ax1 = fig.add_subplot(211)
ax1.errorbar(k, ps, rms_sig, fmt='o', label=r'$\tilde{P}_{data}(k)$')
ax1.plot(k, rms_mean, 'k', label=r'$\tilde{P}_{noise}(k)$', alpha=0.4)
# ax1.plot(k_th, ps_th * 10, 'r--', label=r'$10 * P_{Theory}(k)$')
ax1.set_ylabel(r'$\tilde{P}(k)$ [$\mu$K${}^2$ (Mpc)${}^3$]')
ax1.set_ylim(1e5, 1e8)  # ax1.set_ylim(0, 0.1)
Beispiel #3
0
my_map = map_cosmo.MapCosmo(mapname)
my_map2 = map_cosmo.MapCosmo(mapname2)

tot_rms = np.zeros_like(my_map.rms)
where = np.where((my_map.rms * my_map2.rms) != 0)
tot_rms[where] = np.sqrt(my_map.rms[where]**2 + my_map2.rms[where]**2)

summap = np.zeros_like(my_map.map)
summap[where] = (my_map.map[where] + my_map2.map[where])
diffmap = np.zeros_like(my_map.map)
diffmap[where] = (my_map.map[where] - my_map2.map[where])

my_map.rms = tot_rms
my_map.map = summap

sum_ps = power_spectrum.PowerSpectrum(my_map)

ps, k, nmodes = sum_ps.calculate_ps()

rms_mean, rms_sig = sum_ps.run_noise_sims(10)

outname = 'spectra/ps_sum' + my_map.save_string + '_' + my_map2.map_string + '.h5'

sum_ps.make_h5(outname=outname)

ps_sum, k, _ = sum_ps.calculate_ps()

my_map.map = diffmap
diff_ps = power_spectrum.PowerSpectrum(my_map)
ps_diff, k, _ = diff_ps.calculate_ps()