Psyllid
v1.12.4
Project 8 Data Acquisisition Software
|
A basic FMT. More...
#include <frequency_mask_trigger.hh>
Classes | |
struct | exe_func_context |
Public Types | |
enum | status_t { mask_update, triggering } |
enum | trigger_mode_t { single_level, two_level } |
enum | threshold_t : uint32_t { snr, sigma } |
Public Member Functions | |
frequency_mask_trigger () | |
virtual | ~frequency_mask_trigger () |
void | set_n_packets_for_mask (unsigned a_n_pkts) |
void | set_threshold_ampl_snr (double a_ampl_snr) |
void | set_threshold_power_snr (double a_power_snr) |
void | set_threshold_power_snr_high (double a_power_snr) |
void | set_threshold_power_sigma (double a_power_sigma) |
void | set_threshold_power_sigma_high (double a_power_sigma) |
void | set_threshold_dB (double a_dB) |
void | set_trigger_mode (const std::string &a_trigger_mode) |
void | set_threshold_type (const std::string &a_threshold_type) |
std::string | get_trigger_mode_str () const |
std::string | get_threshold_type_str () const |
void | calculate_snr_mask_spline_points (std::vector< double > &t_x_vals, std::vector< double > &t_y_vals, double threshold) |
void | calculate_sigma_mask_spline_points (std::vector< double > &t_x_vals, std::vector< double > &t_y_vals, double threshold) |
void | set_mask_parameters_from_node (const scarab::param_node &a_mask_and_data_values) |
snake_case_mv_accessible (uint64_t, length) | |
snake_case_mv_accessible_noset (unsigned, n_packets_for_mask) | |
snake_case_mv_accessible (double, threshold_snr) | |
snake_case_mv_accessible (double, threshold_snr_high) | |
snake_case_mv_accessible (double, threshold_sigma) | |
snake_case_mv_accessible (double, threshold_sigma_high) | |
snake_case_mv_accessible (threshold_t, threshold_type) | |
snake_case_mv_accessible (unsigned, n_spline_points) | |
snake_case_mv_accessible_noset (status_t, status) | |
snake_case_mv_accessible (trigger_mode_t, trigger_mode) | |
snake_case_mv_accessible (unsigned, n_excluded_bins) | |
void | switch_to_update_mask () |
void | switch_to_apply_trigger () |
void | write_mask (const std::string &a_filename) |
void | initialize () |
void | execute (midge::diptera *a_midge=nullptr) |
void | finalize () |
Static Public Member Functions | |
static uint32_t | trigger_mode_to_uint (trigger_mode_t a_trigger_mode) |
static trigger_mode_t | uint_to_trigger_mode (uint32_t a_trigger_mode_uint) |
static std::string | trigger_mode_to_string (trigger_mode_t a_trigger_mode) |
static trigger_mode_t | string_to_trigger_mode (const std::string &a_trigger_mode) |
static uint32_t | threshold_to_uint (threshold_t a_threshold) |
static threshold_t | uint_to_threshold (uint32_t a_threshold_uint) |
static std::string | threshold_to_string (threshold_t a_threshold) |
static threshold_t | string_to_threshold (const std::string &a_threshold_string) |
Private Member Functions | |
void | exe_apply_threshold (exe_func_context &a_ctx) |
void | exe_apply_two_thresholds (exe_func_context &a_ctx) |
void | exe_add_to_mask (exe_func_context &a_ctx) |
Private Attributes | |
void(frequency_mask_trigger::* | f_exe_func )(exe_func_context &a_ctx) |
std::mutex | f_exe_func_mutex |
std::atomic< bool > | f_break_exe_func |
std::vector< double > | f_mask |
std::vector< double > | f_mask2 |
std::vector< double > | f_average_data |
std::vector< double > | f_variance_data |
unsigned | f_n_summed |
std::mutex | f_mask_mutex |
A basic FMT.
The FMT has two modes of operation: updating the mask, and triggering.
When switched to the "updating" mode, the existing mask is erased, and the subsequent spectra that are passed to the FMT are used to calculate the new mask. The number of spectra used for the mask is configurable. Those spectra are summed together as they arrive. Once the appropriate number of spectra have been used, the average value is calculated, and the mask is multiplied by the threshold SNR (assuming the data are amplitude values, not power).
In triggering mode, each arriving spectrum is compared to the mask bin-by-bin. If a bin crosses the threshold, the spectrum passes the trigger and the bin-by-bin comparison is stopped.
It is possible to set a second threshold (threshold-power-snr-high). A second mask is calculated for this threshold and the incoming spectra are compared to both masks. The output trigger flag has an additional variable "high_threshold" which is set true if the higher threshold led to a trigger. It is always set to true if only one trigger level is used.
The mask can be written to a JSON file via the write_mask() function. The format for the file is: { "timestamp": "[timestamp]", "n-packets": [number of packets averaged], "mask": [value_0, value_1, . . . .] }
Parameter setting is not thread-safe. Executing (including switching modes) is thread-safe.
Node type: "frequency-mask-trigger"
Available configuration values:
Available DAQ commands:
Input Streams:
Output Streams:
Definition at line 83 of file frequency_mask_trigger.hh.
|
strong |
Enumerator | |
---|---|
mask_update | |
triggering |
Definition at line 87 of file frequency_mask_trigger.hh.
|
strong |
Enumerator | |
---|---|
snr | |
sigma |
Definition at line 103 of file frequency_mask_trigger.hh.
|
strong |
Enumerator | |
---|---|
single_level | |
two_level |
Definition at line 93 of file frequency_mask_trigger.hh.
Definition at line 62 of file frequency_mask_trigger.cc.
|
virtual |
Definition at line 84 of file frequency_mask_trigger.cc.
void calculate_sigma_mask_spline_points | ( | std::vector< double > & | t_x_vals, |
std::vector< double > & | t_y_vals, | ||
double | threshold | ||
) |
Definition at line 112 of file frequency_mask_trigger.cc.
void calculate_snr_mask_spline_points | ( | std::vector< double > & | t_x_vals, |
std::vector< double > & | t_y_vals, | ||
double | threshold | ||
) |
Definition at line 130 of file frequency_mask_trigger.cc.
|
private |
Definition at line 318 of file frequency_mask_trigger.cc.
|
private |
Definition at line 534 of file frequency_mask_trigger.cc.
|
private |
Definition at line 686 of file frequency_mask_trigger.cc.
void execute | ( | midge::diptera * | a_midge = nullptr | ) |
Definition at line 292 of file frequency_mask_trigger.cc.
void finalize | ( | ) |
Definition at line 857 of file frequency_mask_trigger.cc.
|
inline |
Definition at line 218 of file frequency_mask_trigger.hh.
|
inline |
Definition at line 213 of file frequency_mask_trigger.hh.
void initialize | ( | ) |
Definition at line 286 of file frequency_mask_trigger.cc.
void set_mask_parameters_from_node | ( | const scarab::param_node & | a_mask_and_data_values | ) |
Definition at line 148 of file frequency_mask_trigger.cc.
void set_n_packets_for_mask | ( | unsigned | a_n_pkts | ) |
Definition at line 88 of file frequency_mask_trigger.cc.
void set_threshold_ampl_snr | ( | double | a_ampl_snr | ) |
Definition at line 98 of file frequency_mask_trigger.cc.
void set_threshold_dB | ( | double | a_dB | ) |
Definition at line 105 of file frequency_mask_trigger.cc.
void set_threshold_power_sigma | ( | double | a_power_sigma | ) |
void set_threshold_power_sigma_high | ( | double | a_power_sigma | ) |
void set_threshold_power_snr | ( | double | a_power_snr | ) |
void set_threshold_power_snr_high | ( | double | a_power_snr | ) |
|
inline |
Definition at line 208 of file frequency_mask_trigger.hh.
|
inline |
Definition at line 203 of file frequency_mask_trigger.hh.
snake_case_mv_accessible | ( | uint64_t | , |
length | |||
) |
snake_case_mv_accessible | ( | double | , |
threshold_snr | |||
) |
snake_case_mv_accessible | ( | double | , |
threshold_snr_high | |||
) |
snake_case_mv_accessible | ( | double | , |
threshold_sigma | |||
) |
snake_case_mv_accessible | ( | double | , |
threshold_sigma_high | |||
) |
snake_case_mv_accessible | ( | threshold_t | , |
threshold_type | |||
) |
snake_case_mv_accessible | ( | unsigned | , |
n_spline_points | |||
) |
snake_case_mv_accessible | ( | trigger_mode_t | , |
trigger_mode | |||
) |
snake_case_mv_accessible | ( | unsigned | , |
n_excluded_bins | |||
) |
snake_case_mv_accessible_noset | ( | unsigned | , |
n_packets_for_mask | |||
) |
snake_case_mv_accessible_noset | ( | status_t | , |
status | |||
) |
|
static |
Definition at line 55 of file frequency_mask_trigger.cc.
|
static |
Definition at line 39 of file frequency_mask_trigger.cc.
void switch_to_apply_trigger | ( | ) |
Definition at line 202 of file frequency_mask_trigger.cc.
void switch_to_update_mask | ( | ) |
Definition at line 188 of file frequency_mask_trigger.cc.
|
static |
Definition at line 47 of file frequency_mask_trigger.cc.
|
inlinestatic |
Definition at line 194 of file frequency_mask_trigger.hh.
|
static |
Definition at line 30 of file frequency_mask_trigger.cc.
|
inlinestatic |
Definition at line 185 of file frequency_mask_trigger.hh.
|
inlinestatic |
Definition at line 198 of file frequency_mask_trigger.hh.
|
inlinestatic |
Definition at line 189 of file frequency_mask_trigger.hh.
void write_mask | ( | const std::string & | a_filename | ) |
Definition at line 230 of file frequency_mask_trigger.cc.
|
private |
Definition at line 177 of file frequency_mask_trigger.hh.
|
private |
Definition at line 172 of file frequency_mask_trigger.hh.
|
private |
Definition at line 170 of file frequency_mask_trigger.hh.
|
private |
Definition at line 171 of file frequency_mask_trigger.hh.
|
private |
Definition at line 175 of file frequency_mask_trigger.hh.
|
private |
Definition at line 176 of file frequency_mask_trigger.hh.
|
private |
Definition at line 181 of file frequency_mask_trigger.hh.
|
private |
Definition at line 179 of file frequency_mask_trigger.hh.
|
private |
Definition at line 178 of file frequency_mask_trigger.hh.