suncasa.utils.stackplotX

Attributes

sunpy1

Classes

LightCurveBuilder

SpaceTimeSlitBuilder

CutslitBuilder

Stackplot

Functions

aiaprep(sunpymap)

resettable(f)

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

runningmean(data, window, mode, 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 values at a slice

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.stackplotX.sunpy1[source]
suncasa.utils.stackplotX.aiaprep(sunpymap)[source]
suncasa.utils.stackplotX.resettable(f)[source]
suncasa.utils.stackplotX.b_filter(data, lowcut, highcut, fs, ix)[source]
suncasa.utils.stackplotX.runningmean(data, window, mode, ix)[source]
Parameters:
  • data

  • window

  • ix

  • mode – available options are ratio and diff

Returns:

suncasa.utils.stackplotX.c_correlate(a, v, returnx=False)[source]
suncasa.utils.stackplotX.XCorrMap(data, refpix=[0, 0])[source]
suncasa.utils.stackplotX.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.stackplotX.FitSlit(xx, yy, cutwidth, cutang, cutlength, s=None, method='Polyfit', ascending=False)[source]
suncasa.utils.stackplotX.MakeSlit(pointDF)[source]
suncasa.utils.stackplotX.getimprofile(data, cutslit, xrange=None, yrange=None, get_peak=False, verbose=False)[source]

Get values at a slice

Inputs:

data: input image data. Dimension: (ny, nx) or (ny, nx, nwv). nwv is the number of wavelengths/frequencies cutslit: cutslit generated from CutslitBuilder().cutslitplt xrange: [min(xs), max(xs)], where xs is the x coordinate values of the input image data.

If None (default), assume pixel coordinate values in cutslit

yrange: [min(ys), max(ys)], where ys is the y coordinate values of the input image data.

If None (default), assume pixel coordinate values in cutslit

get_peak: If True, return the peak of all pixels across the slit within the slit width.

If False (default), return the average value.

verbose: If True, print out more details in command line. Default is False

Returns:

distance from min(cutslit[‘xcen’]), min(cutslit[‘ycen’])

’y’: value on the cut, the shape is (len(cutslit[‘xcen’], [nwv])}

Return type:

A dictionary of {‘x’

suncasa.utils.stackplotX.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.stackplotX.grid(x, y, z, resX=20, resY=40)[source]

Convert 3 column data to matplotlib grid

suncasa.utils.stackplotX.polyfit(x, y, length, deg)[source]
class suncasa.utils.stackplotX.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.stackplotX.SpaceTimeSlitBuilder(axes, dspec, cutlength=80, cutsmooth=10.0, scale=1.0, color='white')[source]
dspec[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]
select_distance_along_a_slice(ixx)[source]

select points more accurately by doing it on a distance-flux plot

spacetimeslits_tofile(outfile=None, spacetimeslits=None)[source]
spacetimeslits_fromfile(infile, color=None)[source]
class suncasa.utils.stackplotX.CutslitBuilder(axes, cutwidth=5.0, cutlength=150, cutang=0.0, cutsmooth=10.0, scale=1.0)[source]
axes[source]
cutlength = 150[source]
cutwidth = 5.0[source]
cutang = 0.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.stackplotX.Stackplot(infile=None)[source]
instrum_meta[source]
aia_lvl1[source]
suncasadb[source]
fitsdir[source]
mapseq = None[source]
mapseq_diff = None[source]
mapseq_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]
fig_mapseq = None[source]
pixscale = 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_mapseq(trange, outfile=None, fov=None, wavelength='171', binpix=1, dt_data=1, derotate=False, tosave=True, hdf5=False, superpixel=False, aia_prep=False, mapinterp=False, overwrite=False, dtype=None, normalize=True)[source]
mapseq_fromfile(infile)[source]
mapseq_tofile(outfile=None, mapseq=None, hdf5=False)[source]
mapseq_drot()[source]
mapseq_resample(binpix=1)[source]
mapseq_diff_denoise(log=False, vmax=None, vmin=None)[source]
mapseq_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, dtype=None, hdf5=False, normalize=True)[source]
Parameters:
  • mode – accept modes: rdiff, rratio, bdiff, bratio, dtrend, dtrend_diff, dtrend_ratio

  • 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_mapseq(mapseq=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:
  • mapseq

  • 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(mapseq, frm_range=[], threshold=None, gamma=1.0, get_peak=False, trackslit_diffrot=False, negval=False, movingcut=[])[source]

movingcut: [x,y]. x and y are an array of offset in X and Y direction, respectively. the length of x/y is nframes

stackplt_wrap()[source]
stackplt_tofile(outfile=None, stackplt=None)[source]
stackplt_fromfile(infile, doplot=False, **kwargs)[source]
plot_stackplot(mapseq=None, fov=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, trackslit_diffrot=False, negval=False, movingcut=[])[source]
stackplt_traject_fromfile(infile, frm_range=[], cmap='inferno', norm=None, gamma=1.0)[source]
stackplt_lghtcurv_fromfile(infile, frm_range=[], cmap='inferno', norm=None, gamma=1.0, log=False, axes=None)[source]
mapseq_info(mapseq=None)[source]
property cutslit[source]
property tplt[source]
classmethod set_fits_dir(fitsdir)[source]