Plot SIS He Mass Spectrogram

In this example, we use solo_sis_loader’s package to plot the He mass spectrogram.

Import Required Modules

from datetime import datetime

import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import sunpy.net.attrs as a
from matplotlib import colors

from solo_sis_loader import SIS_histo
t_start = '2022-11-11'
t_end = '2022-11-16'
stime = a.Time(t_start, t_end)
level = a.Level('L2')

sish = SIS_histo()
response = sish.search(stime, level=level)
files = sish.fetch(response)
sish.load(files)
Files Downloaded:   0%|          | 0/6 [00:00<?, ?file/s]


solo_L2_epd-sis-a-hehist_20221112_V01.cdf:   0%|          | 0.00/7.98k [00:00<?, ?B/s]

solo_L2_epd-sis-a-hehist_20221111_V01.cdf:   0%|          | 0.00/7.48k [00:00<?, ?B/s]



solo_L2_epd-sis-a-hehist_20221113_V01.cdf:   0%|          | 0.00/7.08k [00:00<?, ?B/s]




solo_L2_epd-sis-a-hehist_20221114_V01.cdf:   0%|          | 0.00/7.63k [00:00<?, ?B/s]





solo_L2_epd-sis-a-hehist_20221115_V01.cdf:   0%|          | 0.00/7.16k [00:00<?, ?B/s]


solo_L2_epd-sis-a-hehist_20221112_V01.cdf:  11%|█         | 870/7.98k [00:00<00:01, 5.05kB/s]



Files Downloaded:  17%|█▋        | 1/6 [00:00<00:02,  2.04file/s]

solo_L2_epd-sis-a-hehist_20221111_V01.cdf:  14%|█▎        | 1.02k/7.48k [00:00<00:01, 5.88kB/s]







solo_L2_epd-sis-a-hehist_20221115_V01.cdf:  14%|█▍        | 1.02k/7.16k [00:00<00:01, 5.94kB/s]









solo_L2_epd-sis-a-hehist_20221113_V01.cdf:  14%|█▍        | 1.02k/7.08k [00:00<00:02, 2.19kB/s]




Files Downloaded:  67%|██████▋   | 4/6 [00:00<00:00,  5.77file/s]




solo_L2_epd-sis-a-hehist_20221114_V01.cdf:  11%|█▏        | 870/7.63k [00:00<00:03, 1.86kB/s]







solo_L2_epd-sis-a-hehist_20221116_V01.cdf:   0%|          | 0.00/6.44k [00:00<?, ?B/s]


solo_L2_epd-sis-a-hehist_20221116_V01.cdf:  14%|█▎        | 870/6.44k [00:00<00:01, 5.31kB/s]



Files Downloaded: 100%|██████████| 6/6 [00:00<00:00,  7.46file/s]
Files Downloaded: 100%|██████████| 6/6 [00:00<00:00,  6.29file/s]

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221111_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221112_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221113_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221114_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221115_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(

 Loading file: /home/docs/sunpy/data/solo_L2_epd-sis-a-hehist_20221116_V01.cdf
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/solo_sis_loader/__init__.py:222: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  data_ = xr.Dataset(
<xarray.Dataset> Size: 95kB
Dimensions:  (time: 288, mass: 80)
Coordinates:
  * time     (time) datetime64[ns] 2kB 2022-11-11T00:43:16 ... 2022-11-17T00:...
  * mass     (mass) float32 320B 2.025 2.075 2.125 2.175 ... 5.875 5.925 5.975
Data variables:
    flux     (time, mass) float32 92kB 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
Attributes:
    instrument:       <sunpy.net.attrs.Instrument(EPD: Energetic Particle Det...
    detector:         <sunpy.net.attrs.Detector: SIS object at 0x7fbfda587650>
    telescope:        A
    axis_title:       EPD-SIS-A Mass Histogram)
    axis_label_time:  Time (UTC)
    axis_label_mass:  Mass (amu)
    axis_label_flux:  Flux (counts)
    units_time:       UTC
    units_mass:       amu
    units_flux:       counts
    mass_bins_low:    [2.   2.05 2.1  2.15 2.2  2.25 2.3  2.35 2.4  2.45 2.5 ...
    mass_bin_width:   [0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05...


fig, axis = plt.subplots(figsize=(6, 5), dpi=200)

sish.dataset.flux.plot.pcolormesh(x='time',
                                  cmap='turbo',
                                  add_colorbar=False,
                                  norm=colors.LogNorm(vmin=1, vmax=100),
                                  ax=axis)

axis.axhline(y=3.016029, linestyle='--', color='tab:red')
axis.axhline(y=4.002603, linestyle='--', color='tab:blue')

axis.set_xlim([datetime(2022, 11, 11), datetime(2022, 11, 16)])
axis.set_ylim([2, 5])

axis.set_yticklabels(axis.get_yticks(), rotation=90, va='center')

axis.set_ylabel('Mass (AMU)')
axis.set_xlabel('Time (UTC)')

axis.yaxis.minorticks_on()

axis.xaxis.set_major_locator(mdates.AutoDateLocator())
axis.xaxis.set_minor_locator(mdates.HourLocator())

plt.setp(axis.get_xticklabels(), rotation=0, ha='center')

axis.set_title('Helium mass spectrogram (SolO SIS-A, 0.5-2 MeV/nuc)')

fig.tight_layout()

plt.show()
Helium mass spectrogram (SolO SIS-A, 0.5-2 MeV/nuc)
/home/docs/checkouts/readthedocs.org/user_builds/solo-sis-loader/checkouts/latest/docs/source/examples/Basic_Plots/solo_sis_plot_histogram.py:48: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  axis.set_yticklabels(axis.get_yticks(), rotation=90, va='center')

Total running time of the script: (0 minutes 1.579 seconds)

Gallery generated by Sphinx-Gallery