EMBERS: Home ༶ Table of Contents ༶ API Reference
embers.rf_tools
is used to pre process, condition and preview raw rf data.
It contains rf_data
, align_data
, colormaps
modules.
A set of tools to decode raw rf data recored by RF Explorers and visualise waterfall plots
embers.rf_tools.rf_data.
read_data
(rf_file=None)¶Convert rf binary data into ndarray
of power and time.
from embers.rf_tools.rf_data import read_data
power, times = read_data(rf_file='~/embers-data/rf.txt')
Parameters: | rf_file – path to rf binary data file str |
---|---|
Returns: |
embers.rf_tools.rf_data.
tile_names
()¶List of MWA and reference antenna names
from embers.rf_tools.rf_data import tile_names
tiles = tile_names()
print(tiles)
>>> ["rf0XX", "rf0YY", "rf1XX", "rf1YY", "S06XX", ....]
Returns: |
|
---|
embers.rf_tools.rf_data.
tile_pairs
(tiles)¶Create a list of all possible AUT ref antenna pairs from tile_names()
.
Reference and MWA antennas can only pair with antennas of the same polarizarion
from embers.rf_tools.rf_data import tile_names, tile_pairs
tiles = tile_names()
tile_pairs = tile_names(tiles)
print(tile_pairs)
>>> [["rf0XX", "S06XX"], ["rf0YY", "S06YY"], ....]
Returns: |
|
---|
embers.rf_tools.rf_data.
time_tree
(start_date, stop_date)¶Split a date interval into 30 min observation chunks.
This is used to travers the following directory tree.
The data_root dir contains a sub-dir for every tile in
tile_names()
within
which are dirs for every day, containg raw rf data files
recorded every 30 minutes
data_root
├── tile1
│ └── YYYY-MM-DD
│ └── tile1_YYYY-MM-DD-HH:MM.txt
└── tile2
└── YYYY-MM-DD
└── tile2_YYYY-MM-DD-HH:MM.txt
from embers.rf_tools.rf_data import time_tree
dates, time_stamps = time_tree("2020-01-01", "2020-01-02")
print(dates)
>>> ["2020-01-01", "2020-01-02"]
print(time_stamps)
>>> [["2020-01-01-00:00, 2020-01-01-00:30", ...],
["2020-01-02-00:00", "2020-01-02-00:30"]]
Parameters: | |
---|---|
Returns: | A |
embers.rf_tools.rf_data.
plt_waterfall
(power, times, name)¶Create waterfall plot()
object from rf data.
waterfall created using parameters power
, times
from read_data()
.
Default unix times are converted to a human readable
HH:MM
format.
Parameters: |
|
---|---|
Returns: |
|
embers.rf_tools.rf_data.
single_waterfall
(rf_file, out_dir)¶Save a waterfall plot from rf data file.
Parameters: | |
---|---|
Returns: | waterfall plot saved by |
embers.rf_tools.rf_data.
batch_waterfall
(tile, time_stamp, data_dir, out_dir)¶Save a waterfall plot for a batch of rf data files.
Parameters: | |
---|---|
Returns: | waterfall plot saved by |
Raises: | FileNotFoundError – input file does not exist |
embers.rf_tools.rf_data.
waterfall_batch
(start_date, stop_date, data_dir, out_dir)¶Save a series of waterfall plots in parallel.
Parameters: |
---|
Tools to temporally align pairs of rf data files, enabling comparisons between data sets
embers.rf_tools.align_data.
savgol_interp
(ref, tile, savgol_window_1=None, savgol_window_2=None, polyorder=None, interp_type=None, interp_freq=None)¶Interpolate a power array followed by savgol smoothing.
Interpolate to a given frequency, making the dimensions of the power arrays from reference and tile antennas equal, enabling comparisons between corresponding data points. Two level of savgol filter applied, first to capture deep nulls + small structure, and second level to smooth over noise.
from embers.rf_tools.align_data import savgol_interp
sg_interp_tuple = savgol_interp(
"~/embers-data/rf0XX.txt",
"~/embers-data/S06XX",
savgol_window_1=11,
savgol_window_2=15,
polyorder=2,
interp_type="cubic",
interp_freq=1)
(ref_ali, tile_ali, time_array,
ref_power, tile_power, ref_time, tile_time) = sg_interp_tuple
Parameters: |
|
---|---|
Returns: | A
|
embers.rf_tools.align_data.
plot_savgol_interp
(ref=None, tile=None, savgol_window_1=None, savgol_window_2=None, polyorder=None, interp_type=None, interp_freq=None, channel=None, out_dir=None)¶Plot single channel of power arrays to visualise savgol_interp()
.
Create a plot of a single channel of raw rf_data
from reference and tile power arrays, along
with the outputs of savgol_interp()
to visualise the effects of
interpolation and savgol smoothing.
Parameters: |
|
---|---|
Returns: | single freqency savgol_interp plot saved to |
embers.rf_tools.align_data.
save_aligned
(tile_pair, time_stamp, savgol_window_1, savgol_window_2, polyorder, interp_type, interp_freq, data_dir, out_dir)¶Save an aligned set of rf data with savez_compressed()
to an npz
file.
A pair of rf data files are smoothed, interpolated and aligned
with the savgol_interp()
.
with the output written to a npz
file and saved to an output
directory tree.
from embers.rf_tools.align_data import save_aligned
savgol_interp(
["rf0XX", "S06XX"],
"2020-01-01-00:00"
savgol_window_1=11,
savgol_window_2=15,
polyorder=2,
interp_type="cubic",
interp_freq=1,
"~/embers-data/",
"~/embers-outputs")
Parameters: |
|
---|---|
Returns: |
|
Raises: | FileNotFoundError – an input file does not exist |
embers.rf_tools.align_data.
align_batch
(start_date=None, stop_date=None, savgol_window_1=None, savgol_window_2=None, polyorder=None, interp_type=None, interp_freq=None, data_dir=None, out_dir=None, max_cores=None)¶Temporally align all RF files within a date interval using save_aligned()
.
Parameters: |
|
---|---|
Returns: |
|
A set of custom colormaps used by embers
embers.rf_tools.colormaps.
spectral
()¶Beautiful non-linear spectral colormap
spectral()
is not perceptually uniform and is
only used to easily preview raw data with high contrast
Returns: |
|
---|
embers.rf_tools.colormaps.
jade
()¶Beautiful perceptually uniform jade green colormap.
Returns: |
|
---|
embers.rf_tools.colormaps.
plt_colormaps
(spec, spec_r, jade, jade_r, out_dir)¶Plot 2x2 grid of sample colormaps.
Parameters: |
|
---|---|
Returns: | waterfall plot saved by |