it's hard to look at all the parts of the test code before the matrix approach maybe i can pull out juts the test data there was a lot of references to graphics too ...0827 i'm working in a new file 0833 i'm kind of funny. things are funny. notes debugging new file seeding random to 0, set size to 16 for debuggin (Pdb) list 11 12 waveform_N = 16 #256 #16 13 recording_N = 16 #256 14 waveform = np.random.random(waveform_N) 15 max_period = np.random.random() * waveform_N // recording_N ** 0.5 * 2 16 -> sample_idcs = np.arange(recording_N) / recording_N * max_period 17 recording = sample_sinusoids_funny(waveform, sample_idcs, max_period) 18 19 waveform_freq_2_recording_time = fourier.create_freq2time(max_period, recording_N, waveform_N, recording_N) 20 waveform_freq_reconstructed = np.linalg.solve(waveform_freq_2_recording_time, recording) 21 waveform_reconstructed = np.fft.ifft(waveform_freq_reconstructed) (Pdb) p waveform array([0.5488135 , 0.71518937, 0.60276338, 0.54488318, 0.4236548 , 0.64589411, 0.43758721, 0.891773 , 0.96366276, 0.38344152, 0.79172504, 0.52889492, 0.56804456, 0.92559664, 0.07103606, 0.0871293 ]) (Pdb) p max_period 0.0 The theory is that max_period is the length that each instance of "waveform" takes up within "recording". "waveform" is a repeating signal to extract the spectrum of. max_period should not be 0. that is a definite glitch. i changed its fudge (Pdb) list 11 12 waveform_N = 16 #256 #16 13 recording_N = 16 #256 14 waveform = np.random.random(waveform_N) 15 max_period = 1 + np.random.random() * (waveform_N - 1) / (recording_N - 1) ** 0.5 * 2 16 -> sample_idcs = np.arange(recording_N) / recording_N * max_period 17 recording = sample_sinusoids_funny(waveform, sample_idcs, max_period) 18 19 waveform_freq_2_recording_time = fourier.create_freq2time(max_period, recording_N, waveform_N, recording_N) 20 waveform_freq_reconstructed = np.linalg.solve(waveform_freq_2_recording_time, recording) 21 waveform_reconstructed = np.fft.ifft(waveform_freq_reconstructed) (Pdb) p waveform array([0.5488135 , 0.71518937, 0.60276338, 0.54488318, 0.4236548 , 0.64589411, 0.43758721, 0.891773 , 0.96366276, 0.38344152, 0.79172504, 0.52889492, 0.56804456, 0.92559664, 0.07103606, 0.0871293 ]) (Pdb) p max_period 1.1566110331467683 looks like I am calculating sample_idcs wrongly (0837) (Pdb) n
/shared/src/scratch/test2_upsamplish.py(17)<module>() -> recording = sample_sinusoids_funny(waveform, sample_idcs, max_period) (Pdb) p sample_idcs array([0. , 0.07228819, 0.14457638, 0.21686457, 0.28915276, 0.36144095, 0.43372914, 0.50601733, 0.57830552, 0.65059371, 0.7228819 , 0.79517009, 0.86745827, 0.93974646, 1.01203465, 1.08432284])
sample_idcs should be the points at which to evaluate waveform, to simulate it being sampled into recording. the numbers should increase more rapidly than y=x, but they are increasing less, so i must have an inverted ratio for it. 16 sample_idcs = np.arange(recording_N) / recording_N * max_period oops ! uhhh it goes to recording_N . it will end up going higher than that when done right. each max_period in recording_N, we want it to hit waveform_N . i'm trying this: sample_idcs = np.arange(recording_N) / max_period * waveform_N