plt.plot(sun["ha"], sun["volts"]) plt.xlabel(r"Hour angle [h]", fontsize=18) plt.ylabel(r"Power", fontsize=18) plt.subplot(212) trans = np.fft.fft(sun["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, sun["dec"], 2.*np.pi*sun["ha"]/24.) bandpass = FourierFilter(min_freq=0.001, max_freq=max(local_fringe_frequencies)) sun["volts"] = np.real(bandpass(sun["t"], sun["volts"])[1]) sun.flatten_invalid_points() sun["volts"] = sun.real_boxcar(200) def boxcar(y, width): """ Normalize each chunk of 200 points to the maximum over that range """ medianed = np.zeros(len(y)) for i, v in enumerate(y): boxcar = y[max(0, i-width/2.):min(len(y), i+width/2.)] medianed[i] = v - np.median(boxcar) return medianed ''' suncopy = sun.copyslice(3600, 7100) suncopy["ha"] = suncopy["ha"] positive_values = suncopy["volts"] >= 0.0 enveloper = FourierFilter(max_freq=0.01)
plt.figure() plt.plot(B_to_try, s2s2, linewidth=2) plt.xlabel(r"$B_y$ [m]", fontsize=18) plt.ylabel(r"$\chi^2$", fontsize=18) ''' # These frequencies are in rad^-1, so to apply the filter we must convert the time array to radians bandpass = FourierFilter(min_freq=min_freq, max_freq=max_freq) # crab.flatten_invalid_points() # crab["volts"] = crab["volts"] / sorted(crab["volts"])[-10] # crab.flatten_invalid_points() # crab["volts"] = crab["volts"] / np.max(abs(crab["volts"])) crab["volts"] = crab.real_boxcar(200) plt.figure() plt.subplot(211) plt.plot(crab["ha"], crab["volts"]) 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) decs_to_try = np.arange(catalog_dec - np.deg2rad(10.0), catalog_dec + np.deg2rad(10.0), np.deg2rad(0.01))