suncasa.utils.ovsa_spectrogram

Attributes

current_date

Functions

int_formatter(x, pos)

setup_time_axis(ax, start, end[, minticks, maxticks])

Set up the time axis for a plot with specific tick intervals based on the time range,

plot([timestamp, timerange, figdir, figname, combine, ...])

Plot the OVRO-LWA and EOVSA spectrograms along with STIX and GOES light curves for a given timestamp or time range.

Module Contents

suncasa.utils.ovsa_spectrogram.int_formatter(x, pos)[source]
suncasa.utils.ovsa_spectrogram.setup_time_axis(ax, start, end, minticks=5, maxticks=10)[source]

Set up the time axis for a plot with specific tick intervals based on the time range, ensuring a minimum and maximum number of ticks.

Parameters:
  • ax (matplotlib.axes.Axes) – The axis to set up the time axis for.

  • start (astropy.time.Time) – The start time of the plot.

  • end (astropy.time.Time) – The end time of the plot.

  • minticks (int) – Minimum number of major ticks desired.

  • maxticks (int) – Maximum number of major ticks desired.

suncasa.utils.ovsa_spectrogram.plot(timestamp=None, timerange=None, figdir='/common/lwa/spec_v2/daily/', figname=None, combine=True, clip=[10, 99.995], clip_ovrolwa=None, clip_eovsa=None, add_logo=False, fast_plot=True, interactive=False, overwrite=False, fix_tlim=False, fix_vrange=False)[source]

Plot the OVRO-LWA and EOVSA spectrograms along with STIX and GOES light curves for a given timestamp or time range.

Parameters:
  • timestamp (datetime.datetime, optional) – The timestamp for the data to be plotted. If not provided, the current UTC time is used.

  • timerange (list of datetime.datetime, optional) – The time range to be plotted. If provided, it overrides the timestamp.

  • figdir (str, optional) – Directory where the figures will be saved, defaults to ‘/common/lwa/spec_v2/daily/’.

  • figname (str, optional) – The file name for the combined figure. If not provided, it is generated based on the timestamp.

  • combine (bool, optional) – If True, combine all plots into a single figure, defaults to True. Otherwise, save each plot (OVRO-LWA, EOVSA, STIX, GOES) separately.

  • clip (list of float, optional) – Default percentile values applied to both EOVSA and OVRO-LWA spectrograms when dataset-specific values are not provided, defaults to [10, 99.995].

  • clip_ovrolwa (list of float, optional) – Percentile values for clipping the OVRO-LWA spectrogram. Falls back to clip if not provided.

  • clip_eovsa (list of float, optional) – Percentile values for clipping the EOVSA spectrogram. Falls back to clip if not provided.

  • add_logo (bool, optional) – If True, add logos to the plots, defaults to False.

  • fast_plot (bool, optional) – If True, use fast plotting methods, defaults to True. If you want to plot the full resolution, set it to False. But it will take longer to plot. If the time range is less than 30 minutes, it will automatically set to False.

  • interactive (bool, optional) – If False, suppress plot display and use the ‘Agg’ backend, defaults to False.

Returns:

List of file paths to the saved figures.

Return type:

list of str

Examples:

from suncasa.utils import ovsa_spectrogram as ovsp from datetime import datetime # Example 1: Plotting the synoptic spectrogram for 2024 July 31 ovsp.plot(datetime(2024, 7, 31), figdir=’/data1/workdir/’)

# Example 2: Plotting the synoptic spectrogram for a specific time interval on 2024 July 31 ovsp.plot(timerange=[datetime(2024, 7, 31, 17, 20), datetime(2024, 7, 31, 20, 40)],

figdir=’/data1/workdir/’, fast_plot=True, clip=[5, 99.995])

# Example 3: Plotting the synoptic spectrogram for a specific time interval on 2024 July 31 in full resolution ovsp.plot(timerange=[datetime(2024, 7, 31, 18, 20), datetime(2024, 7, 31, 18, 40)],

figdir=’/data1/workdir/’, fast_plot=False, clip=[5, 99.995])

# Example 4: Plotting the synoptic spectrogram for a specific time interval on 2025 December 10 and saving to web directory ovsp.plot(timerange=[datetime(2025, 12, 10, 22, 0), datetime(2025, 12, 10, 23, 0)],

figdir=f’/common/webplots/SynopticImg/eovsamedia/eovsa-browser/2025/12/10/’, fast_plot=False, clip=[10, 99.5])

suncasa.utils.ovsa_spectrogram.current_date[source]