Well it's not just the gaps; your data is also non-uniformly sampled.
index_col to use the time column as the index to your dataframe:
df = pd.read_table('BD-10d4669.p.1',
[221 rows x 1 columns]
Then you can see the spacing between samples is not exactly the same:
Out: array([1.052, 1.015])
signal.spectrogram only operates on uniformly-sampled data, and you're throwing away the time information with
You can use
signal.lombscargle to see a spectrum of the non-uniformly sampled data, following the example there:
The .note file says:
Columns: 1) HJD-2,400,000
P0 = 4.84125 days
P1 = 3.38530 days
HJD is Heliocentric Julian Date, so the sampling times are in days and we want to measure periods of several days.
P0 = 4.84125 # days / cycle
P1 = 3.38530 # days / cycle
f0 = 1/P0 # cycles / day
f1 = 1/P1 # cycles / day
# But lombscargle uses angular frequency, so
w0 = f0 * 2*np.pi # = 1.29784 radians / day
w1 = f1 * 2*np.pi # = 1.85602 radians / day
w = np.linspace(0.01, 3, 100000) # radians / day
pgram = signal.lombscargle(df.index, df['mag'], w, normalize=True)
plt.subplot(2, 1, 1)
plt.plot(df.index, df['mag'], 'b+')
plt.subplot(2, 1, 2)
This isn't showing the expected peak at angular frequency of ω0 = 1.29784 rad/day, so I'm confused:
I don't know why the units aren't working out. In the example, the time variable is in seconds, and the peak of the periodogram is at 1, which represents 1 rad/sec.
So if the time variable here is in days, I would expect the
w variable to be in radians/day.
Anyway, after figuring out why the units don't work (maybe my mistake somewhere), you can try to interpolate the original data to regularly-spaced timestamps with NaN values for the missing days:
df.index = pd.to_datetime(df.index + 2_400_000, unit='D', origin='julian')
But there's so little data with such large gaps between them that I don't think you can get any meaningful spectrogram out of it.