예제 #1
0
expected_roots = np.array(find_roots(fR_range, bessel_y))

R_known = np.deg2rad(0.26)
expected_freqs = expected_roots / R_known


# plt.plot(moon["t"], moon["volts"])
minima_spots = [(7000, 11000)]
obs_zeros = []
plottypairs = []
for start, end in minima_spots:
    # Cut out a small window around the guessed envelope
    # fit a quadratic to find minima
    (C1, C2, C3), Y_, s2, cov = fit_components(moon["ha"][start: end], moon.envelope(50)[start:end],
        lambda ha: ha ** 2,
        lambda ha: ha,
        lambda ha: 1,
    )
    plottypairs.append((moon["ha"][start:end], Y_))
    vertex = -C2 / (2. * C1)
    obs_zeros.append(vertex)

    '''
    _, aa = zip(*sorted(zip(b, a)))
    min_ha = aa[0]
    obs_zeros.append(min_ha)

    print "found", min_ha
    plottypairs.append((a, b))
    '''
    print "found", vertex
예제 #2
0
plt.subplot(212)
trans = np.fft.fft(crab["volts"])
freqs = np.fft.fftfreq(len(trans), 2.*np.pi * 1.0 / 86164.)
plt.plot(np.fft.fftshift(freqs), np.fft.fftshift(abs(trans)**2))
plt.xlabel(r"Frequency [rad$^{-1}$]", fontsize=18)
plt.ylabel(r"Power", fontsize=18)

decs_to_try = np.arange(catalog_dec - np.deg2rad(10.0), catalog_dec + np.deg2rad(10.0), np.deg2rad(0.01))

s2s = []
Y_s = []
a1s = []
for dec in decs_to_try:
    # print "trying %s out of %s" % (dec, len(decs_to_try))
    a, Y_, s2, cov = fit_components(crab["ha"], crab.normed, # crab["volts"],
        lambda ha: np.cos(2*np.pi*(B/wl) * np.cos(dec) * np.sin(2.*np.pi*ha/24.)),
        lambda ha: - np.sin(2*np.pi*(B/wl) * np.cos(dec) * np.sin(2.*np.pi*ha/24.))
    )
    s2s.append(s2)
    Y_s.append(Y_)
    a1s.append(a)

a1 = a1s[np.argmin(s2s)]
measured_dec = decs_to_try[np.argmin(s2s)]

plt.figure()
plt.plot(np.rad2deg(decs_to_try), s2s, linewidth=2)
plt.xlabel(r"$\delta$ [deg]", fontsize=18)
plt.ylabel(r"$\chi^2$", fontsize=18)


s2s2 = []