radiospectra.spectrogram.
Spectrogram
(data, time_axis, freq_axis, start, end, t_init=None, t_label='Time', f_label='Frequency', content='', instruments=None)[source]¶Bases: sunpy.util.create.Parent
Spectrogram Class.
Warning
This module is under development! Use at your own risk.
Attributes
data  (ndarray ) twodimensional array of the image data of the spectrogram. 
time_axis  (ndarray ) onedimensional array containing the offset from the start for each column of data. 
freq_axis  (ndarray ) onedimensional array containing information about the frequencies each row of the image corresponds to. 
start  (datetime ) starting time of the measurement 
end  (datetime ) end time of the measurement 
t_init  (int) offset from the start of the day the measurement began. If None gets automatically set from start. 
t_label  (str) label for the time axis 
f_label  (str) label for the frequency axis 
content  (str) header for the image 
instruments  (str array) instruments that recorded the data, may be more than one if it was constructed using combine_frequencies or join_many. 
Attributes Summary
COPY_PROPERTIES 

dtype 

shape 
Methods Summary
at_freq (freq) 

auto_const_bg () 
Automatically determine background. 
auto_find_background ([amount]) 
Automatically find the background. 
clip_freq ([vmin, vmax]) 
Return a new spectrogram only consisting of frequencies in the interval [vmin, vmax]. 
clip_values ([vmin, vmax, out]) 
Clip intensities to be in the interval [vmin, vmax]. 
format_freq () 
Override to configure default plotting. 
format_time () 
Override to configure default plotting. 
freq_overlap (other) 
Get frequency range present in both spectrograms. 
interpolate (frequency) 
Linearly interpolate intensity at unknown frequency using linear interpolation of its two neighbours. 
linearize_freqs ([delta_freq]) 
Rebin frequencies so that the frequency axis is linear. 
peek (*args, **kwargs) 
Plot spectrum onto current axes. 
plot ([figure, overlays, colorbar, vmin, …]) 
Plot spectrogram onto figure. 
randomized_auto_const_bg (amount) 
Automatically determine background. 
randomized_subtract_bg (amount) 
Perform randomized constant background subtraction. 
rescale ([vmin, vmax, dtype]) 
Rescale intensities to [vmin, vmax]. 
subtract_bg () 
Perform constant background subtraction. 
time_formatter (x, pos) 
This returns the label for the tick of value x at a specified pos on the time axis. 
time_to_x (time) 
Return xcoordinate in spectrogram that corresponds to the passed datetime value. 
Attributes Documentation
COPY_PROPERTIES
= [('time_axis', 1), ('freq_axis', 1), ('instruments', 1), ('start', 0), ('end', 0), ('t_label', 0), ('f_label', 0), ('content', 0), ('t_init', 0)]¶dtype
¶shape
¶Methods Documentation
auto_find_background
(amount=0.05)[source]¶Automatically find the background. This is done by first subtracting the average value in each channel and then finding those times which have the lowest standard deviation.
Parameters:  amount : float


clip_freq
(vmin=None, vmax=None)[source]¶Return a new spectrogram only consisting of frequencies in the interval [vmin, vmax].
Parameters:  vmin : float
vmax : float


clip_values
(vmin=None, vmax=None, out=None)[source]¶Clip intensities to be in the interval [vmin, vmax].
Any values greater than the maximum will be assigned the maximum, any values lower than the minimum will be assigned the minimum. If either is left out or None, do not clip at that side of the interval.
Parameters:  min : int or float
max : int or float


freq_overlap
(other)[source]¶Get frequency range present in both spectrograms. Returns (min, max) tuple.
Parameters:  other : Spectrogram


interpolate
(frequency)[source]¶Linearly interpolate intensity at unknown frequency using linear interpolation of its two neighbours.
Parameters:  frequency : float or int


linearize_freqs
(delta_freq=None)[source]¶Rebin frequencies so that the frequency axis is linear.
Parameters:  delta_freq : float


peek
(*args, **kwargs)[source]¶Plot spectrum onto current axes.
Parameters:  *args : dict **kwargs : dict


Returns:  fig :

plot
(figure=None, overlays=[], colorbar=True, vmin=None, vmax=None, linear=True, showz=True, yres=1080, max_dist=None, **matplotlib_args)[source]¶Plot spectrogram onto figure.
Parameters:  figure :
overlays : list
colorbar : bool
vmin : float
vmax : float
linear : bool
showz : bool
yres : int or None
max_dist : float or None


randomized_auto_const_bg
(amount)[source]¶Automatically determine background. Only consider a randomly chosen subset of the image.
Parameters:  amount : int


randomized_subtract_bg
(amount)[source]¶Perform randomized constant background subtraction. Does not produce the same result every time it is run.
Parameters:  amount : int


rescale
(vmin=0, vmax=1, dtype=dtype('float32'))[source]¶Rescale intensities to [vmin, vmax]. Note that vmin ≠ vmax and spectrogram.min() ≠ spectrogram.max().
Parameters:  vmin : float or int
vmax : float or int
dtype :

