suncasa.utils.stackplot

Classes

LightCurveBuilder

SpaceTimeSlitBuilder

CutslitBuilder

Stackplot

Functions

resettable(f)

b_filter(data, lowcut, highcut, fs, ix)

runningmean(data, window, ix)

c_correlate(a, v[, returnx])

XCorrMap(data[, refpix])

XCorrStackplt(z, x, y[, doxscale])

get the cross correlation map along y axis

FitSlit(xx, yy, cutwidth, cutang, cutlength[, s, ...])

MakeSlit(pointDF)

getimprofile(data, cutslit[, xrange, yrange, get_peak])

smooth(x[, window_len, window])

smooth the data using a window with requested size.

grid(x, y, z[, resX, resY])

Convert 3 column data to matplotlib grid

polyfit(x, y, length, deg)

Module Contents

suncasa.utils.stackplot.resettable(f)[source]
suncasa.utils.stackplot.b_filter(data, lowcut, highcut, fs, ix)[source]
suncasa.utils.stackplot.runningmean(data, window, ix)[source]
suncasa.utils.stackplot.c_correlate(a, v, returnx=False)[source]
suncasa.utils.stackplot.XCorrMap(data, refpix=[0, 0])[source]
suncasa.utils.stackplot.XCorrStackplt(z, x, y, doxscale=True)[source]

get the cross correlation map along y axis :param z: data :param x: x axis :param y: y axis :return:

suncasa.utils.stackplot.FitSlit(xx, yy, cutwidth, cutang, cutlength, s=None, method='Polyfit', ascending=True)[source]
suncasa.utils.stackplot.MakeSlit(pointDF)[source]
suncasa.utils.stackplot.getimprofile(data, cutslit, xrange=None, yrange=None, get_peak=False)[source]
suncasa.utils.stackplot.smooth(x, window_len=11, window='hanning')[source]

smooth the data using a window with requested size.

This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the begining and end part of the output signal.

input:

x: the input signal window_len: the dimension of the smoothing window; should be an odd integer window: the type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’

flat window will produce a moving average smoothing.

output:

the smoothed signal

example:

t=linspace(-2,2,0.1) x=sin(t)+randn(len(t))*0.1 y=smooth(x)

see also:

numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve scipy.signal.lfilter

NOTE: length(output) != length(input), to correct this: return y[(window_len/2-1):-(window_len/2)] instead of just y.

suncasa.utils.stackplot.grid(x, y, z, resX=20, resY=40)[source]

Convert 3 column data to matplotlib grid

suncasa.utils.stackplot.polyfit(x, y, length, deg)[source]
class suncasa.utils.stackplot.LightCurveBuilder(stackplt, axes, scale=1.0, color='white')[source]
stackplt[source]
axes_dspec[source]
lghtcurvlines = [][source]
scale = 1.0[source]
color = 'white'[source]
xx[source]
yy[source]
cid[source]
bcut_curvsav[source]
bcut_curvdel[source]
lightcurves = [][source]
clickedpoints_text = [][source]
vmax[source]
vmin[source]
ymax[source]
ymin[source]
__call__(event)[source]
update(mask=None)[source]
save(event)[source]
delete(event)[source]
delete_byindex(index)[source]
update_text()[source]
lightcurves_tofile(outfile=None, lightcurves=None)[source]
lightcurves_fromfile(infile, color=None)[source]
class suncasa.utils.stackplot.SpaceTimeSlitBuilder(axes, cutlength=80, cutsmooth=10.0, scale=1.0, color='white')[source]
cutlength = 80[source]
scale = 1.0[source]
color = 'white'[source]
xx[source]
yy[source]
cid[source]
bcut_cutsav[source]
bcut_cutdel[source]
cutsmooth = 10.0[source]
spacetimeslits = [][source]
slitlines = [][source]
slitlines_text = [][source]
__call__(event)[source]
FitSlit(xx, yy, cutlength, method='Polyfit', s=0, ascending=True)[source]

polynomial fit

update(mask=None)[source]
save(event)[source]
delete(event)[source]
delete_byindex(index)[source]
update_text()[source]
spacetimeslits_tofile(outfile=None, spacetimeslits=None)[source]
spacetimeslits_fromfile(infile, color=None)[source]
class suncasa.utils.stackplot.CutslitBuilder(axes, cutwidth=5, cutang=0, cutlength=80, cutsmooth=10.0, scale=1.0)[source]
axes[source]
cutlength = 80[source]
cutwidth = 5[source]
cutang = 0[source]
cutsmooth = 10.0[source]
scale = 1.0[source]
xx[source]
yy[source]
cid[source]
__call__(event)[source]
update(mask=None)[source]
class suncasa.utils.stackplot.Stackplot(infile=None)[source]
instrum_meta[source]
aia_lvl1[source]
suncasadb[source]
fitsdir[source]
mapcube = None[source]
mapcube_diff = None[source]
mapcube_plot = None[source]
cutslitbd = None[source]
stackplt = None[source]
trange = None[source]
wavelength = None[source]
fitsfile = None[source]
exptime_orig = None[source]
fov = None[source]
binpix = None[source]
dt_data = None[source]
divider_im = None[source]
divider_dspec = None[source]
sCutwdth = None[source]
sCutang = None[source]
sCutlngth = None[source]
fig_mapcube = None[source]
get_plot_title(smap, title)[source]
plot_map(smap, dspec=None, diff=False, norm=None, cmap=None, SymLogNorm=False, linthresh=0.5, returnImAx=False, layout_vert=False, uni_cm=False, draw_limb=False, draw_grid=False, colortitle=None, title=['observatory', 'detector', 'wavelength', 'time'], fov=fov, *args, **kwargs)[source]
make_mapcube(trange, outfile=None, fov=None, wavelength='171', binpix=1, dt_data=1, derotate=False, tosave=True, superpixel=False, aia_prep=False, mapinterp=False)[source]
mapcube_fromfile(infile)[source]
mapcube_tofile(outfile=None, mapcube=None)[source]
mapcube_drot()[source]
mapcube_resample(binpix=1)[source]
mapcube_diff_denoise(log=False, vmax=None, vmin=None)[source]
mapcube_mkdiff(mode='rdiff', dt=36.0, medfilt=None, gaussfilt=None, bfilter=False, lowcut=1 / 10 / 60.0, highcut=1 / 1 / 60.0, window=[None, None], outfile=None, tosave=False)[source]
Parameters:
  • mode – accept modes: rdiff, rratio, bdiff, bratio, dtrend

  • dt – time difference in second between frames when [rdiff, rratio, bdiff, bratio] is invoked

  • medfilt

  • gaussfilt

  • bfilter – do butter bandpass filter

  • lowcut – low cutoff frequency in Hz

  • highcut – high cutoff frequency in Hz

  • outfile

  • tosave

Returns:

plot_mapcube(mapcube=None, hdr=False, norm=None, vmax=None, vmin=None, cmap=None, diff=False, sav_img=False, out_dir=None, dpi=100, anim=False, silent=False, draw_limb=False, draw_grid=False, colortitle=None, title=['observatory', 'detector', 'wavelength', 'time'], fov=[], fps=15)[source]
Parameters:
  • mapcube

  • hdr

  • vmax

  • vmin

  • diff

  • sav_img

  • out_dir

  • dpi

  • anim

Returns:

cutslit_fromfile(infile, color=None, mask=None)[source]
cutslit_tofile(outfile=None, cutslit=None)[source]
make_stackplot(mapcube, frm_range=[], threshold=None, gamma=1.0, get_peak=False)[source]
stackplt_wrap()[source]
stackplt_tofile(outfile=None, stackplt=None)[source]
stackplt_fromfile(infile, **kwargs)[source]
plot_stackplot(mapcube=None, hdr=False, norm=None, vmax=None, vmin=None, cmap=None, layout_vert=False, diff=False, uni_cm=True, sav_img=False, out_dir=None, dpi=100, anim=False, frm_range=[], cutslitplt=None, silent=False, refresh=True, threshold=None, gamma=1.0, get_peak=False)[source]
stackplt_traject_fromfile(infile, frm_range=[], cmap='inferno', vmax=None, vmin=None, gamma=1.0)[source]
stackplt_lghtcurv_fromfile(infile, frm_range=[], cmap='inferno', vmax=None, vmin=None, gamma=1.0, log=False, axes=None)[source]
mapcube_info(mapcube=None)[source]
property cutslit[source]
property tplt[source]
classmethod set_fits_dir(fitsdir)[source]