# Next we set invalid points (from telescope homing) to the avg_dc moon.flatten_invalid_points() plt.subplot(211) plt.plot(moon["ha"], moon["volts"]) plt.xlabel(r"Hour angle [h]", fontsize=18) plt.ylabel(r"Power", fontsize=18) plt.subplot(212) trans = np.fft.fft(moon["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) # Now we remove the dc offset, as well as high frequency noise local_fringe_frequencies = fringe_freq(B, wl, moon["dec"], 2.*np.pi*moon["ha"]/24.) bandpass = FourierFilter(min_freq=0.001, max_freq=max(local_fringe_frequencies)) # moon["volts"] = np.real(bandpass(moon["t"], moon["volts"])[1]) moon.flatten_invalid_points() # moon["volts"] = moon.real_boxcar(200) moon["volts"] = np.load("moonshine.npz")["volts"] plt.figure() plt.plot(moon["ha"], moon["volts"]) plt.xlabel(r"Hour angle [h]", fontsize=18) plt.ylabel(r"Power", fontsize=18) plt.plot(moon["ha"], moon.envelope(50)) ''' mooncopy = moon.copyslice(3600, 7100) mooncopy["ha"] = mooncopy["ha"]
plt.xlabel(r"Hour angle [h]", fontsize=18) plt.ylabel(r"Power", fontsize=18) 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) # First we set invalid points (from telescope homing) to the avg_dc crab.flatten_invalid_points() crab["volts_orig"] = crab["volts"] # Next we find the min and max fringe frequencies that we expect to see in the data # divide it into chunks since the fringe frequency changes over time local_fringe_frequencies = fringe_freq(10.0, wl, OBJECTS["3C144"]["dec"], 2.*np.pi*crab["ha"]/24.) min_freq = np.min(abs(local_fringe_frequencies)) # min_freq = 40.0 # rad^-1 (seen by eye as the limit of good data) max_freq = np.max(abs(local_fringe_frequencies)) catalog_dec = OBJECTS["3C144"]["dec"] ''' s2s2 = [] Y_s2 = [] a2s = [] B_to_try = np.arange(5.0, 15.0, 0.01) for baseline in B_to_try: a, Y_, s2, cov = fit_components(crab["ha"], crab.normed, #crab["volts"], lambda ha: np.cos(2*np.pi*(baseline/wl) * np.cos(catalog_dec) * np.sin(2.*np.pi*ha/24.)), lambda ha: - np.sin(2*np.pi*(baseline/wl) * np.cos(catalog_dec) * np.sin(2.*np.pi*ha/24.))