Laser-Wobble: Show amplitude spectral density instead
This commit is contained in:
		
							parent
							
								
									3bc3984375
								
							
						
					
					
						commit
						1906e71696
					
				
					 3 changed files with 35 additions and 27 deletions
				
			
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -87,7 +87,7 @@ print(f"Video processing took {processing_time:.2f} seconds ({processing_time /
 | 
			
		|||
    Snapshot capture of frame   2331 at  77.70s: Intensity 12.612
 | 
			
		||||
    Snapshot capture of frame   2664 at  88.80s: Intensity 12.257
 | 
			
		||||
    Snapshot capture of frame   2997 at  99.90s: Intensity 12.728
 | 
			
		||||
    Video processing took 251.50 seconds (0.084 seconds per frame).
 | 
			
		||||
    Video processing took 257.32 seconds (0.086 seconds per frame).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -202,8 +202,11 @@ pass
 | 
			
		|||
```python
 | 
			
		||||
from scipy import signal
 | 
			
		||||
 | 
			
		||||
fx, psd_x = signal.periodogram(np.nan_to_num(laser_position[:, 1]), frame_rate)
 | 
			
		||||
fy, psd_y = signal.periodogram(np.nan_to_num(laser_position[:, 0]), frame_rate)
 | 
			
		||||
frequency_x, power_spectral_density_x = signal.periodogram(np.nan_to_num(laser_position[:, 1]), frame_rate)
 | 
			
		||||
frequency_y, power_spectral_density_y = signal.periodogram(np.nan_to_num(laser_position[:, 0]), frame_rate)
 | 
			
		||||
 | 
			
		||||
amplitude_spectral_density_x = np.sqrt(power_spectral_density_x)
 | 
			
		||||
amplitude_spectral_density_y = np.sqrt(power_spectral_density_y)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Spectral Analysis
 | 
			
		||||
| 
						 | 
				
			
			@ -214,15 +217,16 @@ The following figure looks at the spectral density in the displacement along X a
 | 
			
		|||
fig, ax = plt.subplots(2, 1, figsize=(16, 8))
 | 
			
		||||
 | 
			
		||||
ax[1].axvline(x=2.822, color="red")
 | 
			
		||||
ax[1].annotate(" theoretical spring resonance", xy=(2.822, 2e5))
 | 
			
		||||
ax[1].annotate(" theoretical spring resonance", xy=(2.822, 1080 / 2 - 150))
 | 
			
		||||
 | 
			
		||||
ax[0].loglog(frequency_x, amplitude_spectral_density_x, label="X axis")
 | 
			
		||||
ax[1].loglog(frequency_y, amplitude_spectral_density_y, label="Y axis")
 | 
			
		||||
 | 
			
		||||
ax[0].loglog(fx, psd_x, label="X axis")
 | 
			
		||||
ax[1].loglog(fy, psd_y, label="Y axis")
 | 
			
		||||
for a in ax:
 | 
			
		||||
    a.set_xlabel("frequency / Hz")
 | 
			
		||||
    a.set_ylabel("spectral density")
 | 
			
		||||
    a.set_ylabel("amplitude spectral density")
 | 
			
		||||
    a.set_xlim(0.5, 15)
 | 
			
		||||
    a.set_ylim(1, 5e5)
 | 
			
		||||
    a.set_ylim(1, 1080 / 2)
 | 
			
		||||
    a.legend()
 | 
			
		||||
    a.grid(axis="x", which="both")
 | 
			
		||||
    a.grid(axis="y", which="major")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								Calculations/Laser-Wobble/output_14_0.png
									 (Stored with Git LFS)
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Calculations/Laser-Wobble/output_14_0.png
									 (Stored with Git LFS)
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue