nenupy.io.io_tools.ST_Slice
- class nenupy.io.io_tools.ST_Slice(time, frequency, value, analog_pointing_times=<Time object: scale='utc' format='jd' value=[]>, digital_pointing_times=<Time object: scale='utc' format='jd' value=[]>, polarization='NW')[source]
Bases:
objectClass to handle data sub-set from Statistical data.
Attributes Summary
Data record times.
Data record frequencies.
Data values.
Analog pointing start times corresponding to this data set.
Digital pointing start times corresponding to this data set.
Methods Summary
plot([fig_ax])Plots the data, while automatically taking into account its shape (lightcurve, spectrum or dynamic spectrum).
rebin([dt, df, method])Rebins the data in time and frequency.
fit_transit([method, upper_threshold])Do a fit.
flatten_frequency()flatten_time()clear_pointing_switch([flatten_frequency, ...])Attributes and Methods Documentation
- __init__(time, frequency, value, analog_pointing_times=<Time object: scale='utc' format='jd' value=[]>, digital_pointing_times=<Time object: scale='utc' format='jd' value=[]>, polarization='NW')[source]
Methods
__init__(time, frequency, value[, ...])clean_rfi([t_sigma, f_sigma])clear_pointing_switch([flatten_frequency, ...])fit_transit([method, upper_threshold])Do a fit.
flatten_frequency()flatten_time()median_filter([filter_size])plot([fig_ax])Plots the data, while automatically taking into account its shape (lightcurve, spectrum or dynamic spectrum).
rebin([dt, df, method])Rebins the data in time and frequency.
Attributes
Analog pointing start times corresponding to this data set.
Digital pointing start times corresponding to this data set.
Data record frequencies.
Data record polarization.
_summary_
Data record times.
Data values.
- property analog_pointing_times
Analog pointing start times corresponding to this data set.
- Getter:
Starting times array.
- Type:
- clear_pointing_switch(flatten_frequency=True, pointing_dt=<TimeDelta object: scale='None' format='sec' value=360.0>, peak_sample_error=2, return_correction=False)[source]
- \[p(t) = a \log(t) + bt^2 + ct + d\]
- property digital_pointing_times
Digital pointing start times corresponding to this data set.
- Getter:
Starting times array.
- Type:
- fit_transit(method='gaussian', upper_threshold=None, **kwargs)[source]
Do a fit.
- kwargs
filter_window (default (200))
- plot(fig_ax=None, **kwargs)[source]
Plots the data, while automatically taking into account its shape (lightcurve, spectrum or dynamic spectrum).
Several parameters, listed below, can be tuned to adapt the plot to the user requirements:
Data display keywords
- Parameters:
decibel (
bool) – If set toTrue, the data will be displayed in a decibel scale (i.e., \({\rm dB} = 10 \log_{10}({\rm data})\)). Default isTrue.xmin (
QuantityorTimeDatetime) – Minimal x-axis value (could be either time or frequency units depending on the data shape). Default is automatic scaling.xmax (
QuantityorTimeDatetime) – Maximal x-axis value (could be either time or frequency units depending on the data shape). Default is automatic scaling.ymin (
floatorQuantity) – Minimal y-axis value (could be either data amplitude or frequency units depending on the data shape). Default is automatic scaling.ymax (
floatorQuantity) – Maximal y-axis value (could be either data amplitude or frequency units depending on the data shape). Default is automatic scaling.vmin (
float) – Dynamic spectrum plot only. Minimal data value to display.vmax (
float) – Dynamic spectrum plot only. Maximal data value to display.
Overplot keywords
- Parameters:
vlines ([
TimeDatetime]) – Temporal plot only. Adds vertical lines at specific times. The expected format is an array ofTimeDatetime. Default is[].analog_pointing (
bool) – Temporal plot only. Overplots vertical dot-dashed black lines at analog pointing start times. Default isFalse.digital_pointing (
bool) – Temporal plot only. Overplots vertical dotted black lines at analog pointing start times. Default isFalse.hatched_overlay ((
Time,Quantity,ndarray)) – Dynamic spectrum plot only. Produces a hatched overlay on top of the dynamic spectrum. The expected format is(time, frequency, hatched_array)wherehatched_arrayis a booleanndarray, shaped as (frequency, time), set toTruewhere a hatched cell should be drawn. Default isNone.
Plotting layout keywords
- Parameters:
figname (
str) – Name of the file (absolute or relative path) to save the figure. Default is''(i.e., only show the figure).figsize (
tuple) – Set the figure size. Default is(15, 7).title (
str) – Set the figure title. Default is''.colorbar_label (
str) – Dynamic spectrum plot only. Label of the color bar. Default is'Amp'ifdecibel=Falseand'dB'otherwise.cmap (
str) – Dynamic spectrum plot only. Color map used to represent the data. Default is'YlGnBu_r'.
- Example:
from nenupy.io.bst import BST from astropy.time import Time, TimeDelta import astropy.units as u import numpy as np # Select BST data bst = BST("/path/to/BST.fits") data = bst.get() # Prepare a boolean array to overlay a hatched pattern hatch_array = np.zeros((30, 300), dtype=bool) hatch_array[5:20, 100:200] = True # Specify time and frequency arrays time_dts = np.arange(300)*TimeDelta(1, format='sec') times = Time("2022-01-24T11:01:00") + time_dts frequencies = np.linspace(47, 52, 30)*u.MHz # Plot data.plot( hatched_overlay=( times, frequencies, hatch_array ) )
- rebin(dt=None, df=None, method='mean')[source]
Rebins the data in time and frequency.
- Parameters:
- Returns:
Rebinned data.
- Return type:
ST_Slice- Example:
from nenupy.io.bst import BST import astropy.units as u bst = BST("/path/to/BST.fits") data = bst.get() rebin_data = data.rebin( dt=3*u.s, df=2*u.MHz )
- property sdata
_summary_
- Returns:
_description_
- Return type:
SData