File:Power spectrum of sunspot number, from 1945 to 2017.png
![File:Power spectrum of sunspot number, from 1945 to 2017.png](https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Power_spectrum_of_sunspot_number%2C_from_1945_to_2017.png/368px-Power_spectrum_of_sunspot_number%2C_from_1945_to_2017.png?20230714043708)
Original file (959 × 1,560 pixels, file size: 325 KB, MIME type: image/png)
Captions
Captions
Summary
editDescriptionPower spectrum of sunspot number, from 1945 to 2017.png |
English: The daily sunspot number from 1945-01-02 to 2017-06-30, and its power spectral analysis. There are two prominent peaks corresponding to its 27-day cycle and 11-year cycle.
See "The 27-day signal in sunspot number series and the solar dynamo" (JL Le Mouël, MG Shnirman, EM Blanter - Solar Physics, 2007) data from NOAA plotted in Python ```python import pandas as pd import matplotlib.pyplot as plt from urllib.request import urlopen from io import StringIO
url = "https://ngdc.noaa.gov/stp/space-weather/solar-data/solar-indices/sunspot-numbers/american/lists/list_aavso-arssn_daily.txt" raw_data = urlopen(url).read().decode('utf-8') print("data retrieved")
data_lines = raw_data.split('\n')[3:]
data = StringIO('\n'.join(data_lines))
columns = ['Year', 'Month', 'Day', 'SSN']
df = pd.read_csv(data, delim_whitespace=True, names=columns)
df['Date'] = pd.to_datetime(df'Year', 'Month', 'Day')
df.set_index('Date', inplace=True)
df = df.dropna(subset=['SSN']) import numpy as np ssn = df['SSN'] n = len(ssn)
yf = np.fft.fft(ssn)
power_spectrum = np.abs(yf[:n//2]) ** 2
xf = np.fft.fftfreq(n, d=1) # Assume the time step d=1
xf = xf[:n//2]
fig, axes = plt.subplot_mosaic("A;B;B", figsize=(10, 16))
ax = axes["A"] ax.scatter(df.index, df['SSN'], s=0.5) ax.set_title('Sunspot Number Over Time') ax.set_xlabel('Date') ax.set_ylabel('SSN')
ax = axes["B"] ax.set_xscale('log') ax.set_yscale('log') ax.scatter(xf, power_spectrum, s=1) num_segments = 100
num_segments = 100 min_log_freq = np.log(np.min(xf[xf > 0])) # Exclude zero frequency max_log_freq = np.log(np.max(xf)) log_freq_range = max_log_freq - min_log_freq for i in range(num_segments): start = i * len(xf) // num_segments end = (i + 1) * len(xf) // num_segments avg_log_freq = np.mean(np.log(xf[start:end][xf[start:end] > 0])) # Exclude zero frequency alpha = 1 - ((avg_log_freq - min_log_freq) / log_freq_range) # Calculate alpha relative to log-frequency range alpha = alpha**2 ax.loglog(xf[start:end], power_spectrum[start:end], color='b', alpha=alpha) solar_cycle = (10.7 * 365) ax.vlines(1/solar_cycle, ymin=10**2, ymax=10**12, linestyle='--', linewidth=0.5) ax.text(1/solar_cycle, 10**12, 'Solar cycle = 10.7 years', rotation=0, verticalalignment='center', fontsize=12) lunar_cycle = 27.3 ax.vlines(1/lunar_cycle, ymin=10**2, ymax=10**12, linestyle='--', linewidth=0.5) ax.text(1/lunar_cycle, 10**12, 'Monthly cycle = 27.3 days', rotation=0, verticalalignment='center', fontsize=12)
nonzero_indices = xf > 10**(-4) xf_nonzero = xf[nonzero_indices] power_spectrum_nonzero = power_spectrum[nonzero_indices]
weights = 1 / xf_nonzero
log_xf = np.log(xf_nonzero) log_power_spectrum = np.log(power_spectrum_nonzero)
A = np.vstack([log_xf, np.ones(len(log_xf))]).T b = log_power_spectrum
x, residuals, rank, s = np.linalg.lstsq(A * np.sqrt(weights[:, np.newaxis]), b * np.sqrt(weights), rcond=None)
b_weighted = x[0] log_a_weighted = x[1] a_weighted = np.exp(log_a_weighted) xf_fit = np.linspace(np.min(xf_nonzero), np.max(xf_nonzero), 1000) power_spectrum_fit_weighted = a_weighted * xf_fit ** b_weighted ax.loglog(xf_fit, power_spectrum_fit_weighted, 'r-', label=f'S(f) = {a_weighted:.2e} * f^{{{b_weighted:.2f}}}', color="black", linewidth=1, alpha=0.5, linestyle="--") ax.legend() ax.set_title('Power Spectrum of SSN') ax.set_xlabel('Frequency [day^(-1)]') ax.set_ylabel('Power Spectrum') ax.grid(True)
plt.tight_layout() plt.show() ``` |
Date | |
Source | Own work |
Author | Cosmia Nebula |
Licensing
edit![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 04:37, 14 July 2023 | ![]() | 959 × 1,560 (325 KB) | Cosmia Nebula (talk | contribs) | Uploaded while editing "Sunspot" on en.wikipedia.org |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Software used | |
---|---|
Horizontal resolution | 39.37 dpc |
Vertical resolution | 39.37 dpc |