Utility Functions¶
- PyThea.utils.download_fits(timerange, imager, imager_dict=None, database_dir=None)[source]¶
Downloads the imaging data (FITS files) from the Virtual Solar Observatory (VSO).
- Parameters:
timerange (sunpy.net.attrs.Time) – The time range of the data search.
imager (str) – The name of the imager (e.g., ‘AIA’, ‘HMI’).
imager_dict (dict, optional) – A dictionary containing imager properties where keys are imager names and values are dictionaries with properties including ‘fido’, ‘source’, ‘instrument’, ‘detector’ (optional), and ‘wavelength’ (optional). The default imager_dict is from PyThea.config.selected_imagers.import imager_dict.
database_dir (str, optional) – The base directory where the data will be saved. The default is os.path.join(Path.home(), ‘PyThea’).
- Returns:
A list of downloaded FITS file paths.
- Return type:
- PyThea.utils.load_fits(files)[source]¶
Loads imaging data (FITS files) from a list of files and returns them as SunPy map objects.
- PyThea.utils.make_figure(map, cmap='Greys_r', clim=[-20, 20], clip_model=True, **kwargs)[source]¶
Creates the main imager figure and returns the figure and axis handles.
- Parameters:
map (sunpy.map.Map) – The SunPy map to be plotted.
cmap (str, optional) – The colormap to be used for the plot (default is ‘Greys_r’).
clim (list, optional) – The color limits for the plot as [min, max] (default is [-20, 20]).
clip_model (bool, optional) – Whether to clip the axis limits to the map’s data shape (default is True).
**kwargs (dict) –
- Additional keyword arguments for customization, including:
fig: The figure object (default creates a new figure).
axis: The axis object (default creates a new axis with the map’s projection).
median_filter: The size of the median filter to apply (default is 1, which means no filtering).
- Returns:
The figure and axis handles.
- Return type:
Notes
This function customizes the plot by optionally applying a median filter, setting color limits, drawing the solar limb, and adjusting axis properties.
- PyThea.utils.get_hek_flare(timerange, thresshold='B1.0')[source]¶
Returns the flare list for a given day from HEK.
This function will download the flare data from HEK and return a list of flares.
- Parameters:
timerange (sunpy.net.attrs.Time) – The time range of the data search.
thresshold (str, optional) – The flare class above which to do the search (default ‘B1.0’).
thresshold – The flare class above which the search will return records (default: ‘B1.0’).
- Return type: